Merge git://github.com/kvalo/ath10k-firmware into work2

* git://github.com/kvalo/ath10k-firmware:
  ap: promote firmware-2.bin_10.1.467-1 untested
  README: add description and a link
  Update LICENSE.qca_firmware.
  ap: add untested firmware-2.bin_10.1.467-1
  ap: add untested firmware-2.bin_10.1.436-1
  Add ap/firmware-2.bin-10.1.389
  Add 999.999.0.636 firmware-2.bin image
  Update hw2.0 firmware to 1.0.0.636
  Update firmware to 1.0.0.629
  qca988x: hw2.0: update firmware to 1.0.0.615
  Rename LICENSE to LICENSE.qca_firmware
  Add hw2.0 firmware version 1.0.0.614.
  Add license file
  Initial commit
diff --git a/3com/3C359.bin b/3com/3C359.bin
new file mode 100644
index 0000000..b132989
--- /dev/null
+++ b/3com/3C359.bin
Binary files differ
diff --git a/3com/typhoon.bin b/3com/typhoon.bin
new file mode 100644
index 0000000..81d1294
--- /dev/null
+++ b/3com/typhoon.bin
Binary files differ
diff --git a/GPL-3 b/GPL-3
new file mode 100644
index 0000000..4432540
--- /dev/null
+++ b/GPL-3
@@ -0,0 +1,676 @@
+
+		    GNU GENERAL PUBLIC LICENSE
+		       Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+			    Preamble
+
+  The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+  The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works.  By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users.  We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors.  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+  To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights.  Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received.  You must make sure that they, too, receive
+or can get the source code.  And you must show them these terms so they
+know their rights.
+
+  Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+  For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software.  For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+  Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so.  This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software.  The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable.  Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products.  If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+  Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary.  To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+		       TERMS AND CONDITIONS
+
+  0. Definitions.
+
+  "This License" refers to version 3 of the GNU General Public License.
+
+  "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+ 
+  "The Program" refers to any copyrightable work licensed under this
+License.  Each licensee is addressed as "you".  "Licensees" and
+"recipients" may be individuals or organizations.
+
+  To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy.  The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+  A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+  To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy.  Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+  To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies.  Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+  An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License.  If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+  1. Source Code.
+
+  The "source code" for a work means the preferred form of the work
+for making modifications to it.  "Object code" means any non-source
+form of a work.
+
+  A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+  The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form.  A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+  The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities.  However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work.  For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+  The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+  The Corresponding Source for a work in source code form is that
+same work.
+
+  2. Basic Permissions.
+
+  All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met.  This License explicitly affirms your unlimited
+permission to run the unmodified Program.  The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work.  This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+  You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force.  You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright.  Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+  Conveying under any other circumstances is permitted solely under
+the conditions stated below.  Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+  3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+  No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+  When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+  4. Conveying Verbatim Copies.
+
+  You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+  You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+  5. Conveying Modified Source Versions.
+
+  You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+    a) The work must carry prominent notices stating that you modified
+    it, and giving a relevant date.
+
+    b) The work must carry prominent notices stating that it is
+    released under this License and any conditions added under section
+    7.  This requirement modifies the requirement in section 4 to
+    "keep intact all notices".
+
+    c) You must license the entire work, as a whole, under this
+    License to anyone who comes into possession of a copy.  This
+    License will therefore apply, along with any applicable section 7
+    additional terms, to the whole of the work, and all its parts,
+    regardless of how they are packaged.  This License gives no
+    permission to license the work in any other way, but it does not
+    invalidate such permission if you have separately received it.
+
+    d) If the work has interactive user interfaces, each must display
+    Appropriate Legal Notices; however, if the Program has interactive
+    interfaces that do not display Appropriate Legal Notices, your
+    work need not make them do so.
+
+  A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit.  Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+  6. Conveying Non-Source Forms.
+
+  You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+    a) Convey the object code in, or embodied in, a physical product
+    (including a physical distribution medium), accompanied by the
+    Corresponding Source fixed on a durable physical medium
+    customarily used for software interchange.
+
+    b) Convey the object code in, or embodied in, a physical product
+    (including a physical distribution medium), accompanied by a
+    written offer, valid for at least three years and valid for as
+    long as you offer spare parts or customer support for that product
+    model, to give anyone who possesses the object code either (1) a
+    copy of the Corresponding Source for all the software in the
+    product that is covered by this License, on a durable physical
+    medium customarily used for software interchange, for a price no
+    more than your reasonable cost of physically performing this
+    conveying of source, or (2) access to copy the
+    Corresponding Source from a network server at no charge.
+
+    c) Convey individual copies of the object code with a copy of the
+    written offer to provide the Corresponding Source.  This
+    alternative is allowed only occasionally and noncommercially, and
+    only if you received the object code with such an offer, in accord
+    with subsection 6b.
+
+    d) Convey the object code by offering access from a designated
+    place (gratis or for a charge), and offer equivalent access to the
+    Corresponding Source in the same way through the same place at no
+    further charge.  You need not require recipients to copy the
+    Corresponding Source along with the object code.  If the place to
+    copy the object code is a network server, the Corresponding Source
+    may be on a different server (operated by you or a third party)
+    that supports equivalent copying facilities, provided you maintain
+    clear directions next to the object code saying where to find the
+    Corresponding Source.  Regardless of what server hosts the
+    Corresponding Source, you remain obligated to ensure that it is
+    available for as long as needed to satisfy these requirements.
+
+    e) Convey the object code using peer-to-peer transmission, provided
+    you inform other peers where the object code and Corresponding
+    Source of the work are being offered to the general public at no
+    charge under subsection 6d.
+
+  A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+  A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling.  In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage.  For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product.  A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+  "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source.  The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+  If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information.  But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+  The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed.  Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+  Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+  7. Additional Terms.
+
+  "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law.  If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+  When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it.  (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.)  You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+  Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+    a) Disclaiming warranty or limiting liability differently from the
+    terms of sections 15 and 16 of this License; or
+
+    b) Requiring preservation of specified reasonable legal notices or
+    author attributions in that material or in the Appropriate Legal
+    Notices displayed by works containing it; or
+
+    c) Prohibiting misrepresentation of the origin of that material, or
+    requiring that modified versions of such material be marked in
+    reasonable ways as different from the original version; or
+
+    d) Limiting the use for publicity purposes of names of licensors or
+    authors of the material; or
+
+    e) Declining to grant rights under trademark law for use of some
+    trade names, trademarks, or service marks; or
+
+    f) Requiring indemnification of licensors and authors of that
+    material by anyone who conveys the material (or modified versions of
+    it) with contractual assumptions of liability to the recipient, for
+    any liability that these contractual assumptions directly impose on
+    those licensors and authors.
+
+  All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10.  If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term.  If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+  If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+  Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+  8. Termination.
+
+  You may not propagate or modify a covered work except as expressly
+provided under this License.  Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+  However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+  Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+  Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License.  If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+  9. Acceptance Not Required for Having Copies.
+
+  You are not required to accept this License in order to receive or
+run a copy of the Program.  Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance.  However,
+nothing other than this License grants you permission to propagate or
+modify any covered work.  These actions infringe copyright if you do
+not accept this License.  Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+  10. Automatic Licensing of Downstream Recipients.
+
+  Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License.  You are not responsible
+for enforcing compliance by third parties with this License.
+
+  An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations.  If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+  You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License.  For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+  11. Patents.
+
+  A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based.  The
+work thus licensed is called the contributor's "contributor version".
+
+  A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version.  For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+  Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+  In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement).  To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+  If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients.  "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+  
+  If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+  A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License.  You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+  Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+  12. No Surrender of Others' Freedom.
+
+  If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all.  For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+  13. Use with the GNU Affero General Public License.
+
+  Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work.  The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+  14. Revised Versions of this License.
+
+  The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+  Each version is given a distinguishing version number.  If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation.  If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+  If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+  Later license versions may give you additional or different
+permissions.  However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+  15. Disclaimer of Warranty.
+
+  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+  16. Limitation of Liability.
+
+  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+  17. Interpretation of Sections 15 and 16.
+
+  If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+		     END OF TERMS AND CONDITIONS
+
+	    How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    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 3 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.  If not, see <http://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+  If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+    <program>  Copyright (C) <year>  <name of author>
+    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+  You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+<http://www.gnu.org/licenses/>.
+
+  The GNU General Public License does not permit incorporating your program
+into proprietary programs.  If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library.  If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.  But first, please read
+<http://www.gnu.org/philosophy/why-not-lgpl.html>.
+
diff --git a/LICENCE.Marvell b/LICENCE.Marvell
new file mode 100644
index 0000000..3224e1b
--- /dev/null
+++ b/LICENCE.Marvell
@@ -0,0 +1,18 @@
+FIRMWARE LICENSE TERMS
+
+
+Copyright (c) Marvell International Ltd.
+
+All rights reserved.
+
+Redistribution. Redistribution and use in binary form, without modification, are permitted provided that the following conditions are met:
+
+* Redistributions must reproduce the above copyright notice and the following disclaimer in the documentation and/or other materials provided with the distribution.
+
+* Neither the name of Marvell International Ltd. nor the names of its suppliers may be used to endorse or promote products derived from this software without specific prior written permission.
+
+* No reverse engineering, decompilation, or disassembly of this software is permitted.
+
+Limited patent license. Marvell International Ltd. grants a world-wide, royalty-free, non-exclusive license under patents it now or hereafter owns or controls to make, have made, use, import, offer to sell and sell ("Utilize") this software, but solely to the extent that any such patent is necessary to Utilize the software alone, or in combination with an operating system licensed under an approved Open Source license as listed by the Open Source Initiative at http://opensource.org/licenses. The patent license shall not apply to any other combinations which include this software. No hardware per se is licensed hereunder.
+
+DISCLAIMER. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/LICENCE.OLPC b/LICENCE.OLPC
new file mode 100644
index 0000000..a740952
--- /dev/null
+++ b/LICENCE.OLPC
@@ -0,0 +1,33 @@
+Copyright (c) 2006, One Laptop per Child and Marvell Corporation.
+All rights reserved.
+
+Redistribution.  Redistribution and use in binary form, without 
+modification, are permitted provided that the following conditions are 
+met:
+
+* Redistributions must reproduce the above copyright notice and the 
+  following disclaimer in the documentation and/or other materials 
+  provided with the distribution.
+* Neither the name of Marvell Corporation nor the names of its suppliers 
+  may be used to endorse or promote products derived from this software 
+  without specific prior written permission.
+* No reverse engineering, decompilation, or disassembly of this software 
+  is permitted.
+* You may not use or attempt to use this software in conjunction with
+  any product that is offered by a third party as a replacement,
+  substitute or alternative to a Marvell Product where a Marvell Product
+  is defined as a proprietary wireless LAN embedded client solution of
+  Marvell or a Marvell Affiliate.
+
+DISCLAIMER.  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 
+CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, 
+BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 
+FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
+COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 
+OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 
+TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 
+USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 
+DAMAGE.
diff --git a/LICENCE.agere b/LICENCE.agere
new file mode 100644
index 0000000..c11466c
--- /dev/null
+++ b/LICENCE.agere
@@ -0,0 +1,77 @@
+agere_sta_fw.bin -- 9.48 Hermes I
+agere_ap_fw.bin  -- 9.48 Hermes I
+
+The above firmware images were compiled from the Agere linux driver
+wl_lkm_718_release.tar.gz, and dumped. The driver is coverred by the
+following copyright and software license.
+
+ * SOFTWARE LICENSE
+ *
+ * This software is provided subject to the following terms and conditions,
+ * which you should read carefully before using the software.  Using this
+ * software indicates your acceptance of these terms and conditions.  If you do
+ * not agree with these terms and conditions, do not use the software.
+ *
+ * COPYRIGHT © 1994 - 1995  by AT&T.                All Rights Reserved
+ * COPYRIGHT © 1996 - 2000 by Lucent Technologies.  All Rights Reserved
+ * COPYRIGHT © 2001 - 2004  by Agere Systems Inc.   All Rights Reserved
+ * All rights reserved.
+ *
+ * Redistribution and use in source or binary forms, with or without
+ * modifications, are permitted provided that the following conditions are met:
+ *
+ * . Redistributions of source code must retain the above copyright notice, this
+ *    list of conditions and the following Disclaimer as comments in the code as
+ *    well as in the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * . Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following Disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *
+ * . Neither the name of Agere Systems Inc. nor the names of the contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * Disclaimer
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, INFRINGEMENT AND THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  ANY
+ * USE, MODIFICATION OR DISTRIBUTION OF THIS SOFTWARE IS SOLELY AT THE USERS OWN
+ * RISK. IN NO EVENT SHALL AGERE SYSTEMS INC. OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, INCLUDING, BUT NOT LIMITED TO, CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+
+The following statement from Agere clarifies the status of the firmware
+
+---
+I would like to confirm that the two drivers; Linux LKM Wireless Driver
+Source Code, Version 7.18 and Linux LKM Wireless Driver Source Code,
+Version 7.22 comply with Open Source BSD License. Therefore the source
+code can be distributed in unmodified or modified form consistent with
+the terms of the license.
+
+The Linux driver architecture was based on two modules, the MSF (Module
+specific functions) and the HCF (Hardware Control Functions).  Included
+in the HCF is run-time firmware (binary format) which is downloaded into
+the RAM of the Hermes 1/2/2.5 WMAC.
+
+This hex coded firmware is not based on any open source software and
+hence it is not subject to any Open Source License.  The firmware was
+developed by Agere and runs on the DISC processor embedded within the
+Hermes 1/2/2.5 Wireless MAC devices. 
+
+Hope this helps.
+
+Sincerely,
+
+Viren Pathare
+Intellectual Property Licensing Manager
+Agere
+---
diff --git a/LICENCE.atheros_firmware b/LICENCE.atheros_firmware
new file mode 100644
index 0000000..e0ebdac
--- /dev/null
+++ b/LICENCE.atheros_firmware
@@ -0,0 +1,38 @@
+Copyright (c) 2008-2010, Atheros Communications, Inc.
+All rights reserved.
+
+Redistribution.  Redistribution and use in binary form, without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions must reproduce the above copyright notice and the
+  following disclaimer in the documentation and/or other materials
+  provided with the distribution.
+
+* Neither the name of Atheros Communications, Inc. nor the names of
+  its suppliers may be used to endorse or promote products derived
+  from this software without specific prior written permission.
+
+* No reverse engineering, decompilation, or disassembly of this
+  software is permitted.
+
+Limited patent license.  Atheros Communications, Inc. grants a
+world-wide, royalty-free, non-exclusive license under patents it
+now or hereafter owns or controls to make, have made, use, import,
+offer to sell and sell ("Utilize") this software, but solely to
+the extent that any such patent is necessary to Utilize the software
+in conjunction with an Atheros Chipset. The patent license shall not
+apply to any other combinations which include this software. No
+hardware per se is licensed hereunder.
+
+DISCLAIMER.  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
+BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/LICENCE.broadcom_bcm43xx b/LICENCE.broadcom_bcm43xx
new file mode 100644
index 0000000..ff26fdd
--- /dev/null
+++ b/LICENCE.broadcom_bcm43xx
@@ -0,0 +1,65 @@
+SOFTWARE LICENSE AGREEMENT
+
+The accompanying software in binary code form (“Software”), is licensed to you,
+or, if you are accepting on behalf of an entity, the entity and its affiliates
+exercising rights hereunder (“Licensee”) subject to the terms of this software
+license agreement (“Agreement”), unless Licensee and Broadcom Corporation
+(“Broadcom”) execute a separate written software license agreement governing
+use of the Software. ANY USE, REPRODUCTION, OR DISTRIBUTION OF THE SOFTWARE
+CONSTITUTES LICENSEE’S ACCEPTANCE OF THIS AGREEMENT.
+
+1.	License. Subject to the terms and conditions of this Agreement,
+Broadcom hereby grants to Licensee a limited, non-exclusive, non-transferable,
+royalty-free license: (i) to use and integrate the Software with any other
+software; and (ii) to reproduce and distribute the Software complete,
+unmodified, and as provided by Broadcom, solely for use with Broadcom
+proprietary integrated circuit product(s) sold by Broadcom with which the
+Software was designed to be used, or their successors.
+
+2.	Restrictions. Licensee shall distribute Software with a copy of this
+Agreement. Licensee shall not remove, efface or obscure any copyright or
+trademark notices from the Software. Reproductions of the Broadcom copyright
+notice shall be included with each copy of the Software, except where such
+Software is embedded in a manner not readily accessible to the end user.
+Licensee shall not: (i) use, license, sell or otherwise distribute the Software
+except as provided in this Agreement; (ii) attempt to modify in any way,
+reverse engineer, decompile or disassemble any portion of the Software; or
+(iii) use the Software or other material in violation of any applicable law or
+regulation, including but not limited to any regulatory agency. This Agreement
+shall automatically terminate upon Licensee’s failure to comply with any of the
+terms of this Agreement. In such event, Licensee will destroy all copies of the
+Software and its component parts.
+
+3.	Ownership. The Software is licensed and not sold.  Title to and
+ownership of the Software, including all intellectual property rights thereto,
+and any portion thereof remain with Broadcom or its licensors. Licensee hereby
+covenants that it will not assert any claim that the Software created by or for
+Broadcom infringe any intellectual property right owned or controlled by
+Licensee.
+
+4.     	Disclaimer. THE SOFTWARE IS OFFERED “AS IS,” AND BROADCOM PROVIDES AND
+GRANTS AND LICENSEE RECEIVES NO SUPPORT AND NO WARRANTIES OF ANY KIND, EXPRESS
+OR IMPLIED, BY STATUTE, COMMUNICATION OR CONDUCT WITH LICENSEE, OR OTHERWISE.
+BROADCOM SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A SPECIFIC PURPOSE, OR NONINFRINGEMENT CONCERNING THE SOFTWARE OR
+ANY UPGRADES TO OR DOCUMENTATION FOR THE SOFTWARE. WITHOUT LIMITATION OF THE
+ABOVE, BROADCOM GRANTS NO WARRANTY THAT THE SOFTWARE IS ERROR-FREE OR WILL
+OPERATE WITHOUT INTERRUPTION, AND GRANTS NO WARRANTY REGARDING ITS USE OR THE
+RESULTS THEREFROM INCLUDING, WITHOUT LIMITATION, ITS CORRECTNESS, ACCURACY, OR
+RELIABILITY. TO THE MAXIMUM EXTENT PERMITTED BY LAW, IN NO EVENT SHALL BROADCOM
+OR ANY OF ITS LICENSORS HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER FOR BREACH OF CONTRACT, TORT (INCLUDING NEGLIGENCE) OR
+OTHERWISE, ARISING OUT OF THIS AGREEMENT OR USE, REPRODUCTION, OR DISTRIBUTION
+OF THE SOFTWARE, INCLUDING BUT NOT LIMITED TO LOSS OF DATA AND LOSS OF PROFITS,
+EVEN IF SUCH PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. THESE
+LIMITATIONS SHALL APPLY NOTWITHSTANDING ANY FAILURE OF ESSENTIAL PURPOSE OF ANY
+LIMITED REMEDY.
+
+5. 	Export Laws.  LICENSEE UNDERSTANDS AND AGREES THAT THE SOFTWARE IS
+SUBJECT TO UNITED STATES AND OTHER APPLICABLE EXPORT-RELATED LAWS AND
+REGULATIONS AND THAT LICENSEE MAY NOT EXPORT, RE-EXPORT OR TRANSFER THE
+SOFTWARE OR ANY DIRECT PRODUCT OF THE SOFTWARE EXCEPT AS PERMITTED UNDER THOSE
+LAWS. WITHOUT LIMITING THE FOREGOING, EXPORT, RE-EXPORT, OR TRANSFER OF THE
+SOFTWARE TO CUBA, IRAN, NORTH KOREA, SUDAN, AND SYRIA IS PROHIBITED.
+
diff --git a/LICENCE.ca0132 b/LICENCE.ca0132
new file mode 100644
index 0000000..411750a
--- /dev/null
+++ b/LICENCE.ca0132
@@ -0,0 +1,47 @@
+Copyright (c) 2012, Creative Technology Ltd
+All rights reserved.
+
+Redistribution.  Redistribution and use in binary form, without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions must reproduce the above copyright notice and the
+  following disclaimer in the documentation and/or other materials
+  provided with the distribution.
+* Neither the name of Creative Technology Ltd or its affiliates ("CTL")
+  nor the names of its suppliers may be used to endorse or promote
+  products derived from this software without specific prior written
+  permission.
+* No reverse engineering, decompilation, or disassembly of this software
+  (or any part thereof) is permitted.
+
+Limited patent license. CTL grants a limited, world-wide,
+royalty-free, non-exclusive license under patents it now or hereafter
+owns or controls to make, have made, use, import, offer to sell and
+sell ("Utilize") this software, but strictly only to the extent that any
+such patent is necessary to Utilize the software alone, or in
+combination with an operating system licensed under an approved Open
+Source license as listed by the Open Source Initiative at
+http://opensource.org/licenses.  The patent license shall not be
+applicable, to any other combinations which include this software.
+No hardware per se is licensed hereunder.
+
+DISCLAIMER.  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
+BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGE.
+
+NO OTHER RIGHTS GRANTED. USER HEREBY ACKNOWLEDGES AND AGREES THAT USE OF
+THIS SOFTWARE SHALL NOT CREATE OR GIVE GROUNDS FOR A LICENSE BY
+IMPLICATION, ESTOPPEL, OR OTHERWISE TO ANY INTELLECTUAL PROPERTY RIGHTS
+(PATENT, COPYRIGHT, TRADE SECRET, MASK WORK, OR OTHER PROPRIETARY RIGHT)
+EMBODIED IN ANY OTHER CTL HARDWARE OR SOFTWARE WHETHER SOLELY OR IN
+COMBINATION WITH THIS SOFTWARE.
diff --git a/LICENCE.chelsio_firmware b/LICENCE.chelsio_firmware
new file mode 100644
index 0000000..0c5e1b4
--- /dev/null
+++ b/LICENCE.chelsio_firmware
@@ -0,0 +1,27 @@
+Copyright (c) 2011 Chelsio Communications
+All rights reserved.
+
+Chelsio Communication Terminator 4 ethernet controller firmware
+
+Redistribution and use in binary form, without modification, are permitted provided
+that the following conditions are met:
+
+1. Redistribution in binary form must reproduce the above copyright notice, this
+   list of conditions and the following disclaimer in the documentation and/or
+   other materials provided with the distribution.
+2. The name of Chelsio Communications may not be used to endorse or promote products
+   derived from this software without specific prior written permission.
+3. Reverse engineering, decompilation, or disassembly of this firmware is not
+   permitted.
+
+DISCLAIMER.  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
+BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/LICENCE.ene_firmware b/LICENCE.ene_firmware
new file mode 100644
index 0000000..08f2b01
--- /dev/null
+++ b/LICENCE.ene_firmware
@@ -0,0 +1,14 @@
+copyright (c) 2011, ENE TECHNOLOGY 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.
diff --git a/LICENCE.go7007 b/LICENCE.go7007
new file mode 100644
index 0000000..3689f3b
--- /dev/null
+++ b/LICENCE.go7007
@@ -0,0 +1,457 @@
+The README file from the original package from Micronas appears below. Only
+the part about the firmware redistribution in section 0 is relevant, all
+other sections are completely obsolete.
+
+---------------------------------------------------------------------------
+                     WIS GO7007SB Public Linux Driver
+---------------------------------------------------------------------------
+
+
+*** Please see the file RELEASE-NOTES for important last-minute updates ***
+
+
+  0. OVERVIEW AND LICENSING/DISCLAIMER
+
+
+This driver kit contains Linux drivers for the WIS GO7007SB multi-format
+video encoder.  Only kernel version 2.6.x is supported.  The video stream
+is available through the Video4Linux2 API and the audio stream is available
+through the ALSA API (or the OSS emulation layer of the ALSA system).
+
+The files in kernel/ and hotplug/ are licensed under the GNU General Public
+License Version 2 from the Free Software Foundation.  A copy of the license
+is included in the file COPYING.
+
+The example applications in apps/ and C header files in include/ are
+licensed under a permissive license included in the source files which
+allows copying, modification and redistribution for any purpose without
+attribution.
+
+The firmware files included in the firmware/ directory may be freely
+redistributed only in conjunction with this document; but modification,
+tampering and reverse engineering are prohibited.
+
+MICRONAS USA, INC., MAKES NO WARRANTIES TO ANY PERSON OR ENTITY WITH
+RESPECT TO THE SOFTWARE OR ANY DERIVATIVES THEREOF OR ANY SERVICES OR
+LICENSES AND DISCLAIMS ALL IMPLIED WARRANTIES, INCLUDING WITHOUT LIMITATION
+WARRANTIES OF MERCHANTABILITY, SUPPORT, AND FITNESS FOR A PARTICULAR
+PURPOSE AND NON-INFRINGEMENT.
+
+
+  1. SYSTEM REQUIREMENTS
+
+
+This driver requires Linux kernel 2.6.  Kernel 2.4 is not supported.  Using
+kernel 2.6.10 or later is recommended, as earlier kernels are known to have
+unstable USB 2.0 support.
+
+A fully built kernel source tree must be available.  Typically this will be
+linked from "/lib/modules/<KERNEL VERSION>/build" for convenience.  If this
+link does not exist, an extra parameter will need to be passed to the
+`make` command.
+
+All vendor-built kernels should already be configured properly.  However,
+for custom-built kernels, the following options need to be enabled in the
+kernel as built-in or modules:
+
+        CONFIG_HOTPLUG           - Support for hot-pluggable devices
+        CONFIG_MODULES           - Enable loadable module support
+        CONFIG_KMOD              - Automatic kernel module loading
+        CONFIG_FW_LOADER         - Hotplug firmware loading support
+        CONFIG_I2C               - I2C support
+        CONFIG_VIDEO_DEV         - Video For Linux
+        CONFIG_SOUND             - Sound card support
+        CONFIG_SND               - Advanced Linux Sound Architecture
+        CONFIG_USB               - Support for Host-side USB
+        CONFIG_USB_DEVICEFS      - USB device filesystem
+        CONFIG_USB_EHCI_HCD      - EHCI HCD (USB 2.0) support
+
+Additionally, to use the example application, the following options need to
+be enabled in the ALSA section:
+
+        CONFIG_SND_MIXER_OSS     - OSS Mixer API
+        CONFIG_SND_PCM_OSS       - OSS PCM (digital audio) API
+
+The hotplug scripts, along with the fxload utility, must also be installed.
+These scripts can be obtained from <http://linux-hotplug.sourceforge.net/>.
+Hotplugging is used for loading firmware into the Cypruss EZ-USB chip using
+fxload and for loading firmware into the driver using the firmware agent.
+
+
+  2. COMPILING AND INSTALLING THE DRIVER
+
+
+Most users should be able to compile the driver by simply running:
+
+        $ make
+
+in the top-level directory of the driver kit.  First the kernel modules
+will be built, followed by the example applications.
+
+If the build system is unable to locate the kernel source tree for the
+currently-running kernel, or if the module should be built for a kernel
+other than the currently-running kernel, an additional parameter will need
+to be passed to make to specify the appropriate kernel source directory:
+
+        $ make KERNELSRC=/usr/src/linux-2.6.10-custom3
+
+Once the compile completes, the driver and firmware files should be
+installed by running:
+
+        $ make install
+
+The kernel modules will be placed in "/lib/modules/<KERNEL VERSION>/extra"
+and the firmware files will be placed in the appropriate hotplug firmware
+directory, usually /lib/firmware.  In addition, USB maps and scripts will
+be placed in /etc/hotplug/usb to enable fxload to initialize the EZ-USB
+control chip when the device is connected.
+
+
+  3. PAL/SECAM TUNER CONFIGURATION (TV402U-EU only)
+
+
+The PAL model of the Plextor ConvertX TV402U may require additional
+configuration to correctly select the appropriate TV frequency band and
+audio subchannel.
+
+Users with a device other than the Plextor ConvertX TV402U-EU should skip
+this section.
+
+The wide variety of PAL TV systems used in Europe requires that additional
+information about the local TV standards be passed to the driver in order
+to properly tune TV channels.  The two necessary parameters are (a) the PAL
+TV band, and (b) the audio subchannel format in use.
+
+In many cases, the appropriate TV band selection is passed to the driver
+from applications.  However, in some cases, the application only specifies
+that the driver should use PAL but not the specific information about the
+appropriate TV band.  To work around this issue, the correct TV band may be
+specified in the "force_band" parameter to the wis-sony-tuner module:
+
+     TV band           force_band
+     -------           ----------
+     PAL B/G                B
+     PAL I                  I
+     PAL D/K                D
+     SECAM L                L
+
+If the "force_band" parameter is specified, the driver will ignore any TV
+band specified by applications and will always use the band provided in the
+module parameter.
+
+The other parameter that can be specified is the audio subchannel format.
+There are several stereo audio carrier systems in use, including NICAM and
+three varieties of A2.  To receive audio broadcast on one of these stereo
+carriers, the "force_mpx_mode" parameter must be specified to the
+wis-sony-tuner module.
+
+     TV band           Audio subcarrier       force_mpx_mode
+     -------           ----------------       --------------
+     PAL B/G            Mono (default)               1
+     PAL B/G                  A2                     2
+     PAL B/G                 NICAM                   3
+     PAL I              Mono (default)               4
+     PAL I                   NICAM                   5
+     PAL D/K            Mono (default)               6
+     PAL D/K                 A2 (1)                  7
+     PAL D/K                 A2 (2)                  8
+     PAL D/K                 A2 (3)                  9
+     PAL D/K                 NICAM                  10
+     SECAM L            Mono (default)              11
+     SECAM L                 NICAM                  12
+
+If the "force_mpx_mode" parameter is not specified, the correct mono-only
+mode will be chosen based on the TV band.  However, the tuner will not
+receive stereo audio or bilingual broadcasts correctly.
+
+To pass the "force_band" or "force_mpx_mode" parameters to the
+wis-sony-tuner module, the following line must be added to the modprobe
+configuration file, which varies from one Linux distribution to another.
+
+     options wis-sony-tuner force_band=B force_mpx_mode=2
+
+The above example would force the tuner to the PAL B/G TV band and receive
+stereo audio broadcasts on the A2 carrier.
+
+To verify that the configuration has been placed in the correct location,
+execute:
+
+        $ modprobe -c | grep wis-sony-tuner
+
+If the configuration line appears, then modprobe will pass the parameters
+correctly the next time the wis-sony-tuner module is loaded into the
+kernel.
+
+
+  4. TESTING THE DRIVER
+
+
+Because few Linux applications are able to correctly capture from
+Video4Linux2 devices with only compressed formats supported, the new driver
+should be tested with the "gorecord" application in the apps/ directory.
+
+First connect a video source to the device, such as a DVD player or VCR.
+This will be captured to a file for testing the driver.  If an input source
+is unavailable, a test file can still be captured, but the video will be
+black and the audio will be silent.
+
+This application will auto-detect the V4L2 and ALSA/OSS device names of the
+hardware and will record video and audio to an AVI file for a specified
+number of seconds.  For example:
+
+        $ apps/gorecord -duration 60 capture.avi
+
+If this application does not successfully record an AVI file, the error
+messages produced by gorecord and recorded in the system log (usually in
+/var/log/messages) should provide information to help resolve the problem.
+
+Supplying no parameters to gorecord will cause it to probe the available
+devices and exit.  Use the -help flag for usage information.
+
+
+  5. USING THE DRIVER
+
+
+The V4L2 device implemented by the driver provides a standard compressed
+format API, within the following criteria:
+
+  * Applications that only support the original Video4Linux1 API will not
+    be able to communicate with this driver at all.
+
+  * No raw video modes are supported, so applications like xawtv that
+    expect only uncompressed video will not function.
+
+  * Supported compression formats are: Motion-JPEG, MPEG1, MPEG2 and MPEG4.
+
+  * MPEG video formats are delivered as Video Elementary Streams only.
+    Program Stream (PS), Transport Stream (TS) and Packetized Elementary
+    Stream (PES) formats are not supported.
+
+  * Video parameters such as format and input port may not be changed while
+    the encoder is active.
+
+  * The audio capture device only functions when the video encoder is
+    actively capturing video.  Attempts to read from the audio device when
+    the encoder is inactive will result in an I/O error.
+
+  * The native format of the audio device is 48Khz 2-channel 16-bit
+    little-endian PCM, delivered through the ALSA system.  No audio
+    compression is implemented in the hardware.  ALSA may convert to other
+    uncompressed formats on the fly.
+
+The include/ directory contains a C header file describing non-standard
+features of the GO7007SB encoder, which are described below:
+
+
+  GO7007IOC_S_COMP_PARAMS, GO7007IOC_G_COMP_PARAMS
+
+    These ioctls are used to negotiate general compression parameters.
+
+    To query the current parameters, call the GO7007IOC_G_COMP_PARAMS ioctl
+    with a pointer to a struct go7007_comp_params.  If the driver is not
+    set to MPEG format, the EINVAL error code will be returned.
+
+    To change the current parameters, initialize all fields of a struct
+    go7007_comp_params and call the GO7007_IOC_S_COMP_PARAMS ioctl with a
+    pointer to this structure.  The driver will return the current
+    parameters with any necessary changes to conform to the limitations of
+    the hardware or current compression mode.  Any or all fields can be set
+    to zero to request a reasonable default value.  If the driver is not
+    set to MPEG format, the EINVAL error code will be returned.  When I/O
+    is in progress, the EBUSY error code will be returned.
+
+    Fields in struct go7007_comp_params:
+
+        __u32                        The maximum number of frames in each
+          gop_size                   Group Of Pictures; i.e. the maximum
+                                     number of frames minus one between
+                                     each key frame.
+
+        __u32                        The maximum number of sequential
+          max_b_frames               bidirectionally-predicted frames.
+                                     (B-frames are not yet supported.)
+
+        enum go7007_aspect_ratio     The aspect ratio to be encoded in the
+          aspect_ratio               meta-data of the compressed format.
+
+                                     Choices are:
+                                        GO7007_ASPECT_RATIO_1_1
+                                        GO7007_ASPECT_RATIO_4_3_NTSC
+                                        GO7007_ASPECT_RATIO_4_3_PAL
+                                        GO7007_ASPECT_RATIO_16_9_NTSC
+                                        GO7007_ASPECT_RATIO_16_9_PAL
+
+        __u32                        Bit-wise OR of control flags (below)
+          flags
+
+    Flags in struct go7007_comp_params:
+
+        GO7007_COMP_CLOSED_GOP       Only produce self-contained GOPs, used
+                                     to produce streams appropriate for
+                                     random seeking.
+
+        GO7007_COMP_OMIT_SEQ_HEADER  Omit the stream sequence header.
+
+
+  GO7007IOC_S_MPEG_PARAMS, GO7007IOC_G_MPEG_PARAMS
+
+    These ioctls are used to negotiate MPEG-specific stream parameters when
+    the pixelformat has been set to V4L2_PIX_FMT_MPEG.
+
+    To query the current parameters, call the GO7007IOC_G_MPEG_PARAMS ioctl
+    with a pointer to a struct go7007_mpeg_params.  If the driver is not
+    set to MPEG format, the EINVAL error code will be returned.
+
+    To change the current parameters, initialize all fields of a struct
+    go7007_mpeg_params and call the GO7007_IOC_S_MPEG_PARAMS ioctl with a
+    pointer to this structure.  The driver will return the current
+    parameters with any necessary changes to conform to the limitations of
+    the hardware or selected MPEG mode.  Any or all fields can be set to
+    zero to request a reasonable default value.  If the driver is not set
+    to MPEG format, the EINVAL error code will be returned.  When I/O is in
+    progress, the EBUSY error code will be returned.
+
+    Fields in struct go7007_mpeg_params:
+
+        enum go7007_mpeg_video_standard
+          mpeg_video_standard        The MPEG video standard in which to
+                                     compress the video.
+
+                                     Choices are:
+                                        GO7007_MPEG_VIDEO_MPEG1
+                                        GO7007_MPEG_VIDEO_MPEG2
+                                        GO7007_MPEG_VIDEO_MPEG4
+
+        __u32                        Bit-wise OR of control flags (below)
+          flags
+
+        __u32                        The profile and level indication to be
+          pali                       stored in the sequence header.  This
+                                     is only used as an indicator to the
+                                     decoder, and does not affect the MPEG
+                                     features used in the video stream.
+                                     Not valid for MPEG1.
+
+                                     Choices for MPEG2 are:
+                                        GO7007_MPEG2_PROFILE_MAIN_MAIN
+
+                                     Choices for MPEG4 are:
+                                        GO7007_MPEG4_PROFILE_S_L0
+                                        GO7007_MPEG4_PROFILE_S_L1
+                                        GO7007_MPEG4_PROFILE_S_L2
+                                        GO7007_MPEG4_PROFILE_S_L3
+                                        GO7007_MPEG4_PROFILE_ARTS_L1
+                                        GO7007_MPEG4_PROFILE_ARTS_L2
+                                        GO7007_MPEG4_PROFILE_ARTS_L3
+                                        GO7007_MPEG4_PROFILE_ARTS_L4
+                                        GO7007_MPEG4_PROFILE_AS_L0
+                                        GO7007_MPEG4_PROFILE_AS_L1
+                                        GO7007_MPEG4_PROFILE_AS_L2
+                                        GO7007_MPEG4_PROFILE_AS_L3
+                                        GO7007_MPEG4_PROFILE_AS_L4
+                                        GO7007_MPEG4_PROFILE_AS_L5
+
+    Flags in struct go7007_mpeg_params:
+
+        GO7007_MPEG_FORCE_DVD_MODE   Force all compression parameters and
+                                     bitrate control settings to comply
+                                     with DVD MPEG2 stream requirements.
+                                     This overrides most compression and
+                                     bitrate settings!
+
+        GO7007_MPEG_OMIT_GOP_HEADER  Omit the GOP header.
+
+        GO7007_MPEG_REPEAT_SEQHEADER Repeat the MPEG sequence header at
+                                     the start of each GOP.
+
+
+  GO7007IOC_S_BITRATE, GO7007IOC_G_BITRATE
+
+    These ioctls are used to set and query the target bitrate value for the
+    compressed video stream.  The bitrate may be selected by storing the
+    target bits per second in an int and calling GO7007IOC_S_BITRATE with a
+    pointer to the int.  The bitrate may be queried by calling
+    GO7007IOC_G_BITRATE with a pointer to an int where the current bitrate
+    will be stored.
+
+    Note that this is the primary means of controlling the video quality
+    for all compression modes, including V4L2_PIX_FMT_MJPEG.  The
+    VIDIOC_S_JPEGCOMP ioctl is not supported.
+
+
+----------------------------------------------------------------------------
+                   Installing the WIS PCI Voyager Driver
+---------------------------------------------------------------------------
+
+The WIS PCI Voyager driver requires several patches to the Linux 2.6.11.x
+kernel source tree before compiling the driver.  These patches update the
+in-kernel SAA7134 driver to the newest development version and patch bugs
+in the TDA8290/TDA8275 tuner driver.
+
+The following patches must be downloaded from Gerd Knorr's website and
+applied in the order listed:
+
+	http://dl.bytesex.org/patches/2.6.11-2/i2c-tuner
+	http://dl.bytesex.org/patches/2.6.11-2/i2c-tuner2
+	http://dl.bytesex.org/patches/2.6.11-2/v4l2-api-mpeg
+	http://dl.bytesex.org/patches/2.6.11-2/saa7134-update
+
+The following patches are included with this SDK and can be applied in any
+order:
+
+	patches/2.6.11/saa7134-voyager.diff
+	patches/2.6.11/tda8275-newaddr.diff
+	patches/2.6.11/tda8290-ntsc.diff
+
+Check to make sure the CONFIG_VIDEO_SAA7134 option is enabled in the kernel
+configuration, and build and install the kernel.
+
+After rebooting into the new kernel, the GO7007 driver can be compiled and
+installed:
+
+	$ make SAA7134_BUILD=y
+	$ make install
+	$ modprobe saa7134-go7007
+
+There will be two V4L video devices associated with the PCI Voyager.  The
+first device (most likely /dev/video0) provides access to the raw video
+capture mode of the SAA7133 device and is used to configure the source
+video parameters and tune the TV tuner.  This device can be used with xawtv
+or other V4L(2) video software as a standard uncompressed device.
+
+The second device (most likely /dev/video1) provides access to the
+compression functions of the GO7007.  It can be tested using the gorecord
+application in the apps/ directory of this SDK:
+
+	$ apps/gorecord -vdevice /dev/video1 -noaudio test.avi
+
+Currently the frame resolution is fixed at 720x480 (NTSC) or 720x576 (PAL),
+and the video standard must be specified to both the raw and the compressed
+video devices (xawtv and gorecord, for example).
+
+
+--------------------------------------------------------------------------
+RELEASE NOTES FOR WIS GO7007SB LINUX DRIVER
+---------------------------------------------------------------------------
+
+Last updated: 5 November 2005
+
+ - Release 0.9.7 includes new support for using udev to run fxload.  The
+   install script should automatically detect whether the old hotplug
+   scripts or the new udev rules should be used.  To force the use of
+   hotplug, run "make install USE_UDEV=n".  To force the use of udev, run
+   "make install USE_UDEV=y".
+
+ - Motion detection is supported but undocumented.  Try the `modet` app
+   for a demonstration of how to use the facility.
+
+ - Using USB2.0 devices such as the TV402U with USB1.1 HCDs or hubs can
+   cause buffer overruns and frame drops, even at low framerates, due to
+   inconsistency in the bitrate control mechanism.
+
+ - On devices with an SAA7115, including the Plextor ConvertX, video height
+   values of 96, 128, 160, 192, 256, 320, and 384 do not work in NTSC mode.
+   All valid heights up to 512 work correctly in PAL mode.
+
+ - The WIS Star Trek and PCI Voyager boards have no support yet for audio
+   or the TV tuner.
diff --git a/LICENCE.i2400m b/LICENCE.i2400m
new file mode 100644
index 0000000..263167f
--- /dev/null
+++ b/LICENCE.i2400m
@@ -0,0 +1,43 @@
+Copyright (c) 2008, Intel Corporation.
+
+All rights reserved.
+
+Redistribution.  
+
+Redistribution and use in binary form, without modification, are
+permitted provided that the following conditions are met:
+
+ * Redistributions must reproduce the above copyright notice and the
+   following disclaimer in the documentation and/or other materials
+   provided with the distribution.
+
+ * Neither the name of Intel Corporation nor the names of its
+   suppliers may be used to endorse or promote products derived from
+   this software without specific prior written permission.
+
+ * No reverse engineering, decompilation, or disassembly of this
+   software is permitted.
+
+Limited patent license.
+
+Intel Corporation grants a world-wide, royalty-free, non-exclusive
+license under patents it now or hereafter owns or controls to make,
+have made, use, import, offer to sell and sell (“Utilize”) this
+software, but solely to the extent that any such patent is necessary
+to Utilize the software alone.  The patent license shall not apply to
+any combinations which include this software.  No hardware per se is
+licensed hereunder.
+
+DISCLAIMER.  
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/LICENCE.ibt_firmware b/LICENCE.ibt_firmware
new file mode 100644
index 0000000..262784b
--- /dev/null
+++ b/LICENCE.ibt_firmware
@@ -0,0 +1,39 @@
+Copyright © 2013, Intel Corporation.
+All rights reserved.
+
+Redistribution.  Redistribution and use in binary form, without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions must reproduce the above copyright notice and the
+  following disclaimer in the documentation and/or other materials
+  provided with the distribution.
+* Neither the name of Intel Corporation nor the names of its suppliers
+  may be used to endorse or promote products derived from this software
+  without specific prior written permission.
+* No reverse engineering, decompilation, or disassembly of this software
+  is permitted.
+
+Limited patent license.  Intel Corporation grants a world-wide,
+royalty-free, non-exclusive license under patents it now or hereafter
+owns or controls to make, have made, use, import, offer to sell and
+sell ("Utilize") this software, but solely to the extent that any
+such patent is necessary to Utilize the software alone, or in
+combination with an operating system licensed under an approved Open
+Source license as listed by the Open Source Initiative at
+http://opensource.org/licenses.  The patent license shall not apply to
+any other combinations which include this software.  No hardware per
+se is licensed hereunder.
+
+DISCLAIMER.  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
+BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGE.
diff --git a/LICENCE.iwlwifi_firmware b/LICENCE.iwlwifi_firmware
new file mode 100644
index 0000000..01c32a0
--- /dev/null
+++ b/LICENCE.iwlwifi_firmware
@@ -0,0 +1,39 @@
+Copyright (c) 2006-2013, Intel Corporation.
+All rights reserved.
+
+Redistribution.  Redistribution and use in binary form, without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions must reproduce the above copyright notice and the
+  following disclaimer in the documentation and/or other materials
+  provided with the distribution.
+* Neither the name of Intel Corporation nor the names of its suppliers
+  may be used to endorse or promote products derived from this software
+  without specific prior written permission.
+* No reverse engineering, decompilation, or disassembly of this software
+  is permitted.
+
+Limited patent license.  Intel Corporation grants a world-wide,
+royalty-free, non-exclusive license under patents it now or hereafter
+owns or controls to make, have made, use, import, offer to sell and
+sell ("Utilize") this software, but solely to the extent that any
+such patent is necessary to Utilize the software alone, or in
+combination with an operating system licensed under an approved Open
+Source license as listed by the Open Source Initiative at
+http://opensource.org/licenses.  The patent license shall not apply to
+any other combinations which include this software.  No hardware per
+se is licensed hereunder.
+
+DISCLAIMER.  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
+BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGE.
diff --git a/LICENCE.mwl8335 b/LICENCE.mwl8335
new file mode 100644
index 0000000..0b82452
--- /dev/null
+++ b/LICENCE.mwl8335
@@ -0,0 +1,52 @@
+FIRMWARE LICENSE TERMS
+
+
+Copyright (c) Marvell International Ltd.
+
+All rights reserved.
+
+Redistribution. Redistribution and use in binary form, without modification, are
+permitted provided that the following conditions are met:
+
+* Redistributions must reproduce the above copyright notice and the following
+disclaimer in the documentation and/or other materials provided with the
+distribution.
+
+* Neither the name of Marvell International Ltd. nor the names of its suppliers
+may be used to endorse or promote products derived from this software without
+specific prior written permission.
+
+* No reverse engineering, decompilation, or disassembly of this software is
+permitted.
+
+Limited patent license. Marvell International Ltd. grants a world-wide,
+royalty-free, non-exclusive license under patents it now or hereafter owns or
+controls to make, have made, use, import, offer to sell and sell ("Utilize")
+this software, but solely to the extent that any such patent is necessary to
+Utilize the software alone, or in combination with an operating system licensed
+under an approved Open Source license as listed by the Open Source Initiative at
+http://opensource.org/licenses. The patent license shall not apply to any other
+combinations which include this software. No hardware per se is licensed
+hereunder.
+
+DISCLAIMER. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+----
+
+NOTE: this firmware was generated from img_cb35_fw_duplex.h contained in the
+GPL source release of the Maxtor Shared Storage II product available here:
+
+http://www.seagate.com/staticfiles/maxtor/en_us/downloads/MSSII_3.1.2.src.tgz
+
+Explicit permission from Marvell was obtained to upload this firmware to the
+linux-firmware git repository under the Marvell firmware license above.
+
diff --git a/LICENCE.myri10ge_firmware b/LICENCE.myri10ge_firmware
new file mode 100644
index 0000000..8184023
--- /dev/null
+++ b/LICENCE.myri10ge_firmware
@@ -0,0 +1,28 @@
+/*******************************************************************************
+
+Copyright (c) 2006-2010, Myricom Inc.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+    this list of conditions and the following disclaimer.
+
+ 2. Neither the name of the Myricom Inc, nor the names of its
+    contributors may be used to endorse or promote products derived from
+    this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+***************************************************************************/
diff --git a/LICENCE.phanfw b/LICENCE.phanfw
new file mode 100644
index 0000000..8f7782f
--- /dev/null
+++ b/LICENCE.phanfw
@@ -0,0 +1,32 @@
+Copyright ©  2003-2013 QLogic Corporation
+QLogic Linux Intelligent Ethernet (3000 and 3100 Series) Adapter Firmware
+
+Redistribution and use in binary form, without modification, for use in
+conjunction with QLogic authorized products is permitted provided that the
+following conditions are met:
+
+1. Redistribution in binary form must reproduce the above copyright notice, this
+   list of conditions and the following disclaimer in the documentation and/or
+   other materials provided with the distribution.
+2. The name of QLogic Corporation may not be used to endorse or promote products
+   derived from this software without specific prior written permission.
+3. Reverse engineering, decompilation, or disassembly of this firmware is not
+   permitted.
+
+REGARDLESS OF WHAT LICENSING MECHANISM IS USED OR APPLICABLE,THIS PROGRAM IS
+PROVIDED BY QLOGIC CORPORATION "AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR
+BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+GOODS OR SERVICES; LOSS OF USE,DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGE.
+
+USER ACKNOWLEDGES AND AGREES THAT USE OF THIS PROGRAM WILL NOT CREATE OR GIVE
+GROUNDS FOR A LICENSE BY IMPLICATION, ESTOPPEL, OR OTHERWISE IN ANY INTELLECTUAL
+PROPERTY RIGHTS (PATENT, COPYRIGHT, TRADE SECRET, MASK WORK, OR OTHER
+PROPRIETARY RIGHT) EMBODIED IN ANY OTHER QLOGIC HARDWARE OR SOFTWARE EITHER
+SOLELY OR IN COMBINATION WITH THIS PROGRAM.
diff --git a/LICENCE.qla2xxx b/LICENCE.qla2xxx
new file mode 100644
index 0000000..f669ae0
--- /dev/null
+++ b/LICENCE.qla2xxx
@@ -0,0 +1,39 @@
+Copyright (c)  2003-2006 QLogic Corporation
+QLogic Linux Fibre Channel HBA Firmware
+
+You may redistribute the hardware specific firmware binary file
+under the following terms:
+
+	1. Redistribution of source code (only if applicable),
+	   must retain the above copyright notice, this list of
+	   conditions and the following disclaimer.
+
+	2. Redistribution in binary form must reproduce the above
+	   copyright notice, this list of conditions and the
+	   following disclaimer in the documentation and/or other
+	   materials provided with the distribution.
+
+	3. The name of QLogic Corporation may not be used to
+	   endorse or promote products derived from this software
+	   without specific prior written permission
+
+REGARDLESS OF WHAT LICENSING MECHANISM IS USED OR APPLICABLE,
+THIS PROGRAM IS PROVIDED BY QLOGIC CORPORATION "AS IS'' AND ANY
+EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR
+BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+USER ACKNOWLEDGES AND AGREES THAT USE OF THIS PROGRAM WILL NOT
+CREATE OR GIVE GROUNDS FOR A LICENSE BY IMPLICATION, ESTOPPEL, OR
+OTHERWISE IN ANY INTELLECTUAL PROPERTY RIGHTS (PATENT, COPYRIGHT,
+TRADE SECRET, MASK WORK, OR OTHER PROPRIETARY RIGHT) EMBODIED IN
+ANY OTHER QLOGIC HARDWARE OR SOFTWARE EITHER SOLELY OR IN
+COMBINATION WITH THIS PROGRAM.
diff --git a/LICENCE.ralink-firmware.txt b/LICENCE.ralink-firmware.txt
new file mode 100644
index 0000000..18dd038
--- /dev/null
+++ b/LICENCE.ralink-firmware.txt
@@ -0,0 +1,39 @@
+Copyright (c) 2007, Ralink Technology Corporation 
+All rights reserved.
+
+Redistribution.  Redistribution and use in binary form, without 
+modification, are permitted provided that the following conditions are 
+met:
+
+* Redistributions must reproduce the above copyright notice and the 
+  following disclaimer in the documentation and/or other materials 
+  provided with the distribution. 
+* Neither the name of Ralink Technology Corporation nor the names of its
+  suppliers may be used to endorse or promote products derived from this
+  software without specific prior written permission. 
+* No reverse engineering, decompilation, or disassembly of this software 
+  is permitted.
+
+Limited patent license. Ralink Technology Corporation grants a world-wide, 
+royalty-free, non-exclusive license under patents it now or hereafter 
+owns or controls to make, have made, use, import, offer to sell and 
+sell ("Utilize") this software, but solely to the extent that any 
+such patent is necessary to Utilize the software alone, or in 
+combination with an operating system licensed under an approved Open 
+Source license as listed by the Open Source Initiative at 
+http://opensource.org/licenses.  The patent license shall not apply to 
+any other combinations which include this software.  No hardware per 
+se is licensed hereunder.
+
+DISCLAIMER.  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 
+CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, 
+BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 
+FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
+COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 
+OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 
+TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 
+USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 
+DAMAGE.
diff --git a/LICENCE.ralink_a_mediatek_company_firmware b/LICENCE.ralink_a_mediatek_company_firmware
new file mode 100644
index 0000000..fef16b6
--- /dev/null
+++ b/LICENCE.ralink_a_mediatek_company_firmware
@@ -0,0 +1,39 @@
+Copyright (c) 2013, Ralink, A MediaTek Company 
+All rights reserved.
+
+Redistribution.  Redistribution and use in binary form, without 
+modification, are permitted provided that the following conditions are 
+met:
+
+* Redistributions must reproduce the above copyright notice and the 
+  following disclaimer in the documentation and/or other materials 
+  provided with the distribution. 
+* Neither the name of Ralink Technology Corporation nor the names of its
+  suppliers may be used to endorse or promote products derived from this
+  software without specific prior written permission. 
+* No reverse engineering, decompilation, or disassembly of this software 
+  is permitted.
+
+Limited patent license. Ralink Technology Corporation grants a world-wide, 
+royalty-free, non-exclusive license under patents it now or hereafter 
+owns or controls to make, have made, use, import, offer to sell and 
+sell ("Utilize") this software, but solely to the extent that any 
+such patent is necessary to Utilize the software alone, or in 
+combination with an operating system licensed under an approved Open 
+Source license as listed by the Open Source Initiative at 
+http://opensource.org/licenses.  The patent license shall not apply to 
+any other combinations which include this software.  No hardware per 
+se is licensed hereunder.
+
+DISCLAIMER.  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 
+CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, 
+BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 
+FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
+COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 
+OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 
+TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 
+USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 
+DAMAGE.
diff --git a/LICENCE.rtlwifi_firmware.txt b/LICENCE.rtlwifi_firmware.txt
new file mode 100644
index 0000000..d70921f
--- /dev/null
+++ b/LICENCE.rtlwifi_firmware.txt
@@ -0,0 +1,39 @@
+Copyright (c) 2010, Realtek Semiconductor Corporation 
+All rights reserved.
+
+Redistribution.  Redistribution and use in binary form, without 
+modification, are permitted provided that the following conditions are 
+met:
+
+* Redistributions must reproduce the above copyright notice and the 
+  following disclaimer in the documentation and/or other materials 
+  provided with the distribution. 
+* Neither the name of Realtek Semiconductor Corporation nor the names of its
+  suppliers may be used to endorse or promote products derived from this
+  software without specific prior written permission. 
+* No reverse engineering, decompilation, or disassembly of this software 
+  is permitted.
+
+Limited patent license. Realtek Semiconductor Corporation grants a world-wide, 
+royalty-free, non-exclusive license under patents it now or hereafter 
+owns or controls to make, have made, use, import, offer to sell and 
+sell ("Utilize") this software, but solely to the extent that any 
+such patent is necessary to Utilize the software alone, or in 
+combination with an operating system licensed under an approved Open 
+Source license as listed by the Open Source Initiative at 
+http://opensource.org/licenses.  The patent license shall not apply to 
+any other combinations which include this software.  No hardware per 
+se is licensed hereunder.
+
+DISCLAIMER.  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 
+CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, 
+BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 
+FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
+COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 
+OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 
+TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 
+USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 
+DAMAGE.
diff --git a/LICENCE.tda7706-firmware.txt b/LICENCE.tda7706-firmware.txt
new file mode 100644
index 0000000..6d81594
--- /dev/null
+++ b/LICENCE.tda7706-firmware.txt
@@ -0,0 +1,48 @@
+FIRMWARE LICENSE TERMS
+
+
+Copyright (c) ST Microelectronics
+
+All rights reserved.
+
+Redistribution. Redistribution and use in binary form, without modification, are
+permitted provided that the following conditions are met:
+
+* Redistributions must reproduce the above copyright notice and the following
+disclaimer in the documentation and/or other materials provided with the
+distribution.
+
+* Neither the name of ST Microelectronics nor the names of its suppliers
+may be used to endorse or promote products derived from this software without
+specific prior written permission.
+
+* No reverse engineering, decompilation, or disassembly of this software is
+permitted.
+
+Limited patent license. ST Microelectronics grants a world-wide,
+royalty-free, non-exclusive license under patents it now or hereafter owns or
+controls to make, have made, use, import, offer to sell and sell ("Utilize")
+this software, but solely to the extent that any such patent is necessary to
+Utilize the software alone, or in combination with an operating system licensed
+under an approved Open Source license as listed by the Open Source Initiative at
+http://opensource.org/licenses. The patent license shall not apply to any other
+combinations which include this software. No hardware per se is licensed
+hereunder.
+
+DISCLAIMER. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED.
+
+STMicroelectronics has made every effort possible to ensure that this software is free of any bugs or
+errors; however, in no way is the software to be considered error or bug free. You assume all
+responsibility for any damages or lost data that may result from any errors or bugs in the software.
+IN NO EVENT WILL STMicroelectronics BE LIABLE TO YOU FOR ANY GENERAL, SPECIAL,
+INDIRECT, CONSEQUENTIAL, INCIDENTAL OR OTHER DAMAGES ARISING OUT OF THIS
+LICENSE.
+----
+
+Note
+Explicit permission from ST Microelectronics was obtained to upload this firmware to the
+linux-firmware git repository under the ST Microelectronics firmware license above.
+
diff --git a/LICENCE.ti-connectivity b/LICENCE.ti-connectivity
new file mode 100644
index 0000000..91a1516
--- /dev/null
+++ b/LICENCE.ti-connectivity
@@ -0,0 +1,46 @@
+TECHNOLOGY AND SOFTWARE PUBLICLY AVAILABLE
+SOFTWARE LICENSE
+
+Copyright (c) 2011, Texas Instruments Incorporated.
+
+All rights reserved.
+
+Redistribution.
+
+Redistribution and use in binary form, without modification, are
+permitted provided that the following conditions are met:
+
+ * Redistributions must preserve existing copyright notices and reproduce
+   this license (including the above copyright notice and the disclaimer below)
+   in the documentation and/or other materials provided with the distribution.
+
+ * Neither the name of Texas Instruments Incorporated nor the names of
+   its suppliers may be used to endorse or promote products derived
+   from this software without specific prior written permission.
+
+ * No reverse engineering, decompilation, or disassembly of this
+   software is permitted.
+
+Limited patent license.
+
+Texas Instruments Incorporated grants a world-wide, royalty-free,
+non-exclusive license under patents it now or hereafter owns or controls
+to make, have made, use, import, offer to sell and sell ("Utilize") this
+software, but solely to the extent that any such patent is necessary
+to Utilize the software alone.  The patent license shall not apply to
+any combinations which include this software.  No hardware per se is
+licensed hereunder.
+
+DISCLAIMER.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/LICENCE.ueagle-atm4-firmware b/LICENCE.ueagle-atm4-firmware
new file mode 100644
index 0000000..333675d
--- /dev/null
+++ b/LICENCE.ueagle-atm4-firmware
@@ -0,0 +1,39 @@
+This license applies to eagle4 firmware & DSPcode
+namely, the files eagleIV.fw  DSP4p.bin*
+
+| Copyright (2006) Ikanos Communications, Inc. 
+| 
+| Redistribution and use in source and binary forms, with or without 
+| modification, are permitted provided that the following 
+| conditions are met: 
+| 
+| * Redistribution of source code must retain the above copyright 
+| notice, this list of conditions and the following disclaimer. 
+| 
+| * Redistribution in binary form must reproduce the above 
+| copyright notice, this list of conditions and the following 
+| disclaimer in the documentation and/or other materials provided 
+| with the distribution. 
+| 
+| * The name of Ikanos Corporation may not be used to endorse         
+|   or promote products derived from this source code without specific     
+|   prior written consent of Ikanos Corporation. 
+| 
+| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+| "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+| LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 
+| A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
+| OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
+| SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
+| LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 
+| DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 
+| THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
+| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
+| OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+| USER ACKNOWLEDGES AND AGREES THAT THE PURCHASE OR USE OF THIS SOFTWARE WILL 
+| NOT CREATE OR GIVE GROUNDS FOR A     
+|  LICENSE BY IMPLICATION, ESTOPPEL, OR OTHERWISE IN ANY INTELLECTUAL         
+|  PROPERTY RIGHTS (PATENT, COPYRIGHT, TRADE SECRET, MASK WORK, OR OTHER   
+|  PROPRIETARY RIGHT) EMBODIED IN ANY OTHER IKANOS HARDWARE OR SOFTWARE         
+|  EITHER SOLELY OR IN COMBINATION WITH THIS SOFTWARE. 
+
diff --git a/LICENCE.via_vt6656 b/LICENCE.via_vt6656
new file mode 100644
index 0000000..f231f98
--- /dev/null
+++ b/LICENCE.via_vt6656
@@ -0,0 +1,25 @@
+The following license applies to the binary-only VT6656 firmware
+as contained in the file "vntwusb.fw"
+================================================================
+Copyright 1998-2010 VIA Technologies, Inc. All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
diff --git a/LICENCE.wl1251 b/LICENCE.wl1251
new file mode 100644
index 0000000..bd0f5f1
--- /dev/null
+++ b/LICENCE.wl1251
@@ -0,0 +1,59 @@
+Copyright (c) 2000 – 2013 Texas Instruments Incorporated
+
+All rights reserved not granted herein.
+
+Limited License.
+
+Texas Instruments Incorporated grants a world-wide, royalty-free, non-exclusive
+license under copyrights and patents it now or hereafter owns or controls to
+make, have made, use, import, offer to sell and sell ("Utilize") this software
+subject to the terms herein.  With respect to the foregoing patent license,
+such license is granted  solely to the extent that any such patent is necessary
+to Utilize the software alone.  The patent license shall not apply to any
+combinations which include this software, other than combinations with devices
+manufactured by or for TI (“TI Devices”).  No hardware patent is licensed
+hereunder.
+
+Redistributions must preserve existing copyright notices and reproduce this
+license (including the above copyright notice and the disclaimer and (if
+applicable) source code license limitations below) in the documentation and/or
+other materials provided with the distribution
+
+Redistribution and use in binary form, without modification, are permitted
+provided that the following conditions are met:
+
+*	No reverse engineering, decompilation, or disassembly of this software
+	is permitted with respect to any software provided in binary form.
+
+*	any redistribution and use are licensed by TI for use only with TI
+	Devices.
+
+*	Nothing shall obligate TI to provide you with source code for the
+	software licensed and provided to you in object code.
+
+If software source code is provided to you, modification and redistribution of
+the source code are permitted provided that the following conditions are met:
+
+*	any redistribution and use of the source code, including any resulting
+	derivative works, are licensed by TI for use only with TI Devices.
+
+*	any redistribution and use of any object code compiled from the source
+	code and any resulting derivative works, are licensed by TI for use
+	only with TI Devices.
+
+Neither the name of Texas Instruments Incorporated nor the names of its
+suppliers may be used to endorse or promote products derived from this software
+without specific prior written permission.
+
+DISCLAIMER.
+
+THIS SOFTWARE IS PROVIDED BY TI AND TI’S LICENSORS "AS IS" AND ANY EXPRESS OR
+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+EVENT SHALL TI AND TI’S LICENSORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/LICENCE.xc5000 b/LICENCE.xc5000
new file mode 100644
index 0000000..0ac8557
--- /dev/null
+++ b/LICENCE.xc5000
@@ -0,0 +1,23 @@
+The following XC500 firmware file "dvb-fe-xc5000-1.6.114.fw" was
+created based on "xc5000_firmwares_32000Khz.h".
+
+Firmware provided as part of an XC5000 Linux developers kit by Brian
+Mathews <bmathews@xceive.com> to Devin Heitmueller <dheitmueller@linuxtv.org>
+on July 1, 2009.
+
+The code was released by Xceive under the following license:
+
+// Copyright (c) 2009, Xceive Corporation <info@xceive.com>
+//
+// Permission to use, copy, modify, and/or distribute this software, only
+// for use with Xceive ICs, for any purpose with or without fee is hereby
+// granted, provided that the above copyright notice and this permission
+// notice appear in all source code 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.
diff --git a/LICENSE.amd-ucode b/LICENSE.amd-ucode
new file mode 100644
index 0000000..9d4c425
--- /dev/null
+++ b/LICENSE.amd-ucode
@@ -0,0 +1,64 @@
+Copyright (C) 2010-2013 Advanced Micro Devices, Inc., All rights reserved.
+
+Permission is hereby granted by Advanced Micro Devices, Inc. ("AMD"),
+free of any license fees, to any person obtaining a copy of this
+microcode in binary form (the "Software") ("You"), to install,
+reproduce, copy and distribute copies of the Software and to permit
+persons to whom the Software is provided to do the same, subject to
+the following terms and conditions.  Your use of any portion of the
+Software shall constitute Your acceptance of the following terms and
+conditions. If You do not agree to the following terms and conditions,
+do not use, retain or redistribute any portion of the Software.
+
+If You redistribute this Software, You must reproduce the above
+copyright notice and this license with the Software.
+Without specific, prior, written permission from AMD, You may not
+reference AMD or AMD products in the promotion of any product derived
+from or incorporating this Software in any manner that implies that
+AMD endorses or has certified such product derived from or
+incorporating this Software.
+
+You may not reverse engineer, decompile, or disassemble this Software
+or any portion thereof.
+
+THE SOFTWARE IS PROVIDED "AS IS" WITHOUT ANY EXPRESS OR IMPLIED
+WARRANTY OF ANY KIND, INCLUDING BUT NOT LIMITED TO WARRANTIES OF
+MERCHANTABILITY, NONINFRINGEMENT, TITLE, FITNESS FOR ANY PARTICULAR
+PURPOSE, OR WARRANTIES ARISING FROM CONDUCT, COURSE OF DEALING, OR
+USAGE OF TRADE. IN NO EVENT SHALL AMD OR ITS LICENSORS BE LIABLE FOR
+ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR
+LOSS OF PROFITS, BUSINESS INTERRUPTION, OR LOSS OF DATA OR
+INFORMATION) ARISING OUT OF AMD'S NEGLIGENCE, GROSS NEGLIGENCE, THE
+USE OF OR INABILITY TO USE THE SOFTWARE, EVEN IF AMD HAS BEEN ADVISED
+OF THE POSSIBILITY OF SUCH DAMAGES. BECAUSE SOME JURISDICTIONS
+PROHIBIT THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR
+INCIDENTAL DAMAGES OR THE EXCLUSION OF IMPLIED WARRANTIES, THE ABOVE
+LIMITATION MAY NOT APPLY TO YOU.
+
+Without limiting the foregoing, the Software may implement third party
+technologies for which You must obtain licenses from parties other
+than AMD. You agree that AMD has not obtained or conveyed to You, and
+that You shall be responsible for obtaining the rights to use and/or
+distribute the applicable underlying intellectual property rights
+related to the third party technologies. These third party
+technologies are not licensed hereunder.
+
+If You use the Software (in whole or in part), You shall adhere to all
+applicable U.S., European, and other export laws, including but not
+limited to the U.S. Export Administration Regulations ("EAR"), (15
+C.F.R. Sections 730 through 774), and E.U. Council Regulation (EC) No
+1334/2000 of 22 June 2000. Further, pursuant to Section 740.6  of the
+EAR, You hereby certify that, except pursuant to a license granted by
+the United States Department of Commerce Bureau of Industry and
+Security or as otherwise permitted pursuant to a License Exception
+under the U.S. Export Administration Regulations ("EAR"), You will not
+(1) export, re-export or release to a national of a country in Country
+Groups D:1, E:1 or E:2 any restricted technology, software, or source
+code You receive hereunder, or (2) export to Country Groups D:1, E:1
+or E:2 the direct product of such technology or software, if such
+foreign produced direct product is subject to national security
+controls as identified on the Commerce Control List (currently found
+in Supplement 1 to Part 774 of EAR). For the most current Country
+Group listings, or for additional information about the EAR or Your
+obligations under those regulations, please refer to the U.S. Bureau
+of Industry and Security?s website at ttp://www.bis.doc.gov/.
diff --git a/LICENSE.dib0700 b/LICENSE.dib0700
new file mode 100644
index 0000000..fdb6bde
--- /dev/null
+++ b/LICENSE.dib0700
@@ -0,0 +1,22 @@
+Firmware provided by Patrick Boettcher <pboettcher@dibcom.fr> to Devin
+Heitmueller <dheitmueller@kernellabs.com> on October 8, 2009.
+
+The USB firmware file "dvb-usb-dib0700.1.20.fw" for DiBcom's DiB0700,
+used together with the Linux driver module dvb-usb-dib0700, is
+provided under the following licensing terms:
+
+Copyright (c) 2009, DiBcom
+
+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.
diff --git a/LICENSE.radeon b/LICENSE.radeon
new file mode 100644
index 0000000..0d1894f
--- /dev/null
+++ b/LICENSE.radeon
@@ -0,0 +1,51 @@
+Copyright (C) 2009-2013  Advanced Micro Devices, Inc. All rights reserved.
+
+REDISTRIBUTION: Permission is hereby granted, free of any license fees,
+to any person obtaining a copy of this microcode (the "Software"), to
+install, reproduce, copy and distribute copies, in binary form only, of
+the Software and to permit persons to whom the Software is provided to
+do the same, provided that the following conditions are met:
+
+No reverse engineering, decompilation, or disassembly of this Software
+is permitted.
+
+Redistributions must reproduce the above copyright notice, this
+permission notice, and the following disclaimers and notices in the
+Software documentation and/or other materials provided with the
+Software.
+
+DISCLAIMER: THE USE OF THE SOFTWARE IS AT YOUR SOLE RISK.  THE SOFTWARE
+IS PROVIDED "AS IS" AND WITHOUT WARRANTY OF ANY KIND AND COPYRIGHT
+HOLDER AND ITS LICENSORS EXPRESSLY DISCLAIM ALL WARRANTIES, EXPRESS AND
+IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+COPYRIGHT HOLDER AND ITS LICENSORS DO NOT WARRANT THAT THE SOFTWARE WILL
+MEET YOUR REQUIREMENTS, OR THAT THE OPERATION OF THE SOFTWARE WILL BE
+UNINTERRUPTED OR ERROR-FREE.  THE ENTIRE RISK ASSOCIATED WITH THE USE OF
+THE SOFTWARE IS ASSUMED BY YOU.  FURTHERMORE, COPYRIGHT HOLDER AND ITS
+LICENSORS DO NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE
+OR THE RESULTS OF THE USE OF THE SOFTWARE IN TERMS OF ITS CORRECTNESS,
+ACCURACY, RELIABILITY, CURRENTNESS, OR OTHERWISE.
+
+DISCLAIMER: UNDER NO CIRCUMSTANCES INCLUDING NEGLIGENCE, SHALL COPYRIGHT
+HOLDER AND ITS LICENSORS OR ITS DIRECTORS, OFFICERS, EMPLOYEES OR AGENTS
+("AUTHORIZED REPRESENTATIVES") BE LIABLE FOR ANY INCIDENTAL, INDIRECT,
+SPECIAL OR CONSEQUENTIAL DAMAGES (INCLUDING DAMAGES FOR LOSS OF BUSINESS
+PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, AND THE
+LIKE) ARISING OUT OF THE USE, MISUSE OR INABILITY TO USE THE SOFTWARE,
+BREACH OR DEFAULT, INCLUDING THOSE ARISING FROM INFRINGEMENT OR ALLEGED
+INFRINGEMENT OF ANY PATENT, TRADEMARK, COPYRIGHT OR OTHER INTELLECTUAL
+PROPERTY RIGHT EVEN IF COPYRIGHT HOLDER AND ITS AUTHORIZED
+REPRESENTATIVES HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.  IN
+NO EVENT SHALL COPYRIGHT HOLDER OR ITS AUTHORIZED REPRESENTATIVES TOTAL
+LIABILITY FOR ALL DAMAGES, LOSSES, AND CAUSES OF ACTION (WHETHER IN
+CONTRACT, TORT (INCLUDING NEGLIGENCE) OR OTHERWISE) EXCEED THE AMOUNT OF
+US$10.
+
+Notice:  The Software is subject to United States export laws and
+regulations.  You agree to comply with all domestic and international
+export laws and regulations that apply to the Software, including but
+not limited to the Export Administration Regulations administered by the
+U.S. Department of Commerce and International Traffic in Arm Regulations
+administered by the U.S. Department of State.  These laws include
+restrictions on destinations, end users and end use.
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..321a4e2
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,12 @@
+# This file implements the GNOME Build API:
+# http://people.gnome.org/~walters/docs/build-api.txt
+
+FIRMWAREDIR = /lib/firmware
+
+all:
+
+install:
+	mkdir -p $(DESTDIR)$(FIRMWAREDIR)
+	cp -r * $(DESTDIR)$(FIRMWAREDIR)
+	rm -f $(DESTDIR)/usbdux/*dux $(DESTDIR)/*/*.asm
+	rm $(DESTDIR)$(FIRMWAREDIR)/{WHENCE,LICENSE.*,LICENCE.*}
diff --git a/README b/README
new file mode 100644
index 0000000..0ed6d79
--- /dev/null
+++ b/README
@@ -0,0 +1,38 @@
+
+	Linux firmware
+	==============
+
+  <http://git.kernel.org/?p=linux/kernel/git/firmware/linux-firmware.git>
+
+  git://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git
+
+This repository contains all these firmware images which have been
+extracted from older drivers, as well various new firmware images which
+we were never permitted to include in a GPL'd work, but which we _have_
+been permitted to redistribute under separate cover.
+
+To submit firmware to this repository, please send either a git binary
+diff or preferably a git pull request to:
+      David Woodhouse <dwmw2@infradead.org>
+      Ben Hutchings <ben@decadent.org.uk>
+and also cc: to related mailing lists.
+
+Your commit should include an update to the WHENCE file clearly
+identifying the licence under which the firmware is available, and
+that it is redistributable. If the licence is long and involved, it's
+permitted to include it in a separate file and refer to it from the
+WHENCE file.
+And if it were possible, a changelog of the firmware itself.
+
+Ideally, your commit should contain a Signed-Off-By: from someone
+authoritative on the licensing of the firmware in question (i.e. from
+within the company that owns the code).
+
+
+WARNING:
+=======
+
+Don't send any "CONFIDENTIALITY STATEMENT" in your e-mail, patch or
+request. Otherwise your firmware _will never be accepted_.
+
+Maintainers are really busy, so don't expect a prompt reply.
diff --git a/RTL8192E/boot.img b/RTL8192E/boot.img
new file mode 100644
index 0000000..16998bb
--- /dev/null
+++ b/RTL8192E/boot.img
Binary files differ
diff --git a/RTL8192E/data.img b/RTL8192E/data.img
new file mode 100644
index 0000000..4cabc4a
--- /dev/null
+++ b/RTL8192E/data.img
Binary files differ
diff --git a/RTL8192E/main.img b/RTL8192E/main.img
new file mode 100644
index 0000000..7703afd
--- /dev/null
+++ b/RTL8192E/main.img
Binary files differ
diff --git a/TDA7706_OM_v2.5.1_boot.txt b/TDA7706_OM_v2.5.1_boot.txt
new file mode 100644
index 0000000..2420372
--- /dev/null
+++ b/TDA7706_OM_v2.5.1_boot.txt
@@ -0,0 +1,56 @@
+01AB00,00000100,8A
+01C000,FB801000,FBC8AA00,FB95AE00,FB961600,FBC91A00,FFF70000,FFF70000,FFF70000,E1FFE01B,90007053,9200506B,9200901F,FB270000,FFE60298,FB802200,8A
+01C011,E0FFE000,E4000000,C040A020,FB270243,C0002468,4E224000,FFF70000,D8000020,FB102243,6C620000,C4A7E020,C003F020,FA480000,FB800100,FB102000,FB95A040,C00B6020,907FE000,C0800020,FC040243,4C670000,94014000,C0002020,947BC01B,9001C000,A8004000,811D6000,A001C01B,FC040065,FB806406,FB805A01,FFF70000,A001C06B,9087801B,9001C000,FB102000,FB86EC40,E1084000,A0010000,4FA70000,A0018000,A47FC000,40A70405,A001A033,AC8EF405,40A71937,FB1029A4,44A71024,64A70000,FB89C240,FB102000,FBCCB440,FB102000,FBC72840,FB102000,FBC41A40,A0022000,FB102025,C009D020,FA480000,FB800100,FB102000,FBC9D840,FB102000,FBFB9040,FB102000,FBFEF240,FB102000,FBCA6640,FB102000,FBCA4E40,A27FE000,FC040026,FB800100,FB102000,FB82A640,FB102000,FBFC2E40,FB102000,FBFF0A40,A2084000,C00CC020,FB814801,82658000,907FE000,AC854000,FB102021,C00D7020,FA480000,FB800100,FB102000,FBCFBA40,FB814801,C00E0020,907FE000,A0420000,FFA80487,FB80EA04,FB102000,FBE16640,FB102000,FBFF0A40,A2084000,C00F8020,FB814801,82658000,907FE000,FB102000,FBCFBA40,FB102000,FB8C5240,FB814801,C0106020,907FE000,FB102000,FBFC2E40,FB102000,FBFF0A40,A2084000,C0118020,FB814801,82658000,907FE000,FB102000,FBCFBA40,FB814801,C0122020,907FE000,A0420000,FFA80487,FB812C04,FB102000,FBE16640,FB102000,FBFF0A40,A2084000,C013A020,FB814801,82658000,907FE000,FB102000,FBCFBA40,FB102000,FB905C40,FB814801,C00B6020,907FE000,FB805800,FF270000,FFF70000,FFF70000,A001E000,E03E0000,48270225,FC040033,FC0404C6,FB81620B,E42B4000,4E002000,4E250000,4E10A925,4E004C06,FC040482,44006900,4E008401,FC040033,4C670000,FC040075,C0002408,C000F020,7C670000,FC040046,FC040506,FC040033,FC040049,FC040042,0867101F,93E00000,91F00000,DE0AC020,FC040243,FC040343,91C00000,A1C00000,FFA80480,FB819006,FB800080,E40EC000,E0100000,48002000,4E004800,A0224024,FC040900,FC040224,FC040033,FFA80480,FB81B204,FB81B401,FFF70000,4E00C000,4E250000,00670900,FC040824,FC040406,FC041482,FC040037,FB800081,08670000,08A70000,FB102000,FB963E40,FB102000,FBDB9C40,FCA4003F,A00FE000,FC400000,FD200040,FFF70000,FD200040,FFF70000,F0002000,FFC00017,C0101414,E413801B,48A54000,48A54800,FE27001A,48A54C06,FE27001D,48A56C06,FC580C06,E4138402,4E254013,FC04028B,9013901F,48A70000,48A54800,FE27001A,48A55C07,FE27001D,48A57C07,FC041C07,FC041403,FC041017,FC04128F,9213A000,FD280000,FFF70000,E10B0000,A0010000,4FA70000,44270000,E10B2000,A0010000,4FA70000,64270000,E107C000,A0010000,4FA70000,48270000,80142000,E107E000,A0010000,4FA70000,48270000,AC17E000,A214A800,80148026,FB102C86,FC040482,9014A000,FB827040,FB800080,FB102000,FBDD3640,E013C000,E4178000,4E250000,A0146000,48270800,FC040025,4E002C06,FC040482,44270900,00670000,FC040025,4E002C06,FC040482,08670900,00A70000,FC040025,FC040C06,FB800081,FC040482,08A70000,E0142000,20670000,48270026,FC040446,FC041025,FB82922B,FFF70000,28670000,C00004C8,FB828E0D,FFF70000,AC7BA000,FB829201,FC040409,FC040409,FC040449,FC040449,AC180000,AC182900,FC040074,C0002408,FC040041,FC040502,FC040033,FB800081,FC0400FB,08A70000,A0422000,E4842065,FB830E07,E07DC000,4E004000,4A270000,FC440000,58102000,20E70800,FC040074,C0002408,FC040042,FC040502,FC040033,44262000,4E006880,FC040024,0867103B,FC0404CD,FB82D00A,FC04001B,08A70000,A054E000,FFA80480,FB82DE07,FFF70000,2140A000,FC0400FB,01809926,E27E902D,4C40DD07,29670074,76270000,C0002408,C0011020,5C670000,01670045,FC040502,FC040033,09270406,4C270033,01E60000,FC040900,FC040024,09E62000,FC0404E5,FB830E04,AC850000,FB102021,C030F020,FA480000,FB800100,FB800080,A07EA000,807F4000,FB102000,FB8D6040,A07F6000,A27F8000,C0024504,AC416000,4C6703AE,AC432429,A07F8466,FC0404C5,FB832C04,FFA80117,90406000,90486000,C0006020,90484000,A0714000,FB102025,C033F020,FA480000,FB800100,FB800080,E47AE000,E07E2000,4E250000,A0084000,A0366800,4E002000,4E004401,44006800,48008401,44270075,C0002408,C001F020,7C670000,FC040046,A0006506,FC040033,4827004D,44270075,C0002408,C000B020,7C670000,FC040046,48270506,FC040033,FC040049,4E262000,FC040800,FB800081,FC040024,44270000,E47AE000,E07E2000,4E250000,A02C4000,A02F2800,4E002000,4E004401,44006800,48008401,44270075,C0002408,C0013020,7C670000,FC040046,A0006506,FC040033,4827004D,44270075,C0002408,C000B020,7C670000,FC040046,48270506,FC040033,FC040049,4E262000,FC040800,FB800081,FC040024,44270000,E47AE000,4E250000,A014A000,4E002800,FC040401,4C670000,FC040075,C0002408,C0013020,7C670000,FC040046,A0006506,FC040033,FB800081,E07E204D,44270000,E07DE01B,FE270004,44A70000,FB800080,A05E8000,C0008020,FC041025,FC0404C6,FB83EC08,FC041023,C0360020,FC040243,925E6000,6C67120F,FC04006B,FC04040B,FC04122D,A065E40B,FFA80482,FB840204,FFA8010B,AC77C000,54270021,C040F020,FB102000,FA480000,FB800100,A05EB01F,FC400000,A05E6000,FC04020D,F01D606B,48A70000,FC041407,FC040053,FB841806,FB800081,5C670000,40270000,C4000020,FC040223,54270000,00670000,FC040065,FB843A06,807EE000,FB102000,FB887040,FB844000,807EE000,FB102000,FB889440,FB800080,C0C00020,FC040223,54270000,00670000,FC040065,FB850406,A8014000,FFA80092,94014000,C0280020,FC040243,C0006468,91D00000,A1D00000,FFA80480,FB845C06,A1E00000,AC8F6000,FC040425,91E00000,C0280020,FC040243,C0006468,91C00000,A1C00000,FFA80480,FB847206,D6000020,FC040243,FC040343,91D00000,A1D00000,FFA80480,FB848006,A1E00000,FFA8028C,91E00000,D6000020,FC040243,FC040343,91C00000,A1C00000,FFA80480,FB849406,D4000020,FC040243,FC040343,91D00000,A1D00000,FFA80480,FB84A206,A1E00000,FFA80084,91E00000,D4000020,FC040243,FC040343,91C00000,A1C00000,FFA80480,FB84B606,C0280020,FC040243,C000A468,91D00000,A1D00000,FFA80480,FB84C406,A1E00000,FFA8028D,91E00000,C0280020,FC040243,C000A468,91C00000,A1C00000,FFA80480,FB84D806,C0280020,FC040243,C0002468,91D00000,A1D00000,FFA80480,FB84E606,A1F00000,AC8F2000,FC040425,91F00000,C0280020,FC040243,C0002468,91C00000,A1C00000,FFA80480,FB84FC06,FB85FA00,C00024C4,FB851606,A8014000,FFA80291,FFA80492,FB854C07,FFA80312,94014000,FB85FA00,C00044C4,FB852806,A8014000,FFA80091,FFA80492,FB854C07,FFA80312,94014000,FB85FA00,C00064C4,FB853A06,F0004000,4E244000,E4824000,4E204000,FB85FA01,4E240000,4E200000,C00084C4,FB854A06,F0004000,E4828000,4E244000,4E204000,4E240000,4E200000,FB85FA00,C0280020,FC040243,C0002468,91D00000,A1D00000,FFA80480,FB855406,A1F00000,AC8F0000,FC040465,91F00000,C0280020,FC040243,C0002468,91C00000,A1C00000,FFA80480,FB856A06,D6000020,FC040243,FC040343,91D00000,A1D00000,FFA80480,FB857806,A1E00000,FFA8008C,91E00000,D6000020,FC040243,FC040343,91C00000,A1C00000,FFA80480,FB858C06,D4000020,FC040243,FC040343,91D00000,A1D00000,FFA80480,FB859A06,A1E00000,FFA80284,91E00000,D4000020,FC040243,FC040343,91C00000,A1C00000,FFA80480,FB85AE06,C0280020,FC040243,C0006468,91D00000,A1D00000,FFA80480,FB85BC06,A1E00000,AC8F4000,FC040465,91E00000,C0280020,FC040243,C0006468,91C00000,A1C00000,FFA80480,FB85D206,C0280020,FC040243,C000A468,91D00000,A1D00000,FFA80480,FB85E006,A1E00000,FFA8008D,91E00000,C0280020,FC040243,C000A468,91C00000,A1C00000,FFA80480,FB85F406,FB800080,C4200020,FC040223,54270000,00670000,C00024C4,FB861206,CC000020,FC040243,FB863601,4C662000,C20B4020,C00044C4,FB862006,CE000020,FC040243,FB863601,4C662000,C0126020,C00064C4,FB862E06,C8000020,FC040243,FB863601,4C662000,C0080020,CA000020,FC040243,4C662000,C2104020,4E362000,C0280020,FC040243,C0008468,91D00000,A1D00000,FFA80480,FB864006,A1E00000,D1FFF020,FC041247,C01FF46C,FC041427,FC04146D,93E00000,91C0006B,A1C00000,FFA80480,FB865606,91D00000,A1D00000,FFA80480,FB865E06,A1E00000,D0001020,D240144C,7C671427,FC04147F,93E00000,91C00000,A1C00000,FFA80480,FB867206,D6000020,FC040243,FC040343,91D00000,A1D00000,FFA80480,FB868006,A3E00000,FFA802EC,93E00000,91C00000,A1C00000,FFA80480,FB868E06,83E00000,91C00000,A1C00000,FFA80480,FB869806,FB800080,00A7001B,2066006B,FC040406,FC040406,54A7141E,4E2E3026,93D0106F,A1D00000,FFA80480,FB86AE06,A1F00000,50A70406,A1E00000,FC040406,FC0404CD,FB86AC09,FFF70000,50A70000,FB800081,4C670000,50270000,C0060020,68A70243,54270000,68A70000,A05EC026,FC04138D,68A71057,83F00000,68A70000,83E00000,91C0006B,A1C00000,FFA80480,FB86E006,C00024CC,FB86D60E,FB800080,A05EA01B,A25EC000,A25EF026,FC040066,FB874007,FFF70000,FC400000,FC040065,FB875804,68A70000,FC040416,4E263057,C00004CC,FB87000F,FFF70000,68A70000,FC4404DE,FB872205,FC400000,F21D6000,C0800020,FC040243,E0000000,4C670000,FB875801,54270000,E85EA000,68270000,FB1023E6,C007F020,E05F042B,C0041020,FC040047,FC700000,68270000,FC400026,C073B020,FA480000,FB800100,E0000000,E85EA000,FB875800,FC041056,FC040067,FB875807,FFF70000,925EE000,E13D6000,E31D6000,F81D5809,68A70000,70A70000,68A70000,70A70000,FB800080,20670000,C003E020,00E713E6,FC04142E,C003A4CC,FB877E09,20BE0000,4E240000,E3200000,F81DD009,48A70000,50A70000,48A70000,50A70000,C0004020,FB87A401,905EE000,91400000,C027E020,5C270263,A25EC429,54A70026,C00344CC,FB879A07,FC464000,F0004000,FC040053,C00044C8,FB878E0F,68A70000,70A70000,FB87A400,68A70053,C00044C8,FB879A0F,4E2E0000,4E204000,FB800080,C07E0020,48270243,6C670000,FC041026,FC040427,FC0403E3,C00404C8,FB87BC06,FB102000,FB842640,FB87D000,C00424C8,FB87C606,FB102000,FB85FC40,FB87D000,C1000020,FC040243,6C671427,FC04140E,74270000,FB800080,A07EC000,AC85A000,E067E4C5,FB87E20B,E2660000,E4602000,FB102000,FBBFDC40,A06CA000,FB800081,FC040025,54270000,A07EC000,AC866000,E067E4C5,FB87FA0B,E2660000,E4690000,FB102000,FBC2A440,A06E0000,FB800081,FC040025,54270000,E2660000,10E70000,AC864000,FC0404C5,FB88140D,E067E000,E467C000,FB102000,FBC25840,A06DE000,FB800081,FC040025,54270000,A001E000,AC85C000,FC0404C5,FB885A0D,FFF70000,E067E000,01670000,AC85E000,FC0404C5,FB885A0A,02270000,AC860000,FC0404C5,FB885A0A,A0666000,AC862000,FC0404C5,FB885A0C,02A70000,C002C4C4,FB885A0A,FC04001B,0A670000,C002C020,0AA70000,D0000020,D0002448,4C670000,0AE70000,C0036020,0BE70000,FB800081,A06C2000,80660000,A07EC000,A4688000,A201E800,FC0402A6,FC040482,FB800081,FC040406,907EC000,C01C1020,FC041247,93D00000,A1D00000,FFA80480,FB887606,A1E00000,FFA80284,A1F00000,91E00000,FFA80290,FFA80314,91F00000,93C00000,A1C00000,FFA80480,FB888C06,FB800080,C01C1020,FC041247,93D00000,A1D00000,FFA80480,FB889A06,A1E00000,FFA80084,A1F00000,91E00000,FFA80090,FFA80114,91F00000,93C00000,A1C00000,FFA80480,FB88B006,FB800080,A0860000,FC040065,FB88D204,AC892000,FB102021,C08C9020,FA480000,FB800100,AC894000,FB102021,C08D3020,FA480000,FB800100,FB800080,A0010000,E0860000,E3072000,5FA70000,78270000,00E71246,7C670025,FC0404D6,FB88EC0D,E4868000,4E002000,4E250000,FC040880,01270C06,FC040482,08E70025,FC041026,28A70000,A257E000,FC0404D6,FB89040D,FFF70000,4E00A000,4E008000,AE890880,4E00CC06,FC040482,09270033,4C670000,4E00E800,4E010401,FC040033,4C670000,FC040075,C0002408,C000D020,7C670000,FC040046,00E70506,FC040033,4E012049,4E004041,FC040833,4C67120C,09661037,01C06980,FC040024,FC040049,FC0404DD,FB893E0F,FFF70000,22A70000,FC040021,00A7101F,09A704C6,FB89500B,4E014000,AE88E000,FC0404DD,FB89520C,FC041021,FB895200,FC041056,A0006000,FC04104D,2AA70000,A0008000,FB800081,FC041045,2AE70000,E0860000,01E70000,A20D6025,FC0404D6,FB89700D,E487E000,4E002000,4E250000,4E10E880,4E004C06,FC040482,4C670000,09C06800,4E008401,FC040033,4C670000,FC040075,C0002408,C000D020,7C670000,FC040046,FC040506,FC040033,4E00A049,4E00C041,0A2700FB,A02F2409,FC04101F,FC0404DD,FB89A20B,FFF70000,AC00A000,FC041021,FC04040B,0A670000,01A70000,026703C5,FC040243,C0021564,81E0040B,91F00000,DCA00020,FC040243,FC040343,91C00000,A1C00000,FFA80480,FB89BA06,FB800080,A000E000,A400C000,FC0404C5,FB89FE04,E4808000,4E27C000,4E350000,B800E022,C09DB020,FB102000,FA480000,FB800100,D4000020,FC040243,FC040343,A8014000,91D00000,A3D00000,FFA804C0,FB89E406,FFA80481,FB89F405,A3E00000,FFA802E6,FFA801E6,93E00000,91C00000,A3C00000,FFA804C0,FB89F806,FB800080,A08E0000,FC040065,FB8A4604,A08E2000,FB102025,C0A11020,FA480000,FB800100,A08F6000,A08F8025,A0877025,FC040065,FB8A2205,FFF70000,AC00A000,FC040021,FC041021,908F6000,928F8000,91F00000,DE098020,FC040243,FC040343,91C00000,A1C00000,FFA80480,FB8A3006,93F00000,DE09A020,FC040243,FC040343,91C00000,A1C00000,FFA80480,FB8A4006,FB800080,E08E2000,00A70000,20670025,FC0404D6,FB8A580D,E4896000,4E002000,4E250000,FC040880,4E004C06,FC040482,08A7101F,FC0404C9,FB8A6C0B,FFF70000,4E106000,4E108000,CFFFF020,4E00B247,FC040022,0A670000,2A27101F,00A70000,FC0404C5,FB8A7C0A,CFFFF020,FC041247,E48B8000,29E50000,03A70021,FC041025,C00024CC,FB8A9209,20D08000,4E002000,4E004000,4E10A000,FC0404F6,FB8A980C,FC04106F,C00064CC,FB8AA008,4E006000,4E10C000,AC8DA021,0AA70022,FB800081,0AE70021,44270000,E08E2000,00E70000,A257E025,FC0404D6,FB8ABA0D,E48A2000,4E002000,4E250000,23A70880,4E004C06,FC040482,08E704DE,FB8ACA09,FFF70000,A800A000,00E70000,4E006000,4E008800,4E360401,4E00A033,4C670000,FC040075,C0002408,C000D020,7C670000,FC040046,FC040506,FC040033,4E00C049,0900E900,A0006000,FC040224,5C27004D,0B010800,4E012401,FC040033,4C670000,FC040075,C0002408,C000D020,7C670000,FC040046,FC040506,FC040033,4E014049,09670900,A0006000,FC040224,AC8DC04D,FB800081,0B670021,44270000,E08F0000,02270000,A28E4025,FC0404D6,FB8B220D,E48C6000,4E002000,4E250000,FC040880,02A70C06,FC040482,0A270025,FC0404D6,FB8B340B,FFF70000,4E002000,4E250000,FC040880,02404C06,FC040CA6,0A806824,02270406,FC040482,0A670033,22A71446,02E70DAE,23271824,FC041407,FC041D27,2AC088A4,FC040416,FC040482,0B270000,02E70000,FC040800,C0003020,FC0404C2,FB8B640F,FFF70000,03E70000,FC0410FF,AC8DE407,2B670000,FB800081,0BE70000,B88E2000,E08FF01F,02670000,FC040055,0A670000,C00004C8,FB8B860F,E48C6000,20D10000,0200A000,2A270025,09E70021,0A670000,0080C01B,FC041C0D,FC0404E3,FB8B940D,FFF70000,4E00E000,FC04006B,FC040800,FC0404E3,FB8B9C0C,FC04006B,AC8E0000,44270021,C0BA9020,FB102000,FA480000,FB800100,FB800081,AC8D8000,B88E2000,E1072000,A0010000,4FA70000,68270000,FC040246,6C67001B,828E4000,E28F0000,91E00000,58A70000,81F00000,DE09E020,FC040243,FC040343,91C00000,A1C00000,FFA80480,FB8BCC06,58A70000,81F00000,DE09C020,FC040243,FC040343,91C00000,A1C00000,FFA80480,FB8BDE06,58A70000,81F00000,DE0A4020,FC040243,FC040343,91C00000,A1C00000,FFA80480,FB8BF006,F2004000,58A70000,81F00000,DE094020,FC040243,FC040343,91C00000,A1C00000,FFA80480,FB8C0406,58A70000,81F00000,DE090020,FC040243,FC040343,91C00000,A1C00000,FFA80480,FB8C1606,FB800080,DE000020,FC040243,FC040343,A28EE000,83E00000,91C00000,A1C00000,FFA80480,FB8C2A06,FB800080,DE000020,FC040243,FC040343,91D00000,A1D00000,FFA80480,FB8C3A06,A3E00000,828EE000,FFA802E3,93E00000,91C00000,A1C00000,FFA80480,FB8C4A06,FB800080,A27F0000,FC040066,FB8C9004,A27F301F,FFA804D5,FB8C6407,927F0000,927F2000,AA7B8000,C0280020,FC040243,C000A468,91D00000,A1D00000,FFA80480,FB8C6C06,C003F020,A1F00437,FC040263,FC041267,FC0410F7,FC041427,FC04046B,91F00000,C0280020,FC040243,C000A468,91C00000,A1C00000,FFA80480,FB8C8A06,FB800080,FB102000,FB8C3240,A07EE000,FC040065,FB8CA004,FB102000,FB887040,FB800080,FB102000,FB8C1E40,A07EE000,FC040065,FB8CB004,FB102000,FB889440,FB800080,A042A000,C00064C4,FB8D5A06,E450806D,9042A000,C0006020,90484000,AC460000,4E27C000,4A270000,80486000,A0714000,FB102025,C0CD3020,FA480000,FB800100,C0008020,90484000,E4516000,AC460000,4E27C000,4A270000,80486000,A0714000,FB102025,C0CEB020,FA480000,FB800100,E44E0000,A0404000,4E250000,4E012425,FB102469,C0005020,92484000,FFA80315,90486000,A0714000,FC040025,C0D07020,FA480000,FB800100,A0404000,4E250000,4E012425,FB102469,C0005020,92484000,90486000,A0714000,FC040025,C0D1F020,FA480000,FB800100,AC460000,A0569021,AC4D1567,FC040021,FFA805C0,FB8D3205,FFF70000,A84CE000,AC4D4000,A84D2021,91E00000,81F00000,C02E0020,FC040243,C0004468,91C00000,A1C00000,FFA80480,FB8D3E06,A056601B,91E00000,81F00000,C6004020,91C00000,A1C00000,FFA80480,FB8D4E06,FB8D5E01,A842A000,80480000,FB102000,FBE5AC40,FB800080,A07F4000,A4438000,A0436405,C0030588,E27F8406,FB800081,907F6000,56270000,FB102000,FBE91240,AC014000,FC040021,FFA80502,FB8D9004,A04C0000,FFA80290,904C0000,A0122000,AC44C000,FC0404C5,FB8D9008,A04C0000,FFA80090,904C0000,FB800080,A0420000,FFA8048A,FB8E1205,E045A000,A4490000,48270000,FC0404C5,FB8E120E,02270000,FC0404C5,FB8E1208,02270000,FC0404C5,FB8DB406,FB8DE601,A047C000,FC040025,FC04001B,00670000,FC0404C5,FB8DC20A,FB8DB601,FFF70000,F000206B,90458000,48270000,00670485,4E240243,4C671445,4E2E2000,FB102000,FBC74440,8047E000,A0458000,E046C000,4FA70000,00670000,4E240000,A447E445,4E2407C9,FC0403C4,FC040409,AC57E000,A0006409,FC04004D,C01FF020,5C670000,A8442045,90482000,A4404000,FC041425,5C67023B,FC040466,FC0404E9,FB8E1204,90404000,C0005020,92484000,90486000,A0714000,FB102025,C0E13020,FA480000,FB800100,FB102000,FB8D6040,A07F6000,A27F8000,C0024504,AC416000,4C6703AE,AC432429,A07F8466,FC0404C5,FB8E2A04,FFA80117,90406000,90486000,C0006020,90484000,A0714000,FB102025,C0E3D020,FA480000,FB800100,C1062020,FC040243,C01FE468,A4408000,A2434429,4C67024E,A27F8466,4C670000,C003E434,FC040273,A0440466,FFA80115,C00044C4,FB8E5E0E,FB8E6E01,FFF70000,FFA80116,A0440000,C00064C4,FB8E6A06,FB8E6E01,FFF70000,FFA80117,FFA80116,FFA80117,A0490000,AC440000,FFA80314,FC0404C5,FB8E7A0E,FFA80114,90408000,C0009020,92484000,90486000,A0714000,FB102025,C0E8D020,FA480000,FB800100,FB800080,FB102000,FBEABC40,D6000020,FC040243,FC040343,91D00000,A1D00000,FFA80480,FB8E9A06,A1E00000,FFA8008D,A0420000,FFA8048B,FB8EAC04,FFA8030D,91E00000,D6000020,FC040243,FC040343,91C00000,A1C00000,FFA80480,FB8EB606,FB800080,A0484000,AC418000,FC040465,91D00000,A1C00000,FFA80480,FB8EC606,A1F00000,FFA80497,FB8EC406,A0486000,81F00000,91C00000,A1C00000,FFA80480,FB8ED806,FB800080,A0426000,C00044C4,FB8EF606,A0762000,FB102025,C0EF1020,FA480000,FB800100,FB102000,FBE07840,FB8F0800,C00224C4,FB8F0806,A0764000,FB102025,C0F05020,FA480000,FB800100,FB102000,FBE0D440,FB102000,FBF24C40,FB800080,A0450000,FC040065,FB8F6406,AC424000,BC820000,C0002020,9057006D,90450000,A04C0000,FFA80291,904C0000,A0420000,FFA80086,A8014000,FFA80480,FB8F4E05,FFF70000,90420000,A0224000,FFA80080,FFA80103,90224000,A0662000,80494000,C0002020,90662000,A0762000,FB102025,C0F4D020,FA480000,FB800100,FB8F5A00,A8014000,FFA80482,FB8F5A04,A0224000,FFA80080,90224000,A841A000,80424000,FB8F9C01,A4490000,BC45A000,C00204C4,FB8F9806,A801406D,FFA80480,FB8F8A05,FFF70000,90450000,A0224000,FFA80280,FFA80303,90224000,A0494000,80662000,A0764000,FB102025,C0F89020,FA480000,FB800100,FB8F9C00,A8014000,FFA80482,FB8F9C04,A0224000,FFA80280,90224000,FB8F9C00,FB102000,FBF6A640,FB800080,A0428000,C00084C4,FB902E06,A056A000,FC040065,FB8FC606,A857A06D,9056A065,FB8FB807,FFF70000,AC576000,C000A020,90428000,B8036000,A0024000,FB102025,C0FC5020,FA480000,FB800100,FB8FE000,AC578000,AC57A485,FC04006B,9003606D,9056A4C5,FB8FD608,C000A020,90428000,A0024000,FB102025,C0FE1020,FA480000,FB800100,E04E401B,A4490000,48A70000,FC0404C5,FB8FF006,FB8FFC01,C01FE020,48A70000,FC040065,FB8FFA06,FB8FFC01,FFF70000,C01FC020,F000206B,C00204C8,FB8FE408,C01FE4C8,FB905A06,C002D544,FC040067,FB905A05,FFF70000,807F2000,FC04001B,FFA805C0,FB901604,C0002020,A0420000,FFA8048B,FB901E04,C00024A8,FC040063,FB905A04,A0732000,FB102025,C102D020,FA480000,FB800100,FB905A00,A0428000,C000C4C4,FB905606,FB102000,FBF97E40,C0002020,907F0000,C02C8020,FC040243,C0080468,A2490000,4E262000,FC0404DE,FB905007,FFF70000,A0006000,A88EC000,FB905A01,FFF70000,807FA000,FB102000,FBF97E40,FB800080,E48E301F,4E00506F,E1A00051,4E044063,FB906C05,64250000,00E70000,FB800080,4E103025,4E32506A,FB90782B,FFF70000,21270000,FC04101F,FC0404C5,FB908006,AE00C000,FC041022,FC040066,FB908804,AE00C000,FC041022,4E320000,4E004000,C007E020,4E042051,4E044063,FB909C06,C0014020,D4AB5020,298450F7,29A70000,FB800080,FB102000,FBBC0440,A00FE000,FC400000,A0010000,FC240065,FB90D207,FCA40030,F2080000,FD200040,FFF70000,E426601B,48A54000,48A54800,FE270012,48A54C06,48A50C06,FE270015,48A56C06,A017EC06,FC040402,FD280000,FFF70000,FB90F601,81082013,91080000,FD200060,FFF70000,A112001B,50A70000,E4266000,58A54000,58A54800,FE270012,58A54C06,58A50C06,FE270015,58A56C06,A1122C06,40A70402,FD2C0000,FFF70000,E80FE013,9017E000,FB800080,FB102000,FBB54440,E03E4000,E42C0000,4E250000,A0096000,48270800,FC040025,4E002C06,FC040482,44270900,00670000,FC040025,FC040C06,FB800081,FC040482,08670000,FB102000,FB912E40,FB102000,FB815040,FB800080,C1F1A020,90036000,FB102000,FBC7D840,FB800080,A0030000,E322C000,5FA70000,A03F6000,FC400000,48270000,50A70000,A03F8000,FC400000,48270000,50A70000,A03FA000,FC400000,48270000,50A70000,A03FC000,FC400000,48270000,50A70000,A03FE000,FC400000,FB800081,48270000,50A70000,FB102000,FBB82E40,E429701F,A2026000,E0362000,4FE50000,48270000,4E002800,E017A401,4FE70223,48270033,FC04004F,FC0404C6,FB91800D,FFF70000,4E004000,4E006000,E2366925,5FC08C06,58270482,4E00A813,442E2401,00670223,FC040033,FC040049,FC0404C6,FB919A0D,FFF70000,4E10C000,4E10E000,FC040965,48110C46,FC040482,FC040013,08671022,FC040066,FB91AE05,E21FA000,5FE70000,FC0412C7,FFA805C1,FB91B406,4C270000,FFA805C2,FB91BA06,FC04001B,FB800081,FC04004D,54270000,FB102000,FBB87E40,E42A6000,4E254000,A2027021,FC040066,FB91D004,FC0412C7,FFA805C0,FB920A06,E01FB01F,4FE54000,00670000,C00044C4,FB91E605,68360000,4E27E000,6A270000,6827145E,AE00A000,FC040022,FC040065,FB91F605,FFF70000,F5FFE000,6A270000,6827041E,FC0404D6,FB91FE0C,FC041055,5C670000,FC0404D7,FB92060A,FC04106D,5C670000,FC040025,08670000,FB800080,FB102000,FBB90240,A2026000,E01FC000,4FE70000,48270000,20660000,FC0404DE,FB923004,E42AE025,0867C000,4E350000,BA036000,A0024000,FB102025,C1231020,FA480000,FB800100,FB800080,E43BE000,A0010000,E0242000,68002000,E305A880,5FA50024,58107023,20804800,20403C87,30651C87,40A71037,008048A4,A4316C06,60A70D86,64A70033,44A71531,4E008900,4E108531,4C6C0980,10670C46,4E360409,AA02B403,FC04141F,FFA804D2,FB926806,FC040021,FC041022,4800A000,4480C900,6800E824,40912402,00410C86,6801CC06,40A70402,4E114CC6,E63DC402,4E116953,44918864,48270402,2051ACC6,60AD0C06,4E3D0CC6,4E086402,FC040402,4E182953,449848E4,68270402,00588C46,4098ACC6,20C0AC06,FC040402,FC040402,FC040953,4498C864,4810CCE6,2040ED86,64A70013,40913864,44A71403,00411C87,6801DC07,40A71403,4E115CC7,FC041403,4E1179D7,64919864,48271403,2051BCC7,60AD1C07,4E3D1CC7,4E087403,FC041403,4E1839D7,649858E4,68271403,00589C47,40A71CC7,5408BC07,20671403,FC041403,FC041997,6488D824,FC041CA7,FC041403,FC041017,FB800081,64270000,38670000,FB102000,FBA41E40,E030C000,A01F2000,68270025,FC0404F6,FB92F60D,E48F8000,4E002000,4E250000,A00D6826,20670C86,FC040482,44270025,FC0404F6,FB93080D,FFF70000,4E006000,4E004000,E4928826,A00DCC86,4E002482,0867101F,4E250485,A011604F,FC040293,4E004049,E0277075,C000340C,44007041,A20C7507,4E0098B7,FC04140E,28670501,A423E000,AC8EA509,08A70000,E07FA000,00670000,48270825,AC932C26,FC040402,FC040013,08670000,E0320000,A00EE000,48270800,FC040025,FC040C06,FC040482,44270900,00670000,FC040025,FC040C06,FC040482,08670900,00A70000,FC040025,FC040C06,FB800081,FC040482,08A70000,A002706A,E61AA000,E40E0000,E00C0000,E222C000,5FA70000,31270000,4E2C0000,E21EA021,4FAE0000,5F8CC021,480CA000,4E250000,4E102800,C001E020,4C670074,C0002408,9202C045,30E70502,FC040033,FC040419,FC040033,FC0404F6,FB93960B,10404000,4E106000,4E10A000,4E008000,FC040065,FB939E04,4E10A000,4E008000,E435191F,4E3508E4,4E002402,FC040033,18E7104B,22FE29C0,A0027401,4E08D037,4E1049C0,4E18B411,FC04120F,2BA70000,E01F2000,4FA70000,58270000,A0026405,68006496,E00FA8B3,78008000,A4007401,4FA71217,E230B037,5FA71049,48270000,74271447,FC041049,FC04149F,FC041417,FC041037,C002E528,C002F52C,FC04046B,6C670000,FC040066,FB93EA05,FFF70000,0308E000,4E2D0000,DFFFE494,4E190033,0AC93405,A0006000,21E7104D,E201F037,2B1949C0,4E2E0401,FC040033,FC040900,FC040024,FC04004A,09270000,A716C000,58271022,FC0404DD,FB94120D,E42AA000,4E250000,4E004000,E63719A5,4E2D1C07,4E189483,74082980,4E084401,A00DD073,C000340C,FC041041,FC04150B,FC041037,4E187042,FC04104A,FB800081,FC04104D,920DC000,FB102000,FBAAFA40,A2318000,E434D026,A20C0000,E03184D7,FB94440B,AE34C000,A031A000,4E102000,E41998ED,E217CDC7,4E002482,44270000,FBAB6A01,0C750000,A0026000,FB800080,FB102000,FBAD8E40,E031C000,68270000,A20D7026,E435A4D7,FB94680B,E2300000,4E350000,4E102000,306718ED,4E104DC7,FC040482,44270000,0C670000,FBADE801,A0026000,E01E8000,FB800080,FB102000,FBB09440,E226E000,A00D6000,78271025,FC0404F7,FB948E0D,E42B6000,4E002000,4E250000,E01559A6,48271C87,20671483,7427003D,1067103E,FC04040B,FC04028B,FC0404E6,FB94A60D,FFF70000,4E006000,4E004000,AA02A925,FFA804C5,FB94B206,FC040C06,FC040482,18670000,FB800080,C1F1C020,90036000,FB102000,FBC7D840,FB102000,FBD0D040,FB800080,FB102000,FBB46040,A0010000,E30C2000,5FA70000,A0274000,50A70000,A0278000,50A70000,A027A000,50A70000,A0030000,E322C000,5FA70000,A03F6000,FC400000,48270000,50A70000,A03F8000,FC400000,48270000,50A70000,A03FA000,FC400000,48270000,50A70000,A03FC000,FC400000,48270000,50A70000,A03FE000,FC400000,FB800081,48270000,50A70000,FB102000,FBA7A640,E030C000,E4900000,48250000,00402800,A2006401,4E004223,4E10804E,08806800,00A70401,4E260223,A0006000,FC04004D,FC040033,08C0A900,FC040024,09270940,4E00C401,FC040223,4E00E049,FB800081,FC040041,09670000,E01B2000,21670000,FC04006E,C00104C8,FB95440C,FC04001B,09670000,C000E4C8,FB956C06,E4910000,A226E000,4E250000,4E102880,4E004074,C0002408,4E106042,FC040502,FC040033,4E008409,FC040033,4E10A04A,FC040041,FC040940,FB959A01,FC040024,90272000,C00104C8,FB959606,E491C000,A2270000,4E250000,4E102880,4E004074,C0002408,4E106042,FC040502,FC040033,4E008409,FC040033,4E10A04A,A4272041,FC040940,FC040024,FC040900,FB959A01,FC040024,90274000,FB102000,FBA7D240,FB800081,AC062000,B8032000,FB102000,FB962640,C1F1E020,90036000,FB102000,FBC7D840,FB800080,A1000000,FFA80494,FB960A04,81200000,A1002000,81202000,A1004000,81204000,A1006000,81206000,A1008000,81208000,A100A000,8120A000,A100C000,8120C000,A100E000,8120E000,A1010000,81210000,A1012000,81212000,A1014000,81214000,A1016000,81216000,A1018000,81218000,A101A000,8121A000,A101C000,8121C000,A101E000,8121E000,A1020000,81220000,A1022000,81222000,A1024000,81224000,C0006020,A1026000,81226000,FB961401,905EE000,91400000,C003E424,C0027020,E1000047,905EC000,E85EA000,FB8000C0,A1200000,C003E424,C0027020,E1200047,905EC000,FB8000C1,E85EA000,FFF70000,C14B4020,94018000,C1124020,9401C000,FB800081,C1634020,94024000,C1F18020,90036000,FB102000,FBC7D840,FB800080,A0030000,E322C000,5FA70000,A03F6000,FC400000,48270000,50A70000,A03F8000,FC400000,48270000,50A70000,A03FA000,FC400000,48270000,50A70000,A03FC000,FC400000,48270000,50A70000,A03FE000,FC400000,FB800081,48270000,50A70000,8A
+01CDFD,D8FFF2AB,D7555555,01010300,C60000B6,CC0000CD,01010200,290001EC,2A0001DC,28000188,270054E0,26000000,25000000,2400D000,234E8000,22000002,210000A0,05010400,BB35DD9A,BA2761A7,B9099E2E,B8F6467E,B7F7D180,B6026D97,B50621B2,B400E495,B3FC1EE0,B2FDB94C,B101D45B,B0027359,AFFFB8A1,AEFE12F9,ADFF5BA0,AC012147,AB00F909,AAFF9D70,A9FF1FE2,A8FFE081,A7009033,A60058E5,A5FFC5D1,A4FFA76F,A3FFFCD0,A2003ABE,A1002052,A0FFE5C3,9FFFCE9D,9EFFDE6B,9DFFF486,9CFFFEA0,BF008000,BE004000,BD004000,BC004000,C1000001,C0400000,7C266666,1C000122,1B0000CC,180000E2,15010000,FE000000,FA000000,2E000000,2D000000,2C000000,02800300,FF000003,FE000003,FD000091,FC000096,FB000095,02800100,DB000000,DA100000,D9800000,D8FFFFB1,D74EC4EC,02810300,C600002D,CC000033,01010200,61008000,60008000,59000FFD,58000FFE,57000FFF,56000000,55000000,54000000,52000000,51000000,50000000,4F000000,4E000000,4D000000,4C000000,4B000000,53000001,5F200000,5E0020C5,5D007FBE,5CFB051F,5B0020C5,5A0020C5,0B810100,290001EC,2A0001A0,28000188,27003B69,26000000,25000000,2400A000,2352F000,22000004,210001F3,05010400,E300084F,B2000906,B10008E0,B00008AF,E400088D,AE00087C,03010000,FA000000,FE000000,2E000000,2D000000,2C000000,02800300,FF00004B,FE0001B3,FD0001B1,FC0001BA,FB0001B9,F0000000,03000100,7F000400,00800000,DB000000,DAFFF2D5,D9040D2B,D8FFF2AB,D7555555,02810300,C6000016,CC000001,01010200,57008000,55000700,F2000000,F1000000,F0000000,EF000000,EE800000,ED000000,EC000000,EB000000,EA000000,E9800000,E8000000,E7000000,E6000000,E5000000,E4800000,E3800000,E2000001,F47FCE9B,F37FE74E,FB00045C,FA000919,FD000500,FF000430,5E000200,5D7FFE00,5C000100,5B007F00,F9000A61,0F010100,99001000,290001EC,2A0001BE,28000188,27009F2B,26000000,25000000,24020000,237C5000,22000004,21000192,48070000,47004800,3E000000,46010000,45040000,44020000,43000000,42FFE000,41014000,400047C8,3F057E21,3D7FFFFF,3C200000,3B06CF42,3AD98937,39000200,381E0000,37001900,3639999A,3519349A,3419349A,4A0004B0,4900046A,877FFFFF,867FFFFF,8507EB85,84F80000,83080000,82EC0000,810C6A56,80282690,7F000100,7E0FFFFE,7D0FFFFE,7C000100,700005D7,6F0005B7,6E000589,6D000555,6C000524,6B000800,6A666666,69733333,68002900,67733333,66010000,65002000,64010000,63200000,62008000,61040000,60100000,5F002000,5E010000,5D020000,5C01A000,5B002000,5A200000,59FEE979,587CBC6A,57020000,56200000,55FEE979,547CBC6A,53000002,5202C6C6,51000380,500051EB,4F001A00,4E001200,4D0207FE,4C00072F,4B000E5E,98000001,97400080,96FFFFF0,95700000,94000000,8D7FFFFF,8C7FFFFF,8B400000,8A000000,89000003,887A0000,937FFFFF,92040000,9100A000,90040000,8F000000,8EE00E94,32810400,D640A3D7,30000A9C,2F000A84,2D000A3D,29000A2A,25000A18,240009AF,1B000971,04010000,FA000000,FE000000,FD000000,2E000000,2D000000,2C000000,03000300,FF00006B,FE00007D,FD0000F9,FC00003F,FB00003E,02800100,3B000000,3A000000,37000000,33000000,307FFFFF,3100046A,7F000000,88000000,87000000,86000000,84000000,83000000,82000000,81000000,80000000,74000000,73000000,71000524,707FFFFF,09800400,FF0352F8,DF0001EC,3D003000,3C070000,3B0E8000,3A000E00,17330000,15002000,04300000,C70002AC,C60002A9,C50002AB,DC000018,DD86BCA2,07010300,C9040C37,FC058000,F8000500,C8000474,C6000016,C501BD50,C414DFC0,BD000001,BC000FB1,64000800,6B00110F,05810200,7778D6FC,7606C77C,75066666,7BFFFCFF,7A000300,79CF3FFB,7830C004,020352F8,74000001,73000001,72000000,71000000,29002491,2A002491,28002491,33001100,31000002,300B0000,2F001300,2E003300,32000001,2D140000,0B010400,F7000000,6F0003F5,6000040E,6E000401,640003E9,F9000000,F8000000,180003D3,170003AD,130001F0,FA000000,8A00075F,B2000651,B1000649,98000747,8F0007CF,95000770,9A0006B8,97000787,09800300,4C000064,FE000221,FB000365,F8000350,02000200,01000000,00800C00,00060E44,00080E86,00080F3E,00060F8B,8A
+01CF93,8E000000,8D20001F,8C01A57C,8B20001F,8A01A004,8920001F,88019E10,8720001F,86019DAC,8520001C,84019B54,8320001C,820198FC,8120001C,80019898,7F800000,7E017C14,7D400000,7C017282,7B20001F,7A016B48,7920001F,78016AE4,7720001F,76013880,7520001F,7401381C,73800000,72013178,0E800200,00010FB0,4A23FF01,491A1917,480B88F8,47FF48B1,46F9C063,45FABA58,44FEAB93,4301C994,420266E3,41012DDD,40FFBB67,3FFF2063,3EFF60B7,3DFFE7EF,3C003826,3B00388C,3A00148C,39FFF914,38FFF364,37FFF98A,36FFFF81,3500015A,340000DA,33000034,0C010100,4A23FF01,491A1917,480B88F8,47FF48B1,46F9C063,45FABA58,44FEAB93,4301C994,420266E3,41012DDD,40FFBB67,3FFF2063,3EFF60B7,3DFFE7EF,3C003826,3B00388C,3A00148C,39FFF914,38FFF364,37FFF98A,36FFFF81,3500015A,340000DA,33000034,0C010100,4A23FF01,491A1917,480B88F8,47FF48B1,46F9C063,45FABA58,44FEAB93,4301C994,420266E3,41012DDD,40FFBB67,3FFF2063,3EFF60B7,3DFFE7EF,3C003826,3B00388C,3A00148C,39FFF914,38FFF364,37FFF98A,36FFFF81,3500015A,340000DA,33000034,0C010100,00010FCA,00010FE3,00010FFC,8A
+01900A,00000000,8A
+0190FF,00000000,8A
+01B7FF,00000000,8A
+014004,00500010,01801082,8A
+014003,00000000,8A
+014007,00010000,FFFFFFFF,0000000B,8A
+014001,B0C27F7E,B0C27FFE,8A
+00B000,00000111,8A
+00A000,00000031,0016CE99,0000FFFF,00059CC0,8A
+00B000,00002111,8A
+008000,00000721,8A
+008100,11111100,8A
+009000,00000721,8A
+015000,000F2131,8A
+014001,80027B7E,8A
+011000,00000501,8A
+001000,00000000,8A
+00E000,00000000,8A
+00F000,00000009,8A
+001800,00190014,200F0009,00190015,220F0009,00190016,240F0009,00190017,260F0009,00190018,280F0009,00190064,300F0009,00190065,320F0009,00190066,340F0009,00190067,360F0009,00190068,380F0009,0019001E,200F000A,0019001F,220F000A,00190020,240F000A,00190021,260F000A,00190022,280F000A,0019006E,300F000A,0019006F,320F000A,00190070,340F000A,00190071,360F000A,00190072,380F000A,00190019,200F0008,0019001A,220F0008,0019001B,240F0008,0019001C,260F0008,0019001D,280F0008,00190069,300F0008,0019006A,320F0008,0019006B,340F0008,0019006C,360F0008,0019006D,380F0008,00190023,200F000F,00190024,220F000F,00190025,240F000F,00190026,260F000F,00190027,280F000F,00190073,300F000F,00190074,320F000F,00190075,340F000F,00190076,360F000F,00190077,380F000F,00190028,200F000E,00190029,220F000E,0019002A,240F000E,0019002B,260F000E,0019002C,280F000E,00190078,300F000E,00190079,320F000E,0019007A,340F000E,0019007B,360F000E,0019007C,380F000E,00100002,10170009,00100001,10170008,00190036,22100005,00190086,32100005,00100002,1217000B,00100001,1217000A,00190037,24100005,00190087,34100005,00190091,34060004,00190090,34060003,00100002,24190041,00100001,24190040,00100002,26190058,00100002,361900A8,00100001,26190059,00100001,361900A9,0019003E,28100007,0019008E,38100007,0019003F,28100005,0019008F,38100005,00190239,280F0012,00190289,380F0012,000E0020,2019005A,000E0020,2219005B,000E0020,2419005C,000E0020,2619005D,000E0020,2819005E,000E0020,301900AA,000E0020,321900AB,000E0020,341900AC,000E0020,361900AD,000E0020,381900AE,00080500,26190042,00080500,36190092,00080600,26190043,00080600,36190093,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00190031,210E0606,00190081,310E0606,00060001,0317000A,00060002,0317000B,00190038,25100005,0019002D,210E0610,0019007D,310E0610,0019002E,210E0611,0019007E,310E0611,0019002F,210E0608,0019007F,310E0608,00190030,210E0609,00190080,310E0609,00190032,210E0618,00190082,310E0618,00190033,210E0619,00190083,310E0619,001900B6,41130800,0019003C,2517002A,0019003D,2517002B,0019008C,3517002A,0019008D,3517002B,00160004,25190044,000E000C,23190046,000E000C,33190096,000E000D,23190047,000E000D,33190097,00160004,35190094,00160005,25190045,00160005,35190095,000E0028,2319004A,000E0028,3319009A,000E0029,2319004B,000E0029,3319009B,000E002A,2319004C,000E002A,3319009C,000E002B,2319004D,000E002B,3319009D,000E0621,23190061,000E0624,23190062,000E0620,331900B3,000F0806,411900B4,000E0400,171900B8,000E0401,171900B9,000E0402,171900BA,000E0403,171900BB,000E0404,171900BC,000E0405,171900BD,000E0406,171900BE,000E0407,191900BF,000E0408,191900C0,000E0409,191900C1,000E040A,191900C2,000E040B,191900C3,000E040C,191900C4,000E040D,191900C5,00170024,25190056,00170025,25190057,00170024,351900A6,00170025,351900A7,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00190034,25090800,00190084,35090800,00190035,25090880,00190085,35090880,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,001906FF,19010000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,8A
+00F05B,00110000,8A
+00F068,147B0000,7FEF0000,04190000,7FDE0000,000A0000,FFF80000,FFFE0000,00040000,20000000,30000000,40000000,8A
+00F074,20000000,30000000,40000000,01600000,01700000,01800000,00400000,00200000,7EB70000,00400000,00200000,02500000,10000000,18000000,00000000,00020000,000A0000,08000000,20000000,40000000,000C0000,00200000,00FA0000,001C0000,2C880000,8A
+00F08E,0FA00000,001C0000,07D00000,7FFF0000,000A0000,FC180000,00320000,007D0000,8A
+00F048,02000000,7D000000,7FFF0000,7D000000,00140000,10000000,002F0000,001F0000,00800000,15000000,00110000,00110000,06660000,0CCC0000,20000000,00000000,00000000,00010000,8A
+00E008,00000000,7FFF0000,8A
+00E014,20000000,60000000,8A
+00E021,00000000,02000000,8A
+00E500,00190200,0000009A,8A
+00E378,7FFFFF00,00000000,8A
+00E622,04000000,73000000,8A
+00E30E,7FFFFF00,00000000,8A
+00E31E,7FFFFF00,00000000,8A
+00E34E,7FFFFF00,00000000,8A
+017002,00000000,8A
+017021,00000000,8A
+017020,0002C000,8A
+017026,00020000,00020000,80010000,8A
+003002,00000000,8A
+003001,000014FF,8A
+010000,00000001,8A
+010004,00190000,8A
+00E000,00080801,8A
+00F000,00000009,00000000,8A
+00F802,00000001,8A
+002000,00001001,8A
+001000,00000031,8A
+013000,70000015,8A
+006000,00001F01,8A
+006800,00234000,00000000,0041D000,00000000,00796000,00000000,00C8F000,00000000,0133A000,00000000,01BB0000,00000000,025E5000,00000000,031A7000,00000000,03E99000,00000000,04C34000,00000000,059D6000,00000000,066C4000,00000000,07240000,00000000,07B95000,00000000,0822C000,00000000,08594000,00000000,8A
+006000,00001F21,8A
diff --git a/TDA7706_OM_v3.0.2_boot.txt b/TDA7706_OM_v3.0.2_boot.txt
new file mode 100644
index 0000000..03d9e38
--- /dev/null
+++ b/TDA7706_OM_v3.0.2_boot.txt
@@ -0,0 +1,56 @@
+// TDA7706 OM SW Version: 3.0.2
+01AB00,00000100,8A
+01C000,FB801000,FBD06C00,FBD08C00,FBD0F400,FBD10400,FFF70000,FFF70000,FFF70000,E1FFE01B,90007053,9200506B,9200901F,FB270000,FFE60298,FB802200,8A
+01C011,E0FFE000,E4000000,C0600020,FB270243,C0004468,4E224000,FFF70000,D8000020,FB102243,4C620000,FBD1F640,FB102000,FB82A440,C00B4020,908AE000,C0800020,FC040243,4C670000,94014000,C0002020,94B0401B,9001C000,A8004000,811D6000,A001C01B,FC040065,FB805E06,FB805401,FFF70000,A001C06B,90A1201B,9001C000,FB102000,FBE24840,E1098000,A0010000,4FA70000,A0018000,A490E000,40A70405,A001A033,AC9ED405,40A71937,FB1029A4,44A71024,64A70000,FBD63840,FB102000,FBD49C40,FB102000,FBCEEA40,FB102000,FBCBCC40,A0022000,FB102025,C0097020,FA480000,FB800100,FB102000,FB828440,FB102000,FBFCCA40,FB102000,FBFBCE40,FB102000,FBFF8E40,FB102000,FBD1DE40,FB102000,FBD1C640,A28AE000,FC040026,FB800100,FB102000,FBD9F040,FB810001,C00BE020,908AE000,FB102000,FBD5D040,FB810001,C00C8020,908AE000,FB102000,FBD5E040,FB810001,C00D2020,908AE000,FB102000,FBD5EC40,FB810001,C00DC020,908AE000,FB810001,C00E2020,908AE000,FB102000,FBD5FC40,FB810001,C00EC020,908AE000,FB102000,FBD60240,FB810001,C00F6020,908AE000,FB102000,FBD60E40,FB810001,C00B4020,908AE000,FB805200,FF270000,FFF70000,FFF70000,00670000,C00024C4,FB811606,A8014000,FB813201,FFA80293,94014000,C000A4C4,FB813206,C0C00020,FC040223,54270000,00A70000,FC040245,A8014000,94B02000,FFA80291,FFA80312,FB813601,FFA80113,94014000,FB102000,FBDEC040,FB800080,FB102000,FBD65240,D4000020,FC040243,FC040343,91D00000,A3D00000,FFA804C0,FB814406,A3E00000,FFA802E6,93E00000,91C00000,A3C00000,FFA804C0,FB815206,FB800080,FB102000,FBD6BE40,D4000020,FC040243,FC040343,91D00000,A3D00000,FFA804C0,FB816606,A3E00000,FFA802E6,93E00000,91C00000,A3C00000,FFA804C0,FB817406,FB800080,A0620000,FFA80487,FB81A806,A2690000,AC640000,C0003020,FC0404DE,FB819A0C,FFA8048B,FB81A607,E4764000,9274E000,E475C01B,9074E000,FB81A600,FFA8048B,FB81A607,E475C000,9274E000,E476401B,9074E000,FBEC4000,FBEBEC00,FB800080,A0626000,C00044C4,FB81C406,FB10206D,90626000,FBD61840,FB102000,FBE94440,E06CE000,C8168020,FB800100,FB81EA00,C00224C4,FB81E606,FB10206D,90626000,FBD62840,FB102000,FBE9A040,C0004020,907F8000,AC626000,A0224000,BC9DC000,FFA80281,A861C000,FB81EA01,90224000,80624000,C80FA020,FB800100,FB800080,A2628000,C000C4D4,FB826606,A0016000,FB102025,C01FD020,FA480000,FB800100,FC04001B,90628000,A0622000,FFA80287,90622000,A0620000,FC041025,FC040063,FB821006,FFA803E6,92620000,A07B2000,FB102025,C021D020,FA480000,FB800100,A079A000,FB102025,C0227020,FA480000,FB800100,A0784000,FB102025,C0231020,FA480000,FB800100,A07BA000,FB102025,C023B020,FA480000,FB800100,C0002020,90916000,C02C6020,FC040243,C00F0468,A2690000,4E262000,FC0404DE,FB826009,FFF70000,A0006000,C02CA020,FC040243,C0010468,A2690000,4E262000,FC0404DE,FB82600E,A89EA000,FB826A01,FFF70000,8090C000,C8802020,FB800100,FB800080,C1F1A020,90036000,FB102000,FBCF9A40,FB800080,C1F1C020,90036000,FB102000,FBCF9A40,FB102000,FBD90840,FB800080,AA014000,C0022554,C0006428,FB828E04,FBD15000,E0910000,FFA804D3,FB829E05,E49EE000,00802000,FB82A001,FFF70000,AAB02000,A3600000,FBD18400,FB800080,FB102000,FB82B240,C1F1E020,90036000,FB102000,FBCF9A40,FB800080,C0276020,94018000,C026C020,9401C000,FB800081,C02C0020,94024000,C1F18020,90036000,FB102000,FBCF9A40,FB800080,8A
+01CF65,C40000B6,CA0000CD,01010300,C60011D0,C400005B,C306F540,C2537F00,FA7FFFFF,F5000006,F2035000,F1050000,E2300000,DB003900,05010300,27002000,26200000,1B020000,19023000,15000000,02028000,91007000,90007000,8F007000,8E007000,7F1C4456,7C00A000,7A19999A,79000200,78002000,77080000,E90000AD,E800009C,09010400,CA0000D6,DB0000BE,C40000F6,01800300,61000084,00800400,00000000,00010F67,00000000,00040F8B,91800000,9000474A,8F20001F,8E01A57C,8D20001F,8C01A004,8B20001F,8A019E10,8920001F,88019DAC,8720001C,86019B54,8520001C,840198FC,8320001C,82019898,81400000,800182B8,7F800000,7E017C14,7D400000,7C017282,7B20001F,7A016B48,7920001F,78016AE4,7720001F,76013880,7520001F,7401381C,73800000,72013178,10000300,00010FB0,8A
+01900A,00000000,8A
+0190FF,00000000,8A
+01B7FF,00000000,8A
+014004,00500010,01801082,8A
+014003,00000000,8A
+014007,00010000,FFFFFFFF,0000000B,8A
+014001,B0C27F7E,B0C27FFE,8A
+00B000,00000111,8A
+00A000,00000031,0016CE99,0000FFFF,00059CC0,8A
+00B000,00002111,8A
+008000,00000721,8A
+008100,11111100,8A
+009000,00000721,8A
+015000,000F2131,8A
+014001,80027B7E,8A
+011000,00000501,8A
+001000,00000000,8A
+00E000,00000000,8A
+00F000,00000009,8A
+001800,00190014,200F0009,00190015,220F0009,00190016,240F0009,00190017,260F0009,00190018,280F0009,00190074,300F0009,00190075,320F0009,00190076,340F0009,00190077,360F0009,00190078,380F0009,0019001E,200F000A,0019001F,220F000A,00190020,240F000A,00190021,260F000A,00190022,280F000A,0019007E,300F000A,0019007F,320F000A,00190080,340F000A,00190081,360F000A,00190082,380F000A,00190019,200F0008,0019001A,220F0008,0019001B,240F0008,0019001C,260F0008,0019001D,280F0008,00190079,300F0008,0019007A,320F0008,0019007B,340F0008,0019007C,360F0008,0019007D,380F0008,00190023,200F000F,00190024,220F000F,00190025,240F000F,00190026,260F000F,00190027,280F000F,00190083,300F000F,00190084,320F000F,00190085,340F000F,00190086,360F000F,00190087,380F000F,00190028,200F000E,00190029,220F000E,0019002A,240F000E,0019002B,260F000E,0019002C,280F000E,00190088,300F000E,00190089,320F000E,0019008A,340F000E,0019008B,360F000E,0019008C,380F000E,00100002,10170009,00100001,10170008,00190036,22100005,00190096,32100005,00100002,1217000B,00100001,1217000A,00190037,24100005,00190097,34100005,0019009F,34060004,0019009E,34060003,00100002,2419003F,00100001,2419003E,00100002,26190062,00100002,361900C2,00100001,26190063,00100001,361900C3,0019003C,28100007,0019009C,38100007,0019003D,28100005,0019009D,38100005,00190239,280F0012,00190299,380F0012,000E0020,20190064,000E0020,22190065,000E0020,24190066,000E0020,26190067,000E0020,28190068,000E0020,301900C4,000E0020,321900C5,000E0020,341900C6,000E0020,361900C7,000E0020,381900C8,00080600,2619004C,00080600,361900AC,00080500,2619004D,00080500,361900AD,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00190031,210E0606,00190091,310E0606,00060001,0317000A,00060002,0317000B,00190038,25100005,0019002D,210E0610,0019008D,310E0610,0019002E,210E0611,0019008E,310E0611,0019002F,210E0608,0019008F,310E0608,00190030,210E0609,00190090,310E0609,00190032,210E0618,00190092,310E0618,00190033,210E0619,00190093,310E0619,001900DC,41130800,0019003A,2517002A,0019003B,2517002B,0019009A,3517002A,0019009B,3517002B,00160004,2519004E,000E000C,23190050,000E000C,331900B0,000E000D,23190051,000E000D,331900B1,00160004,351900AE,00160005,2519004F,00160005,351900AF,000E0028,23190054,000E0028,331900B4,000E0029,23190055,000E0029,331900B5,000E002A,23190056,000E002A,331900B6,000E002B,23190057,000E002B,331900B7,000E0621,2319005F,000E0624,23190060,000E0620,331900C1,000F0806,411900DA,000E0400,171900DD,000E0401,171900DE,000E0402,171900DF,000E0403,171900E0,000E0404,171900E1,000E0405,171900E2,000E0406,171900E3,000E0407,191900E4,000E0408,191900E5,000E0409,191900E6,000E040A,191900E7,000E040B,191900E8,000E040C,191900E9,000E040D,191900EA,00170024,25190052,00170025,25190053,00170024,351900B2,00170025,351900B3,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00190034,25090880,00190094,35090880,00190035,25090800,00190095,35090800,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,001906FF,19010000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,8A
+00F05B,00110000,8A
+00F068,147B0000,7FEF0000,04190000,7FDE0000,000A0000,FFF80000,FFFE0000,00040000,20000000,30000000,40000000,8A
+00F074,20000000,30000000,40000000,01600000,01700000,01800000,00400000,00200000,7EB70000,00400000,00200000,02500000,10000000,18000000,00000000,00020000,000A0000,08000000,20000000,40000000,000C0000,00200000,00FA0000,001C0000,2C880000,8A
+00F08E,0FA00000,001C0000,07D00000,7FFF0000,000A0000,FC180000,00320000,007D0000,8A
+00F048,02000000,7D000000,7FFF0000,7D000000,00140000,10000000,002F0000,001F0000,00800000,15000000,00110000,00110000,06660000,0CCC0000,20000000,00000000,00000000,00010000,8A
+00E008,00000000,7FFF0000,8A
+00E014,20000000,60000000,8A
+00E021,00000000,02000000,8A
+00E500,00190200,0000009A,8A
+00E378,7FFFFF00,00000000,8A
+00E622,04000000,73000000,8A
+00E30E,7FFFFF00,00000000,8A
+00E31E,7FFFFF00,00000000,8A
+00E34E,7FFFFF00,00000000,8A
+017002,00000000,8A
+017021,00000000,8A
+017020,0002C000,8A
+017026,00020000,00020000,80010000,8A
+003002,00000000,8A
+003001,000014FF,8A
+010000,00000001,8A
+010004,00190000,8A
+00E000,00080801,8A
+00F000,00000009,00000000,8A
+00F802,00000001,8A
+002000,00001001,8A
+001000,00000031,8A
+013000,70000015,8A
+006000,00001F01,8A
+006800,00234000,00000000,0041D000,00000000,00796000,00000000,00C8F000,00000000,0133A000,00000000,01BB0000,00000000,025E5000,00000000,031A7000,00000000,03E99000,00000000,04C34000,00000000,059D6000,00000000,066C4000,00000000,07240000,00000000,07B95000,00000000,0822C000,00000000,08594000,00000000,8A
+006000,00001F21,8A
diff --git a/WHENCE b/WHENCE
new file mode 100644
index 0000000..3875e77
--- /dev/null
+++ b/WHENCE
@@ -0,0 +1,2352 @@
+             **********
+             * WHENCE *
+             **********
+
+This file attempts to document the origin and licensing information,
+if known, for each piece of firmware distributed for use with the Linux
+kernel.
+
+--------------------------------------------------------------------------
+
+Driver: ambassador -- Madge Ambassador (Collage PCI 155 Server) ATM NIC.
+
+File: atmsar11.fw
+
+Licence: Allegedly GPLv2+, but no source visible. Marked:
+
+  Madge Ambassador ATM Adapter microcode.
+  Copyright (C) 1995-1999  Madge Networks Ltd.
+
+  This microcode data is placed under the terms of the GNU General
+  Public License. The GPL is contained in /usr/doc/copyright/GPL on a
+  Debian system and in the file COPYING in the Linux kernel source.
+
+  We would prefer you not to distribute modified versions without
+  consultation and not to ask for assembly/other microcode source.
+
+--------------------------------------------------------------------------
+
+Driver: snd-korg1212 -- Korg 1212 IO audio device
+
+File: korg/k1212.dsp
+
+Licence: Unknown
+
+Found in alsa-firmware package in hex form; no licensing information.
+
+--------------------------------------------------------------------------
+
+Driver: snd-maestro3 -- ESS Allegro Maestro3 audio device
+
+File: ess/maestro3_assp_kernel.fw
+File: ess/maestro3_assp_minisrc.fw
+
+Licence: Unknown
+
+Found in alsa-firmware package in hex form with a comment claiming to
+be GPLv2+, but without source -- and with another comment saying "ESS
+drops binary dsp code images on our heads, but we don't get to see
+specs on the dsp."
+
+--------------------------------------------------------------------------
+
+Driver: snd-ymfpci -- Yamaha YMF724/740/744/754 audio devices
+
+File: yamaha/ds1_ctrl.fw
+File: yamaha/ds1_dsp.fw
+File: yamaha/ds1e_ctrl.fw
+
+Licence: Unknown
+
+Found alsa-firmware package in hex form, with the following comment:
+   Copyright (c) 1997-1999 Yamaha Corporation. All Rights Reserved.
+
+--------------------------------------------------------------------------
+
+Driver: advansys - AdvanSys SCSI
+
+File: advansys/mcode.bin
+File: advansys/3550.bin
+File: advansys/38C0800.bin
+File: advansys/38C1600.bin
+
+Licence: BSD, no source available.
+
+Found in hex form in kernel source.
+
+--------------------------------------------------------------------------
+
+Driver: qla1280 - Qlogic QLA 1240/1x80/1x160 SCSI support
+
+File: qlogic/1040.bin
+File: qlogic/1280.bin
+File: qlogic/12160.bin
+
+Licence: Allegedly GPLv2+, but no source visible. Marked:
+
+                   QLOGIC LINUX SOFTWARE
+  QLogic ISP1280/ device driver for Linux 2.2.x and 2.4.x
+  Copyright (C) 2001 Qlogic Corporation (www.qlogic.com)
+
+--------------------------------------------------------------------------
+
+Driver: smctr -- SMC ISA/MCA Token Ring adapter
+
+File: tr_smctr.bin
+Version: 6.3C1
+Info: MCT.BIN v6.3C1 03/01/95
+
+Original licence info:
+
+ * This firmware is licensed to you strictly for use in conjunction
+ * with the use of SMC TokenRing adapters. There is no waranty
+ * expressed or implied about its fitness for any purpose.
+
+--------------------------------------------------------------------------
+
+Driver: kaweth -- USB KLSI KL5USB101-based Ethernet device
+
+File: kaweth/new_code.bin
+File: kaweth/new_code_fix.bin
+File: kaweth/trigger_code.bin
+File: kaweth/trigger_code_fix.bin
+
+Licence: Unknown
+
+Found in hex form in the kernel source.
+
+--------------------------------------------------------------------------
+
+Driver: dvb-ttusb-budget -- Technotrend/Hauppauge Nova-USB devices
+
+File: ttusb-budget/dspbootcode.bin
+
+Licence: Unknown
+
+Found in hex form in the kernel source.
+
+--------------------------------------------------------------------------
+
+Driver: keyspan -- USB Keyspan USA-xxx serial device
+
+File: keyspan/mpr.fw
+File: keyspan/usa18x.fw
+File: keyspan/usa19.fw
+File: keyspan/usa19qi.fw
+File: keyspan/usa19qw.fw
+File: keyspan/usa19w.fw
+File: keyspan/usa28.fw
+File: keyspan/usa28xa.fw
+File: keyspan/usa28xb.fw
+File: keyspan/usa28x.fw
+File: keyspan/usa49w.fw
+File: keyspan/usa49wlc.fw
+
+Converted from Intel HEX files, used in our binary representation of ihex.
+
+Original licence information:
+
+		Copyright (C) 1999-2001
+		Keyspan, A division of InnoSys Incorporated ("Keyspan")
+
+	as an unpublished work. This notice does not imply unrestricted or
+	public access to the source code from which this firmware image is
+	derived.  Except as noted below this firmware image may not be
+	reproduced, used, sold or transferred to any third party without
+	Keyspan's prior written consent.  All Rights Reserved.
+
+	Permission is hereby granted for the distribution of this firmware
+	image as part of a Linux or other Open Source operating system kernel
+	in text or binary form as required.
+
+	This firmware may not be modified and may only be used with
+	Keyspan hardware.  Distribution and/or Modification of the
+	keyspan.c driver which includes this firmware, in whole or in
+	part, requires the inclusion of this statement."
+
+--------------------------------------------------------------------------
+
+Driver: keyspan_pda -- USB Keyspan PDA single-port serial device
+
+File: keyspan_pda/keyspan_pda.fw
+Source: keyspan_pda/keyspan_pda.S
+
+File: keyspan_pda/xircom_pgs.fw
+Source: keyspan_pda/xircom_pgs.S
+
+Source: keyspan_pda/Makefile
+
+Licence: GPLv2+
+
+Compiled from original 8051 source into Intel HEX, used in our binary ihex form.
+
+--------------------------------------------------------------------------
+
+Driver: emi26 -- EMI 2|6 USB Audio interface
+
+File: emi26/bitstream.fw
+Version: 1.1.1.131
+Info: DATE=2001dec06
+
+File: emi26/firmware.fw
+Version: 1.0.2.916
+Info: DATE=12.02.2002
+
+File: emi26/loader.fw
+
+Converted from Intel HEX files, used in our binary representation of ihex.
+
+Original licence information:
+/*
+ * This firmware is for the Emagic EMI 2|6 Audio Interface
+ *
+ * The firmware contained herein is Copyright (c) 1999-2002 Emagic
+ * as an unpublished work. This notice does not imply unrestricted
+ * or public access to this firmware which is a trade secret of Emagic,
+ * and which may not be reproduced, used, sold or transferred to
+ * any third party without Emagic's written consent. All Rights Reserved.
+ *
+ * Permission is hereby granted for the distribution of this firmware
+ * image as part of a Linux or other Open Source operating system kernel
+ * in text or binary form as required.
+ *
+ * This firmware may not be modified and may only be used with the
+ * Emagic EMI 2|6 Audio Interface. Distribution and/or Modification of
+ * any driver which includes this firmware, in whole or in part,
+ * requires the inclusion of this statement.
+ */
+
+--------------------------------------------------------------------------
+
+Driver: emi62 -- EMI 6|2m USB Audio interface
+
+File: emi62/bitstream.fw
+Version: 1.0.0.191
+Info: DATE= 2002oct28
+
+File: emi62/loader.fw
+Source: EMILOAD.HEX
+Version: 1.0.2.002
+Info: DATE=10.01.2002
+
+File: emi62/midi.fw
+Source: EMI62MFW.HEX
+Version: 1.04.062
+Info: DATE=16.10.2002
+
+File: emi62/spdif.fw
+Source: EMI62SFW.HEX
+Version: 1.04.062
+Info: DATE=16.10.2002
+
+Converted from Intel HEX files, used in our binary representation of ihex.
+
+Original licence information: None
+
+--------------------------------------------------------------------------
+
+Driver: ti_usb_3410_5052 -- USB TI 3410/5052 serial device
+
+File: ti_3410.fw
+Info: firmware 9/10/04 FW3410_Special_StartWdogOnStartPort
+
+File: ti_5052.fw
+Info: firmware 9/18/04
+
+Licence: Allegedly GPLv2+, but no source visible. Marked:
+	 Copyright (C) 2004 Texas Instruments
+
+Found in hex form in kernel source.
+
+--------------------------------------------------------------------------
+
+Driver: ti_usb_3410_5052 -- Multi-Tech USB cell modems
+
+File: mts_cdma.fw
+File: mts_gsm.fw
+File: mts_edge.fw
+
+Licence: "all firmware components are redistributable in binary form"
+         per support@multitech.com
+	 Copyright (C) 2005 Multi-Tech Systems, Inc.
+
+Found in hex form in ftp://ftp.multitech.com/wireless/wireless_linux.zip
+
+--------------------------------------------------------------------------
+
+Driver: ti_usb_3410_5052 -- Multi-Tech USB fax modems
+
+File: mts_mt9234mu.fw
+File: mts_mt9234zba.fw
+
+Licence: Unknown
+
+--------------------------------------------------------------------------
+
+Driver: whiteheat -- USB ConnectTech WhiteHEAT serial device
+
+File: whiteheat.fw
+Version: 4.06
+
+File: whiteheat_loader.fw
+
+Licence: Allegedly GPLv2, but no source visible. Marked:
+	 Copyright (C) 2000-2002  ConnectTech Inc
+
+Debug loader claims the following behaviour:
+	Port 1 LED flashes when the vend_ax program is running
+	Port 2 LED flashes when any SETUP command arrives
+	Port 3 LED flashes when any valid VENDOR request occurs
+	Port 4 LED flashes when the EXTERNAL RAM DOWNLOAD request occurs
+
+Converted from Intel HEX files, used in our binary representation of ihex.
+
+--------------------------------------------------------------------------
+
+Driver: ip2 -- Computone IntelliPort Plus serial device
+
+File: intelliport2.bin
+
+Licence: Unknown
+
+Found in hex form in kernel source.
+
+--------------------------------------------------------------------------
+
+Driver: cpia2 -- cameras based on Vision's CPiA2
+
+File: cpia2/stv0672_vp4.bin
+
+Licence: Allegedly GPLv2+, but no source visible. Marked:
+	Copyright (C) 2001 STMicroelectronics, Inc.
+	Contact:  steve.miller@st.com
+	Description: This file contains patch data for the CPiA2 (stv0672) VP4.
+
+Found in hex form in kernel source.
+
+--------------------------------------------------------------------------
+
+Driver: dabusb -- Digital Audio Broadcasting (DAB) Receiver for USB and Linux
+
+File: dabusb/firmware.fw
+File: dabusb/bitstream.bin
+
+Licence: Distributable
+
+ * Copyright (C) 1999 BayCom GmbH
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that redistributions of source
+ * code retain the above copyright notice and this comment without
+ * modification.
+
+--------------------------------------------------------------------------
+
+Driver: vicam -- USB 3com HomeConnect (aka vicam)
+
+File: vicam/firmware.fw
+
+Licence: Unknown
+
+Found in hex form in kernel source.
+
+--------------------------------------------------------------------------
+
+Driver: io_edgeport - USB Inside Out Edgeport Serial Driver
+
+File: edgeport/boot.fw
+File: edgeport/boot2.fw
+File: edgeport/down.fw
+File: edgeport/down2.fw
+
+Licence: Allegedly GPLv2+, but no source visible. Marked:
+//**************************************************************
+//* Edgeport/4 Binary Image
+//* Generated by HEX2C v1.06
+//* Copyright (C) 1998 Inside Out Networks, All rights reserved.
+//**************************************************************
+
+Found in hex form in kernel source.
+
+--------------------------------------------------------------------------
+
+Driver: io_ti - USB Inside Out Edgeport Serial Driver
+(TI Devices)
+
+File: edgeport/down3.bin
+
+Licence:
+//**************************************************************
+//* Edgeport Binary Image (for TI based products)
+//* Generated by TIBin2C v2.00 (watchport)
+//* Copyright (C) 2001 Inside Out Networks, All rights reserved.
+//**************************************************************
+
+Found in hex form in kernel source.
+
+--------------------------------------------------------------------------
+
+Driver: dsp56k - Atari DSP56k support
+
+File: dsp56k/bootstrap.bin
+Source: dsp56k/bootstrap.asm
+Source: dsp56k/Makefile
+Source: dsp56k/concat-bootstrap.pl
+
+Licence: GPLv2 or later
+
+DSP56001 assembler, buildable with a56 from
+http://www.zdomain.com/a56.html
+
+--------------------------------------------------------------------------
+
+Driver: snd-sb16-csp - Sound Blaster 16/AWE CSP support
+
+File: sb16/mulaw_main.csp
+File: sb16/alaw_main.csp
+File: sb16/ima_adpcm_init.csp
+File: sb16/ima_adpcm_playback.csp
+File: sb16/ima_adpcm_capture.csp
+
+Licence: Allegedly GPLv2+, but no source visible. Marked:
+/*
+ *  Copyright (c) 1994 Creative Technology Ltd.
+ *  Microcode files for SB16 Advanced Signal Processor
+ */
+
+Found in hex form in kernel source.
+
+--------------------------------------------------------------------------
+
+Driver: qla2xxx - QLogic QLA2XXX Fibre Channel
+
+File: ql2100_fw.bin
+Version: 1.19.38 TP
+File: ql2200_fw.bin
+Version: 2.02.08 TP
+File: ql2300_fw.bin
+Version: 3.03.28 IPX
+File: ql2322_fw.bin
+Version: 3.03.28 IPX
+File: ql2400_fw.bin
+Version: 5.08.00 MID
+File: ql2500_fw.bin
+Version: 5.08.00 MIDQ
+
+Licence: Redistributable. See LICENCE.qla2xxx for details
+
+Available from http://ldriver.qlogic.com/firmware/ 
+
+--------------------------------------------------------------------------
+
+Driver: orinoco - Agere/Prism/Symbol Orinoco support
+
+File: agere_sta_fw.bin
+Version: 9.48 Hermes I
+File: agere_ap_fw.bin
+Version: 9.48 Hermes I
+
+Licence: Redistributable. See LICENCE.agere for details
+
+--------------------------------------------------------------------------
+
+Driver: ar9170 - Atheros 802.11n "otus" USB
+
+File: ar9170-1.fw
+File: ar9170-2.fw
+
+Licence: Redistributable. See LICENCE.atheros_firmware for details
+
+--------------------------------------------------------------------------
+
+Driver: ath9k_htc - Atheros HTC devices (USB)
+
+File: ar9271.fw
+File: ar7010.fw
+File: ar7010_1_1.fw
+File: htc_9271.fw
+Version: 1.3
+File: htc_7010.fw
+Version: 1.3
+
+Licence: Redistributable. See LICENCE.atheros_firmware for details
+
+--------------------------------------------------------------------------
+
+Driver: cassini - Sun Cassini
+
+File: sun/cassini.bin
+
+Licence: Unknown
+
+Found in hex form in kernel source.
+
+--------------------------------------------------------------------------
+
+Driver: slicoss - Alacritech IS-NIC products
+
+File: slicoss/gbdownload.sys
+File: slicoss/gbrcvucode.sys
+File: slicoss/oasisdbgdownload.sys
+File: slicoss/oasisdownload.sys
+File: slicoss/oasisrcvucode.sys
+
+Licence:
+		Copyright (C) 1999-2009 Alacritech, Inc.
+
+	as an unpublished work. This notice does not imply unrestricted or
+	public access to the source code from which this firmware image is
+	derived.  Except as noted below this firmware image may not be
+	reproduced, used, sold or transferred to any third party without
+	Alacritech's prior written consent.  All Rights Reserved.
+
+	Permission is hereby granted for the distribution of this firmware
+	image as part of a Linux or other Open Source operating system kernel
+	in text or binary form as required.
+
+	This firmware may not be modified.
+
+Found in hex form in kernel source.
+
+--------------------------------------------------------------------------
+
+Driver: sxg - Alacritech IS-NIC products
+
+File: sxg/saharadownloadB.sys
+File: sxg/saharadbgdownloadB.sys
+
+Licence:
+		Copyright (C) 1999-2009 Alacritech, Inc.
+
+	as an unpublished work. This notice does not imply unrestricted or
+	public access to the source code from which this firmware image is
+	derived.  Except as noted below this firmware image may not be
+	reproduced, used, sold or transferred to any third party without
+	Alacritech's prior written consent.  All Rights Reserved.
+
+	Permission is hereby granted for the distribution of this firmware
+	image as part of a Linux or other Open Source operating system kernel
+	in text or binary form as required.
+
+	This firmware may not be modified.
+
+Found in hex form in kernel source.
+
+--------------------------------------------------------------------------
+
+Driver: cxgb3 - Chelsio Terminator 3 1G/10G Ethernet adapter
+
+File: cxgb3/t3b_psram-1.1.0.bin
+File: cxgb3/t3c_psram-1.1.0.bin
+File: cxgb3/t3fw-7.0.0.bin
+File: cxgb3/t3fw-7.1.0.bin
+File: cxgb3/t3fw-7.4.0.bin
+File: cxgb3/t3fw-7.10.0.bin
+File: cxgb3/t3fw-7.12.0.bin
+
+Licence: GPLv2 or OpenIB.org BSD license, no source visible
+
+--------------------------------------------------------------------------
+
+Driver: cxgb3 - Chelsio Terminator 3 1G/10G Ethernet adapter
+
+File: cxgb3/ael2005_opt_edc.bin
+File: cxgb3/ael2005_twx_edc.bin
+File: cxgb3/ael2020_twx_edc.bin
+
+Licence:
+ *	Copyright (c) 2007-2009 NetLogic Microsystems, Inc.
+ *
+ *	Permission is hereby granted for the distribution of this firmware
+ *	data in hexadecimal or equivalent format, provided this copyright
+ *	notice is accompanying it.
+
+Found in hex form in kernel source.
+
+--------------------------------------------------------------------------
+
+Driver: cxgb4 - Chelsio Terminator 4 1G/10G Ethernet adapter
+
+File: cxgb4/t4fw-1.6.2.0.bin
+Link: cxgb4/t4fw.bin -> t4fw-1.6.2.0.bin
+
+Licence: Redistributable. See LICENCE.chelsio_firmware for details
+
+--------------------------------------------------------------------------
+
+Driver: e100 -- Intel PRO/100 Ethernet NIC
+
+File: e100/d101m_ucode.bin
+File: e100/d101s_ucode.bin
+File: e100/d102e_ucode.bin
+
+Licence: Unknown
+
+Found in hex form in kernel source.
+
+--------------------------------------------------------------------------
+
+Driver: acenic -- Alteon AceNIC Gigabit Ethernet card
+
+File: acenic/tg1.bin
+File: acenic/tg2.bin
+
+Licence: Unknown
+
+Found in hex form in kernel source, but source allegedly available at
+http://alteon.shareable.org/
+
+--------------------------------------------------------------------------
+
+Driver: tg3 -- Broadcom Tigon3 based gigabit Ethernet cards
+
+File: tigon/tg3.bin
+File: tigon/tg3_tso.bin
+File: tigon/tg3_tso5.bin
+File: tigon/tg357766.bin
+
+Licence:
+ * Firmware is:
+ *	Derived from proprietary unpublished source code,
+ *	Copyright (C) 2000-2013 Broadcom Corporation.
+ *
+ *	Permission is hereby granted for the distribution of this firmware
+ *	data in hexadecimal or equivalent format, provided this copyright
+ *	notice is accompanying it.
+
+Found in hex form in kernel source.
+
+--------------------------------------------------------------------------
+
+Driver: starfire - Adaptec Starfire/DuraLAN support
+
+File: adaptec/starfire_rx.bin
+File: adaptec/starfire_tx.bin
+
+Licence: Allegedly GPLv2, but no source visible.
+
+Found in hex form in kernel source, with the following notice:
+
+ BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE IT IS LICENSED "AS IS" AND
+ THERE IS NO WARRANTY FOR THE PROGRAM, INCLUDING BUT NOT LIMITED TO THE
+ IMPLIED WARRANTIES OF MERCHANTIBILITY OR FITNESS FOR A PARTICULAR PURPOSE
+ (TO THE EXTENT PERMITTED BY APPLICABLE LAW). USE OF THE PROGRAM IS AT YOUR
+ OWN RISK. IN NO EVENT WILL ADAPTEC OR ITS LICENSORS BE LIABLE TO YOU FOR
+ DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES
+ ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM.
+
+--------------------------------------------------------------------------
+
+Driver: i2400m-usb - Intel 2400 Wireless WiMAX Connection over USB
+
+File: i2400m-fw-usb-1.4.sbcf
+File: i2400m-fw-usb-1.5.sbcf
+File: i6050-fw-usb-1.5.sbcf
+
+Licence: Redistributable. See LICENCE.i2400m for details
+
+Also available from http://linuxwimax.org/Download
+
+--------------------------------------------------------------------------
+
+Driver: libertas - Marvell Libertas fullmac-type 802.11b/g cards
+
+File: libertas/cf8381.bin
+File: libertas/cf8381_helper.bin
+File: libertas/cf8385.bin
+File: libertas/cf8385_helper.bin
+File: libertas/gspi8682.bin
+File: libertas/gspi8682_helper.bin
+File: libertas/gspi8686_v9.bin
+File: libertas/gspi8686_v9_helper.bin
+File: libertas/gspi8688.bin
+File: libertas/gspi8688_helper.bin
+File: libertas/sd8385.bin
+File: libertas/sd8385_helper.bin
+File: libertas/sd8682.bin
+File: libertas/sd8682_helper.bin
+File: libertas/sd8686_v8.bin
+File: libertas/sd8686_v8_helper.bin
+File: libertas/sd8686_v9.bin
+File: libertas/sd8686_v9_helper.bin
+File: libertas/usb8388_v5.bin
+File: libertas/usb8388_v9.bin
+File: libertas/usb8682.bin
+File: mrvl/sd8688.bin
+Link: libertas/sd8688.bin -> ../mrvl/sd8688.bin
+File: mrvl/sd8688_helper.bin
+Link: libertas/sd8688_helper.bin -> ../mrvl/sd8688_helper.bin
+
+Licence: Redistributable. See LICENCE.Marvell for details.  Extracted from
+Linux driver tarballs downloaded from Marvell's "Extranet" with permission.
+
+--------------------------------------------------------------------------
+
+Driver: libertas - Marvell Libertas 802.11b/g cards, OLPC firmware
+
+File: libertas/lbtf_sdio.bin
+Version: 9.0.7.p4
+
+File: lbtf_usb.bin
+Version: 5.132.3.p1
+
+File: libertas/usb8388_olpc.bin
+Version: 5.110.22.p23
+
+Licence: Redistributable. See LICENCE.OLPC for details.
+
+Available from http://dev.laptop.org/pub/firmware/libertas/
+
+--------------------------------------------------------------------------
+
+Driver: mwl8k - Marvell Libertas softmac-type 802.11b/g/n cards
+
+File: mwl8k/fmimage_8687.fw
+File: mwl8k/helper_8687.fw
+File: mwl8k/fmimage_8366.fw
+File: mwl8k/fmimage_8366_ap-1.fw
+File: mwl8k/fmimage_8366_ap-2.fw
+File: mwl8k/fmimage_8366_ap-3.fw
+Version: 5.2.8.16
+File: mwl8k/helper_8366.fw
+
+File: mwl8k/fmimage_8764_ap-1.fw
+Version: 7.4.0.9
+
+Licence: Redistributable. See LICENCE.Marvell for details.  8687 images
+downloaded from Marvell's "Extranet" with permission.  8366 images contributed
+directly by Marvell.
+
+--------------------------------------------------------------------------
+
+Driver: mwifiex - Marvell Wi-Fi fullmac-type 802.11n/ac cards
+
+File: mrvl/sd8787_uapsta.bin
+Version: 14.66.9.p96
+
+File: mrvl/sd8797_uapsta.bin
+Version: 14.66.11.p151
+
+File: mrvl/sd8897_uapsta.bin
+Version: 15.69.2.p11
+
+File: mrvl/usb8797_uapsta.bin
+Version: 14.69.11.p179
+
+File: mrvl/pcie8897_uapsta.bin
+Version: 15.69.2.p11
+
+Licence: Redistributable. See LICENCE.Marvell for details.  Originates from
+http://git.marvell.com/?p=mwifiex-firmware.git
+
+--------------------------------------------------------------------------
+
+
+Driver: iwlwifi - Intel Wireless Wifi
+
+File: iwlwifi-3945-2.ucode
+Version: 15.32.2.9
+
+File: iwlwifi-4965-2.ucode
+Version: 228.61.2.24
+
+File: iwlwifi-5000-1.ucode
+Version: 5.4.A.11 (aka 5.4.1.16)
+
+File: iwlwifi-5000-2.ucode
+Version: 8.24.2.12
+
+File: iwlwifi-5000-5.ucode
+Version: 8.83.5.1
+
+File: iwlwifi-5150-2.ucode
+Version: 8.24.2.2
+
+File: iwlwifi-1000-3.ucode
+Version: 128.50.3.1
+
+File: iwlwifi-1000-5.ucode
+Version: 39.31.5.1
+
+File: iwlwifi-6000-4.ucode
+Version: 9.221.4.1
+
+File: iwlwifi-6050-4.ucode
+Version: 9.201.4.1
+
+File: iwlwifi-6050-5.ucode
+Version: 41.28.5.1
+
+File: iwlwifi-6000g2a-5.ucode
+Version: 17.168.5.3
+
+File: iwlwifi-6000g2a-6.ucode
+Version: 18.168.6.1
+
+File: iwlwifi-6000g2b-5.ucode
+Version: 17.168.5.1
+
+File: iwlwifi-6000g2b-6.ucode
+Version: 18.168.6.1
+
+File: iwlwifi-135-6.ucode
+Version: 18.168.6.1
+
+File: iwlwifi-100-5.ucode
+Version: 39.31.5.1
+
+File: iwlwifi-105-6.ucode
+Version: 18.168.6.1
+
+File: iwlwifi-2030-6.ucode
+Version: 18.168.6.1
+
+File: iwlwifi-2000-6.ucode
+Version: 18.168.6.1
+
+File: iwlwifi-7260-7.ucode
+Version: 22.0.7.0
+
+File: iwlwifi-3160-7.ucode
+Version: 22.0.7.0
+
+Licence: Redistributable. See LICENCE.iwlwifi_firmware for details
+
+Also available from http://intellinuxwireless.org/?n=Downloads
+
+--------------------------------------------------------------------------
+
+Driver: cx231xx - Conexant Cx23100/101/102 USB broadcast A/V decoder
+
+File: v4l-cx231xx-avcore-01.fw
+
+Licence:
+  Conexant grants permission to use and redistribute these firmware
+  files for use with Conexant devices, but not as a part of the Linux
+  kernel or in any other form which would require these files themselves
+  to be covered by the terms of the GNU General Public License.
+  These firmware files are distributed in the hope that they will be
+  useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+  of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+--------------------------------------------------------------------------
+
+Driver: tehuti - Tehuti Networks 10G Ethernet
+
+File: tehuti/bdx.bin
+
+Licence:
+
+ Copyright (C) 2007 Tehuti Networks Ltd.
+
+ Permission is hereby granted for the distribution of this firmware data
+ in hexadecimal or equivalent format, provided this copyright notice is
+ accompanying it.
+
+Found in hex form in kernel source.
+
+--------------------------------------------------------------------------
+
+Driver: typhoon - 3cr990 series Typhoon
+
+File: 3com/typhoon.bin
+
+Licence:
+/*
+ * Copyright 1999-2004 3Com Corporation.  All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms of the 3c990img.h
+ * microcode software are permitted provided that the following conditions
+ * are met:
+ * 1. Redistribution of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistribution in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of 3Com may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission
+ *
+ * THIS SOFTWARE IS PROVIDED BY 3COM ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * USER ACKNOWLEDGES AND AGREES THAT PURCHASE OR USE OF THE 3c990img.h
+ * MICROCODE SOFTWARE WILL NOT CREATE OR GIVE GROUNDS FOR A LICENSE BY
+ * IMPLICATION, ESTOPPEL, OR OTHERWISE IN ANY INTELLECTUAL PROPERTY RIGHTS
+ * (PATENT, COPYRIGHT, TRADE SECRET, MASK WORK, OR OTHER PROPRIETARY RIGHT)
+ * EMBODIED IN ANY OTHER 3COM HARDWARE OR SOFTWARE EITHER SOLELY OR IN
+ * COMBINATION WITH THE 3c990img.h MICROCODE SOFTWARE
+ */
+
+Found in hex form in kernel source.
+
+--------------------------------------------------------------------------
+
+Driver: yam - YAM driver for AX.25
+
+File: yam/1200.bin
+File: yam/9600.bin
+
+Licence:
+ * (C) F6FBB 1998
+
+Found in hex form in kernel source.
+
+--------------------------------------------------------------------------
+
+Driver: 3c359 - 3Com 3C359 Token Link Velocity XL adapter
+
+File: 3com/3C359.bin
+
+Licence:
+/*
+ * The firmware this driver downloads into the tokenring card is a
+ * separate program and is not GPL'd source code, even though the Linux
+ * side driver and the routine that loads this data into the card are.
+ *
+ * This firmware is licensed to you strictly for use in conjunction
+ * with the use of 3Com 3C359 TokenRing adapters. There is no
+ * waranty expressed or implied about its fitness for any purpose.
+ */
+/* 3c359_microcode.mac: 3Com 3C359 Tokenring microcode.
+ *
+ * Notes:
+ *  - Loaded from xl_init upon adapter initialization.
+ *
+ * Available from 3Com as part of their standard 3C359 driver.
+ */
+
+Found in hex form in kernel source.
+
+--------------------------------------------------------------------------
+
+Driver: pcnet_cs - NE2000 compatible PCMCIA adapter
+
+File: cis/LA-PCM.cis
+File: cis/PCMLM28.cis
+File: cis/DP83903.cis
+File: cis/NE2K.cis
+File: cis/tamarack.cis
+File: cis/PE-200.cis
+File: cis/PE520.cis
+Source: cis/src/LA-PCM.cis
+Source: cis/src/PCMLM28.cis
+Source: cis/src/DP83903.cis
+Source: cis/src/NE2K.cis
+Source: cis/src/tamarack.cis
+Source: cis/src/PE-200.cis
+Source: cis/src/PE520.cis
+
+Licence: Dual GPLv2/MPL
+
+Originally developed by the pcmcia-cs project
+Copyright (C) 1998, 1999, 2000 David A. Hinds
+
+--------------------------------------------------------------------------
+
+Driver: 3c589_cs - 3Com PCMCIA adapter
+
+File: cis/3CXEM556.cis
+Source: cis/src/3CXEM556.cis
+
+Licence: Dual GPLv2/MPL
+
+Originally developed by the pcmcia-cs project
+Copyright (C) 1998, 1999, 2000 David A. Hinds
+
+--------------------------------------------------------------------------
+
+Driver: 3c574_cs - 3Com PCMCIA adapter
+
+File: cis/3CCFEM556.cis
+Source: cis/src/3CCFEM556.cis
+
+Licence: Dual GPLv2/MPL
+
+Originally developed by the pcmcia-cs project
+Copyright (C) 1998, 1999, 2000 David A. Hinds
+
+--------------------------------------------------------------------------
+
+Driver: serial_cs - Serial PCMCIA adapter
+
+File: cis/MT5634ZLX.cis
+File: cis/RS-COM-2P.cis
+File: cis/COMpad2.cis
+File: cis/COMpad4.cis
+Source: cis/src/MT5634ZLX.cis
+Source: cis/src/RS-COM-2P.cis
+Source: cis/src/COMpad2.cis
+Source: cis/src/COMpad4.cis
+
+Licence: Dual GPLv2/MPL
+
+Originally developed by the pcmcia-cs project
+Copyright (C) 1998, 1999, 2000 David A. Hinds
+
+--------------------------------------------------------------------------
+
+Driver: serial_cs - Serial PCMCIA adapter
+
+File: cis/SW_555_SER.cis
+File: cis/SW_7xx_SER.cis
+File: cis/SW_8xx_SER.cis
+
+Licence: GPLv3
+
+Copyright Sierra Wireless
+
+--------------------------------------------------------------------------
+
+Driver: smc91c92_cs - SMC 91Cxx PCMCIA
+
+File: ositech/Xilinx7OD.bin
+
+Licence: Allegedly GPL, but no source visible. Marked:
+    This file contains the firmware of Seven of Diamonds from OSITECH.
+    (Special thanks to Kevin MacPherson of OSITECH)
+
+Found in hex form in kernel source.
+
+--------------------------------------------------------------------------
+
+Driver: cx23418 - Conexant PCI Broadcast A/V with MPEG encoder
+
+File: v4l-cx23418-apu.fw
+File: v4l-cx23418-cpu.fw
+File: v4l-cx23418-dig.fw
+
+Licence:
+  Conexant grants permission to use and redistribute these firmware
+  files for use with Conexant devices, but not as a part of the Linux
+  kernel or in any other form which would require these files themselves
+  to be covered by the terms of the GNU General Public License.
+  These firmware files are distributed in the hope that they will be
+  useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+  of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+--------------------------------------------------------------------------
+
+Driver: cx23885 - Conexant PCI Express Broadcast A/V decoder
+
+File: v4l-cx23885-avcore-01.fw
+File: v4l-cx23885-enc.fw
+
+Licence:
+  Conexant grants permission to use and redistribute these firmware
+  files for use with Conexant devices, but not as a part of the Linux
+  kernel or in any other form which would require these files themselves
+  to be covered by the terms of the GNU General Public License.
+  These firmware files are distributed in the hope that they will be
+  useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+  of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+--------------------------------------------------------------------------
+
+Driver: cx23840 - Conexant sideport Broadcast A/V decoder
+
+File: v4l-cx25840.fw
+
+Licence:
+  Conexant grants permission to use and redistribute these firmware
+  files for use with Conexant devices, but not as a part of the Linux
+  kernel or in any other form which would require these files themselves
+  to be covered by the terms of the GNU General Public License.
+  These firmware files are distributed in the hope that they will be
+  useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+  of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+--------------------------------------------------------------------------
+
+Driver: qlogicpti - PTI Qlogic, ISP Driver
+
+File: qlogic/isp1000.bin
+
+Licence: Unknown
+
+Found in hex form in kernel source.
+
+--------------------------------------------------------------------------
+
+Driver: myri_sbus - MyriCOM Gigabit Ethernet
+
+File: myricom/lanai.bin
+
+Licence: Unknown
+
+Found in hex form in kernel source.
+
+--------------------------------------------------------------------------
+
+Driver: bnx2x: Broadcom Everest
+
+File: bnx2x-e1-4.8.53.0.fw
+File: bnx2x-e1h-4.8.53.0.fw
+File: bnx2x-e1-5.2.7.0.fw
+File: bnx2x-e1h-5.2.7.0.fw
+File: bnx2x-e1-5.2.13.0.fw
+File: bnx2x-e1h-5.2.13.0.fw
+File: bnx2x/bnx2x-e1-6.0.34.0.fw
+File: bnx2x/bnx2x-e1h-6.0.34.0.fw
+File: bnx2x/bnx2x-e2-6.0.34.0.fw
+File: bnx2x/bnx2x-e1-6.2.5.0.fw
+File: bnx2x/bnx2x-e1h-6.2.5.0.fw
+File: bnx2x/bnx2x-e2-6.2.5.0.fw
+File: bnx2x/bnx2x-e1-6.2.9.0.fw
+File: bnx2x/bnx2x-e1h-6.2.9.0.fw
+File: bnx2x/bnx2x-e2-6.2.9.0.fw
+File: bnx2x/bnx2x-e2-7.0.20.0.fw
+File: bnx2x/bnx2x-e1-7.0.20.0.fw
+File: bnx2x/bnx2x-e1h-7.0.20.0.fw
+File: bnx2x/bnx2x-e2-7.0.23.0.fw
+File: bnx2x/bnx2x-e1-7.0.23.0.fw
+File: bnx2x/bnx2x-e1h-7.0.23.0.fw
+File: bnx2x/bnx2x-e2-7.0.29.0.fw
+File: bnx2x/bnx2x-e1-7.0.29.0.fw
+File: bnx2x/bnx2x-e1h-7.0.29.0.fw
+File: bnx2x/bnx2x-e2-7.2.16.0.fw
+File: bnx2x/bnx2x-e1-7.2.16.0.fw
+File: bnx2x/bnx2x-e1h-7.2.16.0.fw
+File: bnx2x/bnx2x-e2-7.2.51.0.fw
+File: bnx2x/bnx2x-e1-7.2.51.0.fw
+File: bnx2x/bnx2x-e1h-7.2.51.0.fw
+File: bnx2x/bnx2x-e1-7.8.2.0.fw
+File: bnx2x/bnx2x-e1h-7.8.2.0.fw
+File: bnx2x/bnx2x-e2-7.8.2.0.fw
+File: bnx2x/bnx2x-e1-7.8.17.0.fw
+File: bnx2x/bnx2x-e1h-7.8.17.0.fw
+File: bnx2x/bnx2x-e2-7.8.17.0.fw
+
+License:
+  Copyright (c) 2007-2011 Broadcom Corporation
+
+  This file contains firmware data derived from proprietary unpublished
+  source code, Copyright (c) 2007-2011 Broadcom Corporation.
+
+  Permission is hereby granted for the distribution of this firmware data
+  in hexadecimal or equivalent format, provided this copyright notice is
+  accompanying it.
+
+
+Found in hex form in kernel source.
+
+--------------------------------------------------------------------------
+
+Driver: bnx2 - Broadcom NetXtremeII
+
+File: bnx2/bnx2-mips-06-4.6.16.fw
+File: bnx2/bnx2-mips-06-5.0.0.j3.fw
+File: bnx2/bnx2-mips-06-5.0.0.j6.fw
+File: bnx2/bnx2-mips-06-6.0.15.fw
+File: bnx2/bnx2-mips-06-6.2.1.fw
+File: bnx2/bnx2-mips-06-6.2.3.fw
+File: bnx2/bnx2-mips-09-4.6.17.fw
+File: bnx2/bnx2-mips-09-5.0.0.j3.fw
+File: bnx2/bnx2-mips-09-5.0.0.j9.fw
+File: bnx2/bnx2-mips-09-5.0.0.j15.fw
+File: bnx2/bnx2-mips-09-6.0.17.fw
+File: bnx2/bnx2-mips-09-6.2.1.fw
+File: bnx2/bnx2-mips-09-6.2.1a.fw
+File: bnx2/bnx2-mips-09-6.2.1b.fw
+File: bnx2/bnx2-rv2p-06-4.6.16.fw
+File: bnx2/bnx2-rv2p-06-5.0.0.j3.fw
+File: bnx2/bnx2-rv2p-06-6.0.15.fw
+File: bnx2/bnx2-rv2p-09-4.6.15.fw
+File: bnx2/bnx2-rv2p-09-5.0.0.j3.fw
+File: bnx2/bnx2-rv2p-09-5.0.0.j10.fw
+File: bnx2/bnx2-rv2p-09-6.0.17.fw
+File: bnx2/bnx2-rv2p-09ax-5.0.0.j3.fw
+File: bnx2/bnx2-rv2p-09ax-5.0.0.j10.fw
+File: bnx2/bnx2-rv2p-09ax-6.0.17.fw
+
+Licence:
+
+ This file contains firmware data derived from proprietary unpublished
+ source code, Copyright (c) 2004 - 2010 Broadcom Corporation.
+
+ Permission is hereby granted for the distribution of this firmware data
+ in hexadecimal or equivalent format, provided this copyright notice is
+ accompanying it.
+
+Found in hex form in kernel source.
+
+--------------------------------------------------------------------------
+
+Driver: netxen_nic - NetXen Multi port (1/10) Gigabit Ethernet NIC
+
+File: phanfw.bin
+Version: 4.0.590
+
+Licence: Redistributable. See LICENCE.phanfw for details.
+
+Available from http://ldriver.qlogic.com/firmware/netxen_nic/new/
+
+--------------------------------------------------------------------------
+
+Driver: dvb-ttpci -- AV7110 cards
+
+File: av7110/bootcode.bin
+Source: av7110/Boot.S
+Source: av7110/Makefile
+
+Licence: GPLv2 or later
+
+ARM assembly source code from http://www.linuxtv.org/downloads/firmware/Boot.S
+
+--------------------------------------------------------------------------
+
+Driver: snd-wavefront - ISA WaveFront sound card
+
+File: yamaha/yss225_registers.bin
+
+Licence: Allegedly GPLv2+, but no source visible.
+
+Found in hex form in kernel source, with the following comment:
+   Copyright (c) 1998-2002 by Paul Davis <pbd@op.net>
+
+--------------------------------------------------------------------------
+
+Driver: rt61pci - Ralink RT2561, RT2561S, RT2661 wireless MACs
+
+File: rt2561.bin
+File: rt2561s.bin
+File: rt2661.bin
+
+Licence: Redistributable. See LICENCE.ralink-firmware.txt for details
+
+Downloaded from http://www.ralinktech.com/ralink/Home/Support/Linux.html
+
+--------------------------------------------------------------------------
+
+Driver: rt73usb - Ralink RT2571W, RT2671 wireless MACs
+
+File: rt73.bin
+
+Licence: Redistributable. See LICENCE.ralink-firmware.txt for details
+
+Downloaded from http://www.ralinktech.com/ralink/Home/Support/Linux.html
+
+--------------------------------------------------------------------------
+
+Driver: rt2800pci - Ralink RT2860, RT2890, RT3090, RT3290, RT5390 wireless MACs
+
+File: rt2860.bin
+File: rt3290.bin
+
+Licence: Redistributable. See LICENCE.ralink-firmware.txt for details
+
+Binary file supplied by Shiang Tu <shiang_tu@ralinktech.com>. Firmware Version 34
+rt3290.bin is a specific firmware support the RT3290 chip. Firmware Version 37
+
+--------------------------------------------------------------------------
+
+Driver: rt2860sta - Ralink RT3090 wireless MACs
+
+Link: rt3090.bin -> rt2860.bin
+
+Licence: Redistributable. See LICENCE.ralink-firmware.txt for details
+
+--------------------------------------------------------------------------
+
+Driver: rt2800usb - Ralink RT2870, RT3070, RT3071, RT3072, RT5370 wireless MACs
+
+File: rt2870.bin
+
+Licence: Redistributable. See LICENCE.ralink-firmware.txt for details
+
+Binary file supplied by Shiang Tu <shiang_tu@ralinktech.com>. Firmware Version 29
+
+--------------------------------------------------------------------------
+
+Driver: rt2870sta - Ralink RT2870, RT3070, RT3071 wireless MACs
+
+Link: rt3070.bin -> rt2870.bin
+File: rt3071.bin
+
+Licence: Redistributable. See LICENCE.ralink-firmware.txt for details
+
+rt3071.bin is a copy of bytes 4096-8191 of rt2870.bin for compatibility.
+
+--------------------------------------------------------------------------
+
+Driver: usbdux/usbduxfast/usbduxsigma - usbdux data acquisition cards
+
+File: usbdux_firmware.bin
+File: usbduxfast_firmware.bin
+File: usbduxsigma_firmware.bin
+Source: usbdux/fx2-include.asm
+Source: usbdux/usbduxfast_firmware.asm
+Source: usbdux/usbdux_firmware.asm
+Source: usbdux/usbduxsigma_firmware.asm
+
+Licence: GPLv2. See source code in usbdux/ subdirectory.
+
+Provided from the author, Bernd Porr <BerndPorr@f2s.com>
+
+--------------------------------------------------------------------------
+
+Driver: xc5000 - Xceive 5000 Tuner driver
+
+File: dvb-fe-xc5000-1.6.114.fw
+Version: 1.6.114
+
+Licence: Redistributable. See LICENCE.xc5000 for details
+
+--------------------------------------------------------------------------
+
+Driver: dib0700 - DiBcom dib0700 USB DVB bridge driver
+
+File: dvb-usb-dib0700-1.20.fw
+Version: 1.20
+
+Licence: Redistributable. See LICENCE.dib0700 for details
+
+--------------------------------------------------------------------------
+
+Driver: ath3k - DFU Driver for Atheros bluetooth chipset AR3011
+
+File: ath3k-1.fw
+Version: 1.0
+
+Fix EEPROM radio table issue and change PID to 3005
+
+Licence: Redistributable. See LICENCE.atheros_firmware for details
+
+--------------------------------------------------------------------------
+
+Driver: mga - Matrox G200/G400/G550
+
+File: matrox/g200_warp.fw
+File: matrox/g400_warp.fw
+
+Licence:
+
+Copyright 1999 Matrox Graphics Inc.
+All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the "Software"),
+to deal in the Software without restriction, including without limitation
+the rights to use, copy, modify, merge, publish, distribute, sublicense,
+and/or sell copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+MATROX GRAPHICS INC., OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM,
+DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
+OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Found in hex form in kernel source.
+
+--------------------------------------------------------------------------
+
+Driver: r128 - ATI Rage 128
+
+File: r128/r128_cce.bin
+
+Licence:
+
+Copyright 2000 Advanced Micro Devices, Inc.
+
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+
+Found in decimal form in kernel source.
+
+--------------------------------------------------------------------------
+
+Driver: radeon - ATI Radeon
+
+File: radeon/R100_cp.bin
+File: radeon/R200_cp.bin
+File: radeon/R300_cp.bin
+File: radeon/R420_cp.bin
+File: radeon/RS600_cp.bin
+File: radeon/RS690_cp.bin
+File: radeon/R520_cp.bin
+File: radeon/R600_pfp.bin
+File: radeon/R600_me.bin
+File: radeon/RV610_pfp.bin
+File: radeon/RV610_me.bin
+File: radeon/RV630_pfp.bin
+File: radeon/RV630_me.bin
+File: radeon/RV620_pfp.bin
+File: radeon/RV620_me.bin
+File: radeon/RV635_pfp.bin
+File: radeon/RV635_me.bin
+File: radeon/RV670_pfp.bin
+File: radeon/RV670_me.bin
+File: radeon/RS780_pfp.bin
+File: radeon/RS780_me.bin
+File: radeon/RV770_pfp.bin
+File: radeon/RV770_me.bin
+File: radeon/RV730_pfp.bin
+File: radeon/RV730_me.bin
+File: radeon/RV710_pfp.bin
+File: radeon/RV710_me.bin
+
+Licence:
+
+ * Copyright 2007-2009 Advanced Micro Devices, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Found in hex form in kernel source.
+
+--------------------------------------------------------------------------
+
+Driver: radeon - ATI Radeon
+
+File: radeon/R600_rlc.bin
+File: radeon/R700_rlc.bin
+File: radeon/RV710_uvd.bin
+File: radeon/RV710_smc.bin
+File: radeon/RV730_smc.bin
+File: radeon/RV740_smc.bin
+File: radeon/RV770_smc.bin
+File: radeon/CEDAR_me.bin
+File: radeon/CEDAR_pfp.bin
+File: radeon/CEDAR_rlc.bin
+File: radeon/CEDAR_smc.bin
+File: radeon/CYPRESS_me.bin
+File: radeon/CYPRESS_pfp.bin
+File: radeon/CYPRESS_rlc.bin
+File: radeon/CYPRESS_uvd.bin
+File: radeon/CYPRESS_smc.bin
+File: radeon/JUNIPER_me.bin
+File: radeon/JUNIPER_pfp.bin
+File: radeon/JUNIPER_rlc.bin
+File: radeon/JUNIPER_smc.bin
+File: radeon/REDWOOD_me.bin
+File: radeon/REDWOOD_pfp.bin
+File: radeon/REDWOOD_rlc.bin
+File: radeon/REDWOOD_smc.bin
+File: radeon/PALM_me.bin
+File: radeon/PALM_pfp.bin
+File: radeon/SUMO_rlc.bin
+File: radeon/SUMO_uvd.bin
+File: radeon/BARTS_mc.bin
+File: radeon/BARTS_me.bin
+File: radeon/BARTS_pfp.bin
+File: radeon/BARTS_smc.bin
+File: radeon/BTC_rlc.bin
+File: radeon/CAICOS_mc.bin
+File: radeon/CAICOS_me.bin
+File: radeon/CAICOS_pfp.bin
+File: radeon/CAICOS_smc.bin
+File: radeon/TURKS_mc.bin
+File: radeon/TURKS_me.bin
+File: radeon/TURKS_pfp.bin
+File: radeon/TURKS_smc.bin
+File: radeon/CAYMAN_mc.bin
+File: radeon/CAYMAN_me.bin
+File: radeon/CAYMAN_pfp.bin
+File: radeon/CAYMAN_rlc.bin
+File: radeon/CAYMAN_smc.bin
+File: radeon/SUMO_pfp.bin
+File: radeon/SUMO_me.bin
+File: radeon/SUMO2_pfp.bin
+File: radeon/SUMO2_me.bin
+File: radeon/ARUBA_me.bin
+File: radeon/ARUBA_pfp.bin
+File: radeon/ARUBA_rlc.bin
+File: radeon/PITCAIRN_ce.bin
+File: radeon/PITCAIRN_mc.bin
+File: radeon/PITCAIRN_me.bin
+File: radeon/PITCAIRN_pfp.bin
+File: radeon/PITCAIRN_rlc.bin
+File: radeon/PITCAIRN_smc.bin
+File: radeon/TAHITI_ce.bin
+File: radeon/TAHITI_mc.bin
+File: radeon/TAHITI_me.bin
+File: radeon/TAHITI_pfp.bin
+File: radeon/TAHITI_rlc.bin
+File: radeon/TAHITI_uvd.bin
+File: radeon/TAHITI_smc.bin
+File: radeon/VERDE_ce.bin
+File: radeon/VERDE_mc.bin
+File: radeon/VERDE_me.bin
+File: radeon/VERDE_pfp.bin
+File: radeon/VERDE_rlc.bin
+File: radeon/VERDE_smc.bin
+File: radeon/OLAND_ce.bin
+File: radeon/OLAND_mc.bin
+File: radeon/OLAND_me.bin
+File: radeon/OLAND_pfp.bin
+File: radeon/OLAND_rlc.bin
+File: radeon/OLAND_smc.bin
+File: radeon/HAINAN_ce.bin
+File: radeon/HAINAN_mc.bin
+File: radeon/HAINAN_me.bin
+File: radeon/HAINAN_pfp.bin
+File: radeon/HAINAN_rlc.bin
+File: radeon/HAINAN_smc.bin
+File: radeon/BONAIRE_ce.bin
+File: radeon/BONAIRE_mc.bin
+File: radeon/BONAIRE_me.bin
+File: radeon/BONAIRE_mec.bin
+File: radeon/BONAIRE_pfp.bin
+File: radeon/BONAIRE_rlc.bin
+File: radeon/BONAIRE_sdma.bin
+File: radeon/BONAIRE_uvd.bin
+File: radeon/BONAIRE_smc.bin
+File: radeon/KABINI_ce.bin
+File: radeon/KABINI_me.bin
+File: radeon/KABINI_mec.bin
+File: radeon/KABINI_pfp.bin
+File: radeon/KABINI_rlc.bin
+File: radeon/KABINI_sdma.bin
+File: radeon/KAVERI_ce.bin
+File: radeon/KAVERI_me.bin
+File: radeon/KAVERI_mec.bin
+File: radeon/KAVERI_pfp.bin
+File: radeon/KAVERI_rlc.bin
+File: radeon/KAVERI_sdma.bin
+
+Licence: Redistributable. See LICENSE.radeon for details.
+
+--------------------------------------------------------------------------
+
+Driver: s2255drv
+
+File: f2255usb.bin
+
+Licence:
+  Sensoray grants permission to use and redistribute these firmware
+  files for use with Sensoray devices, but not as a part of the Linux
+  kernel or in any other form which would require these files themselves
+  to be covered by the terms of the GNU General Public License.
+  These firmware files are distributed in the hope that they will be
+  useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+  of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+--------------------------------------------------------------------------
+
+Driver: rtl8192e - Realtek 8192 PCI wireless driver
+
+File: RTL8192E/*
+Licence: Redistributable, provided by Realtek in their driver
+         source download.
+
+--------------------------------------------------------------------------
+
+Driver: lgs8gxx - Legend Silicon GB20600 demodulator driver
+
+File: lgs8g75.fw
+
+Licence: Unknown
+
+--------------------------------------------------------------------------
+
+Driver: ib_qib - QLogic Infiniband
+
+File: qlogic/sd7220.fw
+
+Licence:
+
+ * Copyright (c) 2007, 2008 QLogic Corporation. All rights reserved.
+ *
+ * This software is available to you under a choice of one of two
+ * licenses.  You may choose to be licensed under the terms of the GNU
+ * General Public License (GPL) Version 2, available from the file
+ * COPYING in the main directory of this source tree, or the
+ * OpenIB.org BSD license below:
+ *
+ *     Redistribution and use in source and binary forms, with or
+ *     without modification, are permitted provided that the following
+ *     conditions are met:
+ *
+ *      - Redistributions of source code must retain the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer.
+ *
+ *      - Redistributions in binary form must reproduce the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer in the documentation and/or other materials
+ *        provided with the distribution.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+
+Found in hex form in kernel source.
+
+--------------------------------------------------------------------------
+
+Driver: ueagle-atm - Driver for USB ADSL Modems based on Eagle IV Chipset
+
+File: ueagle-atm/CMV4p.bin.v2
+File: ueagle-atm/DSP4p.bin
+File: ueagle-atm/eagleIV.fw
+Version: 1.0
+
+Licence: Redistributable. See LICENCE.ueagle-atm4-firmware for details
+
+--------------------------------------------------------------------------
+
+Driver: ueagle-atm - Driver for USB ADSL Modems based on Eagle I,II,III
+
+File: ueagle-atm/930-fpga.bin
+File: ueagle-atm/CMVeiWO.bin    
+File: ueagle-atm/CMVepFR10.bin  
+File: ueagle-atm/DSP9p.bin	
+File: ueagle-atm/eagleIII.fw
+File: ueagle-atm/adi930.fw     
+File: ueagle-atm/CMVep.bin      
+File: ueagle-atm/CMVepFR.bin    
+File: ueagle-atm/DSPei.bin
+File: ueagle-atm/CMV9i.bin     
+File: ueagle-atm/CMVepES03.bin  
+File: ueagle-atm/CMVepIT.bin    
+File: ueagle-atm/DSPep.bin
+File: ueagle-atm/CMV9p.bin     
+File: ueagle-atm/CMVepES.bin    
+File: ueagle-atm/CMVepWO.bin    
+File: ueagle-atm/eagleI.fw
+File: ueagle-atm/CMVei.bin     
+File: ueagle-atm/CMVepFR04.bin  
+File: ueagle-atm/DSP9i.bin	    
+File: ueagle-atm/eagleII.fw
+Version: 1.1
+
+Licence: Redistributable. Based on 
+         https://mail.gna.org/public/eagleusb-dev/2004-11/msg00172.html
+
+--------------------------------------------------------------------------
+
+Driver: vxge - Exar X3100 Series 10GbE PCIe I/O Virtualized Server Adapter
+
+File: vxge/X3fw.ncf
+File: vxge/X3fw-pxe.ncf
+Version: 1.8.1
+
+Licence:
+
+ This file contains firmware data derived from proprietary unpublished
+ source code, Copyright (c) 2010 Exar Corporation.
+
+ Permission is hereby granted for the distribution of this firmware data
+ in hexadecimal or equivalent format, provided this copyright notice is
+ accompanying it.
+
+--------------------------------------------------------------------------
+
+Driver: brcmsmac - Broadcom 802.11n softmac wireless LAN driver.
+
+File: brcm/bcm43xx-0.fw
+File: brcm/bcm43xx_hdr-0.fw
+Version: 610.812
+
+Licence: Redistributable. See LICENCE.broadcom_bcm43xx for details.
+
+--------------------------------------------------------------------------
+
+Driver: brcmfmac - Broadcom 802.11n fullmac wireless LAN driver.
+
+File: brcm/bcm4329-fullmac-4.bin
+File: brcm/brcmfmac43236b.bin
+File: brcm/brcmfmac4329-sdio.bin
+File: brcm/brcmfmac4330-sdio.bin
+File: brcm/brcmfmac4334-sdio.bin
+File: brcm/brcmfmac4335-sdio.bin
+File: brcm/brcmfmac43241b0-sdio.bin
+File: brcm/brcmfmac43241b4-sdio.bin
+
+Licence: Redistributable. See LICENCE.broadcom_bcm43xx for details.
+
+--------------------------------------------------------------------------
+
+Driver: tda7706 - FM radio Highly integrated tuner for AM/FM car-radio
+
+File: TDA7706_OM_v2.5.1_boot.txt
+File: TDA7706_OM_v3.0.2_boot.txt
+
+Licence: Redistributable. See LICENCE.tda7706-firmware.txt for details.
+        Copyright © 2010 STMicroelectronics
+
+--------------------------------------------------------------------------
+
+Driver: wl1251 - Texas Instruments 802.11 WLAN driver for WiLink4 chips
+
+File: ti-connectivity/wl1251-fw.bin
+Version: 4.0.4.3.7
+
+File: ti-connectivity/wl1251-nvs.bin
+
+Licence: See LICENCE.wl1251 for details.
+
+The published NVS files are for testing only.  Every device needs to
+have a unique NVS which is properly calibrated for best results.
+
+The driver expects to find the firmwares under a ti-connectivity subdirectory.
+So if your system looks for firmwares in /lib/firmware, the firmwares for
+wl12xx chips must be located in /lib/firmware/ti-connectivity/.
+
+--------------------------------------------------------------------------
+
+Driver: wl12xx - Texas Instruments 802.11 WLAN driver for WiLink6/7 chips
+
+File: ti-connectivity/wl1271-fw.bin
+Version: 6.1.0.50.350 (STA-only)
+File: ti-connectivity/wl1271-fw-2.bin
+Version: 6.1.5.50.74 (STA-only)
+File: ti-connectivity/wl1271-fw-ap.bin
+Version: 6.2.1.0.54 (AP-only)
+File: ti-connectivity/wl127x-fw-3.bin
+Version: 6.3.0.0.77
+File: ti-connectivity/wl127x-fw-plt-3.bin
+Version: 6.3.0.0.77 (PLT-only)
+File: ti-connectivity/wl127x-fw-4-sr.bin
+Version: 6.3.5.0.98 (Single-role)
+File: ti-connectivity/wl127x-fw-4-mr.bin
+Version: 6.5.2.0.15 (Multi-role)
+File: ti-connectivity/wl127x-fw-4-plt.bin
+Version: 6.3.5.0.98 (PLT-only)
+File: ti-connectivity/wl127x-fw-5-sr.bin
+Version: 6.3.10.0.133 (Single-role)
+File: ti-connectivity/wl127x-fw-5-mr.bin
+Version: 6.5.7.0.42 (Multi-role)
+File: ti-connectivity/wl127x-fw-5-plt.bin
+Version: 6.3.10.0.133 (PLT-only)
+
+File: ti-connectivity/wl128x-fw.bin
+Version: 7.1.5.50.74 (STA-only)
+File: ti-connectivity/wl128x-fw-ap.bin
+Version: 7.2.1.0.54 (AP-only)
+File: ti-connectivity/wl128x-fw-3.bin
+Version: 7.3.0.0.77
+File: ti-connectivity/wl128x-fw-plt-3.bin
+Version: 7.3.0.0.77
+File: ti-connectivity/wl128x-fw-4-sr.bin
+Version: 7.3.5.0.98 (Single-role)
+File: ti-connectivity/wl128x-fw-4-mr.bin
+Version: 7.5.2.0.15 (Multi-role)
+File: ti-connectivity/wl128x-fw-4-plt.bin
+Version: 7.3.5.0.98 (PLT)
+File: ti-connectivity/wl128x-fw-5-sr.bin
+Version: 7.3.10.0.133 (Single-role)
+File: ti-connectivity/wl128x-fw-5-mr.bin
+Version: 7.5.7.0.42 (Multi-role)
+File: ti-connectivity/wl128x-fw-5-plt.bin
+Version: 7.3.10.2.133 (PLT-only)
+
+File: ti-connectivity/wl127x-nvs.bin
+File: ti-connectivity/wl128x-nvs.bin
+Link: ti-connectivity/wl12xx-nvs.bin -> wl127x-nvs.bin
+Link: ti-connectivity/wl1271-nvs.bin -> wl127x-nvs.bin
+
+Licence: See LICENCE.ti-connectivity for details.
+
+The NVS file includes two parts:
+	 - radio calibration
+	 - HW configuration parameters (aka. INI values)
+
+The published NVS files are for testing only.  Every device needs to
+hava a unique NVS which is properly calibrated for best results.  You
+can find more information about NVS generation for your device here:
+
+http://wireless.kernel.org/en/users/Drivers/wl12xx/calibrator
+
+If you're using a wl127x based device, use a symbolic link called
+wl1271-nvs.bin that links to the wl127x-nvs.bin file.  If you are
+using wl128x, link to wl128x-nvs.bin instead.
+
+The driver expects to find the firmwares under a ti-connectivity
+subdirectory.  So if your system looks for firmwares in /lib/firmware,
+the firmwares for wl12xx chips must be located in
+/lib/firmware/ti-connectivity/.
+
+--------------------------------------------------------------------------
+
+Driver: wl18xx - Texas Instruments 802.11 WLAN driver for WiLink8 chips
+
+File: ti-connectivity/wl18xx-fw.bin
+Version: 8.2.0.0.100
+File: ti-connectivity/wl18xx-fw-2.bin
+Version: 8.5.0.0.55
+File: ti-connectivity/wl18xx-conf.bin
+Version: 6/5
+
+Licence: See LICENCE.ti-connectivity for details.
+
+The driver expects to find the firmwares under a ti-connectivity
+subdirectory.  So if your system looks for firmwares in /lib/firmware,
+the firmwares for wl18xx chips must be located in
+/lib/firmware/ti-connectivity/.
+
+--------------------------------------------------------------------------
+
+Driver: TI_ST - Texas Instruments bluetooth driver
+
+File: ti-connectivity/TIInit_7.2.31.bts
+
+Licence: See LICENCE.ti-connectivity for details.
+
+	TIInit_7.2.31.bts version 7.2.31
+
+	In order to use that file copy it to /lib/firmware/ti-connectivity.
+
+--------------------------------------------------------------------------
+
+Driver: tlg2300 - Telgent 2300 V4L/DVB driver.
+
+File: tlg2300_firmware.bin
+
+Licence:
+  Telegent System grants permission to use and redistribute these
+  firmware files for use with devices containing the chip tlg2300, but
+  not as a part of the Linux kernel or in any other form which would
+  require these files themselves to be covered by the terms of the GNU
+  General Public License. These firmware files are distributed in the
+  hope that they will be useful, but WITHOUT ANY WARRANTY; without even
+  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+  PURPOSE.
+
+--------------------------------------------------------------------------
+
+Driver: r8712u - Realtek 802.11n WLAN driver for RTL8712U
+
+File: rtlwifi/rtl8712u.bin
+Info: From Vendor's rtl8712_8188_8191_8192SU_usb_linux_v7_0.20100831
+      Reverted rtl8188C_8192C_8192D_usb_linux_v3.4.2_3727.20120404
+
+Licence: Redistributable. See LICENCE.rtlwifi_firmware.txt for details.
+
+--------------------------------------------------------------------------
+
+Driver: rtl8192ce - Realtek 802.11n WLAN driver for RTL8192CE
+
+File: rtlwifi/rtl8192cfw.bin
+File: rtlwifi/rtl8192cfwU.bin
+File: rtlwifi/rtl8192cfwU_B.bin
+
+Licence: Redistributable. See LICENCE.rtlwifi_firmware.txt for details.
+
+--------------------------------------------------------------------------
+
+Driver: rtl8192cu - Realtek 802.11n WLAN driver for RTL8192CU
+
+File: rtlwifi/rtl8192cufw.bin
+FILE: rtlwifi/rtl8192cufw_A.bin
+FILE: rtlwifi/rtl8192cufw_B.bin
+FILE: rtlwifi/rtl8192cufw_TMSC.bin
+
+Licence: Redistributable. See LICENCE.rtlwifi_firmware.txt for details.
+
+--------------------------------------------------------------------------
+
+Driver: rtl8192se - Realtek 802.11n WLAN driver for RTL8192SE
+
+Info: updated from rtl_92ce_92se_92de_linux_mac80211_0004.0816.2011 driver version
+File: rtlwifi/rtl8192sefw.bin
+
+Licence: Redistributable. See LICENCE.rtlwifi_firmware.txt for details.
+
+--------------------------------------------------------------------------
+
+Driver: rtl8192de - Realtek 802.11n WLAN driver for RTL8192DE
+
+Info: updated from Realtek version rtl_92ce_92se_92de_linux_mac80211_0004.0816.2011
+File: rtlwifi/rtl8192defw.bin
+
+Licence: Redistributable. See LICENCE.rtlwifi_firmware.txt for details.
+
+--------------------------------------------------------------------------
+
+Driver: rtl8723e - Realtek 802.11n WLAN driver for RTL8723E
+
+Info: Taken from Realtek version rtl_92ce_92se_92de_8723ae_linux_mac80211_0007.0809.2012
+File: rtlwifi/rtl8723fw.bin
+File: rtlwifi/rtl8723fw_B.bin
+
+Licence: Redistributable. See LICENCE.rtlwifi_firmware.txt for details.
+
+--------------------------------------------------------------------------
+
+Driver: rtl8188ee - Realtek 802.11n WLAN driver for RTL8188EE
+
+Info: Taken from Realtek version rtl_92ce_92se_92de_8723ae_88ee_linux_mac80211_0010.0109.2013
+File: rtlwifi/rtl8188efw.bin
+
+Licence: Redistributable. See LICENCE.rtlwifi_firmware.txt for details.
+
+--------------------------------------------------------------------------
+
+Driver: rtl8188eu - Realtek 802.11n WLAN driver for RTL8188EU
+
+Info: Taken from Realtek version RTL8188EUS_linux_v4.1.4_6773.20130222
+File: rtlwifi/rtl8188eufw.bin
+
+Licence: Redistributable. See LICENCE.rtlwifi_firmware.txt for details.
+
+--------------------------------------------------------------------------
+
+Driver: r8169 - RealTek 8169/8168/8101 ethernet driver.
+
+File: rtl_nic/rtl8168d-1.fw
+File: rtl_nic/rtl8168d-2.fw
+File: rtl_nic/rtl8105e-1.fw
+File: rtl_nic/rtl8168e-1.fw
+File: rtl_nic/rtl8168e-2.fw
+
+File: rtl_nic/rtl8168e-3.fw
+Version: 0.0.4
+
+File: rtl_nic/rtl8168f-1.fw
+Version: 0.0.5
+
+File: rtl_nic/rtl8168f-2.fw
+Version: 0.0.4
+
+File: rtl_nic/rtl8411-1.fw
+Version: 0.0.3
+
+File: rtl_nic/rtl8411-2.fw
+Version: 0.0.1
+
+File: rtl_nic/rtl8402-1.fw
+Version: 0.0.1
+
+File: rtl_nic/rtl8106e-1.fw
+Version: 0.0.1
+
+File: rtl_nic/rtl8106e-2.fw
+Version: 0.0.1
+
+File: rtl_nic/rtl8168g-1.fw
+Version: 0.0.3
+
+File: rtl_nic/rtl8168g-2.fw
+Version: 0.0.1
+
+File: rtl_nic/rtl8168g-3.fw
+Version: 0.0.1
+
+Licence:
+ * Copyright © 2011-2013, Realtek Semiconductor Corporation
+ *
+ * Permission is hereby granted for the distribution of this firmware
+ * data in hexadecimal or equivalent format, provided this copyright
+ * notice is accompanying it.
+
+--------------------------------------------------------------------------
+
+Driver: vt6656 - VIA VT6656 USB wireless driver
+
+File: vntwusb.fw
+
+Licence: Redistributable. See LICENCE.via_vt6656 for details.
+
+--------------------------------------------------------------------------
+
+Driver: DFU Driver for Atheros bluetooth chipset AR3012
+
+File: ar3k/AthrBT_0x01020001.dfu
+File: ar3k/ramps_0x01020001_26.dfu
+File: ar3k/AthrBT_0x01020200.dfu
+File: ar3k/ramps_0x01020200_26.dfu
+File: ar3k/ramps_0x01020200_40.dfu
+File: ar3k/AthrBT_0x31010000.dfu
+File: ar3k/ramps_0x31010000_40.dfu
+File: ar3k/AthrBT_0x11020000.dfu
+File: ar3k/ramps_0x11020000_40.dfu
+File: ar3k/AthrBT_0x01020201.dfu
+File: ar3k/ramps_0x01020201_26.dfu
+File: ar3k/ramps_0x01020201_40.dfu
+File: ar3k/AthrBT_0x41020000.dfu
+File: ar3k/ramps_0x41020000_40.dfu
+
+Licence: Redistributable. See LICENCE.atheros_firmware for details
+
+--------------------------------------------------------------------------
+
+Driver:Atheros AR300x UART HCI Bluetooth Chip driver
+
+File: ar3k/1020201/PS_ASIC.pst
+File: ar3k/1020201/RamPatch.txt
+File: ar3k/1020200/ar3kbdaddr.pst
+File: ar3k/1020200/PS_ASIC.pst
+File: ar3k/1020200/RamPatch.txt
+File: ar3k/30101/ar3kbdaddr.pst
+File: ar3k/30101/PS_ASIC.pst
+File: ar3k/30101/RamPatch.txt
+File: ar3k/30000/ar3kbdaddr.pst
+File: ar3k/30000/PS_ASIC.pst
+File: ar3k/30000/RamPatch.txt
+
+Licence: Redistributable. See LICENCE.atheros_firmware for details
+
+--------------------------------------------------------------------------
+
+Driver: ath6kl - Atheros support for AR6003
+
+File: ath6k/AR6004/hw1.3/fw-3.bin
+File: ath6k/AR6004/hw1.3/bdata.bin
+File: ath6k/AR6004/hw1.2/fw-2.bin
+File: ath6k/AR6004/hw1.2/bdata.bin
+File: ath6k/AR6003/hw1.0/otp.bin.z77
+File: ath6k/AR6003/hw1.0/bdata.SD31.bin
+File: ath6k/AR6003/hw1.0/bdata.SD32.bin
+File: ath6k/AR6003/hw1.0/data.patch.bin
+File: ath6k/AR6003/hw1.0/bdata.WB31.bin
+File: ath6k/AR6003/hw1.0/athwlan.bin.z77
+File: ath6k/AR6003/hw2.1.1/fw-2.bin
+File: ath6k/AR6003/hw2.1.1/fw-3.bin
+File: ath6k/AR6003/hw2.1.1/otp.bin
+File: ath6k/AR6003/hw2.1.1/athwlan.bin
+File: ath6k/AR6003/hw2.1.1/endpointping.bin
+File: ath6k/AR6003/hw2.1.1/bdata.SD31.bin
+File: ath6k/AR6003/hw2.1.1/bdata.SD32.bin
+File: ath6k/AR6003/hw2.1.1/data.patch.bin
+File: ath6k/AR6003/hw2.1.1/bdata.WB31.bin
+File: ath6k/AR6003/hw2.0/otp.bin.z77
+File: ath6k/AR6003/hw2.0/bdata.SD31.bin
+File: ath6k/AR6003/hw2.0/bdata.SD32.bin
+File: ath6k/AR6003/hw2.0/data.patch.bin
+File: ath6k/AR6003/hw2.0/bdata.WB31.bin
+File: ath6k/AR6003/hw2.0/athwlan.bin.z77
+File: ath6k/AR6002/eeprom.data
+File: ath6k/AR6002/eeprom.bin
+File: ath6k/AR6002/athwlan.bin.z77
+File: ath6k/AR6002/data.patch.hw2_0.bin
+
+Licence: Redistributable. See LICENCE.atheros_firmware for details
+
+--------------------------------------------------------------------------
+
+Driver: myri10ge - Myri10GE 10GbE NIC driver
+
+File: myri10ge_eth_z8e.dat
+File: myri10ge_ethp_z8e.dat
+File: myri10ge_rss_eth_z8e.dat
+File: myri10ge_rss_ethp_z8e.dat
+Version: 1.4.52
+
+License: Redistributable.  See LICENCE.myri10ge_firmware for details.
+
+--------------------------------------------------------------------------
+
+Driver: ath6kl - Atheros support for AR6003 WiFi-Bluetooth combo module
+
+File: ath6k/AR6003.1/hw2.1.1/athwlan.bin
+File: ath6k/AR6003.1/hw2.1.1/bdata.SD31.bin
+File: ath6k/AR6003.1/hw2.1.1/bdata.SD32.bin
+File: ath6k/AR6003.1/hw2.1.1/bdata.WB31.bin
+File: ath6k/AR6003.1/hw2.1.1/data.patch.bin
+File: ath6k/AR6003.1/hw2.1.1/endpointping.bin
+File: ath6k/AR6003.1/hw2.1.1/otp.bin
+
+License: Redistributable. See LICENCE.atheros_firmware for details
+
+--------------------------------------------------------------------------
+
+Driver: ath6kl - Atheros support for AR3001 WiFi-Bluetooth combo module
+
+File: ar3k/30101coex/ar3kbdaddr.pst
+File: ar3k/30101coex/PS_ASIC_aclLowPri.pst
+File: ar3k/30101coex/PS_ASIC_aclHighPri.pst
+File: ar3k/30101coex/PS_ASIC.pst
+File: ar3k/30101coex/RamPatch.txt
+
+License: Redistributable. See LICENCE.atheros_firmware for details
+
+--------------------------------------------------------------------------
+
+Driver: drxk - Micronas DRX-K demodulator driver
+
+File: dvb-usb-terratec-h5-drxk.fw
+
+Licence:
+TERRATEC grants permission to use and redistribute these firmware
+files for use with TERRATEC devices, but not as part of the Linux
+kernel or in any other form which would require these files themselves
+to be covered by the terms of the GNU General Public License.
+
+These firmware files are distributed in the hope that they will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+--------------------------------------------------------------------------
+
+Driver: ene-ub6250 -- ENE UB6250 SD card reader driver
+
+File: ene-ub6250/sd_init1.bin
+File: ene-ub6250/sd_init2.bin
+File: ene-ub6250/sd_rdwr.bin
+File: ene-ub6250/ms_init.bin
+File: ene-ub6250/msp_rdwr.bin
+File: ene-ub6250/ms_rdwr.bin
+
+Licence: Redistributable. See LICENCE.ene_firmware for details.
+
+--------------------------------------------------------------------------
+
+Driver: isci -- Intel C600 SAS controller driver
+
+File: isci/isci_firmware.bin
+Source: isci/create_fw.c
+Source: isci/create_fw.h
+Source: isci/probe_roms.h
+Source: isci/Makefile
+
+Licence: GPLv2
+
+--------------------------------------------------------------------------
+
+Driver: ar5523 -- Atheros AR5523 based USB Wifi dongles
+
+File: ar5523.bin
+
+Licence: Redistributable. See LICENCE.atheros_firmware for details
+
+--------------------------------------------------------------------------
+
+Driver: s5p-mfc - Samsung MFC video encoder/decoder driver
+
+File: s5p-mfc/s5p-mfc.fw
+File: s5p-mfc/s5p-mfc-v6.fw
+
+Licence:
+Samsung grants permission to use and redistribute these firmware
+files for use with Exynos series devices, but not as part of the Linux
+kernel or in any other form which would require these files themselves
+to be covered by the terms of the GNU General Public License.
+
+These firmware files are distributed in the hope that they will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+--------------------------------------------------------------------------
+
+Driver: carl9170 -- Atheros AR9170 802.11 draft-n USB driver
+
+File: carl9170-1.fw
+Version: 1.9.6
+Source: carl9170fw/
+
+Downloaded from http://linuxwireless.org/en/users/Drivers/carl9170
+
+Licence: GPLv2. Some build scripts use the New BSD (3-clause) licence.
+
+--------------------------------------------------------------------------
+
+Driver: snd-hda-codec-ca0132 - Creative Sound Core3D codec
+
+File: ctefx.bin
+File: ctspeq.bin
+
+Licence: Redistributable. See LICENCE.ca0132 for details
+
+Found also in alsa-firmware package.
+
+--------------------------------------------------------------------------
+
+Driver: btusb - Bluetooth USB driver
+
+File: intel/ibt-hw-37.7.bseq
+Version: 1316.02.00
+File: intel/ibt-hw-37.7.10-fw-1.80.2.3.d.bseq
+Version: 1334.02.2E
+File: intel/ibt-hw-37.7.10-fw-1.0.2.3.d.bseq
+Version: 1334.02.2E
+
+Licence: Redistributable. See LICENCE.ibt_firmware for details
+
+--------------------------------------------------------------------------
+
+Driver: btmtk_usb - Bluetooth USB driver
+
+File: mt7650.bin
+
+Licence: Redistributable. See LICENCE.ralink_a_mediatek_company_firmware for details
+
+--------------------------------------------------------------------------
+
+Driver: rp2 -- Comtrol RocketPort 2 serial driver
+
+File: rp2.fw
+
+Licence:
+Copyright (C) 2013 Comtrol Corporation
+
+Comtrol grants permission to use and redistribute these firmware
+files for use with Comtrol devices, but not as part of the Linux
+kernel or in any other form which would require these files themselves
+to be covered by the terms of the GNU General Public License.
+
+These firmware files are distributed in the hope that they will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+--------------------------------------------------------------------------
+
+Driver: go7007
+
+File: go7007/s2250-1.fw
+File: go7007/s2250-2.fw
+Link: s2250.fw -> go7007/s2250-2.fw
+Link: s2250_loader.fw -> go7007/s2250-1.fw
+
+Licence:
+  Sensoray grants permission to use and redistribute these firmware
+  files for use with Sensoray devices, but not as a part of the Linux
+  kernel or in any other form which would require these files themselves
+  to be covered by the terms of the GNU General Public License.
+  These firmware files are distributed in the hope that they will be
+  useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+  of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+File: go7007/go7007fw.bin
+File: go7007/go7007tv.bin
+File: go7007/lr192.fw
+File: go7007/px-m402u.fw
+File: go7007/px-tv402u.fw
+File: go7007/wis-startrek.fw
+
+Licence: Redistributable. See LICENCE.go7007_firmware for details
+
+--------------------------------------------------------------------------
+
+Driver: microcode_amd - AMD CPU Microcode Update Driver for Linux
+
+File: amd-ucode/microcode_amd.bin
+Version: 2013-07-10
+File: amd-ucode/microcode_amd_fam15h.bin
+Version: 2013-07-10
+
+License: Redistributable. See LICENSE.amd-ucode for details
+
+--------------------------------------------------------------------------
+
+Driver: mxuport - MOXA UPort USB Serial hub driver
+
+File: moxa/moxa-1250.fw
+File: moxa/moxa-1251.fw
+File: moxa/moxa-1410.fw
+File: moxa/moxa-1450.fw
+File: moxa/moxa-1451.fw
+File: moxa/moxa-1613.fw
+File: moxa/moxa-1618.fw
+File: moxa/moxa-1653.fw
+File: moxa/moxa-1658.fw
+
+License:
+The software accompanying this license statement (the “Software”)
+is the property of Moxa Inc. (the “Moxa”), and is protected by
+United States and International Copyright Laws and International
+treaty provisions. No ownership rights are granted by this
+Agreement or possession of the Software. Therefore, you must treat
+the Licensed Software like any other copyrighted material. Your
+rights and obligations in its use are described as follows:
+
+1. You may freely redistribute this software under this license.
+2. You may freely download and use this software on Moxa's device.
+3. You may not modify or attempt to reverse engineer the software, or
+   make any attempt to change or even examine the source code of the
+   software.
+4. You may not re-license or sub-license the software to any person or
+   business, using any other license.
+5. Moxa(r) is worldwide registered trademark.
+
+--------------------------------------------------------------------------
+
+Driver: cw1200 - ST-E CW1100/CW1200 WLAN driver
+
+File: sdd_sagrad_1091_1098.bin
+
+License:
+  Copyright (c) 2011-2013 Sagrad, Inc.
+
+  This SDD ("Static Dynamic Data") file is licensed strictly for use with
+  the Sagrad WiFi modules (such as the SG901-1091/1098) that utilize the
+  cw1200 driver. There is no warranty expressed or implied about its 
+  fitness for any purpose.
+
+  Permission is hereby granted for the distribution of this SDD file as
+  part of Linux or other Open Source operating system kernel in text or
+  binary form as required.
+
+  (Please note that the actual device firmware is separately licensed by 
+   ST-E, who has not provided explicit permission for general redistibution)
+
+--------------------------------------------------------------------------
+
+Driver: BFA/BNA - Brocade Adapter FC/FCOE drivers
+
+File: cbfw-3.2.1.1.bin
+FIle: ctfw-3.2.1.1.bin
+FIle: ct2fw-3.2.1.1.bin
+
+Licence:
+
+This file contains firmware data derived from proprietary unpublished
+source code, Copyright (c) 2013 Brocade Communications Systems, Inc.
+
+Permission is hereby granted for the distribution of this firmware data
+in hexadecimal or equivalent format, provided this copyright notice is
+accompanying it.
+
+Found in hex form in kernel source.
+
+Brocade grants permission to use and redistribute these firmware files
+for use with Brocade devices, but not as a part of the Linux
+kernel or in any other form which would require these files themselves
+to be covered by the terms of the GNU General Public License.
+These firmware files are distributed in the hope that they will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+--------------------------------------------------------------------------
+
diff --git a/acenic/tg1.bin b/acenic/tg1.bin
new file mode 100644
index 0000000..6a714fa
--- /dev/null
+++ b/acenic/tg1.bin
Binary files differ
diff --git a/acenic/tg2.bin b/acenic/tg2.bin
new file mode 100644
index 0000000..689981e
--- /dev/null
+++ b/acenic/tg2.bin
Binary files differ
diff --git a/adaptec/starfire_rx.bin b/adaptec/starfire_rx.bin
new file mode 100644
index 0000000..5abd88f
--- /dev/null
+++ b/adaptec/starfire_rx.bin
Binary files differ
diff --git a/adaptec/starfire_tx.bin b/adaptec/starfire_tx.bin
new file mode 100644
index 0000000..5abd88f
--- /dev/null
+++ b/adaptec/starfire_tx.bin
Binary files differ
diff --git a/advansys/3550.bin b/advansys/3550.bin
new file mode 100644
index 0000000..5a4581c
--- /dev/null
+++ b/advansys/3550.bin
Binary files differ
diff --git a/advansys/38C0800.bin b/advansys/38C0800.bin
new file mode 100644
index 0000000..2b222cd
--- /dev/null
+++ b/advansys/38C0800.bin
Binary files differ
diff --git a/advansys/38C1600.bin b/advansys/38C1600.bin
new file mode 100644
index 0000000..db568df
--- /dev/null
+++ b/advansys/38C1600.bin
Binary files differ
diff --git a/advansys/mcode.bin b/advansys/mcode.bin
new file mode 100644
index 0000000..c126509
--- /dev/null
+++ b/advansys/mcode.bin
Binary files differ
diff --git a/agere_ap_fw.bin b/agere_ap_fw.bin
new file mode 100644
index 0000000..8375c94
--- /dev/null
+++ b/agere_ap_fw.bin
Binary files differ
diff --git a/agere_sta_fw.bin b/agere_sta_fw.bin
new file mode 100644
index 0000000..bae000f
--- /dev/null
+++ b/agere_sta_fw.bin
Binary files differ
diff --git a/amd-ucode/microcode_amd.bin b/amd-ucode/microcode_amd.bin
new file mode 100644
index 0000000..23c9dd3
--- /dev/null
+++ b/amd-ucode/microcode_amd.bin
Binary files differ
diff --git a/amd-ucode/microcode_amd.bin.asc b/amd-ucode/microcode_amd.bin.asc
new file mode 100644
index 0000000..e8048b1
--- /dev/null
+++ b/amd-ucode/microcode_amd.bin.asc
@@ -0,0 +1,11 @@
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v1.4.11 (GNU/Linux)
+
+iQEcBAABAgAGBQJR3dkLAAoJEKXo28mMAQi0/9cIAKraXlbchZkkIPzyMrZBZZJe
+zapMterpLdDYL6zukfqgF7Frg94+ilGPK9yKAFsvC+EJyHrF5lbRQ/JthANdRv+Y
+8sBKz5/knVI72WdjSjg+473I1rFdIUK+YN7Ygp6eAwP3fg/IQ9UD9iQfWKbbUnx0
+WSEMCZm/izsyU2LQMJvtizJ2gz9ktFoALUtTvj0bv34CKr++qqngEVFy/WKQdR6x
+R3l5MjFAhvzO0O9gV59s1tXbPU56HRhMbvSBn3NIVZu17pwAFySHwQLAeW10GH0j
+UfgpKQppbz90iLLaSh8vseTOoTBn5SegDtK0JEJNMOuK1VoZ+kgv0cqGCs17HBQ=
+=FnHv
+-----END PGP SIGNATURE-----
diff --git a/amd-ucode/microcode_amd_fam15h.bin b/amd-ucode/microcode_amd_fam15h.bin
new file mode 100644
index 0000000..08a2f7c
--- /dev/null
+++ b/amd-ucode/microcode_amd_fam15h.bin
Binary files differ
diff --git a/amd-ucode/microcode_amd_fam15h.bin.asc b/amd-ucode/microcode_amd_fam15h.bin.asc
new file mode 100644
index 0000000..6125d0d
--- /dev/null
+++ b/amd-ucode/microcode_amd_fam15h.bin.asc
@@ -0,0 +1,11 @@
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v1.4.11 (GNU/Linux)
+
+iQEcBAABAgAGBQJR3dkfAAoJEKXo28mMAQi0iTsIAJ5nCgz/+jFYag2W/OH+kOQe
+BDXYSC5diXQR5wF/HUkXWh0sl+jNK/OrRVxT7sFaEgAUhEXhK6Df/h7qnJAYQGFr
+5+CKhfSr/0Qbk1ziWYAXVKMOXbuLWSSIov1SCcwLsps7A7puITK6xDemLby7KDGC
+xCUfKIM/BO6DyFpNhKQ+xJdDi+yVxUKQhbdk/8gY94VdUnVZq3CTK9UStpBuaXu0
+qJNfhbaU+OzgZmnmLq5+xGsCML1xfbgF6sexVRx7oT/Jv30tm97YQJWR0h4DU7jU
+zjID8kGtYRVV7+i8jC+jVpFo21yDVUkHUcqtNXXRB/lbOYFAm+UJviAEc4NEdSw=
+=JaWY
+-----END PGP SIGNATURE-----
diff --git a/ar3k/1020200/PS_ASIC.pst b/ar3k/1020200/PS_ASIC.pst
new file mode 100644
index 0000000..85b2efb
--- /dev/null
+++ b/ar3k/1020200/PS_ASIC.pst
@@ -0,0 +1,133 @@
+

+// Radio table TAG 

+#

+[H:S]012C

+[H:S]00EE

+[H:A]B1 B1 12 00 B0 08 FE FE 7E 00 19 00 00 20 02 00 

+     0C 09 00 14 00 00 8C 08 00 00 00 40 80 08 78 00 

+     00 01 84 08 AD AC 80 5F 88 08 20 3F 00 41 8C 08 

+     00 00 00 40 94 08 54 25 64 92 98 08 C8 4E 2C 2E 

+     9C 08 C0 20 DA 2C C0 08 B6 0D 01 00 C4 08 6C DB 

+     B6 6D C8 08 DB 36 D3 6D CC 08 60 DB B6 6D 00 09 

+     50 00 92 04 04 09 20 49 00 80 08 09 E0 6F 5B E5 

+     0C 09 00 14 00 00 10 09 81 03 30 F0 14 09 80 80 

+     43 00 18 09 00 00 00 80 1C 09 00 00 00 00 20 09 

+     02 00 00 00 80 0A 3F 00 04 00 84 0A 60 27 76 20 

+     88 0A 00 60 04 58 60 00 00 60 02 00 04 07 C4 C1 

+     8B 00 1C 00 00 05 90 01 0C 07 00 0D 00 00 30 00 

+     D8 70 EF 4A 7C 00 B0 D2 5A B1 78 00 DE 7A 58 00 

+     5C 00 01 00 14 01 44 00 00 00 10 E4 84 00 3F F0 

+     E7 04 C0 00 90 01 2C 00 DC 00 D8 40 06 00 

+// Radio table TAG 

+#

+[H:S]012D

+[H:S]00F0

+[H:A]88 00 52 6B 3D 0E 94 00 41 06 00 00 80 00 20 9C 

+     C8 00 90 00 DD DD 97 06 54 00 E0 A6 09 00 10 07 

+     3D A0 00 3D 14 07 A0 80 01 00 18 07 17 55 D1 0C 

+     1C 07 6D 23 00 00 C0 07 65 A8 0C 0B E4 07 27 CA 

+     54 00 C4 07 FF FF FF 3F C8 07 FF FF E3 3F CC 07 

+     FF FF FF 3F D0 07 FF FF FF 3F D4 07 3F FE FF 3F 

+     D8 07 FF FF FF 3F DC 07 FF FF FF 38 E0 07 FF FF 

+     FF 3F BC 07 D8 05 00 00 B8 07 42 00 0B 00 00 05 

+     4A 1C 00 00 04 05 8A 1C 00 00 08 05 CA 1C 00 00 

+     0C 05 0A 1D 00 00 10 05 4A 1D 00 00 14 05 1A 1C 

+     00 00 18 05 5A 1C 00 00 1C 05 9A 1C 00 00 20 05 

+     DA 1C 00 00 24 05 1A 1D 00 00 28 05 5A 1D 00 00 

+     2C 05 2A 1C 00 00 30 05 6A 1C 00 00 34 05 AA 1C 

+     00 00 38 05 EA 1C 00 00 3C 05 2A 1D 00 00 40 05 

+     6A 1D 00 00 44 05 3A 1C 00 00 48 05 2B 1C 00 00 

+

+// Radio table TAG 

+#

+[H:S]012E

+[H:S]00F0

+[H:A]4C 05 6B 1C 00 00 50 05 AB 1C 00 00 54 05 EB 1C 

+     00 00 58 05 2B 1D 00 00 5C 05 5C 1D 00 00 60 05 

+     2C 1C 00 00 64 05 6C 1C 00 00 68 05 AC 1C 00 00 

+     6C 05 1D 1D 00 00 70 05 2D 1C 00 00 74 05 6D 1C 

+     00 00 78 05 AD 1C 00 00 7C 05 CF 1C 00 00 80 05 

+     0F 1D 00 00 84 05 4F 1D 00 00 88 05 8F 1D 00 00 

+     8C 05 6E 1C 00 00 90 05 AE 1C 00 00 94 05 EE 1C 

+     00 00 98 05 2E 1D 00 00 9C 05 6E 1D 00 00 A0 05 

+     3E 1C 00 00 A4 05 7E 1C 00 00 A8 05 BE 1C 00 00 

+     AC 05 2F 1C 00 00 B0 05 6F 1C 00 00 B4 05 AF 1C 

+     00 00 B8 05 EF 1C 00 00 BC 05 2F 1D 00 00 C0 05 

+     6F 1D 00 00 C4 05 AF 1D 00 00 C8 05 BF 00 00 00 

+     CC 05 FF 1C 00 00 D0 05 3F 01 00 00 D4 05 7F 01 

+     00 00 D8 05 BF 01 00 00 DC 05 FF 01 00 00 E0 05 

+     3F 02 00 00 E4 05 7F 12 00 00 E8 05 BF 02 00 00 

+

+// Radio table TAG 

+#

+[H:S]012F

+[H:S]004A

+[H:A]EC 05 FF 02 00 00 F0 05 3F 03 00 00 F4 05 7F 03 

+     00 00 F8 05 BF 03 00 00 FC 05 FF 03 00 00 04 00 

+     00 00 02 00 10 00 01 CE C0 10 14 00 07 04 00 00 

+     A0 04 00 E9 FF 03 BC 04 FF 41 00 00 01 00 00 C0 

+     02 00 B8 01 01 00 00 00 B2 B2 

+// System config TAG 

+#

+[H:S]0013

+[H:S]00F0

+[H:A]C1 C1 20 02 AD 08 FE FE B4 00 00 CC B1 01 20 00 

+     FF CC 02 CC 04 00 B6 FB A9 90 00 21 00 E0 FF CC 

+     08 CC 1E 00 80 84 00 07 DB 05 93 11 FF CC 0E CC 

+     08 00 EC FF A0 06 00 00 2F FD C1 06 04 00 6D FD 

+     F0 FF 20 07 04 00 50 FD 21 26 04 00 6F FD F4 FF 

+     00 47 04 00 3A FD 80 67 04 00 89 FD F8 FF E0 A6 

+     04 00 12 FD A0 87 08 00 58 FD FC FF C0 A6 08 00 

+     66 FD 60 07 09 00 0B FD 00 00 C0 26 09 00 1D FD 

+     60 27 0D 00 0C FD 04 00 00 E7 10 00 09 FD 00 E7 

+     10 00 09 FD 08 00 60 E6 14 00 58 FD 60 E6 14 00 

+     58 FD FF CC 0F CC 01 01 01 01 07 04 03 33 00 0A 

+     00 04 00 00 60 6D F0 00 66 01 00 00 00 00 00 00 

+     FF CC 10 CC 22 81 A0 0F A0 00 32 00 02 08 0A 64 

+     20 20 0A FF 20 20 FF CC 11 CC 01 01 FF CC 12 CC 

+     09 01 FF 03 00 FF FF 03 FF CC 13 CC 02 01 B8 0B 

+// System config TAG 

+#

+[H:S]0014

+[H:S]0084

+     17 0F E0 FD E0 FD E0 FD E0 FD 58 FD 14 FD 58 FD 

+     14 FD 54 25 11 A0 92 24 00 00 00 00 00 00 00 00 

+     00 00 00 00 02 64 04 02 03 FF 04 03 FF CC 1A CC 

+     04 02 04 00 00 E7 10 00 2A FD 08 00 60 E6 14 00 

+     2A FD FF CC 18 CC 00 00 05 05 14 0A FF CC 17 CC 

+     20 01 FF CC 16 CC 07 00 C9 B0 B4 00 FF CC 14 CC 

+     01 01 FF CC 15 CC 01 00 08 00 FF CC 1D CC 01 00 

+     00 00 00 00 18 00 3C 3C 13 00 69 8C 00 00 A0 E6 

+     FF CC C2 C2 

+// Coex Configuration

+#

+[H:S]0017

+[H:S]0026

+[H:A]d1 d1 20 00 02 01 02 09 0c 00 24 1f 12 00 00 01 

+     00 01 00 00 01 01 01 01 01 00 00 00 01 00 01 01

+     01 01 01 00 d2 d2

+//Bdaddr

+#

+[H:S]0001

+[H:S]0006

+[H:A]77 55 42 7f 03 00

+//Audio

+#

+[H:S]0042

+[H:S]0004

+[H:A]23 08 01 33

+//Audio

+#

+[H:S]0044

+[H:S]0004

+[H:A]dd e5 2e 00

+//Audio

+#

+[H:S]0046

+[H:S]0004

+[H:A]12 00 00 00

+//Audio

+#

+[H:S]0045

+[H:S]0004

+[H:A]00 00 a7 02
\ No newline at end of file
diff --git a/ar3k/1020200/RamPatch.txt b/ar3k/1020200/RamPatch.txt
new file mode 100644
index 0000000..21afed3
--- /dev/null
+++ b/ar3k/1020200/RamPatch.txt
@@ -0,0 +1,3 @@
+DA:00594400

+65f5

+005c99000000000000000000e84759007c785800405c9900e447590000aa59007460580040505900400a5800545c9900701a58007821580000400000dc475900f0505800ea225800704458003058580000505900a047590000235800f01a580070485800f0225800008003000c865800000000400000fc0f000000803fc0ffff00c0ff1f00001c00f03f000000080000000080000080ffff00fe010030525800ffffff0300c00300003005009c1058000000200000004000f01b580000000020feffff070000e01f00000060ffff03f000fcff033083580000020200f04a580000000f000000100000c000003054580000300000701c58000000001ef047580018065800434b5800464b5800704a5800001000009d1b58007e1c5800a01b58007d1c58009e1b58006a180000eb225800ffffff0744505900401758008c875800f8080000a00a00000c8758001a2458003209000044090000806b99000f6c9900ec225800ffff3f001824580000000010005e020010235800087a580070505800000e1800fd225800100a000085245800032358001c235800701b5800fc2258007020580070215800785d58000000600098605800fa0800001809000000400100fc080000080a0000001a58003824580000be0100707a5800305c5800704b58008c845800d80c58000923580070245800704f5800800c00003c825800ffff000000000100ffffffbffffffefffff7ffff0000c00000800000c00f000000200000c03f0000ffffefff0000000a0000000600000002fff6ffff000f000000700000000007000000f000006602000000080034235800a42458007a24580038235800f02458004c245800d40f580071245800545d9900206699007c669900d86699007c6799002068990068689900246e9900a0699900e47699005070990044699900607f990044949900e09599002c9699004498990070085800ac5d9900b88399002083990090839900b8999900105059006450590098625800dc4759007f110000ffffdfff7f0d000098665800b8695800c60c000068fc0000c0475900b8725800b87358005450590070a19900d0a29900f49f9900009f9900909f9900b4a199000ca2990080505900d0475900385059004c5059005050590048505900522358007450590000a5990094a59900bca5990044115800689458008411580078115800c811580000be0000dc4759004c0f580024a699005c895800749358008450590014885800fca69900c4a6990000000000000000000000000000000000000000000000000000000000000000000000000000000000050068fce60300000000000000000000040b0f242a2e282b2f030a0e415353455254000000005c004050590088505900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000364100b10681a81bb80ba7bb129d0bb0cac00c0a3bccc0c241769c03a9094b99e10781d10881d26e1a652204a5030025780465b504e59a04a5a70425b3041df0364100410981510a815902480449031df0000000364100a10b81810c810c298808997ae008001df0364100210e81310d81810c814803490829031df0364100910f812082b09088a0321864221865476307f022112020f41df01df00036410081108192a1d89092c13111819a2892227f30a910d76910e7690da112810c0be5bab592227f30a910cc1a0779030c121df00c021df036410081138182082c008823e61807a112810c0b25b8b592a0ff979207a112810c0b65b7b531148182a1d88082c18a33a2037fcc6aa112810c0be5b5b5a20380b64a16664a089115819229f697b20aa112810c0b25b4b5a20380210f81202aa028121df03641003d02b65207a112810c0b65b2b5210f8120239022120c1df000364100a20200b2a0ffb71a490c05710f8162a1ac704ab06a44c814c73332c033c081168192040092420082282c5914e00800920401b2a0ff663904a11781590a665904c11781591ca20200b79ac506010030dcc0d9141df03681047d03ad01b118811c4ce5ac0441198182a1d88082c18a44b204908c9ba112810c0ba5a9b5b20490610f812c0da2261f22617d576a13b0ebb060eea0c21e640c2ff0cc20c25e64460500b0fbb060ffa0f21f6417ef09a112810c0b25a6b52c0d211a81f11c814c4ca2048f911b8182261f5204900c033951526181d0b8109809c0aac15055b06055a0c21565e205d1e26183c2617caa9992617fc2066cd78805a205e1a24242662c0e920f5882c9fa16b877a2c9f8165a770c0c0c0ee26179c26180bc6ba22181b2c118c2c11965898a2c0db20118c20119f11c81ba8c87b718b7b70fa112810c0b659db52c0df11c81b20118b0c7c0c24119c24242a2a780e11d819215640c8bb78902865200c2261fd0bc10d78c02868d01c20119920118a12081811e8172241dcac9707004911f81c0212182089cc0c1e482617aacd866182be02201a02210a12181108701a0881020a70190aa1080aa2082217d808034a088208022204c08802220460a00e02201812181a0221010a70180aa10208701908810a08820a2217da0a034a022208022208122818022108205d0a201180c17a0a79380814120aa0190aa109123812088119088109205e072a780909911709910a0a920809920a08820b08983a111819205d2b21566907404c0bb11909034207711a07710907720a8519205e280aa20820488d0da20109911e09910a12481e08801a08810a2a1d89088208261829125818205e090bb10a088c170bb20b2617e72217cb11081c077119077108abb922b7fd951676910812681a2afbfa0a910a26b7f808d208951d12781b8310c8ee26177d0bb20b931060c000c070c02885192217d0c0b0c7cc26177b2617e0c0cb20488909911a0991090882010bb111c09e0bb10b261829088208951d2066c326174662d19920f5826690532617466890d326174e128810c1de0cc10d0cc20312981812a81c020001cdbc2638f822883a205d3e0080092046b569907c2048a661c732c8ab816812a81e2d101f22174f26171e2ce7f82287dc2ce45f2247ab0b141d2ce49f0bbc0f12b81e2ce4df0bb10f0bb11e00800822171f2a1f4873f04922172ac49b21564c2a200c0bb20b25564a2066c662a13911c81920958266902668907a112810c0ba578b5c22173b221729221718603000c0c0c0b0cb9926171b26172c26173e12d81812c8120fb11a2218290d0a4d0aa20c0d0a4a2618280ff10f02220e0dd20c02000d2638da2066c560a0a4c4ba205d3911b81b0aac19809aa99e86956ce08a879567a08810781a12e81822815a8eae00800bd0a9c8a812a81822856a22181e00800166a068107818888e00800c61600a2218165b0ffbd0a810781a2617588780cbae00800a2617bcc6aa112810c0ba56db5a2217bbc3abd0aa20a0ac22175baaacbaa0c0b258004a22181b2217b92167b812a811b9982285692567be008008c9a8107818888a2217be0080082245ec02000826390f2245ee2245fc020000c89e26391b2241d1c0cc0cb1090eb10978b09cc6c0c0cc26178c60e00812f81b22174f13081e0b893f0fb20c0bf93b26178a22459c02000a2639892245ac0200092639982245bc0200082639af2245cc02000f2639bb2241d776b1a913181a2046a9209c5a71908812a8182286ee008009132814600000c09a2261fb13381a0a504160a28c2011892618416ac39a22531b08a100c1c808920c08820c02000e22182826389f2046f813481b0ff0180ff10f0ee20c02000e2638ad205d2665d0d812a81a2048f8228830cfbe00800922183665954811681a2217d822859bd01e00800920110b629400c8d0c4eb21564a811c22183a0a414c0c074e0eb10e0cd93c26183662a2282217ff2082100ff2380ffa0f89ff21f02f69f040c48878b090c390c6aa26177926183b2241dd7eb0ac2046bdc0cd22183668d0bc8310c4dd0cc20c931460000c831077b1ae215640c8ff78e128135810c49a205d1a2618390cc20c931807720522177c020003c0ed2217fc263aad20d03b2066cc0dd11e0dd10d02220e13781662b11911c81920958266902668905a13681a02210c0200022638bc020007c0a922386b2046ba099100bbb561b13b206400c7dc20641d0d92080cc11c09b20222178609911e09910c02000d26386c02000612a8192638e8226bbad05e00800209a20c0200092638c8226bcad05e0080081388122217982283c202a20e00800612f81b2ac03d2a200b0b210d0bb20a02b83a13981c02000913a81226a839209ba263913812a818228bdad05e00800c02000913981a26988813d81a22180c13081a0ba01b0aa01c0bb1060aa10b0aa20b22183d13b81b0c034b0940400cc11d0cc10d13c81c09901d09910c09920a09920c13e81a20489907720807720c22cd9476b070c1be00c000601000c0be00c00c0200072639cc02000a2c114d13f814c0e811681c2217e82284dc2639d9851b2046ac2046b40bb11a0cc11e0cc10d0bb10c0bb20b099209951e00800914081b851c020000c12b263887969a831a9791df0b20470814181f20110c204710cadd0d92080cc1170ff0180ff10f07720c6aeffc205d0a22531c0aac0c12b81a0a141c0aa10f0aa11865cff1c7a8221831c6b26780a872a02b7a8040c374600000c17b205d2267b0cb72a041c6997ab040c3b4600000c1b9117818809a2a0ff9c4888199c08914281920990a79908814281820863a718077a7b324242060c0092046bcc4982241d07f8ec9206b97a7b9cd9b205d08205e1b261768a874b8887ab0ebd039221766b878729010c2bb2424292066c66290b920f58266902668902324242376c38a2c11c0c0bc2a1a8654004814381a2c11c82287eb2a0ffe008002c0df11c81e11d8192df2892098ca2a0ffa79904a2011c8c1a324242c2261f9d07d0bc10c206c2063cfec215640c8ee78c070c188261800601000c09926180a20f7427ea090c0c0c0ee2617cc261830c388261798619fe811681822837a2217de00800922184b133818614ff0000364100312a81213a8192a0ff924264924265822325a2c250e00800822325a14481e00800914781b12681a146811c2de145818117810c1f0c0cc24266c24267f908f918c25e00c24e02d25a6ed25a70c25a71b25a6d925a6f1df00000364100a148810c06a0b2b0420b805117816634016905665401691551318171498152058e92a0ff971527c2a1acd10f81820b81a065b0e20681e7b80af20700f24b7f2247001df0ca7d7075b052067f9795e0224700924b7f1df00000364100314a813032b0a22320660a0aa112810c0be517b5a223200c14076a0aa112810c0be516b5a22320f63a11ad028116810c0982282c926320e008001df092037db11781663901490be14b81c13181665901491bb2cafeb26320a20c8df2a0fff71a3352a1ac610f8142ccac40dab0c22d21c7bb13b0fcc0f26d21b26320a20e00a2437c224e001df05ae6e0eab0a20d80c0bbc0f79ad4224e00f2437cb263201df0003641003050740c1a911781204074663401a909665401a919a1318160e6030c2c60b034b72c02606200a20a8f82a0ff871a10e14c810cfde0aab0d7144af20a7f471f447149810c030b278c93261312a112810c0ba509b5d13181cd07d20d8ec60100d13181cd02d20d8d811681ad0482284abd05e008008c3a1b336623cb60e6131020002d0a1df0920a815799b4812a81822824e0080060e6131020000c2a46f8ff000036410021318192028fb6790aa112810c0ba503b592028fa148810c1ca0a9b0920a80b11781663901c90be2028ce24a7fd2028f665901c91bc14081b2a0ffd24c0cb24c0f1df0000036410082a0ff879207a112810c0b65ffb4ad02a545ff5d0a413181a2a4e28204aa621454a088d1914d818a663d0667b907a112810c0be5fcb4710f81b204b40c9aa71b0e261b0b267b08268b05b2173d861500c11581b204b5c22cf6c73b0ca112810c0be5f9b40c9ab204b5d14e81e2a1d8e0ebc1f204b4eaddd20d80b2173d661d26a79f23a11b81b2173d881a92a15e477841979612ba36c2dad3c21c94d2dad4baccc25d14c6ffffa11481c2a1d8c0c2c1b03373caaaa20a806541ffb2a4e23aaaa2ca64a5ec03814f81502a902b228022101df0b2173d46f3ff364100cd04815081ad028858bd03e00800c131810cbecc72b20cb5a20cb4860300b20c8ed2ccaed0bbb0a20b7fb20b81e79a1df15181a20cb2f20f50810f81b79f1082183d92a472aaa8a0b9c0b9031df01df091528192192a46fbff36810081388182283ae00800567a0851428192d5d49209c4176921a802a0a034dc9ab2020dc205c100bb2300cc23b71c0b812a818228aaa2020ce00800710d81615481915381b10f81d205b1e2a1d8e0ddc1f2db2ea8dfba3d9a93a0a0346a33610781f62a320c09c60400ea9d82197f1b8882597ff21b8e0c191bfff25b8ea15581a20ac0076a0e564904b15281c21300b21b22c73b381df0c2db01e15681262ac89901f66a02f63a5df68a02f66ab5268a690c98871a4f0cf9979aa8a8efa0a334a2caf716fa2756c4270c198613000c9ab2a21888671c4ce008002d0a9cbabd039205b11c0c924a0ca2ca10a5df03bd02a10b81822614a80ae00800ad030c0b1c0c65f0031df0ea9d8219801b88825980f21b8f1bfff25c0f06d2ff0c09a12981c02000a22a9fa922a0aa559c6a0c0da0e024e2cefbe09d83576a09821b910c091b88825c11e833d205c1a2130000dd231baaa25300eaddd93316e91e815881915781a812e205b142a1d840eec1a0ab04a921ba4ea8ef9a948a449941811081a0a3348aeee22e7fa931e0e004e911b62e11a112810c0b25d3b49841b10f81a831c2db01a93199410c18d8210c02d02883b62211a112810c0b25d1b49841b10f81a831c2db01d811c0dd11d0aa20a0a074f6ca7af15981a0ea90faeea00e00061b00461a00861900066900061400461700861600c61500061500461400466d00866c00061200461100866500c66400060f00460e00860d00065d00060800460b00860a00c60900865400460800466100864d00060600460500865900c64500820906d209038a821bddd24903824906e20900d11c811beee24900d20d58669d7ff6ca76815a81a0fa908affa00f00061a00461900861800866e00061400461600861500c61400061400461300467800c67300061100461000c66d00466900060e00460d00860c00866200865d00460a00860900c60800c65500460700065000864a00060500460400064400863e0098a4a8749a921baaa97499a4a8041baaa904d821ccedf213031bfff25303e21b901beee25c10a2130198011baaa2530192093a82a0639738028656ff0c9ab2a20588671c0ce0080028014d0a22c23a9caabd028205b10cfc824a0cdbaaa5bb03bd04a10b81822614a80ae00800ad020c0b0cfc65cc034647ff0c094674ffb213021bbbb253024643ffd2090ee2090bdad21beee2490bd2490e06b9ffe2090df2090aeae21bfff2490ae2490d46b4fff2090c820909faf21b88824909f2490c86afff820902d209018a821bddd24901824902c6aaffd20908e20905dad21beee24905d2490806a6ffe20907f20904eae21bfff24904e2490746a1fff22418822415faf21b88826415f2641846bfff82241298f48a821b9999f482641206bbff922417a224149a921baaa2641492641746b6ffa22411d8e4aaa21bddd9e4a2641106b2ffd22416e22413dad21beee26413d2641646adffe22410f8d4eae21bfff9d4e2641006a9fff8248814faf21b888914f92446a5ff88c498948a821b99999489c486a1ff9864a8549a921baaa9549964c69dffa8b4d884aaa21bddd984a9b4069affd844e834dad21beee934d9444696ff000000364100515b8142a1d84043c18138815a5462252282283a606004e0080056da0a56a60a82057d82c8fd56180aa8020cf9a0a034971a05b2caf8561b09b15c81f11b814c4dd0d3c1c80ff2dfd2f20fb8dacce81cc20c0ad82e880e00cc2380ccb0c80cb0ad10b0cc10cc7fb70d62f22580a7bf5c8215961b88825596e11a810c0da0ca93c26580d24e38b215963cb9b7b93c0c9a810d81b2a21388680c6ce00800215d815d0a2a249caabd02324a0c0c4cebaa259b03bd05810781a10b81822814a80ae00800ad020c0b0c4ca5ab031df08c7a922580a7190756faf9d81eb78d9ae215971beee25597c6e1ff00364100811381412a81820823b1398116d804c881915e81c77c47c02000d22b40d7fd3cd7fc39ad0620c59430d3340c0b0c0e8224d40c0fe008001df00c9997971ec02000a22b40d7fa15d7fc12ad0630d3340c0b0c0c0c1e8224d40c0fe008001df0c02000a22b40c77ad0c02000926b40c02000d22b40d7fde5d7fce2ad0620c59430d3340c0b0c0e8224d40c0fe008001df000364100811381915e81820823a13981bc08c02000b22a40c77b28c02000926a40c02000c22a40d7fc19d7f716ad0620c59430d3340c0b812a810c0e8228d40c0fe008001df0000000366100412a818113810c0c820823c901bc780c9997932bad020c1bd12981c02000922d9c909405c09911c020000c1e0c0fd22d9c8224d4d0d03590dd20e00800c601008224daad02e00800a2a0608224d1bd01e00800915e81a13981c02000926a401df036410122611a611681710f817cfb42a0ff424110424118b951b971424120b991a817822645a0a141e00800c139811c0d5140810c0ff25514f2452ae20536e26114d24536a1298132c580220537c02000c22c42c9a1c02000b22a9eb9b1c02000a22a95a0a764a24134915f81c0200081388192298182284a924135e008000c96226112163a059203b467994db203b5471b47a1608122a1d8202bc1815381aaa2a20a808a87a0aab070aaa0a21a648a22376a268203ac0cf997981ea8b1b7ea1981618188681c4ae00800a20228813e810c0b8228a10c1ce0080081108192a1d8214c81a2038fa2611520fab0e20f81e2611bf20f7f909ec1f2611c9a8891118182287f40aec09088100c09a0898382611792211aa2c128d83ac82ab81aa80a9901e5d9ffc16381b2211a61628182211c92266e808890c0bb10e0a811a261169088a08818a2211be00800211681e2211bf2211ad2c128a80db81dc82dd83d65dfff611c81e203ac92038fe9a1f6890b82222ca22115e00800c601006699040c0992462c42450fc2062cd2211b0c0fe2211ce24534f965f24530d24535560c0b82062f47980592063247190fb8b1812a81a81782286ca0a141e00800b207c0076b37a2c120822255b2c124e00800ed0a0c0b916481c20120f2a1d8f0fcc1d2a0c4fa9992099340ccc09099b07099a0da99c09b839261198601007cfe0c08826119913a8192098ce9e14099c016990aa2c118b2c11c8222820c0ce008006d0a822246a20118e00800e8e1a2611892211922011882a1d88022c18165812a278a2216e906a21200b2090c654f03e8e1861800f20630479f10b2062e40cbc016bcf5479f04fd04c0fb9340efc016def481668192a1d890ffc18a8f82088016c8f3c20792b207b7c73b0206ccffb2078b16abf2d16781dadfd20d8000dd23d72b0246c6ff0c1ab2a0ff8222401c9ce0080046c2ff0c0afd0a8602000c020c0f7cf60c19926118b15181f26113b20be9e9e1471b29a2c110814381b2c1148228360c0ce00800811681a26110822847a20110e00800dd0ae8e1c22110c600000c0d7cfca16881660e020625009891e9959985920120924531560e08b2011840fbc016af25f22119820786f20f14873f0882211882c8fe161826920787973f08f22118f2cffd162f25816481920120f2a1d8f099c19a888208938088b07088a082186492a400970802c68b000c0f92121e82174297381282121f8ce892a1d8909bc19a9a92295fa769010c0f169f24b24531f8716995f9850c9f0679000c8f4600000c7f260c2ce7bc29c99588519201109245318985dc8dc79611b22118b2cbfe169b21f22118f2cffd160f210cbf4600000cbf260659e7b656c7b653d26111c26110811c81e9e182082cf2611f161815812a8182286be00800f2211fe8e1c22110d22111b2011816aa13a1688192a1d8909bc18217419a9a99f19219b287390246480088f18218d4b628048645000c9f667f1042453122611e7cfb7cf99985b995460100b2278922611e2d0bfcdbd26111c26110b2cff8163b19c2cff7161c22e9e10cbaa79f250c0b81168192011082282f924507e0080098e10c22609963b6290a2d0946010022211922020c62038eb6a60aa112810c0b6538b462038e62450f914c81bd029066b091628182067e82450ea2068162067f92296e6086909088a08808a2611de00800cc5a0c0a0c1b2535b4a2038f471ab4bd06a2211d25acff416281622114b2211cd22117a2c128813e8122211b8228bccd02e008009203c407690d812a81a81782288da0a141e00800b22784260b1292211682246e9a888828ad02e008007cfaa94526b612a2211292246e6086909088a088287cfbe008001df0b20118a16881b245316995f2cefe88718985566fed92221366297582a1d8808bc18a8a82285ff2a600870f64e9950c8f9891b20120b24531998506acff0c8fc08ec056b8e1168de1c9950cbf9851b20110b245319985c681ff671e2f66260bf21202261f0a822113f668040c0f866efff1648182012092a1d89088c1909bc18afff20f6d9a9a92094ef719de0c1f4666ff0c9fc695ff0c8fc6e8ff69950c9f9871b20118b2453199850679ff0c8a0c0b81168192012082282f92436fe00800f22119e20787f20f14b2211ee73f3d822118261828664623916881c20120a20118d2a1d8d0aac1d0ccc1aa99a1648192094ecaaaa20a6da719010c262d06e73f0bc22110d22111c0c663d02c93d227891be2e02d835632e360f2c0567fe2922b13661905821b02f62811a2c9fe565ae1d21b02c21b1fd73c024682ff0c228682ff0c9a0c0b81168192011882282f924377e00800067dff3621019d03226115bd060c08426117ad057d045203004204028241000044237074a0726116781762611916177fa03334a9919981e169817cfc0c1bab25a0802462a1d86065c189e1001240816a8100bba1c0bb3022deffb261118a669221159094b0d819d0a504561a7ba22117a20a009261100bba16bb67b2cafe161b1ac2cafd16dc1ae2cafc16ce15265a7b266a490c0a0c1b250fb4722117f22117b22116a221100c08981a891b909004991af20f031ba4c207004d0800aa23c2ccfa00ff23f7aa014d0a4247027074a07261167817564c7456b76f46d001921293a169811b99925a138206870088230b88824687f21702e21246f7be30ad05654ffed22110a2668ed81d060800f212978169811bfff258177cb8e20686f2261e00ee2380ff10f2661e0beee24686d0b214813e81ad0582288ccd07e0080092221fa22667576913176a1b811681ad0582287fb22673e00800860200813e818228a3ad05e0080092066da2221966790d70aac0565af20c0bb2424b46c7ff9221109819909214e63902e61905663926460b00813e81bd078228a0ad05e00800911c81b11c819209300c1a5099c056b9eea24b3a46b9ff0c0a0c1b25fdb3c6b6ff4ba10c0b0c8c251003b2a1f84bc10c8d98810c0a810d81a241040c2a88789209009241057921e00800c6abffad05bd07921276813e811b9982288b925276e0080092221f57e90a813e818228a3ad05e00800bd07813e81a8818228a2a20a01e00800869dffa16b81922111a22ab1a09910a16c81926a71b2221fc22667576b10176c0d811681ad0582287fb22673e00800813e818228afe00800d22110d81dd098b4925702d09614261921262910663926e2128af169811beee25f0a060600f212898169811bfff258098602008212889169811b888259080c9997932ea2026c9c0aad078116810c1b82288bcd03e00800c679ffad07b1698192128b8107811b998888925b0be00800c673ff662313ad07bd05813e81c89182288fdd01e00800066eff92066d666974f65302f6330df6a302f69307f6b34d0ceaa7334881078188f8ad07e00800d2070a92a0efd0aac0a7290c8107818888ad07e00800c65eff0c0b7aade21702c2a0f0e0ccc0aaaecbaa65f902cd07810d810c2a8888b2a1f5e008004655ffad07b1698192128b8107811b998888925b0be00800464fffad05cd07813e81d0b21482288db26114e00800a2170292a0ff8c1a979517ad07b1698192128c8107811b998888925b0ce00800c641ff92026c16591a911c81920958a9a1669945cba10c0b0c8ce5f10279410c4b810781a8a11c5992410ca261128898ad07e00800816d81d221122c0b1c59924a00b24a01d24a021c5bd0e841e24a038878ad07e00800062cfff2c9f5564f1181508198288818973802c64100c2a0f0911c81812a81a2096fb2097082282cc0bb10b0b320b0b074b24970e008008116818228910c1ae00800a150810c0bb93ac02000915f81a80a92298aa71908c02000c15f81a26c8a8107810c3a8878b21702e00800a9f116ca07c21702dd0ab2070aa20a0a7abbcbbbdaaacbaaa9b1a5d302ad07b8b1c2a0cf920b01810781c099102c0cc09920924b018888921702b8f14b99925b02e00800b8f1812a81a11c81822854a20a6fe00800e15081d81e1bddd91ec02000a12981b22a9cc02000c16e81922a9dc0bb20c02000b26a9cc02000926a9d4602008107818888ad07e00800915081a8299819a7b90246ebfe5241140c3ab2a21b810d81c2c11488780c1de0080046e5fe9221141c1b663908a73b0526832b263328ad070c4bc169819212948107811b998898925c14e00800ad078116810c1b82288bcd03e00800c6d6fe92221f57e90a813e818228a3ad05e00800922114663969a2026c662a39911c8192095826590266792da13a81a20a94076a2481168182289dad07e008009c6aad07b169819212a08107811b998888925b20e0080006c1fe79715241190c2ab2a1f7c2c1180c8de169810c09810d8192411892129888781b99925e18e0080086b6fe26290266191cc2068fececad07b1698192128d8107811b998888925b0de00800c6adfead07b1698192128b8107811b998888925b0be00800c6a7fecba10c0b0c8c65cc02816f81822836ad05e00800a9c1a2410ca9d192a0ff979a17ad07b1698192128b8107811b998888925b0be008008699fe7941ad070c4b8107819217028898926112e00800dd0aa26118cc9aa112810c0b65b3b3d22118a8e11c08f2a0cfe8d1922114b22112b24d0292c9fee0e841b0c841c24d03f0ee10808e202c0ff0ee2090e893f8c1f24d00e24d01fcbaa22117a20a00d26118262a0da112810c0ba5aeb3d22118e20d01ad078107814c0be09054b09920b16981924d0192128b88881b99925b0be008004673fee16981d21294c11c811bddc20c30d25e14579c07e11c810c1dd24e3a816d81ad078878b8d1e008008668feb2127cd0a8b41bbbb2527ca2570292026c9c09ad078116810c0b82288b0c0ce00800465ffed0961426195f26393e92221fb2127ea8811bbbb2527ea20a0157691ddcaa811681822854e00800811681a881822853a20a01e00800a881a20a010c0ba0dab0b2611320dda0060f00d881e21280f169811beee25f00d20d010c3ee26113d0ddb020dda086070082127ff8811b8882527ff20f01f0dfb020dda0cc3f0c19925d730c1aa26113813e81a20dce82288ebd07e0080092221f57e90a813e818228a3ad05e00800bd07c22113813e81a8818228a1a20a01e00800c630fead05cd07b2070a812a817abbb20b098228ebb0b414e008000cbcc79a28922115822117e881820802e81e0088231bd89088b0d0d00450dd01f81892afdf90ff10f918d92ed91e56f783b22119bc9ba22117a20a00261a18262a30263a3a264a3c265a3ed2cafa1c8c0c1bd0bc834600001c2ba16a81812a81c2a1d8c0c5c1822883caaaa20a93e008001df0e201001c4d1c3be0bd9346f6ff1c5b06f5ff1c6bc6f3ff1c7b86f2ff000036810052a0ff612a817d020c0d0c12d95190e6030c2c90a034a72c029062009961a2a0ff8226384941e00800e13a81e20e9442a0ffe0e104561e13813e81822896a12181e00800a11c8192da28920994e10f819092045619168226f20c3ae008000c1b40cac05d0a4095c00c0ac0ab83a95116f91de17081c16a81d10f81b2a1d8b0b5c1b931dadbd971cabb0c1cc24b8fa20704a24b8d820700892182c8f5561824822622a8710c0cc24b6feaaae00800b17181a87182261fbaaae00800c0200092aebf815f81a15081f2288af90a90ff1092a28f90ff20c02000f2688ac02000d12981e17281c22d9de0cc207c0ee0cc100c4ee0cc20c02000b17381c26d9da8710c6cbaaabd03e58102bd03ad010c3c658102312981ad01c17481817581b8718888cabbe00800d17681c831dacc822c10c02000826380f22c10e22c11c02000ad050c2b82266de26381920cba0c2dd09920924cbae00800063e000c4ee08920824a14f17781c02000e26f81ac72471525ad0582266d0ccbe00800a16a81b2a1d8b0b5c1822620baaaa20a8ce008008226f3ad05e00800b11381920b2c0099230ba9a24b2ce61907a112810c0be575b3a861a0e6131020001df0f20700b20a58471f09471b068c3b0cc286e7ff520a6f47950aa112810c0b2573b3e10f81820e6c56f806a112810c0b2572b3061900b17181a87182261fbaaae008002d0a56aaf6b17381a8710c6cbaaabd03a57102f17681c17881e831c82cfaeec0c014d20eba0c2ff0dd20d24ebacc9c8161818228150c3ae00800811681822816ad03e00800ad0582266d0c2be00800817981822836e008000c1ab8510c09b09a8316b9f0c8410c0d8cacf11c81e20701e24f75d24701311681bd07822388ad05e008002d0a567aee811681822889e008002d0a569aed913a8192099427690eb11c81b20b5840abc0168a10165b108116810c0a8228110c0be00800c16a81d2a1d8d0d5c1a17a81daccb22c1e4c0dd0bb20b26c1eb841920a14562be80c2ee0e920e24a1406a2ff88212698120c1aa24b6f92070616b9ef0c0cc24b8c46c1ff822622a8710c0cc24b6feaaae00800b17181a87182261fbaaae00800c02000815f81f2288a92aebf90ff1092a28f90ff20c02000f2688ac02000d12981e17281c22d9de0cc207c0ee0cc100c4ee0cc20c02000b17381c26d9da8710c6cbaaabd03a55c02bd033ba10c3c255c023129813ba1c17481817581b8718888cabbe00800d17681c831dacc822c10c02000826380f22c10e22c11c02000ad050c2b82266de26381920cba0c2dd09920924cbae00800c6a8ff813e818228b7ad05e00800466bff00364100c15081a17b81d2a000b21a2ad24c10b2cbfeb0b07482cb01b09ba0a099a076a848e2095892c9ec00ee23e65e3ab24c10886cad02e00800217c819802922932ccb9a112810c0b2550b39802922932661914a13a810c9ba20abac10f818c6ab26c1f0c3dd24c731df00bbb86f0ff3641003150818873ad02e008002d0a92a0ff971a10b17d81c2a1d8c0cac1a20310cabba24b801df0368101516a81415381610f81f2a1d89d030c0720e074e2419079019961f0fec1b20671b2611f4a464a4f5acf322c1e220c6d303004326116263215a11281bd072547b3e20190f2a1d8f0fec1b2211f5acf72464e312a81217e814c48808ec12adf22d2249802a2d3068a99820c879971008823a6180db816f21d48b0b1e4f0bbc0b0b0e4820d95f2a0e08cf8820671873b0a922c1e2d0a07e902c60203b8ad21168117eb5ac206c07861076c02860003cc1746d4030cadfa8482611b77bd02c64103ad0ee581fdc2042ab20429822233a0bc93a20190b0b074b9f1e00800a9a188d3a8f1e00800c8a1f0cc111bcca7bc0286b90388d3a8f1e00800cd0a86b6030c07fa9492611b913181b2098fa17f81669b4482223be00800cd0ab63a7d92042ca2a0ffa79974d18081b2261fe2019047eb0286bd03ad0ed0bc63822244b2611ee00800c22689d2211ea2611dc73d0206ca03cd0dc6c803b2daf9b22bc2b63b307cecb7bc02067e02822244a20190e00800b11b81c22689b22bc2a2611dc7bb01cd0be17f81d2a271d0dc82d26e6a0675020c020c0ee2611d8601000c020c0ff2611d0c0882611ca17e81e20190f2a1d8f0fec1aaafa8aa176a620c19b2148cd12b81c8168116815aafa22a67f22460822876c0c141f0ccc0a0a404d0cc10d2211cf0cc110bddd0bc93b261120c2d4bc1a0d993ad0ee00800a901262a05264a02665a0d811681a2a11882286caaa4e00800f2019082a1d880ffc10601000c088261120cbd5acf920c6fa1818156290af22c670c2880ef10878f2a922c1eb7e92488aaa2243ee008000cbdcc4a920422b6297fc20190e2a1d8e0ccc1cac5e22c670c2ff0ee10f816822460f0f14180ffc0812b8180ff10f0ff11f9e1f26112cc1e4646039801f62902464403663902c64203f21102b8e18bc1cbd1e2c11082237d0c09ad0f9921e00800a20190b2a1d8b0aac1aaa5a22a67176a1fb801665b1acba1811681b2c11082286b8bc1e00800c60100d9210c09993199410cfba20190c2a1d8c0aac1822383aaa5a20a93e00800e20190c2a1d8c0cec15accb20c6fd20426dc4bf20425d71f0f0c290c0a822c1ea24419908820826c1ead0ed24425655cfdf2abff0cfcb2a400565a06e20429e2442a664e02461303669e02c611030cbdd79e02c60f030ce8879e02c60d03c79e02460c03d2019082a1d880ddc1dad5c22d1e1c48871e091ca9971e041ce8879e0287fc171c89971e0f1cb8871e0a1cf9971e05f09c10460100977cf6b09c20926d1ec2042cb2a0ffb71c1c82019092a1d89088c18a85e2281ed2042af0ee10e2681ed2442bc2442ac2211bc21c04ac8cd2211be18281d21d05e71d1df816c0e141f0f1e4d0ffc0f0f0e4f7be0c0c3b0c0c8223eba20190e00800f2019082a1d880ffc15acfd22c1e177d1007fd0d0c09818381924419808d20826c1e312981817e810c8b8acfc82cc02000c26390a2a090aaa1a20a00f2a1d8f0aac1aa88a8288838c02000826391e2a090eae1e20e00f0fec15acfd22c1e1c0ab0bd10a0ad1037ed09cc6a0c08826119461200f13081812f810c0eb0e893f0fe20a0ef93e26119f2211bd87fc02000d26398c88fc02000c26399889fc0200082639af8afc02000f2639be2a090eae1e20e00f2a1d8f0fec15acfd22c1e920407b20420811d8110bb1180bb10813481b09901809910b09920926117776d28c13181a20402c20cc5a71c0b812a8182286ee00800e20190813281f2a1d8f0fec18022205acfd22c1eb20c6f661b1c82042266180246b40292211b9209b066190246b1020c088261130601000c09926113a11c810c28a20a74a2611080aa1007fd0a9221100c2dd78902c68e01e18481e02210dc1a0c4982211d0c3ff2611390882082611d460100b2042ab261130c0c0c5d0c0ef13581f2611ae26111d26115c2611c820423913a81661848b20190c2a1d8c0bbc1bab5b22b1ec7eb37c21622fc1cd2d9d1d20db0ec9de209baec4e82211bf2067382185687bf1992d9d192098f0c9bb79904b2211c8c8bc204258c3cd20424dc2de11b81e22ec2f63e0a0c0f818481f2611c80221092066c16f906b18581c18481b07710c02210c02000b18681812681f139819871e22f80920903808e2092c9feb0ee1090e893c02000d13a81e26f80d20d940c6cd70c32e816d13a81e0e141e26460d20d94276d21911c81920975818781a0f90180ff10f07720f639070c1c909c939261160c6dd2611c817e81e20190f2a1d8f0fec18a8f88a81c0990c8109788098821f6b8049831164912168c06c224485abfb20b6fc2611456fb04c2211c0bcc56cc68d2148cd2611206b501dd09f821e22112c2a4e2e73d01cd0fc921a21102b221128bc1812a81cbd182287de2c110e00800980166590fcba1811681b2c11082286b8bc1e00800e20190c2a1d8c0cec1cac5061a00a20402652afdd841b821cd0a812a81a83182287edabbe00800a9b1a201906522fdf14f81e8b1c20190d2a1d8d0ccc1aaee2beef0ee10cac5d22c67e26114176d22f2148ed22448914f81d08ec0908810f09f1197380da14f810b9fd09990a099109261140c0aa2611db20c6f661b129801262905264902665907c2211bc20c72dc2ca133819221140c18a099109022208022200601007cecc02210d2211cdc2de18481e02210565b64f206bc16ff630c098601000c194600000c19f13781c0200092638fc020007c0d82a0908a81820800a2a1d8a088c1c223868a8582086fd0cc100b8856e80f9206400c7da20641d0dc2080ca11c0e92060ee11f0ee10c02000d26386c02000c22116d1118120cc11d0cc10d13a81e2638ed20d949d0c17ed17f2066c662f17811c81820858826118265802667808076d05918381909c204c0ba13f81c02000d11381c2211ce2a09092639d820403f20402eae1e20e0040ff11a08811b08810a0ff10b2a78090ae11c24d24b0aa10a0ff20c0a034a0882080ff20f951661c6fd17e81f2a1d8f0fec1faddd8ad47ed07a112810c0b25c4b2208141922448a12b81909141a08810971807a112810c0b65c2b2e7f207a112810c0be5c1b2d17e81e20190f2a1d8f0eec1eaddb8ad921d08b0b304169b40f20d22909fc10600019204080cad820409d0dc2080c81146bfff0c0ee9c1a12181812a8192064c8228bb109901a09910902220a22115e00800c2211cd22113e8c1f22111b221128d0a9821a221199090a4a0a820a26119822117a11c81908820826117913d81a20a58a26118926120269a2ea12c819221180cb887991b92212022612181508128318838202211a02210809283222121c601009831209911a099108841a131818080a480ee20820ab090ff208cd8920a8f6699080c0d2c0aa9d1c600000c0889d1f62d040c1992464ec0200082211982638cc02000f2638bc02000a22117a2638ac02000226389661c33c21408acdce9c1d26113b7bc12a112810c0be5afb2d22113e8c1b22112c214089851b0bcc0b0b141909ee4b73925c0b141c60700c2a1dfb73c0bc2a1e0b0bcc0b0b1414600001c4b813081f2211d80ff20f2611df13f81912381208b1190881080ee20f0ee20e772280c1ff2464dc22460c02000e9c1d26113c263aca2042cb2a0ffb71a0ca112810c0b65a8b2d22113e8c1d09034a20425b1118120aa11b0aa10b22116f13c81c0cb01f0cc10c0aa20f11381c0cb11c0c920c24f25009911c13b81f2211ac09910a09920a18881909f20a0f920f2611ac13e8122211562dcfec0200082211d8263aac02000e2638dc02000f2639c9c2bb64d10a20421822cd90c1be00800413981460300a20421822cd90c0be00800413981c20190d2a1d8d0ccc1cac5d22c1e676d12f12681e85182afbf808d10826c1ef0ee20e95158d18226bcad02e0080081388182283c707a20e00800bd0ac2a200a2ac03a0a710c0aa20b07a83c02000913a817264839209ba26390d8226bdad02e00800505a20860300a18981c02000922488a09910905520c02000526488a2c114cd01b2a090822666bab1e00800d14081f851c020000c12c2211df26388e2211ae96dc97d1df00c0882611d211f810c1992611c468dfd661b26b20422b62b20d17e81dadfd8ad17ed160c1e0cef0c080c0992611a826111f26115e26113c673feb20c8600bb23e61b02062700ad0ea5d3fce20190f2a1d8f0fec15acf569a08818a81f22c1e80ff20f26c1e276f46d871c20d2100cc23d0cca0c89cb20c0a3c4acabb920b0ccbbbb991909141a7190aa112810c0b258cb2e201908116818808ad0ee00800b18481b02210b891a09841a24b01924b02d113810c4b92211de8710c2c2c0f0c0882611af26111c24e03b0992092611dc24d260c6ee261150c3c0c0dd2611cc261138649fe8204230b88161818d22c1ed09904568917d0a10416ca24ad0e65c8fce20190f2a1d8f0fec156ba23b184810c4dc2211d9135810c580c0ee2611c82611592611a0c08d0cc20b022100c3dc2611d5abfc18381922b1ed26113c09920926b1e82441906b1000c07fae4e2611bc614fdfa7472611b0c074612fda8318821f841b851d12381e2148f90c12120cc11a0ee11d0cc10c0bb20d2148ec22111b951a0f883e0dd010cd8a12681f9410cbbb921f18b81a9c1f0ee10f12081826115f0dd10e0dd20d0cc20c2611106f0fed11381d20d2c00dd23e61d0aa112810c0b2579b2e20190ad0e25bffc922460817e81b20190c2a1d8c0bbc1f816ba888868b14f81a088c0b088108aff812b81f0f14180ff1090ffc080ff10f0ff11f261129801b62902663926c2211c92162b925102fd09261c1381818188a8a2243ee00800f2110216ea2992162b9a9f9251028138810c0982282d9921e0080056ca8fd17e81e20190f2a1d8f0eec1eadda8ad921d08a0a304162a8dd20d2290ddc1d0d0f40632fe0c198671fe0c07c6cdfcf20c8700ff23e61f3582066c662817911c8192097407690eb11c81b20b58b26118265b1a267b17ad0ea5aefcccfae20190f2a1d8f0fec15adfd22d1ec691fff20424168ffe820423261818920190b2a1d8b099c19a9592291e97e907a112810c0b2568b2e2042af63e0aa112810c0b6567b2e2042ac2019082a1d880ccc1d11181cac5b22c1e9871d0bb20b26c1e0c0cc24903f20190d1138180ffc1c24d265acfd22c1ee2611317ed7b92042a820429979872b20c8600bb23e61b6997ed66e2211be20e0556de05918481818c8190221080dd10d26c1e861500917e819a9f98a917692727e92490b4040ca80cbda221135acfc20c6fa0a0740bccb0d893d261150c1bc0ab83a261130601000cfdd26115812a81ad0e82286d0c6be008000c0992611a061e00b2211d0c4ee0bb20b2611d820c87008823e6187592066c662917b11c81b20b74076b0ee11c81e20e58e26118265e51267e4e0c1b918481e20c6f0cf88261150bee9022100c09e09b83926113b17e81babfb8ab176b0f0caf822c670cbe80840480ef93e26115a76d059183819077200c0b0c0cc2611ab2611c0c0dd26111467dfde20c8600ee23e61ea70c5882611546eeffd2019082a1d880ddc1dad5c22d1e77fc02c6f1fc86fbfca2243eb2162b1c49818181c22c1e88a8c0cb04c09b93925102e008009d0aa21102f2162b82ca14aaff90f883f0f0f4f2510246b0fc0c18826113864ffdb8f10ba788c3a0ac63a077c0a0a074e00800b2211bb20bf5a2442cf62b1716b7057961b65714718d81c63ffc0c07fac4c2611b463dfc0c07063cfcd861718e81b63d024639fc718f81c637fc92cf14c657ff817e81f2a1d8f0fec18a8f820896c981ccc85acf822c6717e805920c6f6619100c0aa2611d211f818652fc718f81062afcad0eb881822244d0bb63b2611ee00800c22689d2211ea2611dc7bd01cd0de17f81d2a271d0dc82d26e6a86f1ff00364100610f8182066c261807a112810c0b6541b292064d312a818c49822324e00800211c810c2a920258a2466ccc290c021df0a20259b2025a82231ac2025be00800511681a2025872a0ff771a30a202700c04476a02779a024600000c14822590ad04e00800a2026f822332bd04e008008225910c1ae00800a202584600000c04e65a02e61a6b92cafb169908b2cafa168b08267a35c2caf8164c080c9dd71a51415881e2caf6160e0bf2caf516af0c779a3b8223190c1ae008008225910c0ae0080082258de008008608000c06ad04b202708225950c0ce00800a2026f82232cb20270e00800822319ad06e008000c021df08223190c0ae00800a2026f82232cb20270e00800a16b8182258ca22ab4e008002d0a1df00c1646ecff0c164600000c06b20271c20272a2026fdc4c8225990c19d202700c0cd2cdf8d0c983e00800c60200c16c8182259cc21cf0e00800822319ad06e00800c6e4ff8223190c0ae008000c0ba2026fc2a1d8c0aac1c2a064aaa64aaae53e01c6dcff8223190c0ae008000c0ba2026fc2a1d8c0aac1c2a064aaa64aaae53c01c6d4ff00364100713981c02000819081522780611c818055109c5292a1006206589055202696040cb8879605912681905520c02000526780dc22b17781c02000a22b817cbcc0aa10c02000a26b811df0368100819181e13e81cd03dd029d07ad06bd05b911a9219931222112311e8172a0f0c06411405034e22ee9422110706610605520720381620383807711807710819281406611806610706620605520719381620384320382006611706610719481c033017033106033207221110c0650332039411c85319581dc7dc901c0200062635c165c110c1a0c0b0c0c0c0de00e008644000c1a0c1b0c1cdd06e00e00a196819841a09920c0200092635dc0200081618152635c88680c1ae008009811a821b831c02000c2235cf77cf6c02000c22367c909c020008223688904c02000f2236bf90ac02000e2236ce907c02000d22369d90bc02000e2236a6ced177e02d0ee20e902716181c0200062635c0c1a0c1b413e810c1c8224e90c1de00800c0200052635c88670c1ae00800c0200092235cf779f6b22113c02000a22367a90b92c1589809c020008223688909f2c150f80fc02000e2236be90fd2c15cd80dc02000c2236cc90db2c154b80bc02000a22369a90bc02000e2236a6cec177e02c0ee20922118e909c0200062635c0c1a0c0b0c0c8224e90c0de008001df00c1a0c1b0c1c0c0de00e00c02000b841b2635da8010c19a05993c0200081618152635c88680c1ae00800c02000c2235cf77cf6c02000c811b22367b90cc02000a22368a904c02000982182236b8909c02000f2236cf907c02000e831d22369d90ec02000e2236a6ced177e02d0ee20e902c0200062635c1df000000036810029210c1a0c0b0c0cdd0739114901813e81411e818228e9320481920483e20482e9319941420484e008008161810c0b219581c02000c2a0f0b2625c009411a193814831a09910a19481c04401a044109044209821b19281c0a911c0aa10909034a09920a841c1918140aa11b0aa1080b311c0bb10b0aa20a09920904420c0200042625d0c29c0200092625c88680c1ae00800e801f811c02000b2225cf77bf6dd07c02000000340b22267b90fb0b0b1b90fc02000a2226b000340a90ea0a0b1a90ec020000c1a0c1b0c1c813e810c098228e992625ce008000c49c0200042625dc0200081618192625c88680c1ae00800b161810c4cc02000a2225cf77af6c02000000340d22267d915d0d0b1d915c02000a2226b000340a916a0a0b1a916c020000c0772625c918881909420c0200092625dc02000c2625c886b0c1ae00800c02000e2225cf77ef6c0200082226700034089058080b18905c02000000340f2226bf906f0f0b1f906c0200072625c1df00036810062a0ffb12b81419781ad03a901316c8142c4bc52d3f972d30192236d8204319092c0b09910f099119911671868812a8182286be0080056ca0592042d07e907c213dcb811c72b4e919881b20431c2a1d8c0cbc19a9cd209988cbdd229241bdd567d310c0d46cc00d20433679d04dd0bb24433e19781f2a1d8f0fdc1faeee20e4f00ee23e61e0206df00812a81ad0d82286d0c4be00800d204300c0c609dc016991df19981219a81919781b2a1d8b0bdc1ad0d9a9bd20937001a40dcede2094f00ee23e61e0882094e008823a6180d8815e2296d80814180eec016ce28661d05e219e0163e280c0b9213de0c1e82a1d8808ac100eea1e0992092575e8a2282024b0cbd008823a6183c8212e4913181d8159209b5d0d1e480ddc0d0d0e4a79907880180890416381a92025416d91982043a92152d16b80497bd488213dfe0882082575f060f008205739212de8739318213dfe0882082575f92023366192292024a009923e61919b931e22271a941d79e0f812a81822874e00800b8310c0cf199810c0d92251f276954560b08e2043b9c1e82057587be0ca222710cb9971a040c9ee79a63a815820576a0a1e4873d11e213e1d20577e0eac0e0e0e4e73d02c62b00d20430671d0de2a1d8e0ddc1dadfd20d77d24430a25761c2443a462500cc4b82043b166806a81592043aa0a1e4560906e213e1d20577e0eac0e0e0e4e73d51ed0bd204308606000cf8871a9692043a5609f9e2043bd204308c3e1beee2443bb0eb93e2443b671d521c9e671d1c0caa0c0b913181811681d2497f82282fe2497ee008000c1aa2442c1df01df0a815a0a1e4d20430671d0de2a1d8e0ddc1dadfd20d77d24430a25761c2443aed0c46ecffd204300c0ee2443b06e7ffc2443ac2443bf815d2042ed24430f0f1e4f25761679d02062800819881b2a1d8b0bdc18a8b820861163814d2058b16ed06f20592e205b7f73e02c62a008167818a8b82088000882316d8090c1246140092024a009923a619024695ff9205b782057297b8024692ff8202330b885618e48205739212de87b902468dffd921b931922271a94192c9f55669e2812a81822874e00800b8310c0cd821f199818699ff0c0292251f276914812a8182286be008000c0c0c19a029934600000c02dcd2b213dea815d213dfa0a1e4b0dd10d0bbc0560b0ac2575fa257605c0e4600001c9ec2575ed2043046b1ff0c02c6ecffcc8dfa8be208891beee248890c1b065bffad0be5f9fbf19881b20431c2a1d8c0cbc1fafcf22f24e14f81f0dac0e0dd10e21547e7bd020631fff2058b16efcb919b819a8c82084c3d0b1648e951078122a1d8202bc1819c819a428a22822515a832e00800812a81bd0a9202f0ad030b998228559242f0e0080092044c56c9fd1df00c0206d2ffd213e0b2a078d0dac0d0d0e4d7bb02c6d3ff1c9e06d5ffb2042d07eb3ee213dca21528f0ee11e0e0f4e2575ca73e13819d818818a2575ce00800a09014b2042d4600000c09d20433c12b8190a2c00c1ee0eb20e2442dc0aa10a2636d2d0d60fdc0166fdf0c0b811681a131815c09d24a7f924a7e82282f0caae00800c2a1d8b19e81c0c2c1cabb0c1cb20b80b24433c2442c60bbc0562bdcd2042de2a0fee0dd10d2442d1df0364100c1a781a1a88121a481d1a681f1a581919f8181a08161a18151a281312a8141a381b2d303e2d305426e71526e6b626e6c826e67926e7cf26e77d26e11226e6ea26b64c26b7bc1ae816813a2d30791a9815150814223f221ab81d1ad81e2d308f1ac8182d306b2d304c26b6b82284bf99ed26e11226e1f4975998a8955696581b08161b28191aa8141b48121b58122636c4263f299ba693851b38191b181a1af81a26b6c92681b59131df0000000366100ad02dd05ed06fd07bd03cd04cc8491b6810c189093a0890981b78198c199018808e008001df000000036410082a0705d062d030c0bb906316f8162a08c47280592a06f97a40da2a074a714264c124c1bb9051df098d257690dad046ad28223e00c6ce0080098d2a2afdfa0a910a9d228051df0bd048223de0c0ae00800bd028223e26aa2e0080006f9ff000000368100816f81ad058228c84941e00800422110a1b6812c1927b9042cfb27bb0b0c09a0d3a00c0cc90d060100a093a098099c39ad03b841cd05dd06ed07fd04e5f5ffcc2a2d0a1df0ad02bd03dd05ed06fd0781b78149018818c841e008002d0a1df0000036610031b881ad048223ecbd01e008007d0acc9aa1b9810c0be585b1c64400a20200d2a07ba0a174a73d060c1cbd0a060300b202010c2c80bb11babab0b0f4a227123c78577a11e1ba81e79b0bf1bb81f0fa10f26712463600879b10812a81ad048228efb21718e008004631002c49979b12812a81ad0482d8028228d50c0be00800462b00b911e2cbe1169e0ab911f2cbe0161f0a82272be2a0ff821808a207a8c7684de71a4a92a17f979b44cae2e20e00e73d04cd0e4604001bccc0c074cac2c20c0080cc11cacec0c0f4d1bc81b911d79c1d81bd81b207a982289e0c0ce00800b8110c09a2a0ffa247a89247a992672ba8e72cdc176a09c79b067cddd0aa10a9e7276a0b1c8ee79b067cbff0fa10f9e7a207172ce88c6a879b040b9a9247178ce5ad02bd04ed060c0c8223f40c1de008000c021df0212a81822270ad04e00800920710661916a81166ca11ad040c0992471082224e0c0be008009207106629d0a8111cfbb79ac9ad040c0992471082224e0c0be00800c6edff0036610071b881ad058227ecbd01e00800ad058227ecbd01e0080017640f98ea0c4b2769030c021df0b0c920c9eaad02bd03cd0481b781dd058828ed06e008002d0a1df00036410081388182284ae008008c3af6d2041df0b6d2082096742020544600000c097cfd0c1a90b9a0c1be81f0bb11cabb20c374cabb20c024001c40c1bf8100aaa1cabbc20b80d0da30c0aa20d0cc1030ac83a24b801df00036410481c081616f8187924741c181d81492a145d7b909a1b9810c0b2564b1d814bd0181bd81cd038228c6d0a0f4e00800f226f471c2810c0dd26768b814520400b0b0f4fcdaad05cd010c2ee00f003d0ac60e00b1c381c22be6b2db03b21b4e0c0ab73a0ebd028226df0c1ae008000c13c61200c04ab09214011baa27198fa0a0f406f7ffad05cd030c2ee00f003d0a26130826a30526230266331ecc64a1b9810c0be55bb18226c4ad02e008008c9ab214028226dead03e008000c199267682d031df036610071b881ad048227ecbd01e008006d0accaaa1b9810c0b2558b10c021df092a4049792388227db1c2ae0080016da0798d677e9e5bd068227dc0c9ae0080056fa06917d81a1c481b2a1d8b0b4c1a20a00ba99920980a739580c7a061800c2a405c792358227db1c2ae00800bcea98d677e9a7812a81ad0482284a0c2be00800668a97bd03dd04ed0581bd81a2a4078228180c2ce0080006e0ffad02bd0381b781cd048838dd05e008002d0a1df01ca21df0812a81ad0482284a0c1be0080092caf95659f5bd03dd04ed0581bd81a2a4068228170c2ce0080086cfff00000036410061c98181c88191c781b1c68141c581316f81d1b781c22374e223aea2d30452d306f2d302f22f8f222511292d42651121cb8152d30541ca8142651db9fa926a72e90d8263aec91d626374f93d2263c51df036410061cc818d024206001c228c041df00c02c1cd811bd451ce814034900cb70c89924800724801503390b20300d24600cabbb20b00b24802a21302a248039213022248059098419248047203017248065203025248073203013248081df00036810032c287820378d1d081f688020621000c1c920200924100820201824105f20203e2020280ff11faeef1cf81e0e0f4e25104b20204b24101a20205b1d181a241020c0a920206924104820207c90de90f824103a90ba203780cd9a7b918a2c1100c6c8b22bd02a53b00bd02a1d2810c6c253b00a203780ceba7bb05c20387c24106cd04811681ad0182289fb2c110e008002d0a1df01c221df000366104b2020a81c0812abb920b0d320b0c8099119a333030f4879345fb4bad0125eeff9d04ad010c8c76ac09d20a01d249001baa1b99ad040c0b0c0c65f2ff0c0c4d0ad2c110ad033179810c0e82235140b074e0080082234aad02e008002d041df081d3818808ad02e008002d0a1df0366100ad01e5e8ffa08074dc28816d81822852ad01e008001ba10c0b0c1c65edff1df00036410082120392a21b97980ee5fcff810d818858ad02e008001df081d3818818ad02e008001df00036410082120392a21b97980e65faff810d818858ad02e008001df081d3818828ad02e008001df00036410051d481816d81317c8142287d380352687d51d381322332490541798166130c31d58192243799153264371df02623011df031d681a22437a92586faff003661008181810c2a88480c1be0080081d7811c0a8808b1d881822819b20b91e0080041da810c2921d98192440a980231db81cc8988030c1ae00800860d0066192ba1dc81c02000d22a81c02000d901c12681c02000b801c0bb20c02000b901c020009801c02000926a81c60100a1dd810c0b651db1e87227ee12b842d8d381de810c3a88780c0ce00800a254041df00036410031db8121df8129c31df0000000364100e1e081d21e40821e412add4a9d97b812ad0281e181bd03822818cd04e008002d0a1df0ad03b22e1fcd04dabb6519000c121df000003641005202038202000c06e20202d2020180ee11eaddd0d0f4625400263811ad0281e281bd038808cd04e008002d0a1df0a2020481e381c20207b2020680cc0100bb11cabbc20205887880cc11caaabaaacd05bd03aaade008000c3da0e0f4fd06e0f593f25400e06d832d061df0000036410021e58141e48131e38191e28188b3890949b32263441df000003641001df0000000362100307230206160303160b6233460514137353a50f64040f3405044c00014400033a10c0276940d3736043066c01b22f022113031413736011b222050607025a31df09c536020607026b31df000003736100c127cf47024a31df000000000444956300c021df0362100b6232f6d0250f64040f34047b52a5044c00014400033a122a00076940d3736043066c01b22f0221130314137360222c2011df08cb31df0000037360c0c121df00000000000444956300c021df0007694096203001b336245001b551df0b674ed6203001b3342c4ff62450052c501176527b664d96203007203012b3342c4fe6245007245012b5586030000000036210020522007e2c617e2d740744182a00387835a769715680378136905682379157833692532c310793552c51037640b680378138b33690579158b5527e40717e41407e4211df068034b3369054b5517e40407e4111df06213002b336255002b5507e4021df0006203006245001df016a4ff00234080b310b033c06803769721781388236067816905983370788179156843808981892532c310909681993552c5103764157813882360678169058b33707881791552c50880682027640c78134b3360678169054b556d07ba3317e40607e4181df000006203007203012b336245007245012b5507e4011df06203006245001df0000000007694043245001b551df000b684f13245001b550b44176528b684e43255002b5542c4fe860600003621003030748073117033200073117033205d0207e2cc17e2d640744176970a390539153925393552c5103764063905391552c50827640339054b551764043255002b550764023245001df0000000000002020102000000ff
\ No newline at end of file
diff --git a/ar3k/1020200/ar3kbdaddr.pst b/ar3k/1020200/ar3kbdaddr.pst
new file mode 100644
index 0000000..0520854
--- /dev/null
+++ b/ar3k/1020200/ar3kbdaddr.pst
@@ -0,0 +1 @@
+1260417f0300

diff --git a/ar3k/1020201/PS_ASIC.pst b/ar3k/1020201/PS_ASIC.pst
new file mode 100644
index 0000000..d0c285b
--- /dev/null
+++ b/ar3k/1020201/PS_ASIC.pst
@@ -0,0 +1,26 @@
+
+// Radio table TAG 
+#
+[H:S]012C
+[H:S]0018
+[H:A]B1 B1 12 00 FE 08 FE FE 01 00 01 00 00 20 02 00 
+     08 09 E0 6F 5B E7 B2 B2 
+
+// System config TAG 
+#
+[H:S]0013
+[H:S]00DA
+[H:A]C1 C1 20 02 CA 08 FE FE 67 00 00 CC B1 01 20 00 
+     FF CC 0E CC 08 00 EC FF 60 27 00 00 2F FD 60 27 
+     00 00 6D FD F0 FF A0 07 04 00 50 FD A0 07 04 00 
+     6F FD F4 FF 60 47 04 00 3A FD 60 47 04 00 89 FD 
+     F8 FF 40 47 08 00 12 FD 40 47 08 00 58 FD FC FF 
+     40 E7 04 00 58 FD 40 E7 04 00 58 FD 00 00 00 E7 
+     08 00 58 FD 00 E7 08 00 58 FD 04 00 80 67 0D 40 
+     58 FD 80 67 0D 40 58 FD 08 00 00 67 11 40 58 FD 
+     00 67 11 40 58 FD FF CC 10 CC 22 81 A0 0F A0 00 
+     32 00 02 08 0A 64 20 20 0A FF 20 20 FF CC 11 CC 
+     01 01 FF CC 1A CC 04 02 04 00 80 67 0D 40 58 FD 
+     08 00 00 67 11 40 58 FD FF CC 1D CC 01 00 00 00 
+     00 00 00 00 09 00 02 00 0F 0D 07 00 19 19 FF CC 
+     23 CC C0 49 D0 48 FF CC C2 C2 
diff --git a/ar3k/1020201/RamPatch.txt b/ar3k/1020201/RamPatch.txt
new file mode 100644
index 0000000..f2e838a
--- /dev/null
+++ b/ar3k/1020201/RamPatch.txt
@@ -0,0 +1,3 @@
+DA:00594000
+42f5
+005899000000000000000000044359009c7c58004c58990000435900008359009464580000505900800b580060589900d0185800a4425900985a58003807580000000400112000001220000010200000d01758004b255800409c0000045059008c105800f7ff0000505358004a255800d0465800d01c580010885800246058005019580014115800fffe000098545800ffffff07501e5800feff000000be020038065800385c9900f8619900b458990040599900c45d9900fc5c9900345b9900b85c9900845e9900285f99007c5f99008860990040629900f067900038639900a00858003c6899009c659900b06899009868990048649900d823580000400000a4425900180e580010a5580000fe01009856580000020200ffe0ffff0010000018135800d023580090255800ffffff030127580064255800dc26580050275800ac265800db26580098255800b866580000000010d01e5800005e02008c1d580061255800f8080000287e5800fe1d5800d0525800000e1800504a580024505900ac425900d04d5800501d5800504d580050255800e4265800c4265800d04a5800d0495800788a5800b4425900d84259006a2558005c789900a0789900d4709900ac6a9900186a9900e478990038505900b8645800d06d58003075000060799900003e00003c505900ec865800dc7a990030125800003e01004050590000180000d0925800107b9900907e580044505900180d5800647b99002c705800586f5800b86a5800dc5e580061fc000062fc000072fc000073fc000091fc0000485059000c6358000bfc000014fc000030fc000065fc000036fc0000347d5800a442590090a4580037c85ea10c9b580080400000b47f5700b06458000c645800bc7d9900547e9900687f99001c7c9900f47e9900dc5f58004480990041535345525400005525642d000000007061676528746f7574202564293a25782025782025782025782025782025780d0a0000000d0a70705f70616765282564292c2074643a25642c2073743a256428302d737563290d0a0000000000005c000050590050505900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000364100b10684a81bb80ba7bb129d0bb0cac00c0a3bccc0c241769c03a9094b99e10784d10884d26e1aa50400652902a50901658c02650d02e58702e52b02e53002a53302a58b021df0000000364100410984510a845902480449031df0000000364100a10b84810c844c298808997ae008001df0364100210e84310d84810c844803490829031df03641003d02210f84a20201820200a73304aa8887230aa110840c0be5f5b5a20201a023c022c2202020741df0364100410f8492a0ff82044c32046047e8030cc21df097930aa110840c0be5f2b532046020e6030c2c20b034b72c02206200a2a0ef92044c811184bd03822832a0991092444c0cbae00800411284dc5a822434ad03e00800ad030c2b8224150c0ce00800860300662a15ad030c2b8224150c0ce0080020e6131020000c021df020e6131020004c121df00000366100510f84cd0282052c92054307680256090e92054ca2055e0769040baa162a0d476907b2056e0bbb167b0c711284211384d114840c0ad79c36bd056d0a1c9e76ae280c0f0c1e0c08922b3ec22b3fa0991020cc10c08e8390fe83870f099d0e5659090c76463b008bbb1b660c0986fbff8115846d0a808cc056d80dad010c8c0c06bd06258e02bd04ad010c6ca57b020c1a7cfbdd050c0c104e408801981130e004f0ee11e0ff31809981e0881190ff2020ff2080ee2060ee201c9876a8310c040c19322d3f0c08b03310f033c0308983322d3e7ce2202310e022c02049838704040c19062700a703020625008bdd1bcc4623000cc6061700ad010c0b0c8c658602bd04ad010c6ce57302104e40b8110c19c80130a004f0aa11e08c11808a20908820c0bb81a0af31c11384b0aa20c0aa2050b6b0826b3ea26b3fa616107ceed22b3dc22b3cd26b3de0cc10c26b3c88b7e008000c062d061df09116840c0b979cf31c9c76ac07a2653f62653e8b5588b7a117840c19b26a7f926a7ee0080046f4ff0c090c0d0c0bcc391c2686f1fff91150fcb0822f3ee901a70813b26f3f626f3efcbc911784d2697fa2697ec608001c8dc72d1edd0f1c9ec0eec076ae1ef22d40822d41826d3ff26d3ea70f0db26d41626d4088b7e00800c6ddff8bdd86fcff922f3cb22f3db26f3da09920926f3c06f8ff3661000cbbc2a0fd611284511884710f8442a1d84042c1a2272c5a549205804aaacc39a901269309661973a901b713011df08107840cda88780c5be00800bd0a16cafec801920c041c0aa09920924c04820b0aa2a0cfba88f2080d3c09a0ff1090ff20f2480de20b0a0cbdbaeed24e10920c04a2a0fea09910924c04a20580661a0ad801c2a0fdc0c910c24d04ad02822652c11984e00800a8010cbbc2a0fdb7938d920a04c09910924a0426b907a110840c0ba5c1b5a2272c4aaaa21a03376a1f822690ad02e0080092272c4a999219039093041689f5a110840c0be5beb51df0a205800baa566af4822694ad02e0080092cabf1689f3165af3a110840c0be5bcb51df036410042a1d8510f844042c1a2252c4aaaa20a049cda26ba1b263a18267a159118849a9492098026191a26aa072619141ccbb79a0f811a84ad028828bd03e008002d0a1df0811284822854ad02e008000cfa0c0d811b84b2252c0c1e80c211e0cc204abbb21b248878b0bba0f0bb11e00800f2252c0c624affa25f361df0000036410052a1d8410f845052c142242c5a4422040427621726332226431f26531c2663192623160cd88713110c021df047620a2693070cb99713026623ed0c121df0000000364100511284ad02822592bd03e008008c4a3ca21df000000c09710f8462a1d86062c1b2272c0c8c6abba22b3a76ac58000940a0809180803456a80400194000c3a1c0ca20c26b3a26136626233d26334c264326265323666320bd04a2272cc2a1216aaacaaa0c1c254202c2272c6accb21c030c8dd0bb20b25c03822590ad02e008000c021df04b99c6eeffbd04a2272c0c5c6aaaa2da01253f0206f7ffbd041ccca2272cd2a1056aaadaaae53d0206f2ffbd041c4ca2272cd2a0ec6aaadaaaa53c0206edff000036410032a1d8410f843032c1c2242c3acc821c03d1128437682ead02b2dc01822d4bb20b21e00800560a06c2242cf11c843acce21c03d20ce6f0ee10e25c03569d040c6dd24ce61df0e20ce6922c3afc9ebc7990e034e24ce6c2242c3acc920ce6ac0926192726292e26393526493c26594366690ff21c03376f10a110840c0ba59bb51df00c0a0c1b259bb51df0822d6dad02e008001df0822d93ad02e008001df0822d94ad02e008001df0822d95ad02e008001df0822d96ad02e008001df0364100811d84820834008823e61807a110840c0b6596b592a0ff979207a110840c0ba595b5311e8442a1d84042c13a34a2037fcc6aa110840c0b2594b5a20380b64a16664a08811f848228f687b20aa110840c0b6592b5a20380d10f84b12084d22d2cb0baa0b81b4aadc84a921a03c0bbc0b0b0f417691777e914e21a20e0ee90f0ee11e72b083ce90c12924aad1df0f21a240c89c0ff11f72b0286faff0c021df0000036410032a1d8410f843032c1b2242c3abb821b36ccb8a110840c0be58bb5b2242c3abb8121840c0982284c925b36e00800b2242c3cdd3abb8c4ac20badd71c042c2ee24bad81128482284dad02e008001df0000036610031078488f3ad02e008002a4a92040acc69a110840c0ba586b5c2a1d8b20408510f84c0bbc192252cba999209041c1d37e977d0d91026bd71521202ad0288930c4be0080032020aa204082a33cb33a58bffa24300a0a841a2430192020a5088412a9952490e82490f92040ac2a0cf262901cce9d2020a2adde20d0d2c0bc0ce10060300d2020a2adde20d0d1c0bc0ce10b0ec20e24d0da20408e586ff812284bd0a8878ad02e008001df081218482284ce008003cd6d11284ac2a0c6bcd01624100822d8fa20408e0080092252ca20408b2a1d8b0aac1aa996249ad86050092252ca20408b2a1d8b0bac1ba996249ad822d4de0080088839205b8a123841b99924a38ad02e008001df03681000c4abd02611284710f8452a1d85052c142272c82268d5a44e008000b8a1698149118849a95920980261945a20404b2071827ea3c076b39ad01b2030a0c8c3abbdbbba50b028ba1b2030a0c2c3abbb2cb15a50a02ad02bd0182266a8bc1e008000cb9979a17ad0282264c0c6be008001df0ad0282264c0c6be008001df092cafc16690e8c6aa110840c0ba56eb58107840cda88781c1be008005d0a16ba0c7124840ccba204040c0999549964b0aa20a2440488579974e008008857a941e008008857a951e008000c8cd2a0d6a961b2030adaa43abbb2cb17650202b2c1100c8ca2a0deaaa46501020c4cb2030aa2a0ceaaa43abbb2cb1f650002b2c1180c4ca2a0d2aaa4a5ff010c090c4b76ab1590b4c09ad4a20dcec20bd52b99c24dcea24bd5909074b2c110d2050af2a0cf5addc20d0d3c0ef0cc10e0cc20c24d0d0c8ca2050a0c4d5aaad24a1032ca10a2ca11e5fa019ba3b2c1180c4c25fa01ad02bd058226520c0ce008001df01df00036410092a1d8d10f849092c1d22d2ca118849addc20d04aaa9276c1aa20a809c4aad02811a840c89909c20924d048838bd03e008001df0811284ad0282284c0c6be008001df000003641000c5a511284310f8462a1d86062c132232c82258d6a33bd03e008000b8a16d80892030427690c665415a11884aaa6a20a80ccaaad0282254c0c6be008001df092030366190226540856c90492c4fa56190a8107840cda88780c5be00800bd0a16ba04ad02820b0a3c09ba88f2080dc2a0cfc0ff1090ff20f2480de20b0a0c6dbaeed24e109203040c3cc09920924304822552c11984e0080066641292030447690ead0282257a0c0be008004603001df0ad020c0b8225790c1ce00800ad020c3be12584921303c20304d2a0e3d0cc10e09910c24304822591925303e00800f20304263f07a110840c0b254db58825ad02e008001df036610082120392a2be97982d31078488f3ad02e00800c2a1d8610f842a4ae20408b2262cc0cec1cabb920b010cdaa719148883ad02e008001df0811a848848ad02e008001df09206d4a2a0ffa71910ad0292166d88831b9992566de008001df0511284a20b043cd7076a30ad0ebd02822550c2040ae00800e20408dcda92262ca2a1d8a0aec1aa997249ad82254dad0ee008008883ad02e008001df0ad0e0c0b0c0cd2040b82251a00dd23e00800e2040aa2262c663e0982254aad02e008001df0b20408c2a1d8c0bbc1baaaa20a041c49a7092e0c6bcd0182258f724100a20408e00800dc2aa2262cb20408c2a1d8c0bbc1920100baaa924aad8883ad02e008001df0822549ad02e008001df0000000364100ad02511284410f8472a1d87072c132242c82253c7a33e00800ad028225310c0be00800822532ad02e0080098834107849cb962c320822415ad06e008008884e00800a203ae98830baaa243ae5659feb8a362c3289ceb822415ad06e008008884e008009203aea8a30b999090749243ae562afe8600009203ae610f848c69a110840c0b2533b5822554ad02e00800a223298c3a8884e00800a223288c3a8884e00800ad028225920c1be008008ceaad02b2262c8225727abbb20bade00800ad028225920c3be00800ac1ab2262c7abb920b04b20bad47690a82257aad02e00800460200ad028225790c0ce00800ad028225920c4be008009c0aad020c0cb2262c8225557abbb20bade00800ad028225920c5be008009c0aad020c1cb2262c8225767abbb20bade00800812684822895ad02e00800ad020c0bc2262c8225167accc20cade00800822519ad02e008001df000364100310f846111848203507112842088c056781ba2034c42c35007ea0f822734ad02e0080082262fe008001df0c1248452a0fbb81392a0fdb0d40416bd160c2ba0e104166e1a90aa10f203720c18f0f174f24372f0f883f24372883ca2434ce00800b2037265b00192034ca2437150991092434c7cfa712084c11a84b11d84512784d20b34e2035000dd23279e26e61d0ca110840c0be51cb5c11a847cfaf80ce817f0eec050ee10f6de02064600a90c5c0c460900e61d0ca110840c0b651ab5c11a847cfa981c88179088c0508810b6e806a91c5c0c4600002cac0cba822641bd02e00800a21406c817d21403c0b1e4d0bbc0b0b0e4a7bb2f812684b09ac08228fc925406e0080092a118a78902862500a12884a20ab816da080c1ab2a0ff8226411c9ce008001df0911d84920934009923e61909a110840c0ba512b5c817b824d21402b0bcc050bb10d7bb10b0adc082262eb129841baab0aa10e008009204017cfaa924f09911909074924401b659060c190c1bb2440166191fd21402c21401d79c16e20360279e10a2034c076a0a476a0782262ead0de00800811284ad028228310c0be008001df0576b5c0c4b276a4092037290b70456ab0df0991192437250aa10860b002cbc86c3ff42c360822733ad02e0080092034c47e940822734ad02e0080082262fe008001df0b0aa208699ffb0aa20883ca2434ce00800b20372a5960152a0fd4697ffb093041639e692037116d9e50ba9a243714695ffb813b0b60416dbe4912a84c02000c2232ca22993b2a1d8b0b2c1a0a505bacca24c38c0200082232ca22994ba88a24839f2232ca0e841baffe24f3ad2232ca0c0f5baddc24d3bc2232ca0a875bacca24c3cc02000a2232c922995baaa924a3da2232c909841baaa924a3e822743e0080082262fe008001df092a0ff46c8ff000000364100512084810f84a11d84820850411a8427981c9804660931b20a3400bb23e61b07a110840c0ba5f9b4c815c904460600d814e20a34660d1100ee23e61e07a110840c0be5f7b4f815f914ad028854bd03e008002d0a1df0000000364100ad02811a847cf999088868bd03e008002d0a1df000364100ad02811a847cf999188878bd03e008002d0a1df000364100512c84412d84711a84d13284b13484c13384f13084312e84a13584e13184812b84212f8422684ae268cfa26893326861f268d0c268bb62289d92288bb268a6d268bdb11a84d13c849927693742689d52688b0c04510b8461388491368492688962689e71378472689c613984721507585568065094b088191b4467983b894ba13a84a919813e84311a84f11284c13b84b13d84b26c62e22c61222f1ea22f20a973826f202963e953d26c61e13f84e26f1ec14084c26f4e1df040407447b7b346f0ff00000036410081418492a1d89092c13142849a2892227f30a910d76910e7690da143840c0be5e4b492227f30a910cc1a0779030c121df00c021df03681002901391149215931694179511df0000000364100214484a802922a32ccb9a143840c0b25e1b4a802922a326619199145848209550c029c08b22a3cc2298107eb08662c050c121df00c021df000364100a14684c02000922a85b2a400b09920c02000814784822891926a85e0080081218482284ce00800bc0aa14884c02000d14984c22aa8d0cc10c02000c26aa8c02000b14a84922a80b09920c02000812684926a8082281c0c1ae0080065f6ffdcfae14b84214484e81e9802ac0e922932ccb9a143840c0be5d6b4980292293266190c8111840c1a8228120c1be008001df00036810062a0fff14d84714c84ad02cd03212684c91152d7f942cfc0b2043132d701608bc016781382042da90107e817f2276df0dac0f14e84e217dcf0dd10f0dd11e7ad02c64500814f84a2a1d8a0abc1c150848a8a82089bcaca16580dc22c8cd11d84660c040c0c461f00d20d34b92100dd23e61d07a143840c0ba5cdb4e821679e07a143840c0ba5ccb4f11e84882192a1d89088c18afff931f20f7fcc6fa143840c0be5cab4a831a20a80b64a1a664a0ac11f84b821c22cf6c7bb0ca143840c0b25c9b4a831a20a80e15184b2043150caa0a2a1d8a0abc1c81ceaeae22e2ed12784e0ccc0d0cc10d21547d73c43e2058bbcde9152849afaf20f4c4d0b167f1f61078432a1d8303bc18153849a538a33822615a833e00800822256bd0a9203f0ad040b999243f0e00800a2054c56fafd1df0c20433679c04cd0bb24433b14d84d2a1d8d0dcc1dabbb20b5300bb23e61b02067d00ad0c82226d0c4be00800c204300c0d609cc0160927914d84a2a1d8a0acc19a9ab2093b2d0cdcebc2095300cc23e61c08e2095200ee23a61e0d8815f2296e80814180ffc0164f2f661b05c219e216bc2e0c0be1548492a1d89092c1eae9e20e8aa15584164e05e14884c02000e22e42aac9e0e034268e2e920c339ce9f205b99cefc941b96166191881568482288ead02e00800b861c8410c0d565a2e0c1a8601000c0a4600000c0aa09074e20c4b0c1a00ee23e61e08ad09c60000aac90c0a8217de0012400c1f00efa1e0882082535e820c4b912884008823e61802c67c009209b5279907f811f0f904168f0b820c5516280b92043a9cb9f815821ce4f0f1e480ffc082152df0f0e487bf088217dfe0882082535f0c0e4600000c0ecc3b92043b9ca9f815c2043af0f1e4dc5c9217e1820577909fc09090e4973807060500f815f0f1e49c5a9217e10ca8909fc09090e4973808b2443bc20430860700c20430ccfee2a1d8e0ecc1c15184eaccc20c75c24430f25361d2443ad2443b60fcc0163f101c9e671c1c0caa0c0b912884811184c2497f822830e2497ee008000c1aa2442c1df01df0f20c4a00ff23a61f0206d0ff9205b782057297b80206cdfff20c330bff56cff2920573821cde97b80206c8ffa951f22c71b961f2cff5563ff1812684822874ad02e00800b861a8510c0d0c1e86c9ffb2042d07eb409217dca21528f099119090f492535ca739138124848838a2535ce00800a09014b2042d4600000c09c20433d14e84a8010c1ee0eb20e2442d90aac0d0aa10a2676d2d0c679c02c6d7ff0c0b811184a128845c09c24a7f924a7e8228300caae00800c2a1d8b15484c0c2c1cabb0c1cb20b76b24433c2442c60bbc056bbf2d2042de2a0fee0dd10d2442d1df0d2443ad2443bb815c2042ec24430b0b1e4b25361671c7be14f84a2a1d8a0acc1eaeae20e64165e0be2058b164e0b820592f205b7873f020625009150849a9a92097f0099231669080c19c61100820573f21cde87bf02868efff217dfe0ff20f2535f920c33661970820c4a008823e61867a951b961922c710cbee7995b812684822874ad02e00800b861a8510c0d0c1e8680ff0c09dc599217dea217df90aa10a79944d2535fb253605c0e4600001c9ed2535ec691ffdcabc15184b2043bcaaa920a87bcabfc89d2443b0c0b063fff0c0906f0ff0c1b863cff0c0ec66dff0c0946ecff0c0906ebfff217e0e2a078f0fbc0f0f0e4f73eae1c9ec6ecff0c0a0648ff0c1b1b89824a870630ff0000364100811d8441268482082bb1488416d804c881915784c77c47c02000d22b40d7fd3cd7fc39ad0620c59430d3340c0b0c0e8224d40c0fe008001df00c9997971ec02000a22b40d7fa15d7fc12ad0630d3340c0b0c0c0c1e8224d40c0fe008001df0c02000a22b40c77ad0c02000926b40c02000d22b40d7fde5d7fce2ad0620c59430d3340c0b0c0e8224d40c0fe008001df000364100811d8491578482082ba14884bc08c02000b22a40c77b28c02000926a40c02000c22a40d7fc19d7f716ad0620c59430d3340c0b8126840c0e8228d40c0fe008001df0000000366100412684811d840c0c82082bc901bc780c9997932bad020c1bd14684c02000922d9c909405c09911c020000c1e0c0fd22d9c8224d4d0d03590dd20e00800c601008224daad02e00800a2a0608224d1bd01e00800915784a14884c02000926a401df03641015120842261167cfb42a0ff424110b951211184a815822246a0a141e008001c0f7158840c0662571462472a320736e20737e9e1f2473639c1d14884a1468432c780c02000d22d42d961c02000c22a9ec971c02000b22a9fb981c02000a22a95a0a764a24124915984c0200081218492298182284c924125e008000c9db15a84c15b84160a059203b4d7994ad203b5471d4422a1d8202dc1815c84caa2a20a908a85a0aab0b0aaa0a21a068a22376a268203ac0cf997981ea871b7ea19815d8488681c4ae00800a202298147840c0b8228a10c1ce0080081418492a1d8f15e84a2038fa26110f0fab0220f81f20f7ff261179092c1ed029a8891428482287f40a2c09088100c09a08983826111922116a2c118d83ac82ab81aa80a990125daffc16084b22116915f84822117922970808890c0bb10e0a811a9f19088a08818ad02e00800ed02f22116d2c118a80db81dc82dd83de5dfffe16284b16184c203acb20b90c961471b67c815d22117c0c141662d22d22110c90ee15e84e0ddb0d20d801c7ee79d498111840c2a8228411cece00800460e00980ea14e84909cc0a09910f09911b689288111840c2a8228411c7ce00800c16284b815c80cb0b141c0bbc0c14e84a16384c0bb10f0bb116572ff916484e16584c2038fd2de08b68c0206100181118482282da22110e008009166849209958c69a143840c0be552b4a205c18c6aa143840c0b2552b442470f2247356967624730b16784c22117b20b2cc24734ec0bd16784d20d2f479d08e16784e20e32471e0fb871812684a81582286ca0a141e00800916684920994471913a2c110811184b2c1148228820c0ce008004600007cfaed0aa2611ba26114b205c0c851d20110d26115c26112b0f004076b24811184a2c110822856b2c114e00800cd0ae2211b620110f205c09851926113f0f00446020062a0ff7cfc7cf8826113e7bc0cc9976247319221139987060300e997a22112b22115b24731a987b11884acbfec9cf2cefe56cf35f22115d2a1d8d0ffc1dbebeaef821ec60b88166843921ec42c7897b802c60a019d0d86000092a1d890a6c1aaaba26118b10f84f2038eb20be9d0ef11471b54815a84c9a1808fb08208f21c4d87bd44a2c110811284b2c11482283a0c0ce00800c8a1dc6a0cba0c0b811184920110822830924707e00800c8a1460400b22589b7ba0ba997d851e20110e24731d987e2038ed0ee11915e849aee820e7ff16884261802462e00a2037fb2a1d8b0aac1aaafa20a81568a0a260c02862800d2211416cd09c9a1b66d02062500a15b84920e81812684b0b9c188d8baaaa20a92e00800812684c15a84a9b1b2038ea15b84c0bbb0b20bf3c2a1d8c0bbc188d8baaaa20a95e00800c8a1f16884b62a05922114b64928f63a25b15a84a2038eb0aab0a20af3e54bffc8a1f16884bc2ad8b19d0db62d05e22114b64e02b63923d16484916984a22115b2a1d8b0aac10c1baa99b24d161c0a0c0b88d9b26114a0882089d9e16684d16a84e20e969205c3661e44261941c2037f479c02462500815b8492a1d8909cc18a8982086a564808faa9a20a81661a7cb16784b20b3b163b07424731c2dd030c097cfd924c15924c16d997d987061f000c2d66197a0b8e16f81fc2037f409cc016c919a15b8492a1d8909cc1aaa9a20a6a56ba18a16784a20a3b162a18fa99b2097ff63b02c65d00e205cec0eec016ee160c0ff2497f424731b165840c0a7cf889978987a24b41a24b434665000c9a0c0b811184922115822830924377e008000c09c164840c1aa24c15924c16924c1622611c22038eb6a20aa143840c0be520b422038eb22589815e8422470f8082b092087e92470ea20881915f8482087f8261199229708088909088a08808a2611ae00800911d849209342d0a009923e61907a143840c0b651cb4b16284a815a91b471635c22118b16184c20c80b20b90ec6c471b24c2211ab71c1e679c1bf16a84e16b84f89fe29e8d816184f7be0a820898916a841b88824918cc520c0a0c1be517b492038f479902c6d5ffa2211ab22119a59dff48c1b22117d22111a2c11881478422211c8228bdcd02e008009203c407690d812684a81582288da0a141e00800b22584260b14815f8498f18228709a888828ad02e008007cf9994726b414915f84a8e19229704084909088a088287cfbe008001df0268c640c9aa71c65b2ccf656cbbb624d2c86edfe92a1d80631fff16184e16c84f20f98e29e98f7ae0aa16a840c08824a18c69eff0c8a0c0b811184921564c205cec2436fd09920822830925564e008000c09a165840c1bb24a41924a43e165840c0dd24e4346a0ff624e4106d7fe62491586d5fe0ba9560ae756d8e6c9a1e11184f16984a2a1d8822115b165840c09924b43a088c1a164848afff9d1924a16f20fdae22e30261f020623000c8a0c0bc21564f205cef2436fd0cc20c25564e00e00624731d8a1b165840c1ac22113c987a24b41a8d1d997920abf821a101b99909074924abf973802867fff98d19209be2629052619025609dfb8d10c0aa24bda8679ff82a1d88086c1d20e728a8b82611882087f80ddc016cdbca16984d164840c1bb24d16aaaf1c0b0c0d98dad26114b0992099da86ebfe0c9a0c0bf22115f24377e00e00c164840c1b822112922115a22114a9979247318987b24c154662ff000000366100a16d84c20200d20201e20202f20203b16b84920204b21b8f99018202058911a514ffad02912084bd03981981628490914199088828cd04e008002d0a1df0000000364100811d84820834008823e61807a143840c0ba5f4b3a16e84c16a84bd02e88cc2dcd2c81cd12784e0ccc0d0cc10dd03650fff816284ad028838bd03e008001df000003641008162848848ad02e008002d0a92a0ff971a0fb16f84c2a1d8c0cac10c1acabba24b801df000364100217584c17084617184516284917284817384715f84312684722770b2d303d2d30282636ca2d307817484999ae22db3e935626b73d22db492d304826910d925c26b7469874223f249452263f21df000000036810082a3eb9205019941879415ad05815684b2a3f28228eb0c0ce00800dcaa0cc21df0ad02bd03cd04dd05817684ed068808fd07e008002d0a1df00c2abd020c098177849906822814c20303e00800a22312b17884d7ea7eb21b11b0b004167b0a8156843c3a8228dcbd03e00800167a098156848228db3c3ae00800169a088156843c4a8228dcbd03e00800169a078156848228db3c4ae0080016ba068156844c0a8228dcbd03e0080016ba058156848228db4c0ae0080016da04ad0320b074ed07fd040c1c81778459018228afdd06e0080028061df041778498412caaa7196c2c3cc719670c5aa906d20301263d658224d1bd03e00800cd02dd030c1a822451b806e008000610000c2abd02c179844177843bd382241e0c8ee0080081228488d81c6ae00800d2a08cdad39c2aad02bd03fd07c2a07282247fed06e00800c601008224e6ad0de0080028061df00c020c0999061df082243ead03e0080006faff0000364100217a8431778481768442238d490822638d1df0000036410092a200a17b84c02000817c848808926a9ee008001df0000000364100217e84317d84817c8442232549082263251df00000364100417f84883421808407e805c0200032229c8181848808e00800983407e917c0200032629cc02000b18284a22294b0aa20c02000a262941df00036410021848431838481818442232349082263231df0000036410081858488289768098186848808ad02e008001df0003641002188843187848186844803490829031df03641000c0ad1898482a00ac20204b2020380cc11c0bb80b0b0f4c18a8476a81ea02a90a02211cae2e21e7fda22b79e09003a2366030d0c221df01baaa0a0747cf386fbffb20201664b3de6730d812684a202008228450c1be00800a2a3fe0c0b0c2c818b84d202008228110c2ee00800bd034bd20c4a817784c1798482281e0c4ee008000c021df00cc21df0368104718c846122840c0ff25100e2020a818d842aeefb4e920e0d320e0c8099119a333030f48083c016780b818e84918f848083c016380c9093c016290da19084b19184a0a3c0163a0eb7130e8192848808ad02e008005d0ac62000ad04b2c11082267ecd01e008005d0a72a0910c09926184ad0350b0740c0c818c84d2c1108228510c0ee00800ad07719384b2c110822749c21100e00800922184ac99ec75d21100a194849cfda0a3c016ca0cb19584b0b3c016cb09c19684c0c3c016bc0ce19784e0e3c0160e0af19884f7930582274be00800818c8482284aad02e008002d051df0b20e0ead04c2c11082267cdd01e0080072a0610c0546dcffad04b2c11082267dcd01e008005d0a72a06206d7ffbd04c2c110dd01822685a20e0ee008005d0a72a0920c1992618406d1ffad0425e4ff0c0cd2c1100c0e4d0a822751ad0340b074e0080082274aad02e008005d04c6e2ff920400ccf9a20405b2c1108226880c3ce0080086d7ffd0a074b2c1108226880cbce0080046d3ffd0a074b2c1108226880c2ce0080006cfffd0a074b2c1108226880c5ce00800c6caff000000364100618c848226310c7ae008007d0a8226310c7ae008005d0a8226320c7ae008009199845ab4baaa9219613baaa0a0f4a7b907a19a840c0ba5a0b37a748122843b77888870a0f4e008005d0acc8aa19a840c0be59eb31df01b84d20a0a92a0ffaadd224d0e924d0c824d0d8c73bd03cd04fbad65350021078472550288d20c7ae00800bd0a8892ad05e00800822640ad05e008001df000364100518c848225310c7ae00800919b849229a24d0a5629088225310c7ae008006d0a8225320c7ae0080091998430b074bab692195fbaaa2baaa0a0f4a7b907a19a840c0b6596b34a438122842b44888840a0f4e008006d0acc8aa19a840c0ba594b31df0d20a0a82a0ffaadd824d0c324d0d8c72bd02cd03ebada52b0021078442560288d20c7ae00800bd0a8892ad06e00800822540ad06e008001df00000364100618c848226310c7ae008008122843b4a888840a0f4e008003d0a161a055144840c1ba20a0a1c0c3aaac24a0cb24a0d224a0e9805219c8498e942530227992341078488d40c7ae00800bd0a8894ad03e00800980598e9279909822640ad03e008001df0819d84bd0388880c4ae008001df0366100518c848225310c7ae0080056620a8122840c3c0c25405c9388885aaa2baaa901a0a0f4e008006d0ad14484e20a0a0cefaaeef24e0c524e0dd80d719c84d8edcb5e779d0b812284822826e00800161a080c1992450220a841224503a245045b558c343245001b550c7a318c849801822331925602e00800214484cd0a0c0bad05e52b00a802a8ea779a1c21078488d20c7ae00800bd0a8892ad06e00800914484980998e977191d819d84bd0688880c4ae008001df0ad02819284bd038818cd04e008001df0818c84822840ad06e008001df00c0986deff0000366100ad03b19f840c4c1c88919e849901825400e512004ba3b1a0840c4c651200812284ad0182283e8bb3e00800214484eba30c0b0c2c2c1992430cc2430d652200c2a0b8b802a2c310cabb0c4c650f00a2c3110c0b0c3ca52000a2c3150c0bd8020c3cd20d59d24314a51f000c021df000000036410031a78491a584a1a484f19284d1a28441a684812284c1a184b1a384b9ac426813d99c222814e22886e90f926886291fa2681421a8842263101df00000003641001df00000003641001df0000000362100b6232950f24040f34047b5165044c00014400033a13df07694083732023022c03031413732023022c01df00000cc53000000444956300c021df0000000007694096203001b336245001b551df0b674ed6203001b3342c4ff62450052c501176527b664d96203007203012b3342c4fe6245007245012b5586030000000036210020522007e2c617e2d740744182a00387835a769715680378136905682379157833692532c310793552c51037640b680378138b33690579158b5527e40717e41407e4211df068034b3369054b5517e40407e4111df06213002b336255002b5507e4021df0006203006245001df016a4ff00234080b310b033c06803769721781388236067816905983370788179156843808981892532c310909681993552c5103764157813882360678169058b33707881791552c50880682027640c78134b3360678169054b556d07ba3317e40607e4181df000006203007203012b336245007245012b5507e4011df06203006245001df0000000007694043245001b551df000b684f13245001b550b44176528b684e43255002b5542c4fe860600003621003030748073117033200073117033205d0207e2cc17e2d640744176970a390539153925393552c5103764063905391552c50827640339054b551764043255002b550764023245001df0000000000102020142000000ff
\ No newline at end of file
diff --git a/ar3k/30000/PS_ASIC.pst b/ar3k/30000/PS_ASIC.pst
new file mode 100644
index 0000000..960da12
--- /dev/null
+++ b/ar3k/30000/PS_ASIC.pst
@@ -0,0 +1,59 @@
+// based on 1, change DVDD=0.85V, LPO measure time to 8ms, 1300ms reCal interval

+// Radio table TAG 

+#

+[H:S]012C

+[H:S]0042

+[H:A]B1 B1 12 00 02 00 01 30 06 00 02 00 00 20 02 00 

+     04 00 0C 40 01 00 48 00 00 48 54 9A 02 00 00 08 

+     02 00 48 00 89 EE 70 E6 38 00 D8 70 EF 52 02 00 

+     00 40 00 00 08 00 31 00 00 00 04 00 10 00 00 00 

+     B2 B2 

+// System config TAG 

+#

+[H:S]0013

+[H:S]009C

+[H:A]C1 C1 17 02 02 00 01 30 48 00 0E CC 33 06 01 08 

+     64 96 14 05 FF FF 05 80 00 00 FF CC 00 CC 01 00 

+     20 80 FF CC 02 CC 04 00 DF EC 43 F8 00 21 00 E0 

+     FF CC 03 CC 06 00 80 F0 08 28 80 F4 0C 20 80 F8 

+     0E 18 80 FC 14 10 80 00 18 08 80 04 16 00 FF CC 

+     04 CC 01 00 1A 12 40 96 01 C0 28 00 00 00 C0 01 

+     40 06 00 01 00 00 C8 00 00 F0 00 00 FF CC 0C CC 

+     08 00 01 03 00 7E 08 08 00 7E 01 01 00 7E 01 03 

+     00 7E 03 03 00 7E 61 63 00 7E 63 65 00 7E 6A 6C 

+     00 7E FF CC 09 CC 00 C9 FF CC C2 C2 

+//Extern 32k + 24Mhz CPU

+//#

+//[H:S]0021

+//[H:S]0004

+//[H:A]09 00 00 00

+//Bdaddr

+#

+[H:S]0001

+[H:S]0006

+[H:A]89 60 41 7f 03 00

+//Audio

+#

+[H:S]0002

+[H:S]0004

+[H:A]23 08 01 33

+//Audio

+#

+[H:S]0003

+[H:S]0004

+[H:A]dd e5 2e 00

+//Audio

+#

+[H:S]0015

+[H:S]0004

+[H:A]12 00 00 00

+//Audio

+#

+[H:S]0016

+[H:S]0004

+[H:A]00 00 a7 02

+#

+//PLC

+[H:S]001F

+[H:S]0008

+[H:A]01 1A 06 14 50 B4 32 96

diff --git a/ar3k/30000/RamPatch.txt b/ar3k/30000/RamPatch.txt
new file mode 100644
index 0000000..795cccc
--- /dev/null
+++ b/ar3k/30000/RamPatch.txt
@@ -0,0 +1,2 @@
+0569

+000000000e20000050800000000158000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000d0915300d4915300d8915300dc91530098b0530064ce5300f8d2530008e7530008d253000cd2530098d95300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ff051001010101ffffff50500101010180019800c8019800f4029800d0039800380498001404980024059800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000366100ad0581c206bd01e00800bd0a17641c0c0abd05815d080c0ce00800bd02dd03ed05815c080c0ce00800c60400ad05c1f802922b11819903c09920926b11e008000c021df0003681001c0e516d030c0720d074d241107911d0cd90b805a0cc11cabbb90160e6030c2a609034972a026062003801e2c1102203068d07cc8260e613102000fd061df072631122011072434fc805204290a044114acc882c0c1980a00407e805820c4b07e8079c7aa20c4b07ea12a2c3340c0b0cfc0c198191029911e008000c1972434ec805e8114acca82cd20c4ba0a00416aa0590fd20f24c4bcc4e820349f65878a1b1039805a20a034a9992990980aa01a0a831909821809901909831a7294a0c5a81bc04bd02e00800cd0aad0281be04e805c0b0744ace920c4b0c4dd09920924c4be008009c7a72434a860400ad020c4b81bf0492a0fe909d10924c4be0080060e613102000ad061df00c1a81bd04bd02e00800cd0a46ecff0c5a81bd04bd02e00800cd0a86e8ff0000368100305074bd0120407481c206ad04e00800922a11216d0390920516890ba18804b16e03c0200040349091f204a03311822992c02000b08810a08820a8028269923aaab20a49d2ca48579b08c20a4bc0c204161c08b24a4ae1d104524d01eae5f20e7fe20e803c29f7be4a1c0b424110d9111c0c1c0f1c0552c110fd05cd0580e6030c2e80d034d72e02806200bd05b20500c20500a802c0bb90a0bb11baaa924a3480e613102000420500d811403490520d01a03311ad04b20d0081c204cd05e00800a802b2a0fb3aaa920a4b0c12b09910924a4b1df00c021df0364100811e0621c0098808921207ece8ecc9e1b103b21206a21ef1b73a210c0a817c03d21ef0c1d603f16c03c80ce20f44a0bd11e0bd93d1d209e00800a252071df00000364100817f04916c03880892092880801466180acc79810d04a2a064e008001df0000000364100c02000c16c03e1940391d9032178030c0dd2628bf20902c02000f0ed83e2628cc02000d2628dc02000d2628e820c43b20c28d19d0210bb01d0bb10cc580cba0c53c600000c0a0c83c020000c1dd2628fc02000a2628ac02000b26289a209020c088cfa661a040c1ac60300662a05a2190026ca040c0a8607000c0af0ba01e1da03a2090ce0bb100c1ea0ae93e1f40230aa11e0aa10b0aa20b1fd03c02000a26bc1f209020c18f62f040c098604009209070c1a909a930c2af09911a09910d09920c02000d17f04926bc6d80de20c28d0d014661d0acc7e810d04a2a064e00800c020003262881df00036410081c305c1900920b074e19605d16e09e80ec02000d22d82b94ed92ec02000b90c30e6030c2a309034972a02306200e00800c02000fd0391250382a10082698000710030e6131020001df0
\ No newline at end of file
diff --git a/ar3k/30000/ar3kbdaddr.pst b/ar3k/30000/ar3kbdaddr.pst
new file mode 100644
index 0000000..0520854
--- /dev/null
+++ b/ar3k/30000/ar3kbdaddr.pst
@@ -0,0 +1 @@
+1260417f0300

diff --git a/ar3k/30101/PS_ASIC.pst b/ar3k/30101/PS_ASIC.pst
new file mode 100644
index 0000000..9cf24b7
--- /dev/null
+++ b/ar3k/30101/PS_ASIC.pst
@@ -0,0 +1,70 @@
+

+// Radio table TAG 

+#

+[H:S]012C

+[H:S]0042

+[H:A]B1 B1 12 00 08 00 01 30 06 00 02 00 00 20 02 00 

+     04 00 0C 40 01 00 48 00 00 48 54 9A 02 00 00 08 

+     02 00 48 00 89 EE 70 E6 38 00 D8 70 EF 52 02 00 

+     00 40 00 00 08 00 31 00 00 00 04 00 10 00 00 00 

+     B2 B2 

+// System config TAG 

+#

+[H:S]0013

+[H:S]009C

+[H:A]C1 C1 17 02 08 00 01 30 48 00 0E CC 33 26 01 08 

+     64 96 14 05 FF FF 05 80 00 00 FF CC 00 CC 01 00 

+     20 80 FF CC 02 CC 04 00 DF EC 43 F8 00 21 00 E0 

+     FF CC 03 CC 06 00 80 F0 08 28 80 F4 0C 20 80 F8 

+     0E 18 80 FC 14 10 80 00 18 08 80 04 16 00 FF CC 

+     04 CC 01 00 1A 12 40 96 01 C0 28 00 00 00 C0 01 

+     40 06 00 01 00 00 C8 00 00 F0 00 00 FF CC 0C CC 

+     08 00 01 03 00 7E 08 08 00 7E 01 01 00 7E 01 03 

+     00 7E 03 03 00 7E 61 63 00 7E 63 65 00 7E 6A 6C 

+     00 7E FF CC 09 CC 00 C9 FF CC C2 C2 

+//Extern 32k + 24Mhz CPU

+//#

+//[H:S]0021

+//[H:S]0004

+//[H:A]09 00 00 00

+//Bdaddr

+#

+[H:S]0001

+[H:S]0006

+[H:A]89 60 41 7f 03 00

+//Audio

+#

+[H:S]0002

+[H:S]0004

+[H:A]23 08 01 33

+//Audio

+#

+[H:S]0003

+[H:S]0004

+[H:A]dd e5 2e 00

+//Audio

+#

+[H:S]0015

+[H:S]0004

+[H:A]12 00 00 00

+//Audio

+#

+[H:S]0016

+[H:S]0004

+[H:A]00 00 a7 02

+#

+//PLC

+[H:S]001F

+[H:S]0008

+[H:A]01 1A 06 14 50 B4 32 96

+//Sniff Recovery

+#

+[H:S]003D

+[H:S]0018

+[H:A]A0 0F 00 00 00 08 00 00 0F 00 7D 04 E8 03 01 00

+     01 00 01 05 00 02 1F 01

+//BRM Config

+#

+[H:S]0026

+[H:S]000C

+[H:A]01 20 46 01 0F 02 28 14 01 28 68 01
\ No newline at end of file
diff --git a/ar3k/30101/RamPatch.txt b/ar3k/30101/RamPatch.txt
new file mode 100644
index 0000000..4ccaa17
--- /dev/null
+++ b/ar3k/30101/RamPatch.txt
@@ -0,0 +1,2 @@
+21c7

+000000000e20000050800000000158000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000d8d5530024e7530030e1530060e15300ece1530070e353008ce4530054e1530088e1530040af530088e353008ce35300d4e25300d8e25300fce253003ce3530024e3530054e3530030dd530024b0530078d553000000000000000000000000000000000030d553002ca05300000000000000000000000000000000000000000080019800d80198006c029800ec049800fc0698005c0898009c08980020099800cc099800340a9800340b9800b00b9800700c9800e40c9800580d9800c40d9800300e9800600e9800380f9800d00f9800541198000000000000000000000000000000000084189800501b98000000000000000000000000000000000000000000364100813a03416f0382085148041618040c13bc040c07613b030c02680676942252a1085052821b225a564205062020742654052634026644079205bf1769011b773df04600000c077048c00c024023831df00c021df000364100569208c0200021ce0991f3020c04426992c0200042699398128d04ed0916c9063d09a802c859b809b912a90999028c9ca21e06b82ee00c00860300a21e088bce5c0b81d6020c8de0080098120c4bbcb9c1f302d819c02000ed0cd26c90dd0cc02000426c93c02000a812b26c92a81ac02000b22c910c0cb0bac0a61b04e813a79e0ac0200081f3020c1ff268931df0000036a100a2a0dcbd01810c030c1ce00800a2a0d24bb10c4c421202521201612d0782010092a0d49088827202008a26220280810c030c16e00800313d030c09a203005981076a1690b9a030bba0b21b0407eb0c1b9990907416b9fe4600000c196619040c09c600006d090c19cc290c121df00c2c7951810c03513b03b2a108b0b282b961a8050c02225104baaaa20a1db2a0cdbaaa8bb1e00800721104810c032931a80560d6a0303da0b2030ec2a108c0bb820c4cbaaaa20a1db2a0c8baaacbb1e008008bb10c2c810c03225104a805f831d2030ee2a108e0dd82f971daaaa20a1dd2a0cddaaae00800621104cbb10c4c810c03d861a8052931daaaa20a1dd2a0c8daaae00800e851c831e0e104161e12bd04a13c0381ef02a0ac10e00800d20315b871e881a0f4c0a811faeee040f4b0aac0b20310a020f4d09bc0c2c9feac7df13a03168c0f662c1ff20f539c9f52030e82a108805582813b0388085a88820879513b030b8816880da0f0f4e0a0f4f79a2f0c121df00c0277b60c6097c097bb062bbab794010c12d805e2030ef2a108f0ee82eaddd20d79cc4d82ccfe16d8081df0b941f991d9a1c9b1ba9af7a91a40a2c081b503b841e00800c8b1b841d8a1b08a82f8918a444040f4b941d9a1c9b1ba9f47a91820a4c081b503b841e00800b841c8b1b08a82d8a18a222020f447b204ba222020f4b7b209ba22ba444040f42020f4b092c09084c01658f620a4c016faf59aada0b4c0167bf5b66c404bcac7b40206d3ffd2c2fc47bd02c6d0ff0c021df0ad0c81ef02bd04e0080086b7fff20f53cd09d2cdfed0d07416bff1f66d0246c5ff2bc9d2cdfed0d07486c2ff1c4b673702c6c3ff70e6c0e73b0286c1fff2c2fef0f4c056dfef0c1286beff000000368100815308324114e008003d0a815208ad02e00800d1540837aa070c0aa25202860000a21202c20114daccc20c00921203a0cc827ce4b2cc1fc0bcb3b0b5211bbb40bb10b252019c69815308e008008ceab21203a21201baaa1baa40aa10a25201a13d03720114c20a000c09076c169089a0a088a082180407e80c1b9990907416b9fe4600000c19313b03513a03d2a0c86619070c0b9201004600000c1b9069a0a066a0bcfb0c4c81e905b803d2060ee2a108e0dd82a2a0c8dabbb20b1dd911aaab50bba0e008000c2cd811b80381e905dabbb20b1da2a0cdaaab50bb90b2cb10e00800d2a0c8812d0792a0d4907782b8037a7872078082a1088077820c4c7abbb20b1d81e905daab50bba0e008000c2cb80381e9057abbb20b1da2a0cdaaab50bb90b2cb10e008004bb6a2a0d281e9050c4ce00800a2a0dc0c1c81e905b2c114e00800312e03815508ad02e00800309ac056a909c21201a21202e20114b154080b9e1bdeba8e820800e0d993d0d074a08882dabbf20b00e2c81fa0ff8280e8b3e0e5211beed2cf1ff0dfb340ee10e0e0f4d0d5211bdd40dd10d0d0f4e7bd2582ccfe8080f4825201920b00a09982f2c91f90f9b3f0f5211bff40ff10f0f0f4873f830609002b9c9090f4925201e20b00a0ee82d2ce1fe0deb3d0d5211bdd40dd10d0d0f4d7b902c6d6ff0c0aa25202815308e00800dc1a91b706920907809901909831cc390c0aa252011df00000366100814d08ad02e008000c0541a50862a0d4606382a212016a44b2048a6d0a8cdb261b0b262b52212e031df02d0b1df0b21202821484921483b73837973b34c2cbfea72c1b81ef02e008009c2a815308e00800ccaa81ac07e00800cc2a0c021df0bd03815808ad02e00800b2120292120156bb0d52448a06ebffa13d0352448a920a0072a0cd0769189d0590b9a0a0bba0b21b0407eb0c1b9990907416b9fe4600000c19313b03d2a0c8513a036619070c0b9201004600000c1b9069a0a066a0bceb0c4cb80372060e82a108807782a2a0c87abbb20b1d81e905aaab50bba0e008000c2cb80381e9057abbb20b1da2a0cdaaab50bb90b2cb10e00800d2a0c872a0cdb80342047482a1088044820c4c4abbb20b1d81e905daab50bba0e00800b8030c2c4abbb20b1d81e9057aab50bb90b2cb10e008004bb6a2a0d281e9050c4ce00800815508ad02e00800a020f41df06099c05659ed52448a06c0ff00000036c1002241003241014911592169317941a2a0de0c1cb2c12022412081e90592211ad20164e22118e951d241189971e00800810609ad01e008002d0a1df00000366100a2a0debd01810c030c1ce008004202030c0761590782a0d48087828a66a2067f920100664a1ef6791b817e03c2166aa21669b20202caaab0aac0bd04e00800cc2a1cb21df0520206820202ac45b6352292166962166a0c239a668066c030a6c0817e03bd04e00800165afd2b333030745733e91b777070746697960c021df000003661000c03ad02a901b15907c2a0d4c0c382cabbc20b7f664c22c801d801721b6ab21b69d21d02c21c015d0dd7b7015d077795392d0b6d0c7d0d060d001b333030746693c30c0351cf0642a0ff30b3a050bba0820b00471809814c08a801e00800fc1a1b333030741613fec60d002d0c6d0b0c14bd0540a78281ef02aaa620aac0e00800dc3aa2a06481b503bd04e008001ce9a7b904212e031df01b444040746694d086e5ff0c021df00000364100ad03bd048159080c0ce00800ad058105070c29d21314f10905e8d30c4c0c0bb24316c24301f0ee10e9d3d25501c2132bc25503b24500924504e00800d22311877d17e203c4076e11bd04a2a4300c2cd2030081e3060c3ee00800815008ad03e008001df0003661004081040c0aa25100165808d172085c5ec20301b2030080cc11cabbb0b0f4a0ca90d0cca0f21c021baab79f5bd21c01d25100e2a410e0ebc0166e09f2a411f0fbc016df0882a42c808bc016480892a42d909bc016b907a2a3fda0abc0162a07c2a418c0cbc0166c050c1abd058175080c1ce00800a0a074bd02ed050c1c817408dd01e00800860c00a0a074e79a8f06e8ffad0581da062bb1e00800167a04c20a11b20300376c413c99979b3c81a50592a0f7909c10924a11e008000c021df0bd02ed050c0a0c1c817408dd01e0080006faff60a074bd02ed050c1c817408dd01e0080006f5ffb20300ad02cd03dd05ed06818908fd04e0080086efff00366100612d0782a0d48082828a66f6721481bd05a206a8e00800816108e00800a24301a2440c81a3080c19f20300f24100e20301e24101d203020be5e0e993d24102d20680c20303c241030c2cb20307b24104bd01a20304a24105a2a410e00800b1b70291b302822631a2262d908820b0aa20a2662d8266311df000368100612d0782a0d48082828a66f6722281bd05a206a8e00800816108e00800bd0aa24301921402a13503b2440ca09920925402220300224100f20305f24101e20301e24102d20302d24103d1b702c20303c24104c2262db20306b24105b1b302a20307d0cc20dd01a24106a226319203089241070c19b0aa20821305824108721305b2a42c70784172410942130642410a22130681740820284122410bf20304f2410ce2030ea26631c2662de2410de206801c0c0ba5a0a993e008001df0003661002060f481a408ad06e008002d0a26e61192a06d97160ba2a081a71605b2a06eb7960262a410624100424102bd010c2c0c190be582a0d460a841a24101808382e0e993312d07a2a3eb8a33811b07d20380e00800c1c203b2232dd223317cfee0e230e0dd10d26331c0bb10b2632d1df000003661002060f481a408ad06e008002d0a26e61192a06d97160ba2a081a71605b2a06eb7960262a42c624100424102bd010c2c0c190be582a0d460a841a24101808382e0e993312d07a2a4288a33816e07d20380e00800c1c203b2232dd223317cfee0e230e0dd10d26331c0bb10b2632d1df000003661002060f481a408ad06e0080082a0d480838231a5082d0a8a3326e60592a06d97960262a4108c959203850c1aa09920924385625100a2a3eabd010c2cd203740c190be4811d07e0e993e00800b1c203a2232ac2232e7cfdd0d230d0cc10c2632eb0aa10a2632a1df000003661002060f481a408ad06e0080082a0d480838231a5082d0a8a3326e60592a06d97960262a42c8c959203850c1aa09920924385625100a2a427bd010c2cd203740c190be4811d07e0e993e00800b1c203a2232ac2232e7cfdd0d230d0cc10c2632eb0aa10a2632a1df0000036410081610341b70691b40852a0d45052825a4451c2036224893224859066105033108066106264893264851df0000036410081a408ad02e0080091b706b2a0d4b0b382ba99922989a70909f6733756d5060c021df0f6734b5655ffc21402c0d014c0c20416dc08ad02bd0381b5082c3ce00800c60200ad02bd0381b6082c3ce008000c121df05675fc92140290d014909204160905ad02bd0381b5082c3ce0080006ebff1695fa92140290d014276926ad02bd0381b5082c3ce0080086f0ff92140290d0142769adad02bd0381b5082c3ce0080086eaffad02bd0381b6082c3ce00800c6e6ffad02bd0381b6082c3ce00800c6d6ffad02bd0381b6082c3ce0080046dfff0000003661000c0351a707cd02c91181c606e00800b2a0d4b0b3825a4b921450a099c016590672048581a80721b70662a1e02a2b6a62ad06e00800ad06b2145181aa072901e008009204852d0a771916a2a412d204780c3e81a907b801c2a1edcabb0c2ce00800d811e20484d7161c271e19224484d20478a2a4130c3e81ab07b801c2a1eccabb0c2ce008001b33303074d2c3f6567df71df0000036a100ad05bd0181da06225108e008007d0ac8da21bc03d19b02f13704e1c103176431b21108d70c02c63500922a11d0ac20a9d7f099209267118201000c1fb678028626000c0f20c920e0da20d9d7c26711862200d78c28922a11d0ac20a9d7f09920926711820100cd0af67802062900e0ca2020b920b267110c02c9d7460200e0fc100c1d0c02f02d838207014109056638420c7a812507bd07e00800bc3a8126070c7ae00800ac9aa21301b21302512e03a7bb6481ef02e00800817b08a25301b20100ad03e0080050aac00c19a09583861400c8d71ca240bc10b9d71df0ad0fdd03ed058174080c1ce00800860300bd07cd03dd02817d08a20100e008000c021df060a074dd03ed058174080c1ce0080046faff0c12c6dbffad03817b08b20100e008009d0afcf9ed02a2a3ea0c2cd20700b2c110811d07f207110c2990ff20f24711e00800cd03bd07817c08a21302a2572b92130192572aa20100e00800b8d740bb10b9d706e5ff50c9c056fcf7ad0798d781500840991099d7e008002c021df0364100c16d044c49a2a108813b03a0a2828808718403aa88820824a13d038088a0a088a08208137827908882b1c1048a778817216c039858a848904b457054a058656838ac4560d4b0d81d576d1de2050620d9105a5e8b55270910b0f510f71d0a204510c039104033203958a04b457054a058656084b0ac558818576821881762050678485a568b55206710270710b0951097160a20b510c0a710b0aa20a9481df0000036610056720e0c0b5c8c213a0381ad02ad02e0080082a0faa2a0f092a1e02c8b0c1c4c6d2c0e0caff24254e24243d24244c24224c24226c24242c24245c24246c2424ab25217b24248b2424b925219a2521882521a81e905a2a1040c099901a252265c0a1c4bb24249bd010c2cc242470c4ce00800813e03a2a0ffe00800818c0320e6030c2a209034972a02206200e00800818d03e00800818e03e00800818f03e00800819003e00800819103e00800819203e00800819303e00800819403e00800819503e00800819603e00800819703e00800819803e0080020e6131020008199039d02e00800819a03e008001df0364100cc3322a0641df00c0c0c0a769306a752011bcc1baabd03a2a06481ee02a0ac82e00800a020741df000368100c1a502613b0342a108404282680632a0a84a663a369206bf52262c67e913a21c2582a0808089201baaa25c258246bfc60400921660b206c20c1a001b4000aaa1a09920925660a2130c0cab92031a8178051b9992431ae00800a2431ba2031a0c07b69a0572431a72530c724316724338817905ad02e00800ad02817a05bd03e00800a2165482263bd13c03913b03c16c039809e13a034a99b2091d92292ce0bba0b80b780eb099c0c099109a77707141d077108077c0d07710f07711a7b7017d0aad02bd07cd010c0d81b8035941e00800d13a03b13b035d0ae80bc135034aee920e79f18103ec090c09b62a0582cafd56d80ea21d1ae20d29aacaa2ca14e0ac83a0a0f4a25100463600262a05264a02665a46ad02b21100817b05c13a03920e1dd22e2cc0e9a0e80ef2263be0ddc0e16c03c80ce0dd10daccd13c03c0c141d0cc10f0ccc0d0cc10f0cc11e00800b13b03c13503d13a03f18103880b1c0e4a888208bfa81f27e825f1a502921f261b99925f26c78a32a20d2c47ea2ce09a20817903924d2ce00800b13b03860600c78a17a20d2c476a1181790392a0ef909a10924d2ce00800b13b038841e80bf1c1024aeec20ebfd2a0fbd0cc10d82ec24ebfc2a0bfa80bf0dd204aaa920abfd92ec09910924abf28230c1a8022c0202a931df0a21100881f9911f7e80fc2165477bc09e20d29cc3ef2a4e2f911bd074bc18bd181d703cbe1e0080066550b8ba1cbb181d6034bc1e00800a8214c4cd831b81181c703dabbe00800b13b03c13503d13a03f18103a24316c6c7ff00000036a1000c067cf849612971dd03d981213b0342a0ff8991890191b703a802520904b2a10840e5c016ee0bb0b58272a0a8baaaf20a797a7a661f19c20ae09c3c818405ad05e0080098a70ba9167a1cb2c9fe161b1c817c03ad05e008004bc1dd01bd0a3d0a817d03ad05e008006d0a0b9a169907166a07a2cafd16ba1fb2c6fe163b19264602665654818505ad05e00800461200a2970a817e03b20712e00800cc3a0c0aa2570ac802d2a108d0d5821c0edaccd20cbfb62602c69a00e0dd200c9a0c0bd24cbf714d0381ae0352474be00800a1b7030c19924a050c0bb991c2c6fc165cf3d2c6fb16fdf228911df0b20716d802c2a108c0c582e13a03caddd20d1da827e0dda0d80df16c03d0eac0f0ee10e73b02c63f00c931b09ac056a617e20738e0e9c0ad050cbbd0cec0d16c03815705d0cc10e00800ed0ae951167a0db14d03a20b5a818605b0aab0a941a20a03e00800c2cafed851c901d73c02862d00913a03e871d831524e00c8028851daccf20c1da088c090ffa0f80f2ba88aff816c032bff80ff108881e13d03f908fd0ae20e00f991e0e004562e06f841f20f01661f5af65a57814d0382087c56e804d20cbfb2a080b0bd10f63a10c2a080c78d55d2071bed09e20e44e73d4aa9a1accb5c0a8bb1810c030c4ce00800b2010892071ba8a1b7b916d831c802daccc82c677c0bf13a03e21700f20f43f7be18b63a0246b6ff984192090126590a26390756b9ec4600000c36a861c871b881524c00390b564aebd8a7d2cdfe561d07e802f2a108f0f582faeef13a03e20e1df0eea0e80e0c2ff991f16c032beef0ee10f881e90f06a2ff817c03ad05e008000c0cdd01bd0a3d0a817d03a2073be008006d0a261a11262a0e263a0b92073b471995663692c6f3ff82a10852073b78028085828a7782a0a88a7786f7ffed0946a1ff920713a2970a16e9dfe61a02067effb20712e802b79a2df2a108f0f582faeed20ebf57ed1f0c2ab2a20e0c1c817f032c09909d20924ebfe008008c7a818003524a08e00800921708a837b16c03a0a3c0b0aa10a7b917c802d2a108d0d582daccd20cbf0c8e576d05e0ed20e24cbf816905ad05e0080056bad7818505ad05e008000c49a06993466cffb2a0efb0dd104663ff368100513a03713b0362a0ff41a803bd03a204050c13671a41820401d13c0380e00407e8109824c215179092c0d09910f09911c72924c807f2a108f0fa82faccc20c17b94180cc01c0c831e61c02066f00817b030c4be00800b8412204040c0d6092c01629219807e2a108e0e2820012409aeec20e79a2ce10ec4cf20e1780ff01f0f831e61f0b820e16808801808831a6180df805e22a37f0f141f0eec0169e21661c05821a741608210c0c00f3a1e21407a2a108a0a282a901f0ee20e254079aaa920a17e805809901909831a6195d9911821a80e0e1e480eec0e0e0e497eb3582054697282fb20551f63b29820a79661823b20545921a7cb7391ae921822a3fc93166981081b003ad02e00800c8310c0de82106140092040c3cba168904e73a45b21408f0bb20b25408460e00820545e21a7c873e2eb21408f0bb20b25408920a7966191fe20a1680ee01e0e831e61e13f22a3fc931669f0b81b003ad02e00800c8310c0d0c0e567c05a2040d9c3a92054797ba0eb801a807baaaa22a3f269a02668a38a805f20548a0a1e4f73e0ee2140ab20549e0eac0e0e0e4e7bb6122040467120f82a10880828228078a222202f5224404a2540ad2440c4611000ce9971ac1a2040c56bafba2040d2204048c3a1baaa2440d60b2c0ed0ac0ec93e2440d164b091c9c6712220caa0c0b914d0381ae03224953c24952e008003244001df02204040c0aa2440d86f0ff1df0b20407679b04a24407bd0adcee81af03e00800b20407c20401a09014a13c039092c030cc20c24401a0991099242d0b671bcb81ae03a14d035c09924a52b24a530c0b0caae00800b807c2a108c0c282cabbb20bf5324400b24407679ba0d20401e2a0fee0dd10d244011df0d2440cd2440df21407821408a805220402224404a0a1e4a2540af08810879f0ad25408a254095c0c060400c21409b2a078c0cac0c0c0e4c73be81c9cd2540786caffcc6ce20af31beee24af398070c1cc677ff366101a2a0dfb2c1100c4c42513c81e9050c1dd941d951e00800a2a0dfb2c11481e9050c4ce00800a2a0dfb2c110810c030c4ce00800a2a0dfb2c114810c030c4ce008000c0ad1b706f2c178c2a3f242113c816007e851984190ee01a099019941e951b2231190ee2080ee20e0bb10b26311c7247747ac02464600ad0381610720b074e00800d22311a1b706d0910416a93da21a04a0a004561a3dbd05a2c1201c0c91be0281d402909d10926311e00800811107e00800b2c120d2c140cd0a811207a2c36ce00800a2c37cb2c14481d4020ccce00800d20300ed07a2a3f3b2c1408113070c2ce008000c021df092a0d297a402063300d2a0d247ad02065800b0e00416be08bd040c02811a06ad02e00800224306ad030c1b810f072c0ce0080046f1ff92a08f9094c0564906a906920507e67205168947a672040ba9160a470c14c1c106b21d4c0c1dc2dcff40bb20b25c4ca672010c0dad03bd020c1c8124077cfee00800dcba0c5a812507bd03e00800166a438126070c5ae0080016ba420c1956f93ab2113c1c1a811a06a906e0080028061df0c2a3fac72471b2611947ac02062300cd05dd040cce0c1fa1b702816207a09b20926311ad03bd02e008002d0a1df0c2a076c7a40286420047ac0206d4ff076bbb42a0a4ad0391b902816307909b20926311e00800bd024ae30c2a1c6c810007d1db05e008000c0a811a061c6cc24303b2113ce00800c6b6ffa2a3f8a7a402c6410047aa02065100ad02bd03cd04dd05ed06816407fd07e00800c6adffb2a433b7a402463f0047ab020652000c1420b074816107ad03e00800424306ad03c20303810f070c0be0080006a2ffc2a3efc7a402865e0047ac02067100ad0381610720b074e008000c2abd03c1e202922311811007c09920926311e00800bd0581d4021c0ce008000c2abd020c8cd1db05e2a0a4810007eae3e008001c6a0c89815c06924303e00800d2a088dad316ca2dad02bd03ed06fd07816507c2a072e008004684ffb2a075b7a40246470047ab0286aaff42a400920305b20503b24306b099c0569918b2113c0c0a811a06a906e00800bd03c203060c0a922311810b07409920926311e008008672ffa2a3f6a0a4c0569ae6ad02bd03cd04816607dd05e00800066cff92a4329094c056f9e420b074816107ad03e00800ad03c203030c0b0c09810f07924306e00800c661ffa2a3f9a0a4c0566ae2bd0fed07a2a3ea0c2c811d07d20300e00800ad03816707bd06e00800c657ff92a43490a4c056eadfb21d04b0b004164b163c3a812507bd03e00800167a158126073c3ae0080016ca143c4a812507bd03e0080016fa138126073c4ae00800164a13ad0320b074ed070c0cdd06f2113c8168075901e00800066bff82a3ee8084c05638da0c0acd02dd0381f4061c3be00800863aff92c48c56c9d80c0a811a06bd04e00800815c061c7ae0080042a0884a43160a1aad02bd03dd04ed06fd07816907c2a070e00800062dff92a3f09094c05639d5d16a07c13704d0bb20c0bb20b26311a67208e1bc03e0eb20e26311ad02bd03cd04dd05ed06816b07fd07e00800c61effad05bd03cd02dd06ed078114070c4fe008008619ff0c2a812507bd03e00800164a098126070c2ae00800169a08b2113c0c0a0c0c811a06c906e00800ad03816c07b20306e008000b9a16f9c2ad030c4b922311812807409920926311e00800a2a3f66bb30c2cd20300816d070c3ee00800e2a0a4920306eae316290abd020c2a3c1c810007d1db05e008003c1992430306fafeed07a2a428b2c1600c2c816e0792a4343c72225131925130d20300e0080029063c721df0b2113c2c5a811a06a906e008000617ff811a06a1bb029223110c0cc24313b2113ca09920926311a806e00800ad038128070c2be008009203051699102caa812507bd03e0080016ba0b8126072caae00800160a0bad030c1b0cac0c09810f07924306e008000601ffbd020c2a1cac810007d1db05e008001ca946d6ff816f07ad0de0080046cffe0c0906f4febd042c1a811a06a906e0080046f4feb11f070c6c814e03922311a2a200a09920926311ad04e00800ecaab1b706b21b0407eb227ba5b1200781d4021c0ce00800ad02bd03dd05ed06fd07816907c2a06fe0080086b8fead04812107bd03e00800bd020c2a1c4cd1db05e2a0a4810007eae3e008001c4906b4ffad03812807b2a104e00800424313ed07a2a3f66bb30c2cd203000c09816d07924306e00800bd020c2a1cbcd1db05e2a0a4810007eae3e008001cbff2430386c9fead0320b074cd05d2113c8170070caee0080046c4fe
\ No newline at end of file
diff --git a/ar3k/30101/ar3kbdaddr.pst b/ar3k/30101/ar3kbdaddr.pst
new file mode 100644
index 0000000..0520854
--- /dev/null
+++ b/ar3k/30101/ar3kbdaddr.pst
@@ -0,0 +1 @@
+1260417f0300

diff --git a/ar3k/30101coex/PS_ASIC.pst b/ar3k/30101coex/PS_ASIC.pst
new file mode 100644
index 0000000..617d213
--- /dev/null
+++ b/ar3k/30101coex/PS_ASIC.pst
@@ -0,0 +1,93 @@
+
+// Coex Configuration
+#
+[H:S]0017
+[H:S]0022
+[H:A]d1 d1 20 00 02 01 02 09 0c 00 24 0f 12 00 00 01 
+     00 01 00 00 01 01 01 01 01 00 00 00 01 00 00 00 
+     d2 d2 
+// Radio table TAG 
+#
+[H:S]012C
+[H:S]0042
+[H:A]B1 B1 12 00 08 00 01 30 06 00 02 00 00 20 02 00 
+     04 00 0C 40 01 00 48 00 00 48 54 9A 02 00 00 08 
+     02 00 48 00 89 EE 70 E6 38 00 D8 70 EF 52 02 00 
+     00 40 00 00 08 00 31 00 00 00 04 00 10 00 00 00 
+     B2 B2 
+// System config TAG with 0x1C 
+#
+[H:S]0013
+[H:S]00B6
+[H:A]C1 C1 17 02 06 00 01 30 55 00 0E CC 33 06 01 08 
+     64 96 14 05 FF FF 05 80 00 00 FF CC 00 CC 01 00 
+     20 80 FF CC 02 CC 04 00 DF EC 43 F8 00 21 00 E0 
+     FF CC 03 CC 06 00 80 F0 0E 28 80 F4 12 20 80 F8 
+     14 18 80 FC 1A 10 80 00 1E 08 80 04 1C 00 FF CC 
+     04 CC 01 00 1A 12 40 96 01 C0 28 00 00 00 C0 01 
+     40 06 00 01 00 00 C8 00 00 F0 00 00 FF CC 0C CC 
+     08 00 01 03 00 7E 08 08 00 7E 01 01 00 7E 01 03 
+     00 7E 03 03 00 7E 61 63 00 7E 63 65 00 7E 6A 6C 
+     00 7E FF CC 09 CC 00 C9 FF CC 0B CC 0A 17 07 B2 
+     5E 01 52 0A 60 09 05 06 14 4B 00 00 58 02 D0 07 
+     00 41 FF CC C2 C2 
+//Extern 32k + 24Mhz CPU
+//bit 7: sleep disable/enable, default to enable
+//e.g. to disable sleep, clear bit 7:
+//[H:A]08 00 00 00
+#
+[H:S]0021
+[H:S]0004
+[H:A]88 00 BD 1F
+//Bdaddr
+//#
+//[H:S]0001
+//[H:S]0006
+//[H:A]89 60 41 7f 03 00
+//Audio for Intel I2S format
+#
+[H:S]0002
+[H:S]0004
+[H:A]63 00 01 33
+//Audio
+#
+[H:S]0003
+[H:S]0004
+[H:A]dd e5 2e 00
+//Audio
+#
+[H:S]0015
+[H:S]0004
+[H:A]12 00 00 00
+//Audio
+#
+[H:S]0016
+[H:S]0004
+[H:A]00 00 a7 02
+#
+//PLC
+[H:S]001F
+[H:S]0008
+[H:A]01 1A 06 14 50 B4 32 96
+//Sniff Recovery
+#
+[H:S]003D
+[H:S]0018
+[H:A]A0 0F 00 00 00 08 00 00 0F 00 7D 04 E8 03 01 00
+     01 00 01 05 00 02 1F 01
+//BRM Config
+#
+[H:S]0026
+[H:S]000C
+[H:A]01 20 46 01 0F 02 28 14 01 28 68 01
+//TLPM
+//[79:64] - TLPM wakeup timeout in ms, default 10
+//[127:96] - TLPM idle timeout in ms, default 1000
+//e.g. to change the wakeup timeout to 5 and idle timeout to 2000
+//[H:A]03 00 03 00 00 00 00 00 05 00 0A 00 D0 07 00 00
+//     E8 03 00 00 E8 03 00 00
+#
+[H:S]0023
+[H:S]0018
+[H:A]03 00 03 00 00 00 00 00 05 00 05 00 E8 03 00 00
+     E8 03 00 00 E8 03 00 00
diff --git a/ar3k/30101coex/PS_ASIC_aclHighPri.pst b/ar3k/30101coex/PS_ASIC_aclHighPri.pst
new file mode 100644
index 0000000..67fb856
--- /dev/null
+++ b/ar3k/30101coex/PS_ASIC_aclHighPri.pst
@@ -0,0 +1,93 @@
+
+// Coex Configuration
+#
+[H:S]0017
+[H:S]0022
+[H:A]d1 d1 20 00 02 01 02 09 0c 00 24 0f 04 00 00 01 
+     00 01 00 01 01 01 01 01 01 00 00 00 01 00 00 00 
+     d2 d2 
+// Radio table TAG 
+#
+[H:S]012C
+[H:S]0042
+[H:A]B1 B1 12 00 08 00 01 30 06 00 02 00 00 20 02 00 
+     04 00 0C 40 01 00 48 00 00 48 54 9A 02 00 00 08 
+     02 00 48 00 89 EE 70 E6 38 00 D8 70 EF 52 02 00 
+     00 40 00 00 08 00 31 00 00 00 04 00 10 00 00 00 
+     B2 B2 
+// System config TAG with 0x1C 
+#
+[H:S]0013
+[H:S]00B6
+[H:A]C1 C1 17 02 06 00 01 30 55 00 0E CC 33 06 01 08 
+     64 96 14 05 FF FF 05 80 00 00 FF CC 00 CC 01 00 
+     20 80 FF CC 02 CC 04 00 DF EC 43 F8 00 21 00 E0 
+     FF CC 03 CC 06 00 80 F0 0E 28 80 F4 12 20 80 F8 
+     14 18 80 FC 1A 10 80 00 1E 08 80 04 1C 00 FF CC 
+     04 CC 01 00 1A 12 40 96 01 C0 28 00 00 00 C0 01 
+     40 06 00 01 00 00 C8 00 00 F0 00 00 FF CC 0C CC 
+     08 00 01 03 00 7E 08 08 00 7E 01 01 00 7E 01 03 
+     00 7E 03 03 00 7E 61 63 00 7E 63 65 00 7E 6A 6C 
+     00 7E FF CC 09 CC 00 C9 FF CC 0B CC 0A 17 07 B2 
+     5E 01 52 0A 60 09 05 06 14 4B 00 00 58 02 D0 07 
+     00 41 FF CC C2 C2 
+//Extern 32k + 24Mhz CPU
+//bit 7: sleep disable/enable, default to enable
+//e.g. to disable sleep, clear bit 7:
+//[H:A]08 00 00 00
+#
+[H:S]0021
+[H:S]0004
+[H:A]88 00 BD 1F
+//Bdaddr
+//#
+//[H:S]0001
+//[H:S]0006
+//[H:A]89 60 41 7f 03 00
+//Audio for Intel I2S format
+#
+[H:S]0002
+[H:S]0004
+[H:A]63 00 01 33
+//Audio
+#
+[H:S]0003
+[H:S]0004
+[H:A]dd e5 2e 00
+//Audio
+#
+[H:S]0015
+[H:S]0004
+[H:A]12 00 00 00
+//Audio
+#
+[H:S]0016
+[H:S]0004
+[H:A]00 00 a7 02
+#
+//PLC
+[H:S]001F
+[H:S]0008
+[H:A]01 1A 06 14 50 B4 32 96
+//Sniff Recovery
+#
+[H:S]003D
+[H:S]0018
+[H:A]A0 0F 00 00 00 08 00 00 0F 00 7D 04 E8 03 01 00
+     01 00 01 05 00 02 1F 01
+//BRM Config
+#
+[H:S]0026
+[H:S]000C
+[H:A]01 20 46 01 0F 02 28 14 01 28 68 01
+//TLPM
+//[79:64] - TLPM wakeup timeout in ms, default 10
+//[127:96] - TLPM idle timeout in ms, default 1000
+//e.g. to change the wakeup timeout to 5 and idle timeout to 2000
+//[H:A]03 00 03 00 00 00 00 00 05 00 0A 00 D0 07 00 00
+//     E8 03 00 00 E8 03 00 00
+#
+[H:S]0023
+[H:S]0018
+[H:A]03 00 03 00 00 00 00 00 0A 00 0A 00 E8 03 00 00
+     E8 03 00 00 E8 03 00 00
diff --git a/ar3k/30101coex/PS_ASIC_aclLowPri.pst b/ar3k/30101coex/PS_ASIC_aclLowPri.pst
new file mode 100644
index 0000000..7e3c301
--- /dev/null
+++ b/ar3k/30101coex/PS_ASIC_aclLowPri.pst
@@ -0,0 +1,93 @@
+
+// Coex Configuration
+#
+[H:S]0017
+[H:S]0022
+[H:A]d1 d1 20 00 02 01 02 09 0c 00 24 0f 04 00 00 01 
+     00 01 00 00 01 01 01 01 01 00 00 00 01 00 00 00 
+     d2 d2 
+// Radio table TAG 
+#
+[H:S]012C
+[H:S]0042
+[H:A]B1 B1 12 00 08 00 01 30 06 00 02 00 00 20 02 00 
+     04 00 0C 40 01 00 48 00 00 48 54 9A 02 00 00 08 
+     02 00 48 00 89 EE 70 E6 38 00 D8 70 EF 52 02 00 
+     00 40 00 00 08 00 31 00 00 00 04 00 10 00 00 00 
+     B2 B2 
+// System config TAG with 0x1C 
+#
+[H:S]0013
+[H:S]00B6
+[H:A]C1 C1 17 02 06 00 01 30 55 00 0E CC 33 06 01 08 
+     64 96 14 05 FF FF 05 80 00 00 FF CC 00 CC 01 00 
+     20 80 FF CC 02 CC 04 00 DF EC 43 F8 00 21 00 E0 
+     FF CC 03 CC 06 00 80 F0 0E 28 80 F4 12 20 80 F8 
+     14 18 80 FC 1A 10 80 00 1E 08 80 04 1C 00 FF CC 
+     04 CC 01 00 1A 12 40 96 01 C0 28 00 00 00 C0 01 
+     40 06 00 01 00 00 C8 00 00 F0 00 00 FF CC 0C CC 
+     08 00 01 03 00 7E 08 08 00 7E 01 01 00 7E 01 03 
+     00 7E 03 03 00 7E 61 63 00 7E 63 65 00 7E 6A 6C 
+     00 7E FF CC 09 CC 00 C9 FF CC 0B CC 0A 17 07 B2 
+     5E 01 52 0A 60 09 05 06 14 4B 00 00 58 02 D0 07 
+     00 41 FF CC C2 C2 
+//Extern 32k + 24Mhz CPU
+//bit 7: sleep disable/enable, default to enable
+//e.g. to disable sleep, clear bit 7:
+//[H:A]08 00 00 00
+#
+[H:S]0021
+[H:S]0004
+[H:A]88 00 BD 1F
+//Bdaddr
+//#
+//[H:S]0001
+//[H:S]0006
+//[H:A]89 60 41 7f 03 00
+//Audio for Intel I2S format
+#
+[H:S]0002
+[H:S]0004
+[H:A]63 00 01 33
+//Audio
+#
+[H:S]0003
+[H:S]0004
+[H:A]dd e5 2e 00
+//Audio
+#
+[H:S]0015
+[H:S]0004
+[H:A]12 00 00 00
+//Audio
+#
+[H:S]0016
+[H:S]0004
+[H:A]00 00 a7 02
+#
+//PLC
+[H:S]001F
+[H:S]0008
+[H:A]01 1A 06 14 50 B4 32 96
+//Sniff Recovery
+#
+[H:S]003D
+[H:S]0018
+[H:A]A0 0F 00 00 00 08 00 00 0F 00 7D 04 E8 03 01 00
+     01 00 01 05 00 02 1F 01
+//BRM Config
+#
+[H:S]0026
+[H:S]000C
+[H:A]01 20 46 01 0F 02 28 14 01 28 68 01
+//TLPM
+//[79:64] - TLPM wakeup timeout in ms, default 10
+//[127:96] - TLPM idle timeout in ms, default 1000
+//e.g. to change the wakeup timeout to 5 and idle timeout to 2000
+//[H:A]03 00 03 00 00 00 00 00 05 00 0A 00 D0 07 00 00
+//     E8 03 00 00 E8 03 00 00
+#
+[H:S]0023
+[H:S]0018
+[H:A]03 00 03 00 00 00 00 00 0A 00 0A 00 E8 03 00 00
+     E8 03 00 00 E8 03 00 00
diff --git a/ar3k/30101coex/RamPatch.txt b/ar3k/30101coex/RamPatch.txt
new file mode 100644
index 0000000..3a89f0c
--- /dev/null
+++ b/ar3k/30101coex/RamPatch.txt
@@ -0,0 +1,2 @@
+25f3

+000000000e20000050800000000158000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000d8d5530024e7530030e1530060e15300ece1530070e353008ce4530054e1530088e1530040af530088e353008ce35300d4e25300d8e25300fce253003ce3530024e3530054e3530030dd530024b0530078d5530030d553002ca0530040d9530088e9530024cc530090db530008e1530070dc530038dd5300000000000000000080019800d80198006c029800ec049800fc0698005c0898009c08980020099800cc099800340a9800340b9800b00b9800700c9800e40c9800580d9800c40d9800300e9800600e9800380f9800d00f98005411980084189800501b980058229800d021980004239800b823980098249800d4249800742598000000000000000000364100813a03416f0382085148041618040c13bc040c07613b030c02680676942252a1085052821b225a564205062020742654052634026644079205bf1769011b773df04600000c077048c00c024023831df00c021df000364100569208c0200021ce0991f3020c04426992c0200042699398128d04ed0916c9063d09a802c859b809b912a90999028c9ca21e06b82ee00c00860300a21e088bce5c0b81d6020c8de0080098120c4bbcb9c1f302d819c02000ed0cd26c90dd0cc02000426c93c02000a812b26c92a81ac02000b22c910c0cb0bac0a61b04e813a79e0ac0200081f3020c1ff268931df0000036a100a2a0dcbd01810c030c1ce00800a2a0d24bb10c4c421202521201612d0782010092a0d49088827202008a26220280810c030c16e00800313d030c09a203005981076a1690b9a030bba0b21b0407eb0c1b9990907416b9fe4600000c196619040c09c600006d090c19cc290c121df00c2c7951810c03513b03b2a108b0b282b961a8050c02225104baaaa20a1db2a0cdbaaa8bb1e00800721104810c032931a80560d6a0303da0b2030ec2a108c0bb820c4cbaaaa20a1db2a0c8baaacbb1e008008bb10c2c810c03225104a805f831d2030ee2a108e0dd82f971daaaa20a1dd2a0cddaaae00800621104cbb10c4c810c03d861a8052931daaaa20a1dd2a0c8daaae00800e851c831e0e104161e12bd04a13c0381ef02a0ac10e00800d20315b871e881a0f4c0a811faeee040f4b0aac0b20310a020f4d09bc0c2c9feac7df13a03168c0f662c1ff20f539c9f52030e82a108805582813b0388085a88820879513b030b8816880da0f0f4e0a0f4f79a2f0c121df00c0277b60c6097c097bb062bbab794010c12d805e2030ef2a108f0ee82eaddd20d79cc4d82ccfe16d8081df0b941f991d9a1c9b1ba9af7a91a40a2c081b503b841e00800c8b1b841d8a1b08a82f8918a444040f4b941d9a1c9b1ba9f47a91820a4c081b503b841e00800b841c8b1b08a82d8a18a222020f447b204ba222020f4b7b209ba22ba444040f42020f4b092c09084c01658f620a4c016faf59aada0b4c0167bf5b66c404bcac7b40206d3ffd2c2fc47bd02c6d0ff0c021df0ad0c81ef02bd04e0080086b7fff20f53cd09d2cdfed0d07416bff1f66d0246c5ff2bc9d2cdfed0d07486c2ff1c4b673702c6c3ff70e6c0e73b0286c1fff2c2fef0f4c056dfef0c1286beff000000368100815308324114e008003d0a815208ad02e00800d1540837aa070c0aa25202860000a21202c20114daccc20c00921203a0cc827ce4b2cc1fc0bcb3b0b5211bbb40bb10b252019c69815308e008008ceab21203a21201baaa1baa40aa10a25201a13d03720114c20a000c09076c169089a0a088a082180407e80c1b9990907416b9fe4600000c19313b03513a03d2a0c86619070c0b9201004600000c1b9069a0a066a0bcfb0c4c81e905b803d2060ee2a108e0dd82a2a0c8dabbb20b1dd911aaab50bba0e008000c2cd811b80381e905dabbb20b1da2a0cdaaab50bb90b2cb10e00800d2a0c8812d0792a0d4907782b8037a7872078082a1088077820c4c7abbb20b1d81e905daab50bba0e008000c2cb80381e9057abbb20b1da2a0cdaaab50bb90b2cb10e008004bb6a2a0d281e9050c4ce00800a2a0dc0c1c81e905b2c114e00800312e03815508ad02e00800309ac056a909c21201a21202e20114b154080b9e1bdeba8e820800e0d993d0d074a08882dabbf20b00e2c81fa0ff8280e8b3e0e5211beed2cf1ff0dfb340ee10e0e0f4d0d5211bdd40dd10d0d0f4e7bd2582ccfe8080f4825201920b00a09982f2c91f90f9b3f0f5211bff40ff10f0f0f4873f830609002b9c9090f4925201e20b00a0ee82d2ce1fe0deb3d0d5211bdd40dd10d0d0f4d7b902c6d6ff0c0aa25202815308e00800dc1a91b706920907809901909831cc390c0aa252011df00000366100814d08ad02e008000c0541a50862a0d4606382a212016a44b2048a6d0a8cdb261b0b262b52212e031df02d0b1df0b21202821484921483b73837973b34c2cbfea72c1b81ef02e008009c2a815308e00800ccaa81ac07e00800cc2a0c021df0bd03815808ad02e00800b2120292120156bb0d52448a06ebffa13d0352448a920a0072a0cd0769189d0590b9a0a0bba0b21b0407eb0c1b9990907416b9fe4600000c19313b03d2a0c8513a036619070c0b9201004600000c1b9069a0a066a0bceb0c4cb80372060e82a108807782a2a0c87abbb20b1d81e905aaab50bba0e008000c2cb80381e9057abbb20b1da2a0cdaaab50bb90b2cb10e00800d2a0c872a0cdb80342047482a1088044820c4c4abbb20b1d81e905daab50bba0e00800b8030c2c4abbb20b1d81e9057aab50bb90b2cb10e008004bb6a2a0d281e9050c4ce00800815508ad02e00800a020f41df06099c05659ed52448a06c0ff00000036c1002241003241014911592169317941a2a0de0c1cb2c12022412081e90592211ad20164e22118e951d241189971e00800810609ad01e008002d0a1df00000366100a2a0debd01810c030c1ce008004202030c0761590782a0d48087828a66a2067f920100664a1ef6791b817e03c2166aa21669b20202caaab0aac0bd04e00800cc2a1cb21df0520206820202ac45b6352292166962166a0c239a668066c030a6c0817e03bd04e00800165afd2b333030745733e91b777070746697960c021df000003661000c03ad02a901b15907c2a0d4c0c382cabbc20b7f664c22c801d801721b6ab21b69d21d02c21c015d0dd7b7015d077795392d0b6d0c7d0d060d001b333030746693c30c0351cf0642a0ff30b3a050bba0820b00471809814c08a801e00800fc1a1b333030741613fec60d002d0c6d0b0c14bd0540a78281ef02aaa620aac0e00800dc3aa2a06481b503bd04e008001ce9a7b904212e031df01b444040746694d086e5ff0c021df00000364100ad03bd048159080c0ce00800ad058105070c29d21314f10905e8d30c4c0c0bb24316c24301f0ee10e9d3d25501c2132bc25503b24500924504e00800d22311877d17e203c4076e11bd04a2a4300c2cd2030081e3060c3ee00800815008ad03e008001df0003661004081040c0aa25100165808d172085c5ec20301b2030080cc11cabbb0b0f4a0ca90d0cca0f21c021baab79f5bd21c01d25100e2a410e0ebc0166e09f2a411f0fbc016df0882a42c808bc016480892a42d909bc016b907a2a3fda0abc0162a07c2a418c0cbc0166c050c1abd058175080c1ce00800a0a074bd02ed050c1c817408dd01e00800860c00a0a074e79a8f06e8ffad0581da062bb1e00800167a04c20a11b20300376c413c99979b3c81a50592a0f7909c10924a11e008000c021df0bd02ed050c0a0c1c817408dd01e0080006faff60a074bd02ed050c1c817408dd01e0080006f5ffb20300ad02cd03dd05ed06818908fd04e0080086efff00366100612d0782a0d48082828a66f6721481bd05a206a8e00800816108e00800a24301a2440c81a3080c19f20300f24100e20301e24101d203020be5e0e993d24102d20680c20303c241030c2cb20307b24104bd01a20304a24105a2a410e00800b1b70291b302822631a2262d908820b0aa20a2662d8266311df000368100612d0782a0d48082828a66f6722281bd05a206a8e00800816108e00800bd0aa24301921402a13503b2440ca09920925402220300224100f20305f24101e20301e24102d20302d24103d1b702c20303c24104c2262db20306b24105b1b302a20307d0cc20dd01a24106a226319203089241070c19b0aa20821305824108721305b2a42c70784172410942130642410a22130681740820284122410bf20304f2410ce2030ea26631c2662de2410de206801c0c0ba5a0a993e008001df0003661002060f481a408ad06e008002d0a26e61192a06d97160ba2a081a71605b2a06eb7960262a410624100424102bd010c2c0c190be582a0d460a841a24101808382e0e993312d07a2a3eb8a33811b07d20380e00800c1c203b2232dd223317cfee0e230e0dd10d26331c0bb10b2632d1df000003661002060f481a408ad06e008002d0a26e61192a06d97160ba2a081a71605b2a06eb7960262a42c624100424102bd010c2c0c190be582a0d460a841a24101808382e0e993312d07a2a4288a33816e07d20380e00800c1c203b2232dd223317cfee0e230e0dd10d26331c0bb10b2632d1df000003661002060f481a408ad06e0080082a0d480838231a5082d0a8a3326e60592a06d97960262a4108c959203850c1aa09920924385625100a2a3eabd010c2cd203740c190be4811d07e0e993e00800b1c203a2232ac2232e7cfdd0d230d0cc10c2632eb0aa10a2632a1df000003661002060f481a408ad06e0080082a0d480838231a5082d0a8a3326e60592a06d97960262a42c8c959203850c1aa09920924385625100a2a427bd010c2cd203740c190be4811d07e0e993e00800b1c203a2232ac2232e7cfdd0d230d0cc10c2632eb0aa10a2632a1df0000036410081610341b70691b40852a0d45052825a4451c2036224893224859066105033108066106264893264851df0000036410081a408ad02e0080091b706b2a0d4b0b382ba99922989a70909f6733756d5060c021df0f6734b5655ffc21402c0d014c0c20416dc08ad02bd0381b5082c3ce00800c60200ad02bd0381b6082c3ce008000c121df05675fc92140290d014909204160905ad02bd0381b5082c3ce0080006ebff1695fa92140290d014276926ad02bd0381b5082c3ce0080086f0ff92140290d0142769adad02bd0381b5082c3ce0080086eaffad02bd0381b6082c3ce00800c6e6ffad02bd0381b6082c3ce00800c6d6ffad02bd0381b6082c3ce0080046dfff0000003661000c0351a707cd02c91181c606e00800b2a0d4b0b3825a4b921450a099c016590672048581a80721b70662a1e02a2b6a62ad06e00800ad06b2145181aa072901e008009204852d0a771916a2a412d204780c3e81a907b801c2a1edcabb0c2ce00800d811e20484d7161c271e19224484d20478a2a4130c3e81ab07b801c2a1eccabb0c2ce008001b33303074d2c3f6567df71df0000036a100ad05bd0181da06225108e008007d0ac8da21bc03d19b02f13704e1c103176431b21108d70c02c63500922a11d0ac20a9d7f099209267118201000c1fb678028626000c0f20c920e0da20d9d7c26711862200d78c28922a11d0ac20a9d7f09920926711820100cd0af67802062900e0ca2020b920b267110c02c9d7460200e0fc100c1d0c02f02d838207014109056638420c7a812507bd07e00800bc3a8126070c7ae00800ac9aa21301b21302512e03a7bb6481ef02e00800817b08a25301b20100ad03e0080050aac00c19a09583861400c8d71ca240bc10b9d71df0ad0fdd03ed058174080c1ce00800860300bd07cd03dd02817d08a20100e008000c021df060a074dd03ed058174080c1ce0080046faff0c12c6dbffad03817b08b20100e008009d0afcf9ed02a2a3ea0c2cd20700b2c110811d07f207110c2990ff20f24711e00800cd03bd07817c08a21302a2572b92130192572aa20100e00800b8d740bb10b9d706e5ff50c9c056fcf7ad0798d781500840991099d7e008002c021df0364100c16d044c49a2a108813b03a0a2828808718403aa88820824a13d038088a0a088a08208137827908882b1c1048a778817216c039858a848904b457054a058656838ac4560d4b0d81d576d1de2050620d9105a5e8b55270910b0f510f71d0a204510c039104033203958a04b457054a058656084b0ac558818576821881762050678485a568b55206710270710b0951097160a20b510c0a710b0aa20a9481df0000036610056720e0c0b5c8c213a0381ad02ad02e0080082a0faa2a0f092a1e02c8b0c1c4c6d2c0e0caff24254e24243d24244c24224c24226c24242c24245c24246c2424ab25217b24248b2424b925219a2521882521a81e905a2a1040c099901a252265c0a1c4bb24249bd010c2cc242470c4ce00800813e03a2a0ffe00800818c0320e6030c2a209034972a02206200e00800818d03e00800818e03e00800818f03e00800819003e00800819103e00800819203e00800819303e00800819403e00800819503e00800819603e00800819703e00800819803e0080020e6131020008199039d02e00800819a03e008001df0364100cc3322a0641df00c0c0c0a769306a752011bcc1baabd03a2a06481ee02a0ac82e00800a020741df000368100c1a502613b0342a108404282680632a0a84a663a369206bf52262c67e913a21c2582a0808089201baaa25c258246bfc60400921660b206c20c1a001b4000aaa1a09920925660a2130c0cab92031a8178051b9992431ae00800a2431ba2031a0c07b69a0572431a72530c724316724338817905ad02e00800ad02817a05bd03e00800a2165482263bd13c03913b03c16c039809e13a034a99b2091d92292ce0bba0b80b780eb099c0c099109a77707141d077108077c0d07710f07711a7b7017d0aad02bd07cd010c0d81b8035941e00800d13a03b13b035d0ae80bc135034aee920e79f18103ec090c09b62a0582cafd56d80ea21d1ae20d29aacaa2ca14e0ac83a0a0f4a25100463600262a05264a02665a46ad02b21100817b05c13a03920e1dd22e2cc0e9a0e80ef2263be0ddc0e16c03c80ce0dd10daccd13c03c0c141d0cc10f0ccc0d0cc10f0cc11e00800b13b03c13503d13a03f18103880b1c0e4a888208bfa81f27e825f1a502921f261b99925f26c78a32a20d2c47ea2ce09a20817903924d2ce00800b13b03860600c78a17a20d2c476a1181790392a0ef909a10924d2ce00800b13b038841e80bf1c1024aeec20ebfd2a0fbd0cc10d82ec24ebfc2a0bfa80bf0dd204aaa920abfd92ec09910924abf28230c1a8022c0202a931df0a21100881f9911f7e80fc2165477bc09e20d29cc3ef2a4e2f911bd074bc18bd181d703cbe1e0080066550b8ba1cbb181d6034bc1e00800a8214c4cd831b81181c703dabbe00800b13b03c13503d13a03f18103a24316c6c7ff00000036a1000c067cf849612971dd03d981213b0342a0ff8991890191b703a802520904b2a10840e5c016ee0bb0b58272a0a8baaaf20a797a7a661f19c20ae09c3c818405ad05e0080098a70ba9167a1cb2c9fe161b1c817c03ad05e008004bc1dd01bd0a3d0a817d03ad05e008006d0a0b9a169907166a07a2cafd16ba1fb2c6fe163b19264602665654818505ad05e00800461200a2970a817e03b20712e00800cc3a0c0aa2570ac802d2a108d0d5821c0edaccd20cbfb62602c69a00e0dd200c9a0c0bd24cbf714d0381ae0352474be00800a1b7030c19924a050c0bb991c2c6fc165cf3d2c6fb16fdf228911df0b20716d802c2a108c0c582e13a03caddd20d1da827e0dda0d80df16c03d0eac0f0ee10e73b02c63f00c931b09ac056a617e20738e0e9c0ad050cbbd0cec0d16c03815705d0cc10e00800ed0ae951167a0db14d03a20b5a818605b0aab0a941a20a03e00800c2cafed851c901d73c02862d00913a03e871d831524e00c8028851daccf20c1da088c090ffa0f80f2ba88aff816c032bff80ff108881e13d03f908fd0ae20e00f991e0e004562e06f841f20f01661f5af65a57814d0382087c56e804d20cbfb2a080b0bd10f63a10c2a080c78d55d2071bed09e20e44e73d4aa9a1accb5c0a8bb1810c030c4ce00800b2010892071ba8a1b7b916d831c802daccc82c677c0bf13a03e21700f20f43f7be18b63a0246b6ff984192090126590a26390756b9ec4600000c36a861c871b881524c00390b564aebd8a7d2cdfe561d07e802f2a108f0f582faeef13a03e20e1df0eea0e80e0c2ff991f16c032beef0ee10f881e90f06a2ff817c03ad05e008000c0cdd01bd0a3d0a817d03a2073be008006d0a261a11262a0e263a0b92073b471995663692c6f3ff82a10852073b78028085828a7782a0a88a7786f7ffed0946a1ff920713a2970a16e9dfe61a02067effb20712e802b79a2df2a108f0f582faeed20ebf57ed1f0c2ab2a20e0c1c817f032c09909d20924ebfe008008c7a818003524a08e00800921708a837b16c03a0a3c0b0aa10a7b917c802d2a108d0d582daccd20cbf0c8e576d05e0ed20e24cbf816905ad05e0080056bad7818505ad05e008000c49a06993466cffb2a0efb0dd104663ff368100513a03713b0362a0ff41a803bd03a204050c13671a41820401d13c0380e00407e8109824c215179092c0d09910f09911c72924c807f2a108f0fa82faccc20c17b94180cc01c0c831e61c02066f00817b030c4be00800b8412204040c0d6092c01629219807e2a108e0e2820012409aeec20e79a2ce10ec4cf20e1780ff01f0f831e61f0b820e16808801808831a6180df805e22a37f0f141f0eec0169e21661c05821a741608210c0c00f3a1e21407a2a108a0a282a901f0ee20e254079aaa920a17e805809901909831a6195d9911821a80e0e1e480eec0e0e0e497eb3582054697282fb20551f63b29820a79661823b20545921a7cb7391ae921822a3fc93166981081b003ad02e00800c8310c0de82106140092040c3cba168904e73a45b21408f0bb20b25408460e00820545e21a7c873e2eb21408f0bb20b25408920a7966191fe20a1680ee01e0e831e61e13f22a3fc931669f0b81b003ad02e00800c8310c0d0c0e567c05a2040d9c3a92054797ba0eb801a807baaaa22a3f269a02668a38a805f20548a0a1e4f73e0ee2140ab20549e0eac0e0e0e4e7bb6122040467120f82a10880828228078a222202f5224404a2540ad2440c4611000ce9971ac1a2040c56bafba2040d2204048c3a1baaa2440d60b2c0ed0ac0ec93e2440d164b091c9c6712220caa0c0b914d0381ae03224953c24952e008003244001df02204040c0aa2440d86f0ff1df0b20407679b04a24407bd0adcee81af03e00800b20407c20401a09014a13c039092c030cc20c24401a0991099242d0b671bcb81ae03a14d035c09924a52b24a530c0b0caae00800b807c2a108c0c282cabbb20bf5324400b24407679ba0d20401e2a0fee0dd10d244011df0d2440cd2440df21407821408a805220402224404a0a1e4a2540af08810879f0ad25408a254095c0c060400c21409b2a078c0cac0c0c0e4c73be81c9cd2540786caffcc6ce20af31beee24af398070c1cc677ff366101a2a0dfb2c1100c4c42513c81e9050c1dd941d951e00800a2a0dfb2c11481e9050c4ce00800a2a0dfb2c110810c030c4ce00800a2a0dfb2c114810c030c4ce008000c0ad1b706f2c178c2a3f242113c816007e851984190ee01a099019941e951b2231190ee2080ee20e0bb10b26311c7247747ac02464600ad0381610720b074e00800d22311a1b706d0910416a93da21a04a0a004561a3dbd05a2c1201c0c91be0281d402909d10926311e00800811107e00800b2c120d2c140cd0a811207a2c36ce00800a2c37cb2c14481d4020ccce00800d20300ed07a2a3f3b2c1408113070c2ce008000c021df092a0d297a402063300d2a0d247ad02065800b0e00416be08bd040c02811a06ad02e00800224306ad030c1b810f072c0ce0080046f1ff92a08f9094c0564906a906920507e67205168947a672040ba9160a470c14c1c106b21d4c0c1dc2dcff40bb20b25c4ca672010c0dad03bd020c1c8124077cfee00800dcba0c5a812507bd03e00800166a438126070c5ae0080016ba420c1956f93ab2113c1c1a811a06a906e0080028061df0c2a3fac72471b2611947ac02062300cd05dd040cce0c1fa1b702816207a09b20926311ad03bd02e008002d0a1df0c2a076c7a40286420047ac0206d4ff076bbb42a0a4ad0391b902816307909b20926311e00800bd024ae30c2a1c6c810007d1db05e008000c0a811a061c6cc24303b2113ce00800c6b6ffa2a3f8a7a402c6410047aa02065100ad02bd03cd04dd05ed06816407fd07e00800c6adffb2a433b7a402463f0047ab020652000c1420b074816107ad03e00800424306ad03c20303810f070c0be0080006a2ffc2a3efc7a402865e0047ac02067100ad0381610720b074e008000c2abd03c1e202922311811007c09920926311e00800bd0581d4021c0ce008000c2abd020c8cd1db05e2a0a4810007eae3e008001c6a0c89815c06924303e00800d2a088dad316ca2dad02bd03ed06fd07816507c2a072e008004684ffb2a075b7a40246470047ab0286aaff42a400920305b20503b24306b099c0569918b2113c0c0a811a06a906e00800bd03c203060c0a922311810b07409920926311e008008672ffa2a3f6a0a4c0569ae6ad02bd03cd04816607dd05e00800066cff92a4329094c056f9e420b074816107ad03e00800ad03c203030c0b0c09810f07924306e00800c661ffa2a3f9a0a4c0566ae2bd0fed07a2a3ea0c2c811d07d20300e00800ad03816707bd06e00800c657ff92a43490a4c056eadfb21d04b0b004164b163c3a812507bd03e00800167a158126073c3ae0080016ca143c4a812507bd03e0080016fa138126073c4ae00800164a13ad0320b074ed070c0cdd06f2113c8168075901e00800066bff82a3ee8084c05638da0c0acd02dd0381f4061c3be00800863aff92c48c56c9d80c0a811a06bd04e00800815c061c7ae0080042a0884a43160a1aad02bd03dd04ed06fd07816907c2a070e00800062dff92a3f09094c05639d5d16a07c13704d0bb20c0bb20b26311a67208e1bc03e0eb20e26311ad02bd03cd04dd05ed06816b07fd07e00800c61effad05bd03cd02dd06ed078114070c4fe008008619ff0c2a812507bd03e00800164a098126070c2ae00800169a08b2113c0c0a0c0c811a06c906e00800ad03816c07b20306e008000b9a16f9c2ad030c4b922311812807409920926311e00800a2a3f66bb30c2cd20300816d070c3ee00800e2a0a4920306eae316290abd020c2a3c1c810007d1db05e008003c1992430306fafeed07a2a428b2c1600c2c816e0792a4343c72225131925130d20300e0080029063c721df0b2113c2c5a811a06a906e008000617ff811a06a1bb029223110c0cc24313b2113ca09920926311a806e00800ad038128070c2be008009203051699102caa812507bd03e0080016ba0b8126072caae00800160a0bad030c1b0cac0c09810f07924306e008000601ffbd020c2a1cac810007d1db05e008001ca946d6ff816f07ad0de0080046cffe0c0906f4febd042c1a811a06a906e0080046f4feb11f070c6c814e03922311a2a200a09920926311ad04e00800ecaab1b706b21b0407eb227ba5b1200781d4021c0ce00800ad02bd03dd05ed06fd07816907c2a06fe0080086b8fead04812107bd03e00800bd020c2a1c4cd1db05e2a0a4810007eae3e008001c4906b4ffad03812807b2a104e00800424313ed07a2a3f66bb30c2cd203000c09816d07924306e00800bd020c2a1cbcd1db05e2a0a4810007eae3e008001cbff2430386c9fead0320b074cd05d2113c8170070caee0080046c4fe00368100813304e00800167a072c3abd01810c031c8ce00800a090f4165906b8010c2c376b04c902060100b0a004a90227fb02b0c005c992b0f204b03435b08434b09875b0a874b0d104d912a95299d2897239f2f982b0c105c9a2e811e0d0f5d9e2e0e0f4e962c82181680ac0b0f5b9c2c0c0f4c942a831a92298419932a851a9b2e008001df000003661000c050c030c0a81ce0922510070e6030c297040344729027062004818ad01ac646211009214066719285d0448045624ff060500a1f302c02000926a92c02000926a93b808b904490870e613102000cd071df01624ff38048c353905c6f8ff0c09391816d3fc0c42f1f302c020006d0f926f925813c02000526f905d0fc02000926f93c02000226f92c02000e22f91d8132d0fe0ddc0ed09e61da7c02000a1f3020c19926a9346e6ff003641000c0831f302c020003223889c42811803e00800c02000a1f3027cb9909310926a881df0c02000e1e202b1ab0291f3020c4cc08320826988c02000f22b93c02000e0ff20f26b93c02000d22b93c02000c0dd20d26b93c02000a22b94c02000e0aa20a26b94c02000922b94c02000c09920926b94c02000822b95c02000e08820826b95c02000f22b95c02000c0ff20f26b95c02000d22b96c02000e0dd20d26b96c02000a22b96c02000c0aa20a26b961df036610282a40187920781cb050c0ae0080092a40597920781cb050c0ae0080092a41997920781cb050c0ae008000c0ab1c007c2a0cfb04ab09214011baa27992ea21402bd0181c107cd03e008000c0bc20400e1c207fd0aa814514d07a0a0f4e0dbb0920d001bbbc7990de81d860400a0a0f4a7bcbf061500b0b0f40c8db7bdde0c0eb2d5ff0c0cc26b3eccafbd010c2de00e003d0a060200bd030c2de00e003d0a26130826a30526230266331481c307ad02e008008c9ab21402811a06ad03e00800a2d5ff0c19926a3ec60200bd0281c4070c1ae008000c132d031df000000036610081c7070c1ae008001c5bcd010c4d81d6029d0aa901e20a060c3aea99224908e00800f14904f80f776f0781cb050c1ae008000c021df000000036610081c7070c3ae008000c1ea901420a06d8d34a4a8b44076d0981a602e008000c021df08ba181d402e0cd20b2a088bab3c9d32241040c6ce008000c0ad20307d2410ea2410fdcd2e15d06f21314f25103f20305e20e00f2410f8cfe81a6050c0be00800460100918b06925103cd040c3a81c8074bb1e008000c3a1c5bcd0181d6020c4de00800914904980990970416d9f881cb050c1ae0080086e0ff000036610081c7070c7ae008000c0b81ad02a901520a06c21a025a5a8b55ad05e00800224500bd031ba581d4020c6ce0080081af06ad04e00800bd04cd0a81d4027ba5e008000c3a1c5bcd0181d6020c4de00800f149040c99f80f97121b267218c2a0fbe1d3060c0db1b706d90ea20b00d25e02c0aa10a24b00776f0781cb050c1ae008000c021df0
\ No newline at end of file
diff --git a/ar3k/30101coex/ar3kbdaddr.pst b/ar3k/30101coex/ar3kbdaddr.pst
new file mode 100644
index 0000000..ab466e4
--- /dev/null
+++ b/ar3k/30101coex/ar3kbdaddr.pst
@@ -0,0 +1 @@
+123fe17f0300
diff --git a/ar3k/AthrBT_0x01020001.dfu b/ar3k/AthrBT_0x01020001.dfu
new file mode 100644
index 0000000..f66167b
--- /dev/null
+++ b/ar3k/AthrBT_0x01020001.dfu
Binary files differ
diff --git a/ar3k/AthrBT_0x01020200.dfu b/ar3k/AthrBT_0x01020200.dfu
new file mode 100644
index 0000000..482cad6
--- /dev/null
+++ b/ar3k/AthrBT_0x01020200.dfu
Binary files differ
diff --git a/ar3k/AthrBT_0x01020201.dfu b/ar3k/AthrBT_0x01020201.dfu
new file mode 100644
index 0000000..c51bf1d
--- /dev/null
+++ b/ar3k/AthrBT_0x01020201.dfu
Binary files differ
diff --git a/ar3k/AthrBT_0x11020000.dfu b/ar3k/AthrBT_0x11020000.dfu
new file mode 100644
index 0000000..792aa3b
--- /dev/null
+++ b/ar3k/AthrBT_0x11020000.dfu
Binary files differ
diff --git a/ar3k/AthrBT_0x31010000.dfu b/ar3k/AthrBT_0x31010000.dfu
new file mode 100644
index 0000000..935beb3
--- /dev/null
+++ b/ar3k/AthrBT_0x31010000.dfu
Binary files differ
diff --git a/ar3k/AthrBT_0x41020000.dfu b/ar3k/AthrBT_0x41020000.dfu
new file mode 100755
index 0000000..b1470d8
--- /dev/null
+++ b/ar3k/AthrBT_0x41020000.dfu
Binary files differ
diff --git a/ar3k/ramps_0x01020001_26.dfu b/ar3k/ramps_0x01020001_26.dfu
new file mode 100644
index 0000000..39d22d2
--- /dev/null
+++ b/ar3k/ramps_0x01020001_26.dfu
Binary files differ
diff --git a/ar3k/ramps_0x01020200_26.dfu b/ar3k/ramps_0x01020200_26.dfu
new file mode 100644
index 0000000..4c8e8ed
--- /dev/null
+++ b/ar3k/ramps_0x01020200_26.dfu
Binary files differ
diff --git a/ar3k/ramps_0x01020200_40.dfu b/ar3k/ramps_0x01020200_40.dfu
new file mode 100644
index 0000000..02166c0
--- /dev/null
+++ b/ar3k/ramps_0x01020200_40.dfu
Binary files differ
diff --git a/ar3k/ramps_0x01020201_26.dfu b/ar3k/ramps_0x01020201_26.dfu
new file mode 100644
index 0000000..00bc50a
--- /dev/null
+++ b/ar3k/ramps_0x01020201_26.dfu
Binary files differ
diff --git a/ar3k/ramps_0x01020201_40.dfu b/ar3k/ramps_0x01020201_40.dfu
new file mode 100644
index 0000000..00bc50a
--- /dev/null
+++ b/ar3k/ramps_0x01020201_40.dfu
Binary files differ
diff --git a/ar3k/ramps_0x11020000_40.dfu b/ar3k/ramps_0x11020000_40.dfu
new file mode 100644
index 0000000..3d712ca
--- /dev/null
+++ b/ar3k/ramps_0x11020000_40.dfu
Binary files differ
diff --git a/ar3k/ramps_0x31010000_40.dfu b/ar3k/ramps_0x31010000_40.dfu
new file mode 100644
index 0000000..ef3d79d
--- /dev/null
+++ b/ar3k/ramps_0x31010000_40.dfu
Binary files differ
diff --git a/ar3k/ramps_0x41020000_40.dfu b/ar3k/ramps_0x41020000_40.dfu
new file mode 100755
index 0000000..77383bb
--- /dev/null
+++ b/ar3k/ramps_0x41020000_40.dfu
Binary files differ
diff --git a/ar5523.bin b/ar5523.bin
new file mode 100755
index 0000000..fe373bf
--- /dev/null
+++ b/ar5523.bin
Binary files differ
diff --git a/ar7010.fw b/ar7010.fw
new file mode 100644
index 0000000..840005d
--- /dev/null
+++ b/ar7010.fw
Binary files differ
diff --git a/ar7010_1_1.fw b/ar7010_1_1.fw
new file mode 100644
index 0000000..684d4cd
--- /dev/null
+++ b/ar7010_1_1.fw
Binary files differ
diff --git a/ar9170-1.fw b/ar9170-1.fw
new file mode 100644
index 0000000..d422bdb
--- /dev/null
+++ b/ar9170-1.fw
Binary files differ
diff --git a/ar9170-2.fw b/ar9170-2.fw
new file mode 100644
index 0000000..aa0e807
--- /dev/null
+++ b/ar9170-2.fw
Binary files differ
diff --git a/ar9271.fw b/ar9271.fw
new file mode 100644
index 0000000..d0ee74a
--- /dev/null
+++ b/ar9271.fw
Binary files differ
diff --git a/ath3k-1.fw b/ath3k-1.fw
new file mode 100644
index 0000000..63aa9b9
--- /dev/null
+++ b/ath3k-1.fw
Binary files differ
diff --git a/ath6k/AR6002/athwlan.bin.z77 b/ath6k/AR6002/athwlan.bin.z77
new file mode 100644
index 0000000..29598a1
--- /dev/null
+++ b/ath6k/AR6002/athwlan.bin.z77
Binary files differ
diff --git a/ath6k/AR6002/data.patch.hw2_0.bin b/ath6k/AR6002/data.patch.hw2_0.bin
new file mode 100644
index 0000000..29c0d7a
--- /dev/null
+++ b/ath6k/AR6002/data.patch.hw2_0.bin
Binary files differ
diff --git a/ath6k/AR6002/eeprom.bin b/ath6k/AR6002/eeprom.bin
new file mode 100644
index 0000000..889bd49
--- /dev/null
+++ b/ath6k/AR6002/eeprom.bin
Binary files differ
diff --git a/ath6k/AR6002/eeprom.data b/ath6k/AR6002/eeprom.data
new file mode 100644
index 0000000..9819a79
--- /dev/null
+++ b/ath6k/AR6002/eeprom.data
Binary files differ
diff --git a/ath6k/AR6003.1/hw2.1.1/athwlan.bin b/ath6k/AR6003.1/hw2.1.1/athwlan.bin
new file mode 100644
index 0000000..0781364
--- /dev/null
+++ b/ath6k/AR6003.1/hw2.1.1/athwlan.bin
Binary files differ
diff --git a/ath6k/AR6003.1/hw2.1.1/bdata.SD31.bin b/ath6k/AR6003.1/hw2.1.1/bdata.SD31.bin
new file mode 100644
index 0000000..f9eae92
--- /dev/null
+++ b/ath6k/AR6003.1/hw2.1.1/bdata.SD31.bin
Binary files differ
diff --git a/ath6k/AR6003.1/hw2.1.1/bdata.SD32.bin b/ath6k/AR6003.1/hw2.1.1/bdata.SD32.bin
new file mode 100644
index 0000000..19df518
--- /dev/null
+++ b/ath6k/AR6003.1/hw2.1.1/bdata.SD32.bin
Binary files differ
diff --git a/ath6k/AR6003.1/hw2.1.1/bdata.WB31.bin b/ath6k/AR6003.1/hw2.1.1/bdata.WB31.bin
new file mode 100644
index 0000000..f9eae92
--- /dev/null
+++ b/ath6k/AR6003.1/hw2.1.1/bdata.WB31.bin
Binary files differ
diff --git a/ath6k/AR6003.1/hw2.1.1/data.patch.bin b/ath6k/AR6003.1/hw2.1.1/data.patch.bin
new file mode 100644
index 0000000..4113b4f
--- /dev/null
+++ b/ath6k/AR6003.1/hw2.1.1/data.patch.bin
Binary files differ
diff --git a/ath6k/AR6003.1/hw2.1.1/endpointping.bin b/ath6k/AR6003.1/hw2.1.1/endpointping.bin
new file mode 100644
index 0000000..6237f5a
--- /dev/null
+++ b/ath6k/AR6003.1/hw2.1.1/endpointping.bin
Binary files differ
diff --git a/ath6k/AR6003.1/hw2.1.1/otp.bin b/ath6k/AR6003.1/hw2.1.1/otp.bin
new file mode 100644
index 0000000..02f2664
--- /dev/null
+++ b/ath6k/AR6003.1/hw2.1.1/otp.bin
Binary files differ
diff --git a/ath6k/AR6003/hw1.0/athwlan.bin.z77 b/ath6k/AR6003/hw1.0/athwlan.bin.z77
new file mode 100644
index 0000000..242107b
--- /dev/null
+++ b/ath6k/AR6003/hw1.0/athwlan.bin.z77
Binary files differ
diff --git a/ath6k/AR6003/hw1.0/bdata.SD31.bin b/ath6k/AR6003/hw1.0/bdata.SD31.bin
new file mode 100644
index 0000000..fb36c35
--- /dev/null
+++ b/ath6k/AR6003/hw1.0/bdata.SD31.bin
Binary files differ
diff --git a/ath6k/AR6003/hw1.0/bdata.SD32.bin b/ath6k/AR6003/hw1.0/bdata.SD32.bin
new file mode 100644
index 0000000..deb28cf
--- /dev/null
+++ b/ath6k/AR6003/hw1.0/bdata.SD32.bin
Binary files differ
diff --git a/ath6k/AR6003/hw1.0/bdata.WB31.bin b/ath6k/AR6003/hw1.0/bdata.WB31.bin
new file mode 100644
index 0000000..fb36c35
--- /dev/null
+++ b/ath6k/AR6003/hw1.0/bdata.WB31.bin
Binary files differ
diff --git a/ath6k/AR6003/hw1.0/data.patch.bin b/ath6k/AR6003/hw1.0/data.patch.bin
new file mode 100644
index 0000000..9a2d1ef
--- /dev/null
+++ b/ath6k/AR6003/hw1.0/data.patch.bin
Binary files differ
diff --git a/ath6k/AR6003/hw1.0/otp.bin.z77 b/ath6k/AR6003/hw1.0/otp.bin.z77
new file mode 100644
index 0000000..c8de820
--- /dev/null
+++ b/ath6k/AR6003/hw1.0/otp.bin.z77
Binary files differ
diff --git a/ath6k/AR6003/hw2.0/athwlan.bin.z77 b/ath6k/AR6003/hw2.0/athwlan.bin.z77
new file mode 100644
index 0000000..869f3ce
--- /dev/null
+++ b/ath6k/AR6003/hw2.0/athwlan.bin.z77
Binary files differ
diff --git a/ath6k/AR6003/hw2.0/bdata.SD31.bin b/ath6k/AR6003/hw2.0/bdata.SD31.bin
new file mode 100644
index 0000000..f9eae92
--- /dev/null
+++ b/ath6k/AR6003/hw2.0/bdata.SD31.bin
Binary files differ
diff --git a/ath6k/AR6003/hw2.0/bdata.SD32.bin b/ath6k/AR6003/hw2.0/bdata.SD32.bin
new file mode 100644
index 0000000..e64d54e
--- /dev/null
+++ b/ath6k/AR6003/hw2.0/bdata.SD32.bin
Binary files differ
diff --git a/ath6k/AR6003/hw2.0/bdata.WB31.bin b/ath6k/AR6003/hw2.0/bdata.WB31.bin
new file mode 100644
index 0000000..f9eae92
--- /dev/null
+++ b/ath6k/AR6003/hw2.0/bdata.WB31.bin
Binary files differ
diff --git a/ath6k/AR6003/hw2.0/data.patch.bin b/ath6k/AR6003/hw2.0/data.patch.bin
new file mode 100644
index 0000000..4d0a847
--- /dev/null
+++ b/ath6k/AR6003/hw2.0/data.patch.bin
Binary files differ
diff --git a/ath6k/AR6003/hw2.0/otp.bin.z77 b/ath6k/AR6003/hw2.0/otp.bin.z77
new file mode 100644
index 0000000..4d97ffa
--- /dev/null
+++ b/ath6k/AR6003/hw2.0/otp.bin.z77
Binary files differ
diff --git a/ath6k/AR6003/hw2.1.1/athwlan.bin b/ath6k/AR6003/hw2.1.1/athwlan.bin
new file mode 100644
index 0000000..5631222
--- /dev/null
+++ b/ath6k/AR6003/hw2.1.1/athwlan.bin
Binary files differ
diff --git a/ath6k/AR6003/hw2.1.1/bdata.SD31.bin b/ath6k/AR6003/hw2.1.1/bdata.SD31.bin
new file mode 100644
index 0000000..f9eae92
--- /dev/null
+++ b/ath6k/AR6003/hw2.1.1/bdata.SD31.bin
Binary files differ
diff --git a/ath6k/AR6003/hw2.1.1/bdata.SD32.bin b/ath6k/AR6003/hw2.1.1/bdata.SD32.bin
new file mode 100644
index 0000000..e64d54e
--- /dev/null
+++ b/ath6k/AR6003/hw2.1.1/bdata.SD32.bin
Binary files differ
diff --git a/ath6k/AR6003/hw2.1.1/bdata.WB31.bin b/ath6k/AR6003/hw2.1.1/bdata.WB31.bin
new file mode 100644
index 0000000..f9eae92
--- /dev/null
+++ b/ath6k/AR6003/hw2.1.1/bdata.WB31.bin
Binary files differ
diff --git a/ath6k/AR6003/hw2.1.1/data.patch.bin b/ath6k/AR6003/hw2.1.1/data.patch.bin
new file mode 100644
index 0000000..4113b4f
--- /dev/null
+++ b/ath6k/AR6003/hw2.1.1/data.patch.bin
Binary files differ
diff --git a/ath6k/AR6003/hw2.1.1/endpointping.bin b/ath6k/AR6003/hw2.1.1/endpointping.bin
new file mode 100644
index 0000000..79c4227
--- /dev/null
+++ b/ath6k/AR6003/hw2.1.1/endpointping.bin
Binary files differ
diff --git a/ath6k/AR6003/hw2.1.1/fw-2.bin b/ath6k/AR6003/hw2.1.1/fw-2.bin
new file mode 100644
index 0000000..d577290
--- /dev/null
+++ b/ath6k/AR6003/hw2.1.1/fw-2.bin
Binary files differ
diff --git a/ath6k/AR6003/hw2.1.1/fw-3.bin b/ath6k/AR6003/hw2.1.1/fw-3.bin
new file mode 100644
index 0000000..a25fcd4
--- /dev/null
+++ b/ath6k/AR6003/hw2.1.1/fw-3.bin
Binary files differ
diff --git a/ath6k/AR6003/hw2.1.1/otp.bin b/ath6k/AR6003/hw2.1.1/otp.bin
new file mode 100644
index 0000000..19d2990
--- /dev/null
+++ b/ath6k/AR6003/hw2.1.1/otp.bin
Binary files differ
diff --git a/ath6k/AR6004/hw1.2/bdata.bin b/ath6k/AR6004/hw1.2/bdata.bin
new file mode 100644
index 0000000..743f66f
--- /dev/null
+++ b/ath6k/AR6004/hw1.2/bdata.bin
Binary files differ
diff --git a/ath6k/AR6004/hw1.2/fw-2.bin b/ath6k/AR6004/hw1.2/fw-2.bin
new file mode 100644
index 0000000..a211353
--- /dev/null
+++ b/ath6k/AR6004/hw1.2/fw-2.bin
Binary files differ
diff --git a/ath6k/AR6004/hw1.3/bdata.bin b/ath6k/AR6004/hw1.3/bdata.bin
new file mode 100644
index 0000000..f12ea0a
--- /dev/null
+++ b/ath6k/AR6004/hw1.3/bdata.bin
Binary files differ
diff --git a/ath6k/AR6004/hw1.3/fw-3.bin b/ath6k/AR6004/hw1.3/fw-3.bin
new file mode 100644
index 0000000..fe9d635
--- /dev/null
+++ b/ath6k/AR6004/hw1.3/fw-3.bin
Binary files differ
diff --git a/atmsar11.fw b/atmsar11.fw
new file mode 100644
index 0000000..e14f6bd
--- /dev/null
+++ b/atmsar11.fw
Binary files differ
diff --git a/av7110/Boot.S b/av7110/Boot.S
new file mode 100644
index 0000000..d562fdc
--- /dev/null
+++ b/av7110/Boot.S
@@ -0,0 +1,109 @@
+/*
+   Boot.S: boot loader for Siemens DVB-S card
+
+   Copyright (C) 2001 Convergence integrated media GmbH
+	              Written by Ralph Metzler
+		                 <rjkm@convergence.de>
+   Copyright (C) 2006 Matthieu CASTET <castet.mattheiu@free.fr>
+
+   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; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA.
+
+*/
+
+/*
+	check AV711x_3_1.pdf for some hardware infos
+	build it with :
+	$ cc -mbig-endian -c Boot.S
+	$ ld -Ttext 0x2c000000 -EB -o Boot Boot.o
+	$ objcopy -Obinary Boot
+*/
+
+	.text
+	.align
+	.globl _start
+_start:
+	b reset			// reset vector
+	movs  pc, r14           // undefined
+	subs  pc, r14, #4       // SWI
+	subs  pc, r14, #4       // prefetch abort
+	subs  pc, r14, #8       // data abort
+	subs  pc, r14, #4       // reserved
+	subs  pc, r14, #4       // IRQ
+	subs  pc, r14, #4       // FIQ
+
+	.word tbl               // table needed by firmware ROM
+tbl:	.word (endtbl - tbl)
+	.word 0
+  	.word conf
+endtbl:	.word 0
+conf:	.word 0xa5a55a5a
+	.word 0x001f1555
+	.word 0x00000009
+
+reset:	ldr	r13, buffer
+	ldr	r4, flag
+	mov	r0, #0
+	str	r0, [r4]
+	str	r0, [r4, #4]
+
+	ldr		r1, wait_address
+	ldr		r2, flag_address
+	ldr		r3, sram
+
+copycode: // copy the code HW Sram
+	ldmia	r1!, {r5-r12}
+	stmia	r3!, {r5-r12}
+	cmp		r1, r2
+	ble 	copycode
+	ldr		pc, sram // jump to the copied code
+
+wait:	ldrh	r1, [r4]        // wait for flag!=0
+ 	cmp	r1, #0
+	beq	wait
+
+	mov	r1, r13         // buffer address
+ 	ldr	r3, [r4,#4]     // destaddr
+
+ 	ldrh	r2, [r4,#2]     // get segment length
+	add     r2, r2, #63     // round length to next 64 bytes
+	movs	r2, r2, lsr #6  // and divide by 64
+	moveq	r0, #2          // if 0, set flag to 2, else signal
+	strh	r0, [r4]        // that buffer is accepted by setting to 0
+        beq wait
+	
+copyloop:
+	ldmia	r1!, {r5-r12}
+	stmia	r3!, {r5-r12}
+	ldmia	r1!, {r5-r12}
+	stmia	r3!, {r5-r12}
+ 	subs	r2, r2, #1
+ 	bne	copyloop
+
+	eor     r13, r13, #0x1400    // switch to other buffer
+	b	wait
+
+// flag is stored at 0x2c0003f8, length at 0x2c0003fa,
+// destaddr at 0x2c0003fc
+
+flag:	.word	0x2c0003f8
+
+
+// buffer 1 is at 0x2c000400, buffer 2 at 0x2c001000
+
+buffer:	.word	0x2c000400
+
+sram: .word   0x9e000800
+wait_address: .word   wait
+flag_address: .word   flag
diff --git a/av7110/Makefile b/av7110/Makefile
new file mode 100644
index 0000000..a2776fe
--- /dev/null
+++ b/av7110/Makefile
@@ -0,0 +1,11 @@
+CC = arm-linux-gnueabi-gcc
+LD = arm-linux-gnueabi-ld
+OBJCOPY = arm-linux-gnueabi-objcopy
+
+bootcode.bin: Boot.S
+	$(CC) -mbig-endian -c Boot.S
+	$(LD) -Ttext 0x2c000000 -EB -o Boot Boot.o
+	$(OBJCOPY) -Obinary Boot bootcode.bin
+
+clean:
+	rm -f Boot.o Boot bootcode.bin
diff --git a/av7110/bootcode.bin b/av7110/bootcode.bin
new file mode 100644
index 0000000..f315775
--- /dev/null
+++ b/av7110/bootcode.bin
Binary files differ
diff --git a/bnx2/bnx2-mips-06-4.6.16.fw b/bnx2/bnx2-mips-06-4.6.16.fw
new file mode 100644
index 0000000..0ff4f5a
--- /dev/null
+++ b/bnx2/bnx2-mips-06-4.6.16.fw
Binary files differ
diff --git a/bnx2/bnx2-mips-06-5.0.0.j3.fw b/bnx2/bnx2-mips-06-5.0.0.j3.fw
new file mode 100644
index 0000000..6804b82
--- /dev/null
+++ b/bnx2/bnx2-mips-06-5.0.0.j3.fw
Binary files differ
diff --git a/bnx2/bnx2-mips-06-5.0.0.j6.fw b/bnx2/bnx2-mips-06-5.0.0.j6.fw
new file mode 100644
index 0000000..637c8bb
--- /dev/null
+++ b/bnx2/bnx2-mips-06-5.0.0.j6.fw
Binary files differ
diff --git a/bnx2/bnx2-mips-06-6.0.15.fw b/bnx2/bnx2-mips-06-6.0.15.fw
new file mode 100644
index 0000000..012c972
--- /dev/null
+++ b/bnx2/bnx2-mips-06-6.0.15.fw
Binary files differ
diff --git a/bnx2/bnx2-mips-06-6.2.1.fw b/bnx2/bnx2-mips-06-6.2.1.fw
new file mode 100644
index 0000000..3c17b89
--- /dev/null
+++ b/bnx2/bnx2-mips-06-6.2.1.fw
Binary files differ
diff --git a/bnx2/bnx2-mips-06-6.2.3.fw b/bnx2/bnx2-mips-06-6.2.3.fw
new file mode 100644
index 0000000..7e9e54b
--- /dev/null
+++ b/bnx2/bnx2-mips-06-6.2.3.fw
Binary files differ
diff --git a/bnx2/bnx2-mips-09-4.6.17.fw b/bnx2/bnx2-mips-09-4.6.17.fw
new file mode 100644
index 0000000..2736b4a
--- /dev/null
+++ b/bnx2/bnx2-mips-09-4.6.17.fw
Binary files differ
diff --git a/bnx2/bnx2-mips-09-5.0.0.j15.fw b/bnx2/bnx2-mips-09-5.0.0.j15.fw
new file mode 100644
index 0000000..7f69b5b
--- /dev/null
+++ b/bnx2/bnx2-mips-09-5.0.0.j15.fw
Binary files differ
diff --git a/bnx2/bnx2-mips-09-5.0.0.j3.fw b/bnx2/bnx2-mips-09-5.0.0.j3.fw
new file mode 100644
index 0000000..6c98988
--- /dev/null
+++ b/bnx2/bnx2-mips-09-5.0.0.j3.fw
Binary files differ
diff --git a/bnx2/bnx2-mips-09-5.0.0.j9.fw b/bnx2/bnx2-mips-09-5.0.0.j9.fw
new file mode 100644
index 0000000..21ab10a
--- /dev/null
+++ b/bnx2/bnx2-mips-09-5.0.0.j9.fw
Binary files differ
diff --git a/bnx2/bnx2-mips-09-6.0.17.fw b/bnx2/bnx2-mips-09-6.0.17.fw
new file mode 100644
index 0000000..1349994
--- /dev/null
+++ b/bnx2/bnx2-mips-09-6.0.17.fw
Binary files differ
diff --git a/bnx2/bnx2-mips-09-6.2.1.fw b/bnx2/bnx2-mips-09-6.2.1.fw
new file mode 100644
index 0000000..bd78e3f
--- /dev/null
+++ b/bnx2/bnx2-mips-09-6.2.1.fw
Binary files differ
diff --git a/bnx2/bnx2-mips-09-6.2.1a.fw b/bnx2/bnx2-mips-09-6.2.1a.fw
new file mode 100644
index 0000000..99ac571
--- /dev/null
+++ b/bnx2/bnx2-mips-09-6.2.1a.fw
Binary files differ
diff --git a/bnx2/bnx2-mips-09-6.2.1b.fw b/bnx2/bnx2-mips-09-6.2.1b.fw
new file mode 100644
index 0000000..8bd1e79
--- /dev/null
+++ b/bnx2/bnx2-mips-09-6.2.1b.fw
Binary files differ
diff --git a/bnx2/bnx2-rv2p-06-4.6.16.fw b/bnx2/bnx2-rv2p-06-4.6.16.fw
new file mode 100644
index 0000000..bea33c3
--- /dev/null
+++ b/bnx2/bnx2-rv2p-06-4.6.16.fw
Binary files differ
diff --git a/bnx2/bnx2-rv2p-06-5.0.0.j3.fw b/bnx2/bnx2-rv2p-06-5.0.0.j3.fw
new file mode 100644
index 0000000..1f805a1
--- /dev/null
+++ b/bnx2/bnx2-rv2p-06-5.0.0.j3.fw
Binary files differ
diff --git a/bnx2/bnx2-rv2p-06-6.0.15.fw b/bnx2/bnx2-rv2p-06-6.0.15.fw
new file mode 100644
index 0000000..4d756e1
--- /dev/null
+++ b/bnx2/bnx2-rv2p-06-6.0.15.fw
Binary files differ
diff --git a/bnx2/bnx2-rv2p-09-4.6.15.fw b/bnx2/bnx2-rv2p-09-4.6.15.fw
new file mode 100644
index 0000000..bdb5d10
--- /dev/null
+++ b/bnx2/bnx2-rv2p-09-4.6.15.fw
Binary files differ
diff --git a/bnx2/bnx2-rv2p-09-5.0.0.j10.fw b/bnx2/bnx2-rv2p-09-5.0.0.j10.fw
new file mode 100644
index 0000000..2acc5ff
--- /dev/null
+++ b/bnx2/bnx2-rv2p-09-5.0.0.j10.fw
Binary files differ
diff --git a/bnx2/bnx2-rv2p-09-5.0.0.j3.fw b/bnx2/bnx2-rv2p-09-5.0.0.j3.fw
new file mode 100644
index 0000000..82a5de2
--- /dev/null
+++ b/bnx2/bnx2-rv2p-09-5.0.0.j3.fw
Binary files differ
diff --git a/bnx2/bnx2-rv2p-09-6.0.17.fw b/bnx2/bnx2-rv2p-09-6.0.17.fw
new file mode 100644
index 0000000..6693299
--- /dev/null
+++ b/bnx2/bnx2-rv2p-09-6.0.17.fw
Binary files differ
diff --git a/bnx2/bnx2-rv2p-09ax-5.0.0.j10.fw b/bnx2/bnx2-rv2p-09ax-5.0.0.j10.fw
new file mode 100644
index 0000000..0e390ec
--- /dev/null
+++ b/bnx2/bnx2-rv2p-09ax-5.0.0.j10.fw
Binary files differ
diff --git a/bnx2/bnx2-rv2p-09ax-5.0.0.j3.fw b/bnx2/bnx2-rv2p-09ax-5.0.0.j3.fw
new file mode 100644
index 0000000..834c479
--- /dev/null
+++ b/bnx2/bnx2-rv2p-09ax-5.0.0.j3.fw
Binary files differ
diff --git a/bnx2/bnx2-rv2p-09ax-6.0.17.fw b/bnx2/bnx2-rv2p-09ax-6.0.17.fw
new file mode 100644
index 0000000..e5738ce
--- /dev/null
+++ b/bnx2/bnx2-rv2p-09ax-6.0.17.fw
Binary files differ
diff --git a/bnx2x-e1-4.8.53.0.fw b/bnx2x-e1-4.8.53.0.fw
new file mode 100644
index 0000000..37c0f38
--- /dev/null
+++ b/bnx2x-e1-4.8.53.0.fw
Binary files differ
diff --git a/bnx2x-e1-5.2.13.0.fw b/bnx2x-e1-5.2.13.0.fw
new file mode 100644
index 0000000..d21cf19
--- /dev/null
+++ b/bnx2x-e1-5.2.13.0.fw
Binary files differ
diff --git a/bnx2x-e1-5.2.7.0.fw b/bnx2x-e1-5.2.7.0.fw
new file mode 100644
index 0000000..8303cdc
--- /dev/null
+++ b/bnx2x-e1-5.2.7.0.fw
Binary files differ
diff --git a/bnx2x-e1h-4.8.53.0.fw b/bnx2x-e1h-4.8.53.0.fw
new file mode 100644
index 0000000..6fcd9f9
--- /dev/null
+++ b/bnx2x-e1h-4.8.53.0.fw
Binary files differ
diff --git a/bnx2x-e1h-5.2.13.0.fw b/bnx2x-e1h-5.2.13.0.fw
new file mode 100644
index 0000000..d5a05ea
--- /dev/null
+++ b/bnx2x-e1h-5.2.13.0.fw
Binary files differ
diff --git a/bnx2x-e1h-5.2.7.0.fw b/bnx2x-e1h-5.2.7.0.fw
new file mode 100644
index 0000000..116e713
--- /dev/null
+++ b/bnx2x-e1h-5.2.7.0.fw
Binary files differ
diff --git a/bnx2x/bnx2x-e1-6.0.34.0.fw b/bnx2x/bnx2x-e1-6.0.34.0.fw
new file mode 100644
index 0000000..ec19bcd
--- /dev/null
+++ b/bnx2x/bnx2x-e1-6.0.34.0.fw
Binary files differ
diff --git a/bnx2x/bnx2x-e1-6.2.5.0.fw b/bnx2x/bnx2x-e1-6.2.5.0.fw
new file mode 100644
index 0000000..0d25b92
--- /dev/null
+++ b/bnx2x/bnx2x-e1-6.2.5.0.fw
Binary files differ
diff --git a/bnx2x/bnx2x-e1-6.2.9.0.fw b/bnx2x/bnx2x-e1-6.2.9.0.fw
new file mode 100644
index 0000000..000a704
--- /dev/null
+++ b/bnx2x/bnx2x-e1-6.2.9.0.fw
Binary files differ
diff --git a/bnx2x/bnx2x-e1-7.0.20.0.fw b/bnx2x/bnx2x-e1-7.0.20.0.fw
new file mode 100644
index 0000000..321bf6f
--- /dev/null
+++ b/bnx2x/bnx2x-e1-7.0.20.0.fw
Binary files differ
diff --git a/bnx2x/bnx2x-e1-7.0.23.0.fw b/bnx2x/bnx2x-e1-7.0.23.0.fw
new file mode 100644
index 0000000..6a22ab8
--- /dev/null
+++ b/bnx2x/bnx2x-e1-7.0.23.0.fw
Binary files differ
diff --git a/bnx2x/bnx2x-e1-7.0.29.0.fw b/bnx2x/bnx2x-e1-7.0.29.0.fw
new file mode 100644
index 0000000..1a8fd32
--- /dev/null
+++ b/bnx2x/bnx2x-e1-7.0.29.0.fw
Binary files differ
diff --git a/bnx2x/bnx2x-e1-7.2.16.0.fw b/bnx2x/bnx2x-e1-7.2.16.0.fw
new file mode 100644
index 0000000..b0b6f05
--- /dev/null
+++ b/bnx2x/bnx2x-e1-7.2.16.0.fw
Binary files differ
diff --git a/bnx2x/bnx2x-e1-7.2.51.0.fw b/bnx2x/bnx2x-e1-7.2.51.0.fw
new file mode 100644
index 0000000..39546c7
--- /dev/null
+++ b/bnx2x/bnx2x-e1-7.2.51.0.fw
Binary files differ
diff --git a/bnx2x/bnx2x-e1-7.8.17.0.fw b/bnx2x/bnx2x-e1-7.8.17.0.fw
new file mode 100644
index 0000000..baea31e
--- /dev/null
+++ b/bnx2x/bnx2x-e1-7.8.17.0.fw
Binary files differ
diff --git a/bnx2x/bnx2x-e1-7.8.2.0.fw b/bnx2x/bnx2x-e1-7.8.2.0.fw
new file mode 100644
index 0000000..b1fcbcf
--- /dev/null
+++ b/bnx2x/bnx2x-e1-7.8.2.0.fw
Binary files differ
diff --git a/bnx2x/bnx2x-e1h-6.0.34.0.fw b/bnx2x/bnx2x-e1h-6.0.34.0.fw
new file mode 100644
index 0000000..a6be837
--- /dev/null
+++ b/bnx2x/bnx2x-e1h-6.0.34.0.fw
Binary files differ
diff --git a/bnx2x/bnx2x-e1h-6.2.5.0.fw b/bnx2x/bnx2x-e1h-6.2.5.0.fw
new file mode 100644
index 0000000..3bd15e3
--- /dev/null
+++ b/bnx2x/bnx2x-e1h-6.2.5.0.fw
Binary files differ
diff --git a/bnx2x/bnx2x-e1h-6.2.9.0.fw b/bnx2x/bnx2x-e1h-6.2.9.0.fw
new file mode 100644
index 0000000..84e35c1
--- /dev/null
+++ b/bnx2x/bnx2x-e1h-6.2.9.0.fw
Binary files differ
diff --git a/bnx2x/bnx2x-e1h-7.0.20.0.fw b/bnx2x/bnx2x-e1h-7.0.20.0.fw
new file mode 100644
index 0000000..6fd84c6
--- /dev/null
+++ b/bnx2x/bnx2x-e1h-7.0.20.0.fw
Binary files differ
diff --git a/bnx2x/bnx2x-e1h-7.0.23.0.fw b/bnx2x/bnx2x-e1h-7.0.23.0.fw
new file mode 100644
index 0000000..615031e
--- /dev/null
+++ b/bnx2x/bnx2x-e1h-7.0.23.0.fw
Binary files differ
diff --git a/bnx2x/bnx2x-e1h-7.0.29.0.fw b/bnx2x/bnx2x-e1h-7.0.29.0.fw
new file mode 100644
index 0000000..3068742
--- /dev/null
+++ b/bnx2x/bnx2x-e1h-7.0.29.0.fw
Binary files differ
diff --git a/bnx2x/bnx2x-e1h-7.2.16.0.fw b/bnx2x/bnx2x-e1h-7.2.16.0.fw
new file mode 100644
index 0000000..1d8633c
--- /dev/null
+++ b/bnx2x/bnx2x-e1h-7.2.16.0.fw
Binary files differ
diff --git a/bnx2x/bnx2x-e1h-7.2.51.0.fw b/bnx2x/bnx2x-e1h-7.2.51.0.fw
new file mode 100644
index 0000000..e214a50
--- /dev/null
+++ b/bnx2x/bnx2x-e1h-7.2.51.0.fw
Binary files differ
diff --git a/bnx2x/bnx2x-e1h-7.8.17.0.fw b/bnx2x/bnx2x-e1h-7.8.17.0.fw
new file mode 100644
index 0000000..6510b43
--- /dev/null
+++ b/bnx2x/bnx2x-e1h-7.8.17.0.fw
Binary files differ
diff --git a/bnx2x/bnx2x-e1h-7.8.2.0.fw b/bnx2x/bnx2x-e1h-7.8.2.0.fw
new file mode 100644
index 0000000..2b6014a
--- /dev/null
+++ b/bnx2x/bnx2x-e1h-7.8.2.0.fw
Binary files differ
diff --git a/bnx2x/bnx2x-e2-6.0.34.0.fw b/bnx2x/bnx2x-e2-6.0.34.0.fw
new file mode 100644
index 0000000..f02ca25
--- /dev/null
+++ b/bnx2x/bnx2x-e2-6.0.34.0.fw
Binary files differ
diff --git a/bnx2x/bnx2x-e2-6.2.5.0.fw b/bnx2x/bnx2x-e2-6.2.5.0.fw
new file mode 100644
index 0000000..2f1b2df
--- /dev/null
+++ b/bnx2x/bnx2x-e2-6.2.5.0.fw
Binary files differ
diff --git a/bnx2x/bnx2x-e2-6.2.9.0.fw b/bnx2x/bnx2x-e2-6.2.9.0.fw
new file mode 100644
index 0000000..3198470
--- /dev/null
+++ b/bnx2x/bnx2x-e2-6.2.9.0.fw
Binary files differ
diff --git a/bnx2x/bnx2x-e2-7.0.20.0.fw b/bnx2x/bnx2x-e2-7.0.20.0.fw
new file mode 100644
index 0000000..1ae64c6
--- /dev/null
+++ b/bnx2x/bnx2x-e2-7.0.20.0.fw
Binary files differ
diff --git a/bnx2x/bnx2x-e2-7.0.23.0.fw b/bnx2x/bnx2x-e2-7.0.23.0.fw
new file mode 100644
index 0000000..1d66aeb
--- /dev/null
+++ b/bnx2x/bnx2x-e2-7.0.23.0.fw
Binary files differ
diff --git a/bnx2x/bnx2x-e2-7.0.29.0.fw b/bnx2x/bnx2x-e2-7.0.29.0.fw
new file mode 100644
index 0000000..6138a2e
--- /dev/null
+++ b/bnx2x/bnx2x-e2-7.0.29.0.fw
Binary files differ
diff --git a/bnx2x/bnx2x-e2-7.2.16.0.fw b/bnx2x/bnx2x-e2-7.2.16.0.fw
new file mode 100644
index 0000000..53978cb
--- /dev/null
+++ b/bnx2x/bnx2x-e2-7.2.16.0.fw
Binary files differ
diff --git a/bnx2x/bnx2x-e2-7.2.51.0.fw b/bnx2x/bnx2x-e2-7.2.51.0.fw
new file mode 100644
index 0000000..8b38cd3
--- /dev/null
+++ b/bnx2x/bnx2x-e2-7.2.51.0.fw
Binary files differ
diff --git a/bnx2x/bnx2x-e2-7.8.17.0.fw b/bnx2x/bnx2x-e2-7.8.17.0.fw
new file mode 100644
index 0000000..34abb46
--- /dev/null
+++ b/bnx2x/bnx2x-e2-7.8.17.0.fw
Binary files differ
diff --git a/bnx2x/bnx2x-e2-7.8.2.0.fw b/bnx2x/bnx2x-e2-7.8.2.0.fw
new file mode 100644
index 0000000..ef2d09d
--- /dev/null
+++ b/bnx2x/bnx2x-e2-7.8.2.0.fw
Binary files differ
diff --git a/brcm/bcm4329-fullmac-4.bin b/brcm/bcm4329-fullmac-4.bin
new file mode 100644
index 0000000..fcd41c3
--- /dev/null
+++ b/brcm/bcm4329-fullmac-4.bin
Binary files differ
diff --git a/brcm/bcm43xx-0.fw b/brcm/bcm43xx-0.fw
new file mode 100644
index 0000000..9ee5ccc
--- /dev/null
+++ b/brcm/bcm43xx-0.fw
Binary files differ
diff --git a/brcm/bcm43xx_hdr-0.fw b/brcm/bcm43xx_hdr-0.fw
new file mode 100644
index 0000000..a6db78d
--- /dev/null
+++ b/brcm/bcm43xx_hdr-0.fw
Binary files differ
diff --git a/brcm/brcmfmac43236b.bin b/brcm/brcmfmac43236b.bin
new file mode 100644
index 0000000..8a2004a
--- /dev/null
+++ b/brcm/brcmfmac43236b.bin
Binary files differ
diff --git a/brcm/brcmfmac43241b0-sdio.bin b/brcm/brcmfmac43241b0-sdio.bin
new file mode 100644
index 0000000..729b894
--- /dev/null
+++ b/brcm/brcmfmac43241b0-sdio.bin
Binary files differ
diff --git a/brcm/brcmfmac43241b4-sdio.bin b/brcm/brcmfmac43241b4-sdio.bin
new file mode 100644
index 0000000..5d10c24
--- /dev/null
+++ b/brcm/brcmfmac43241b4-sdio.bin
Binary files differ
diff --git a/brcm/brcmfmac4329-sdio.bin b/brcm/brcmfmac4329-sdio.bin
new file mode 100644
index 0000000..d4c4560
--- /dev/null
+++ b/brcm/brcmfmac4329-sdio.bin
Binary files differ
diff --git a/brcm/brcmfmac4330-sdio.bin b/brcm/brcmfmac4330-sdio.bin
new file mode 100644
index 0000000..e3bc355
--- /dev/null
+++ b/brcm/brcmfmac4330-sdio.bin
Binary files differ
diff --git a/brcm/brcmfmac4334-sdio.bin b/brcm/brcmfmac4334-sdio.bin
new file mode 100644
index 0000000..ade994f
--- /dev/null
+++ b/brcm/brcmfmac4334-sdio.bin
Binary files differ
diff --git a/brcm/brcmfmac4335-sdio.bin b/brcm/brcmfmac4335-sdio.bin
new file mode 100644
index 0000000..a670e96
--- /dev/null
+++ b/brcm/brcmfmac4335-sdio.bin
Binary files differ
diff --git a/carl9170-1.fw b/carl9170-1.fw
new file mode 100644
index 0000000..05c1f48
--- /dev/null
+++ b/carl9170-1.fw
Binary files differ
diff --git a/carl9170fw/CMakeLists.txt b/carl9170fw/CMakeLists.txt
new file mode 100644
index 0000000..c017bbb
--- /dev/null
+++ b/carl9170fw/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8)
+
+project(carl9170)
+
+#if you don't want the full compiler output, remove the following line
+#set(CMAKE_VERBOSE_MAKEFILE ON)
+
+include("config.cmake")
+
+add_subdirectory(carlfw)
+
+if (CONFIG_CARL9170FW_BUILD_MINIBOOT)
+	add_subdirectory(minifw)
+endif (CONFIG_CARL9170FW_BUILD_MINIBOOT)
+
+if (CONFIG_CARL9170FW_BUILD_TOOLS)
+	add_subdirectory(tools)
+endif (CONFIG_CARL9170FW_BUILD_TOOLS)
+
diff --git a/carl9170fw/COPYRIGHT b/carl9170fw/COPYRIGHT
new file mode 100644
index 0000000..b1d3e77
--- /dev/null
+++ b/carl9170fw/COPYRIGHT
@@ -0,0 +1,19 @@
+Atheros carl9170 firmware - used by the ar9170 wireless device
+
+Copyright (c) 2000-2005  ZyDAS Technology Corporation
+Copyright (c) 2007-2009 Atheros Communications, Inc.
+Copyright (c) 2009-2011 Christian Lamparter <chunkeey@googlemail.com>
+
+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; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
diff --git a/carl9170fw/GPL b/carl9170fw/GPL
new file mode 100644
index 0000000..d511905
--- /dev/null
+++ b/carl9170fw/GPL
@@ -0,0 +1,339 @@
+		    GNU GENERAL PUBLIC LICENSE
+		       Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+			    Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Lesser General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+		    GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+  1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+  2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) You must cause the modified files to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in
+    whole or in part contains or is derived from the Program or any
+    part thereof, to be licensed as a whole at no charge to all third
+    parties under the terms of this License.
+
+    c) If the modified program normally reads commands interactively
+    when run, you must cause it, when started running for such
+    interactive use in the most ordinary way, to print or display an
+    announcement including an appropriate copyright notice and a
+    notice that there is no warranty (or else, saying that you provide
+    a warranty) and that users may redistribute the program under
+    these conditions, and telling the user how to view a copy of this
+    License.  (Exception: if the Program itself is interactive but
+    does not normally print such an announcement, your work based on
+    the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of Sections
+    1 and 2 above on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three
+    years, to give any third party, for a charge no more than your
+    cost of physically performing source distribution, a complete
+    machine-readable copy of the corresponding source code, to be
+    distributed under the terms of Sections 1 and 2 above on a medium
+    customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer
+    to distribute corresponding source code.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form with such
+    an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it.  For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable.  However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+  5. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Program or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+  6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded.  In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+  9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation.  If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+  10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission.  For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this.  Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+			    NO WARRANTY
+
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+		     END OF TERMS AND CONDITIONS
+
+	    How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    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; if not, write to the Free Software Foundation, Inc.,
+    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+    Gnomovision version 69, Copyright (C) year name of author
+    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+  `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+  <signature of Ty Coon>, 1 April 1989
+  Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs.  If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library.  If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.
diff --git a/carl9170fw/Kconfig b/carl9170fw/Kconfig
new file mode 100644
index 0000000..03fd2cd
--- /dev/null
+++ b/carl9170fw/Kconfig
@@ -0,0 +1,5 @@
+mainmenu "CARL9170 Firmware Configuration"
+
+source "carlfw/Kconfig"
+source "minifw/Kconfig"
+source "tools/Kconfig"
diff --git a/carl9170fw/README b/carl9170fw/README
new file mode 100644
index 0000000..230b2db
--- /dev/null
+++ b/carl9170fw/README
@@ -0,0 +1,43 @@
+Community AR9170 Linux firmware
+-----------------------
+
+This is the firmware for the Atheros ar9170 802.11n devices.
+
+To build the firmware you will need an SH-2 toolchain.
+You can build your own toolchain:
+
+make -C toolchain
+
+but be aware that this will take some time and requires
+about 1.2 GiB disk space.
+
+The resulting firmware, carl9170.fw, can be used only
+with the carl9170 Linux driver.
+
+After getting a toolchain, you will need to get more
+tools & libs:
+
+ * gcc 4.4+
+
+ * gperf, bison/flex
+
+ * cmake 2.8.0+
+
+ * libusb 1.0+
+
+ * SDL SDK 1.2.13+
+
+afterwards, simply execute:
+
+autogen.sh
+
+to start the configuration and build process.
+
+if you want to "install" your own firmware, you can either
+do this manually, or by executing:
+ 
+autogen.sh install
+
+This will place a copy with the right filename [adds API rev]
+into /lib/firmware/[the default path on most Distributions].
+
diff --git a/carl9170fw/autogen.sh b/carl9170fw/autogen.sh
new file mode 100755
index 0000000..6843f19
--- /dev/null
+++ b/carl9170fw/autogen.sh
@@ -0,0 +1,47 @@
+#!/bin/bash
+
+set -e
+
+case "$1" in
+	config)
+		echo "Configuring..."
+		pushd config
+		cmake .
+		make
+		popd
+		config/conf Kconfig
+		cmake .
+	;;
+
+	compile)
+		echo "Compile time..."
+		make
+	;;
+
+	install)
+		if [ ! -e .config ]; then
+			exit 1
+		fi
+
+		. ./.config
+		make
+
+		echo -n "Installing firmware..."
+		if [ "$CONFIG_CARL9170FW_BUILD_TOOLS" = "y" ] &&
+		   [ "$CONFIG_CARL9170FW_BUILD_MINIBOOT" = "y" ]; then
+			echo -n "Apply miniboot..."
+			tools/src/miniboot a carlfw/carl9170.fw minifw/miniboot.fw
+		fi
+
+		install -m 644 carlfw/carl9170.fw \
+			../carl9170-$CONFIG_CARL9170FW_RELEASE_VERSION.fw
+		echo "done."
+	;;
+
+	*)
+		$0 config
+		$0 compile
+	;;
+
+
+esac
diff --git a/carl9170fw/carlfw/CMakeLists.txt b/carl9170fw/carlfw/CMakeLists.txt
new file mode 100644
index 0000000..caf9595
--- /dev/null
+++ b/carl9170fw/carlfw/CMakeLists.txt
@@ -0,0 +1,67 @@
+cmake_minimum_required(VERSION 2.8)
+
+project(carl9170.fw)
+
+include("../extra/sh-elf-linux.cmake")
+include("../config.cmake")
+
+set(CARLFW_CFLAGS_WARNING "-W -Wall -Wextra -Wunreachable-code -Winline -Wlogical-op -Wno-packed-bitfield-compat -Winit-self -Wshadow -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wformat=2 -Wcast-align -Wmissing-format-attribute -Wmissing-prototypes -Wtype-limits -Wmissing-declarations -Wmissing-noreturn -Wredundant-decls -Wnested-externs -Wdisabled-optimization -Wpointer-arith -Wvolatile-register-var -Waddress -Wbad-function-cast -Wunsafe-loop-optimizations")
+set(CARLFW_CFLAGS_EXTRA "-mbitops -std=gnu99 -ffunction-sections -Wframe-larger-than=128 -Werror")
+set(CARLFW_CFLAGS_DEF "-D__CARL9170FW__")
+if (CONFIG_CARL9170FW_AGGRESSIVE_CFLAGS)
+	set(CARLFW_CFLAGS_AGGRESSIVE "-fomit-frame-pointer -fsee -frename-registers -ftree-vectorize -flto -fstrict-volatile-bitfields -fmodulo-sched")
+endif (CONFIG_CARL9170FW_AGGRESSIVE_CFLAGS)
+
+include_directories (../include/linux ../include/shared ../include include)
+
+set(carl9170_main_src src/main.c src/wlan.c src/fw.c src/gpio.c
+		      src/cmd.c src/uart.c src/dma.c src/hostif.c src/reboot.S
+		      src/printf.c src/rf.c src/cam.c src/wol.c)
+
+set(carl9170_lib_src src/ashlsi3.S src/memcpy.S src/memset.S src/udivsi3_i4i-Os.S)
+set(carl9170_usb_src usb/main.c usb/usb.c usb/fifo.c)
+
+set(carl9170_src ${carl9170_main_src} ${carl9170_lib_src} ${carl9170_usb_src})
+
+set_source_files_properties(src/ashlsi3.S PROPERTIES LANGUAGE C)
+set_source_files_properties(src/memcpy.S PROPERTIES LANGUAGE C)
+set_source_files_properties(src/memset.S PROPERTIES LANGUAGE C)
+set_source_files_properties(src/reboot.S PROPERTIES LANGUAGE C)
+set_source_files_properties(src/udivsi3_i4i-Os.S PROPERTIES LANGUAGE C)
+
+add_executable(carl9170.elf ${carl9170_src})
+
+set_target_properties(carl9170.elf PROPERTIES LINKER_LANGUAGE C)
+
+set_target_properties(carl9170.elf PROPERTIES COMPILE_FLAGS
+	" ${CARLFW_CFLAGS_DEF} ${CARLFW_CFLAGS_EXTRA} ${CARLFW_CFLAGS_AGGRESSIVE} ${CARLFW_CFLAGS_WARNING}")
+set_target_properties(carl9170.elf PROPERTIES LINK_FLAGS "-Tcarl9170.lds")
+
+
+
+add_custom_target(firmware ALL)
+
+add_custom_command(
+	SOURCE carl9170.elf
+	COMMAND ${OBJCOPY}
+	ARGS --strip-unneeded -O binary -R .sram -R .eeprom -R .fwdsc carl9170.elf carl9170.bin
+	TARGET firmware
+	OUTPUTS carl9170.bin)
+
+add_custom_command(
+	SOURCE carl9170.elf
+	COMMAND ${OBJCOPY}
+	ARGS --strip-unneeded -O binary -j .fwdsc carl9170.elf carl9170.dsc
+	TARGET firmware
+	OUTPUTS carl9170.dsc)
+
+add_custom_command(
+	SOURCE firmware
+	TARGET firmware
+	COMMAND cat
+	ARGS "carl9170.bin" "carl9170.dsc" > "carl9170.fw"
+	DEPENDS carl9170.elf carl9170.bin carl9170.dsc
+	OUTPUTS carl9170.fw)
+
+SET_DIRECTORY_PROPERTIES(
+	PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "carl9170.fw")
diff --git a/carl9170fw/carlfw/Kconfig b/carl9170fw/carlfw/Kconfig
new file mode 100644
index 0000000..f42268c
--- /dev/null
+++ b/carl9170fw/carlfw/Kconfig
@@ -0,0 +1,233 @@
+menu "General"
+
+config CARL9170FW_RELEASE_VERSION
+	int
+	default 1
+
+menu "Selectable Hardware Options"
+
+choice
+	prompt "Receiver Max. Frame Length"
+	default CARL9170FW_RX_FRAME_LEN_8192
+
+	config CARL9170FW_RX_FRAME_LEN_4096
+		bool "4096"
+
+	config CARL9170FW_RX_FRAME_LEN_8192
+		bool "8192"
+
+	config CARL9170FW_RX_FRAME_LEN_16384
+		bool "16384"
+
+	config CARL9170FW_RX_FRAME_LEN_32768
+		bool "32768"
+
+endchoice
+
+config CARL9170FW_RX_FRAME_LEN
+	int
+	default 4096 if CARL9170FW_RX_FRAME_LEN_4096
+	default 8192 if CARL9170FW_RX_FRAME_LEN_8192
+	default 16384 if CARL9170FW_RX_FRAME_LEN_16384
+	default 32768 if CARL9170FW_RX_FRAME_LEN_32768
+
+config CARL9170FW_GPIO_INTERRUPT
+	def_bool y
+	prompt "GPIO Software Interrupt"
+	---help---
+	 When this option is enabled, the firmware will poll the GPIO
+	 registers and reports to the driver whenever the GPIO state
+	 has changed from a previous state.
+
+	 Note: This feature is necessary to monitor the WPS button,
+	       if you have one on your device, then say Y.
+
+config CARL9170FW_SECURITY_ENGINE
+	def_bool y
+	prompt "Support Hardware Crypto Engine"
+	---help---
+	 This options controls if the firmware will allow the driver
+	 to program the security engine / CAM through a firmware
+	 interface.
+
+	 Say Y. Unless you want to do the en- and decryption for
+	 CCMP(AES), TKIP/WEP(RC4) in the application anyway.
+
+config CARL9170FW_RADIO_FUNCTIONS
+	def_bool y
+	prompt "Enable Firmware-supported Radio/RF functions"
+	---help---
+	 Some PHY/RF functions (e.g.: AGC and Noise calibration) need
+	 to be done in the firmware.
+
+	 Say Y, unless you really don't need the Radio/RF for
+	 your project.
+
+endmenu
+
+menu "802.11 Firmware Features"
+
+config CARL9170FW_CAB_QUEUE
+	def_bool y
+	prompt "Support software-based Content after Beacon Queue"
+	---help---
+	 This (software) queue is used to send any broad-/multi-cast buffered
+	 frames after the next DTIM beacon.
+
+	 This feature is required for Accesspoint mode operation.
+
+	 Say Y.
+
+endmenu
+
+source "carlfw/usb/Kconfig"
+
+menu "Experimental, Unstable & Testing Extensions"
+
+config CARL9170FW_PRINTF
+	def_bool y
+	prompt "Advanced printf"
+	depends on CARL9170FW_DEBUG_UART || CARL9170FW_DEBUG_USB
+	---help---
+	 Advanced printf (very useful for debugging purposes)
+	 The formats supported by this implementation are:
+		'd' 'u' 'c' 's' 'x' 'X' 'p'.
+
+	 Note: If this option is disabled, the firmware will be only
+	       capable of reported _preformated_ string.
+
+config CARL9170FW_EXPERIMENTAL
+	def_bool y
+	prompt "Experimental Features"
+
+config CARL9170FW_WOL_OPTION
+	def_bool n
+	prompt "Wakeup on WLAN"
+	depends on CARL9170FW_EXPERIMENTAL
+	---help---
+	 With this option enabled, the firmware can wake-up
+	 suspended hosts... As long as they fully support
+	 USB remote wakeup.
+
+config CARL9170FW_WOL
+	def_bool n
+	depends on CARL9170FW_WOL_OPTION
+
+config CARL9170FW_WOL_NL80211_TRIGGERS
+	def_bool n
+	prompt "Standard NL80211 wakeup triggers"
+	depends on CARL9170FW_WOL_OPTION
+	select CARL9170FW_WOL
+	---help---
+	 Available triggers:
+	  * Magic Packet(tm) pattern
+	  * disconnect event
+
+config CARL9170FW_WOL_PROBE_REQUEST
+	def_bool n
+	prompt "Probe Request"
+	depends on CARL9170FW_WOL_OPTION
+	select CARL9170FW_WOL
+	---help---
+	 Scan probe requests for a given SSID.
+
+config CARL9170FW_WOL_PROBE_REQUEST_SSID
+	string
+	prompt "Wakeup on WLAN SSID"
+	default "CARL9170_WAKEUP"
+	depends on CARL9170FW_WOL_PROBE_REQUEST
+
+config CARL9170FW_VIFS_NUM
+	default 1
+	int
+	prompt "Number of additional pseudo virtual interfaces"
+	depends on CARL9170FW_EXPERIMENTAL
+
+config CARL9170FW_FW_MAC_RESET
+	def_bool y
+	prompt "Firmware MAC Chip recovery"
+	depends on CARL9170FW_EXPERIMENTAL
+
+config CARL9170FW_NOISY_MAC_RESET
+	def_bool n
+	prompt "Notify MAC RESET events"
+	depends on CARL9170FW_FW_MAC_RESET
+
+config CARL9170FW_BROKEN_FEATURES
+	def_bool n
+	prompt "Broken Featurs"
+
+config CARL9170FW_DEBUG
+	def_bool n
+	depends on CARL9170FW_BROKEN_FEATURES && CARL9170FW_PRINTF
+	prompt "Enable verbose debugging messages"
+
+config CARL9170FW_DEBUG_LED_HEARTBEAT
+	def_bool n
+	prompt "LED Heartbeat"
+	depends on CARL9170FW_BROKEN_FEATURES
+	---help---
+	 This option conflicts with the application's LED code.
+	 Also, it assumes that you have two LEDs, which is not
+	 necessarily true.
+
+config CARL9170FW_DEBUG_UART
+	def_bool n
+	prompt "Pass debug messages through Highspeed UART"
+	depends on CARL9170FW_BROKEN_FEATURES
+	---help---
+	 This option allows the firmware to send BUG/ERR/INFO/DBG and
+	 hexdumps through the UART _as well_. However, first: you must
+	 connect a working logger.
+
+config CARL9170FW_WATCHDOG_BUTTON
+	def_bool n
+	depends on CARL9170FW_BROKEN && CARL9170FW_GPIO_INTERRUPT
+	prompt "Trigger Watchdog by pressing the WPS button"
+
+choice CARL9170FW_UART_CLOCK
+	prompt "UART Clock"
+	depends on CARL9170FW_DEBUG_UART
+	default CARL9170FW_UART_CLOCK_40M
+
+config CARL9170FW_UART_CLOCK_25M
+	bool "25"
+
+config CARL9170FW_UART_CLOCK_40M
+	bool "40"
+
+endchoice
+
+config CARL9170FW_UNUSABLE
+	def_bool y
+	depends on CARL9170FW_BROKEN || CARL9170FW_DEBUG
+
+config CARL9170FW_USB_MODESWITCH
+	def_bool n
+	prompt "USB 1.1 / 2.0 switching support"
+	depends on CARL9170FW_BROKEN_FEATURES
+	---help---
+	 Mostly implemented, but untested and some serious
+	 doubts remain.
+
+config CARL9170FW_DMA_QUEUE_BUMP
+	def_bool n
+	prompt "Bump a stuck TX queue before doing a MAC reset"
+	depends on CARL9170FW_BROKEN_FEATURES
+
+menu "Build Options"
+config CARL9170FW_AGGRESSIVE_CFLAGS
+	def_bool y
+	prompt "Enable aggressive size optimization"
+	---help---
+	 This option adds several more optimization compiler flags,
+	 which can greatly reduce the firmware size... at the expense
+	 of machine-code readability.
+
+	  Say Y. Else the firmware might not fit onto the device!
+
+endmenu
+
+endmenu
+
+endmenu
diff --git a/carl9170fw/carlfw/carl9170.lds b/carl9170fw/carlfw/carl9170.lds
new file mode 100644
index 0000000..97dda68
--- /dev/null
+++ b/carl9170fw/carlfw/carl9170.lds
@@ -0,0 +1,59 @@
+/*
+ * The carl9170 firwmare gets copied into the device's
+ * Program RAM (pram), which has a size of 16K, but
+ * also has to accomodate the stack the device uses,
+ * which starts at the top of the 16k, so we pretend
+ * that we just have 16256 (16k - 128) of pram.
+ *
+ * This section documents some of the other areas
+ * mapped into the firmware processor's address space
+ * as well.
+ */
+
+ENTRY(_start);
+
+MEMORY
+{
+    eeprom   : ORIGIN = 0x000000, LENGTH = 1024k
+    sram     : ORIGIN = 0x100000, LENGTH = 96k
+    uart     : ORIGIN = 0x1c0000, LENGTH = 4k
+    timer    : ORIGIN = 0x1c1000, LENGTH = 4k
+    vflash   : ORIGIN = 0x1c2000, LENGTH = 4k
+    wlan     : ORIGIN = 0x1c3000, LENGTH = 4k
+    pci2ahb  : ORIGIN = 0x1c4000, LENGTH = 4k
+    security : ORIGIN = 0x1c5000, LENGTH = 4k
+    gpio     : ORIGIN = 0x1d0000, LENGTH = 4k
+    memctl   : ORIGIN = 0x1d1000, LENGTH = 4k
+    irqctl   : ORIGIN = 0x1d2000, LENGTH = 4k
+    usb      : ORIGIN = 0x1e1000, LENGTH = 4k
+    pta      : ORIGIN = 0x1e2000, LENGTH = 4k
+    pram     : ORIGIN = 0x200000, LENGTH = 16256
+    bogus    : ORIGIN = 0x300000, LENGTH = 8k
+}
+
+SECTIONS
+{
+	.eeprom : { *(.eeprom*) } > eeprom
+	.sram	: { *(.sram*) } > sram
+
+	/*
+	 * The ar9170 boot code will execute the code
+	 * at address 0x04 from the loaded firmware as
+	 * such we must ensure our starting routine
+	 * is kept at that address.
+	 */
+	.padding : {
+		/* NOP NOP just in case */
+		LONG(0x00090009)
+	} > pram
+
+	.boot     : { *(.boot) } > pram
+	/* anything else can be anywhere */
+
+	.text	: { *(.text*) } > pram
+	.rodata	: { *(.rodata*) } > pram
+	.bss	: { *(.bss) } > pram
+	.data	: { *(.data*) } > pram
+
+	.fwdsc	: { KEEP(*(.fwdsc)) } > bogus
+}
diff --git a/carl9170fw/carlfw/include/cam.h b/carl9170fw/carlfw/include/cam.h
new file mode 100644
index 0000000..33afe03
--- /dev/null
+++ b/carl9170fw/carlfw/include/cam.h
@@ -0,0 +1,49 @@
+/*
+ * carl9170 firmware - used by the ar9170 wireless device
+ *
+ * CAM (Security Engine) definitions
+ *
+ * Copyright (c) 2000-2005 ZyDAS Technology Corporation
+ * Copyright (c) 2007-2009 Atheros Communications, Inc.
+ * Copyright	2009	Johannes Berg <johannes@sipsolutions.net>
+ * Copyright 2009-2011	Christian Lamparter <chunkeey@googlemail.com>
+ *
+ * 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; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef __CARL9170FW_CAM_H
+#define __CARL9170FW_CAM_H
+
+#include "config.h"
+#include "cmd.h"
+
+#ifdef CONFIG_CARL9170FW_SECURITY_ENGINE
+
+#define ENCRY_TYPE_START_ADDR	24
+#define DEFAULT_ENCRY_TYPE	26
+#define KEY_START_ADDR		27
+#define STA_KEY_START_ADDR	155
+#define COUNTER_START_ADDR      163
+#define STA_COUNTER_START_ADDR	165
+
+/* CAM */
+#define MIC_FINISH			0x1
+
+void set_key(const struct carl9170_set_key_cmd *key);
+void disable_key(const struct carl9170_disable_key_cmd *key);
+
+#endif /* CONFIG_CARL9170FW_SECURITY_ENGINE */
+
+#endif /* __CARL9170FW_CAM_H */
diff --git a/carl9170fw/carlfw/include/carl9170.h b/carl9170fw/carlfw/include/carl9170.h
new file mode 100644
index 0000000..cb16415
--- /dev/null
+++ b/carl9170fw/carlfw/include/carl9170.h
@@ -0,0 +1,222 @@
+/*
+ * carl9170 firmware - used by the ar9170 wireless device
+ *
+ * Firmware context definition
+ *
+ * Copyright 2009-2011 Christian Lamparter <chunkeey@googlemail.com>
+ *
+ * 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; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef __CARL9170FW_CARL9170_H
+#define __CARL9170FW_CARL9170_H
+
+#include "generated/autoconf.h"
+#include "version.h"
+#include "config.h"
+#include "types.h"
+#include "compiler.h"
+#include "fwcmd.h"
+#include "hw.h"
+#include "dma.h"
+#include "usb.h"
+#include "cmd.h"
+
+struct carl9170_bar_ctx {
+	uint8_t ta[6];
+	uint8_t ra[6];
+	__le16 start_seq_num;
+	__le16 control;
+};
+
+#ifdef CONFIG_CARL9170FW_CAB_QUEUE
+enum carl9170_cab_trigger {
+	CARL9170_CAB_TRIGGER_EMPTY	= 0,
+	CARL9170_CAB_TRIGGER_ARMED	= BIT(0),
+	CARL9170_CAB_TRIGGER_DEFER	= BIT(1),
+};
+#endif /* CONFIG_CARL9170FW_CAB_QUEUE */
+
+enum carl9170_ep0_action {
+	CARL9170_EP0_NO_ACTION		= 0,
+	CARL9170_EP0_STALL		= BIT(0),
+	CARL9170_EP0_TRIGGER		= BIT(1),
+};
+
+enum carl9170_mac_reset_state {
+	CARL9170_MAC_RESET_OFF		= 0,
+	CARL9170_MAC_RESET_ARMED,
+	CARL9170_MAC_RESET_RESET,
+	CARL9170_MAC_RESET_FORCE,
+};
+
+enum carl9170_suspend_mode {
+	CARL9170_HOST_AWAKE			= 0,
+	CARL9170_HOST_SUSPENDED,
+	CARL9170_AWAKE_HOST,
+};
+
+enum carl9170_phy_state {
+	CARL9170_PHY_OFF		= 0,
+	CARL9170_PHY_ON
+};
+
+typedef void (*fw_desc_callback_t)(void *, const bool);
+
+/*
+ * This platform - being an odd 32-bit architecture - prefers to
+ * have 32-Bit variables.
+ */
+
+struct firmware_context_struct {
+	/* timer / clocks */
+	unsigned int ticks_per_usec;
+	unsigned int counter;			/* main() cycles */
+
+	/* misc */
+	unsigned int watchdog_enable;
+	unsigned int reboot;
+	unsigned int suspend_mode;
+
+	struct {
+		/* Host Interface DMA queues */
+		struct dma_queue up_queue;	/* used to send frames to the host */
+		struct dma_queue down_queue;	/* stores incoming frames from the host */
+	} pta;
+
+	struct {
+		/* Hardware DMA queues */
+		struct dma_queue tx_queue[__AR9170_NUM_TX_QUEUES];	/* wlan tx queue */
+		struct dma_queue tx_retry;
+		struct dma_queue rx_queue;				/* wlan rx queue */
+
+		/* tx aggregate scheduling */
+		struct carl9170_tx_superframe *ampdu_prev[__AR9170_NUM_TX_QUEUES];
+
+		/* Hardware DMA queue unstuck/fix detection */
+		unsigned int last_super_num[__AR9170_NUM_TX_QUEUES];
+		struct carl9170_tx_superframe *last_super[__AR9170_NUM_TX_QUEUES];
+		unsigned int mac_reset;
+		unsigned int soft_int;
+
+		/* rx filter */
+		unsigned int rx_filter;
+
+		/* tx sequence control counters */
+		unsigned int sequence[CARL9170_INTF_NUM];
+
+#ifdef CONFIG_CARL9170FW_CAB_QUEUE
+		/* CAB */
+		struct dma_queue cab_queue[CARL9170_INTF_NUM];
+		unsigned int cab_queue_len[CARL9170_INTF_NUM];
+		unsigned int cab_flush_time;
+		enum carl9170_cab_trigger cab_flush_trigger[CARL9170_INTF_NUM];
+#endif /* CONFIG_CARL9170FW_CAB_QUEUE */
+
+		/* tx status */
+		unsigned int tx_status_pending,
+			     tx_status_head_idx,
+			     tx_status_tail_idx;
+		struct carl9170_tx_status tx_status_cache[CARL9170_TX_STATUS_NUM];
+
+		/* internal descriptor for use within the service routines */
+		struct dma_desc *fw_desc;
+		unsigned int fw_desc_available;
+		void *fw_desc_data;
+		fw_desc_callback_t fw_desc_callback;
+
+		/* BA(R) Request Handler */
+		struct carl9170_bar_ctx ba_cache[CONFIG_CARL9170FW_BACK_REQS_NUM];
+		unsigned int ba_tail_idx,
+			     ba_head_idx,
+			     queued_ba;
+
+		unsigned int queued_bar;
+	} wlan;
+
+	struct {
+		unsigned int config,
+			     interface_setting,
+			     alternate_interface_setting,
+			     device_feature;
+		enum carl9170_ep0_action ep0_action;
+
+		void *ep0_txrx_buffer;
+		unsigned int ep0_txrx_len,
+			     ep0_txrx_pos;
+
+		struct ar9170_usb_config *cfg_desc;
+		struct ar9170_usb_config *os_cfg_desc;
+
+		/*
+		 * special buffers for command & response handling
+		 *
+		 * the firmware uses a sort of ring-buffer to communicate
+		 * to the host.
+		 */
+		unsigned int int_pending,
+			     int_desc_available,
+			     int_head_index,
+			     int_tail_index;
+		struct dma_desc *int_desc;
+		struct carl9170_rsp int_buf[CARL9170_INT_RQ_CACHES];
+
+#ifdef CONFIG_CARL9170FW_DEBUG_USB
+		/* USB printf */
+		unsigned int put_index;
+		uint8_t put_buffer[CARL9170_MAX_CMD_PAYLOAD_LEN];
+#endif /* CONFIG_CARL9170FW_DEBUG_USB */
+
+	} usb;
+
+	struct {
+#ifdef CONFIG_CARL9170FW_RADIO_FUNCTIONS
+		/* (cached) ar9170_rf_init */
+
+		/* PHY/RF state */
+		unsigned int frequency;
+		unsigned int ht_settings;
+
+		enum carl9170_phy_state state;
+		struct carl9170_psm psm;
+#endif /* CONFIG_CARL9170FW_RADIO_FUNCTIONS */
+	} phy;
+
+	unsigned int tally_clock;
+	struct carl9170_tally_rsp tally;
+	unsigned int tx_time;
+
+#ifdef CONFIG_CARL9170FW_WOL
+	struct {
+		struct carl9170_wol_cmd cmd;
+		unsigned int last_beacon;
+		unsigned int lost_null;
+		unsigned int last_null;
+		bool wake_up;
+	} wol;
+#endif /* CONFIG_CARL9170FW_WOL */
+
+#ifdef CONFIG_CARL9170FW_GPIO_INTERRUPT
+	struct carl9170_gpio cached_gpio_state;
+#endif /*CONFIG_CARL9170FW_GPIO_INTERRUPT */
+};
+
+/*
+ * global firmware context struct.
+ *
+ * NOTE: This struct will zeroed out in start()
+ */
+extern struct firmware_context_struct fw;
+#endif /* __CARL9170FW_CARL9170_H */
diff --git a/carl9170fw/carlfw/include/cmd.h b/carl9170fw/carlfw/include/cmd.h
new file mode 100644
index 0000000..54dd350
--- /dev/null
+++ b/carl9170fw/carlfw/include/cmd.h
@@ -0,0 +1,55 @@
+/*
+ * carl9170 firmware - used by the ar9170 wireless device
+ *
+ * Firmware command interface definition
+ *
+ * Copyright (c) 2000-2005 ZyDAS Technology Corporation
+ * Copyright (c) 2007-2009 Atheros Communications, Inc.
+ * Copyright	2009	Johannes Berg <johannes@sipsolutions.net>
+ * Copyright 2009-2011	Christian Lamparter <chunkeey@googlemail.com>
+ *
+ * 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; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef __CARL9170FW_CMD_H
+#define __CARL9170FW_CMD_H
+
+#include "config.h"
+#include "compiler.h"
+#include "types.h"
+
+#include "fwcmd.h"
+
+static inline void __check(void)
+{
+	BUILD_BUG_ON(sizeof(struct carl9170_cmd) != CARL9170_MAX_CMD_LEN);
+	BUILD_BUG_ON(sizeof(struct carl9170_rsp) != CARL9170_MAX_CMD_LEN);
+	BUILD_BUG_ON(sizeof(struct carl9170_set_key_cmd) != CARL9170_SET_KEY_CMD_SIZE);
+	BUILD_BUG_ON(sizeof(struct carl9170_disable_key_cmd) != CARL9170_DISABLE_KEY_CMD_SIZE);
+	BUILD_BUG_ON(sizeof(struct carl9170_rf_init) != CARL9170_RF_INIT_SIZE);
+	BUILD_BUG_ON(sizeof(struct carl9170_rf_init_result) != CARL9170_RF_INIT_RESULT_SIZE);
+	BUILD_BUG_ON(sizeof(struct carl9170_psm) != CARL9170_PSM_SIZE);
+	BUILD_BUG_ON(sizeof(struct carl9170_tsf_rsp) != CARL9170_TSF_RSP_SIZE);
+	BUILD_BUG_ON(sizeof(struct carl9170_bcn_ctrl_cmd) != CARL9170_BCN_CTRL_CMD_SIZE);
+	BUILD_BUG_ON(sizeof(struct carl9170_tx_status) != CARL9170_TX_STATUS_SIZE);
+	BUILD_BUG_ON(sizeof(struct _carl9170_tx_status) != CARL9170_TX_STATUS_SIZE);
+	BUILD_BUG_ON(sizeof(struct carl9170_gpio) != CARL9170_GPIO_SIZE);
+	BUILD_BUG_ON(sizeof(struct carl9170_rx_filter_cmd) != CARL9170_RX_FILTER_CMD_SIZE);
+	BUILD_BUG_ON(sizeof(struct carl9170_wol_cmd) != CARL9170_WOL_CMD_SIZE);
+}
+
+void handle_cmd(struct carl9170_rsp *resp);
+
+#endif /* __CARL9170FW_CMD_H */
diff --git a/carl9170fw/carlfw/include/config.h b/carl9170fw/carlfw/include/config.h
new file mode 100644
index 0000000..e7c358d
--- /dev/null
+++ b/carl9170fw/carlfw/include/config.h
@@ -0,0 +1,64 @@
+/*
+ * 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; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include "generated/autoconf.h"
+#include "version.h"
+#include "types.h"
+#include "compiler.h"
+#include "fwcmd.h"
+#include "hw.h"
+
+#ifndef __CARL9170FW_CONFIG_H
+#define __CARL9170FW_CONFIG_H
+
+#define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
+
+#if GCC_VERSION < 40400
+# error "This firmware will not work if it is compiled with gcc versions < 4.4"
+# error "See: http://gcc.gnu.org/gcc-4.4/changes.html / Caveats No. 4"
+#endif
+
+#if ((defined CONFIG_CARL9170FW_PRINTF) &&			\
+	(!defined CONFIG_CARL9170FW_DEBUG_USB) &&		\
+	(!defined CONFIG_CARL9170FW_DEBUG_UART))
+# warning "You have disabled all debug message transports."
+# warning "However CONFIG_CARL9170FW_PRINTF is still set..."
+# warning "Which is a waste of firmware space, if you ask me."
+#endif
+
+#define CARL9170_TX_STATUS_NUM		(CARL9170_RSP_TX_STATUS_NUM)
+#define CARL9170_INT_RQ_CACHES		16
+#define AR9170_INT_MAGIC_HEADER_SIZE	12
+#define CARL9170_TBTT_DELTA		(CARL9170_PRETBTT_KUS + 1)
+
+#define CARL9170_GPIO_MASK		(AR9170_GPIO_PORT_WPS_BUTTON_PRESSED)
+
+#ifdef CONFIG_CARL9170FW_VIFS_NUM
+#define CARL9170_INTF_NUM		(1 + CONFIG_CARL9170FW_VIFS_NUM)
+#else
+#define CARL9170_INTF_NUM		(1)
+#endif /* CONFIG_CARL9170FW_VIFS_NUM */
+
+#define CONFIG_CARL9170FW_BACK_REQS_NUM	4
+
+static inline void __config_check(void)
+{
+	BUILD_BUG_ON(!CARL9170_TX_STATUS_NUM);
+	BUILD_BUG_ON(CARL9170_INTF_NUM < 1);
+	BUILD_BUG_ON(CARL9170_INTF_NUM >= AR9170_MAX_VIRTUAL_MAC);
+}
+
+#endif /* __CARL9170FW_CONFIG_H */
diff --git a/carl9170fw/carlfw/include/dma.h b/carl9170fw/carlfw/include/dma.h
new file mode 100644
index 0000000..8f3a9df
--- /dev/null
+++ b/carl9170fw/carlfw/include/dma.h
@@ -0,0 +1,349 @@
+/*
+ * carl9170 firmware - used by the ar9170 wireless device
+ *
+ * This module contains DMA descriptor related definitions.
+ *
+ * Copyright (c) 2000-2005 ZyDAS Technology Corporation
+ * Copyright (c) 2007-2009 Atheros Communications, Inc.
+ * Copyright	2009	Johannes Berg <johannes@sipsolutions.net>
+ * Copyright 2009-2011  Christian Lamparter <chunkeey@googlemail.com>
+ *
+ * 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; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef __CARL9170FW_DMA_H
+#define __CARL9170FW_DMA_H
+
+#include "config.h"
+#include "types.h"
+#include "compiler.h"
+#include "hw.h"
+#include "ieee80211.h"
+#include "wlan.h"
+
+struct dma_desc {
+	volatile uint16_t status;	/* Descriptor status */
+	volatile uint16_t ctrl;		/* Descriptor control */
+	volatile uint16_t dataSize;	/* Data size */
+	volatile uint16_t totalLen;	/* Total length */
+	struct dma_desc *lastAddr;	/* Last address of this chain */
+	union {
+		uint8_t *_dataAddr;	/* Data buffer address */
+		void *dataAddr;
+	} __packed;
+	struct dma_desc *nextAddr;	/* Next TD address */
+} __packed __aligned(4);
+
+/* Up, Dn, 5x Tx, retry, Rx, [USB Int], (CAB), FW */
+#define AR9170_TERMINATOR_NUMBER_B	10
+
+#define AR9170_TERMINATOR_NUMBER_INT	1
+
+#ifdef CONFIG_CARL9170FW_CAB_QUEUE
+#define AR9170_TERMINATOR_NUMBER_CAB	CARL9170_INTF_NUM
+#else
+#define AR9170_TERMINATOR_NUMBER_CAB	0
+#endif /* CONFIG_CARL9170FW_CAB_QUEUE */
+
+#define AR9170_TERMINATOR_NUMBER (AR9170_TERMINATOR_NUMBER_B + \
+				  AR9170_TERMINATOR_NUMBER_INT + \
+				  AR9170_TERMINATOR_NUMBER_CAB)
+
+#define AR9170_BLOCK_SIZE           (256 + 64)
+
+#define AR9170_DESCRIPTOR_SIZE      (sizeof(struct dma_desc))
+
+struct ar9170_tx_ba_frame {
+	struct ar9170_tx_hwdesc hdr;
+	struct ieee80211_ba ba;
+} __packed;
+
+struct carl9170_tx_ba_superframe {
+	struct carl9170_tx_superdesc s;
+	struct ar9170_tx_ba_frame f;
+} __packed;
+
+struct ar9170_tx_null_frame {
+	struct ar9170_tx_hwdesc hdr;
+	struct ieee80211_hdr null;
+} __packed;
+
+struct carl9170_tx_null_superframe {
+	struct carl9170_tx_superdesc s;
+	struct ar9170_tx_null_frame f;
+} __packed;
+
+#define CARL9170_BA_BUFFER_LEN	(__roundup(sizeof(struct carl9170_tx_ba_superframe), 16))
+#define CARL9170_RSP_BUFFER_LEN	AR9170_BLOCK_SIZE
+
+struct carl9170_sram_reserved {
+	union {
+		uint32_t buf[CARL9170_BA_BUFFER_LEN / sizeof(uint32_t)];
+		struct carl9170_tx_ba_superframe ba;
+	} ba;
+
+	union {
+		uint32_t buf[CARL9170_MAX_CMD_LEN / sizeof(uint32_t)];
+		struct carl9170_cmd cmd;
+
+#ifdef CONFIG_CARL9170FW_WOL
+		struct carl9170_tx_null_superframe null;
+#endif /* CONFIG_CARL9170FW_WOL */
+	} cmd;
+
+	union {
+		uint32_t buf[CARL9170_RSP_BUFFER_LEN / sizeof(uint32_t)];
+		struct carl9170_rsp rsp;
+	} rsp;
+
+	union {
+		uint32_t buf[CARL9170_INTF_NUM][AR9170_MAC_BCN_LENGTH_MAX / sizeof(uint32_t)];
+	} bcn;
+};
+
+/*
+ * Memory layout in RAM:
+ *
+ * 0x100000			+--
+ *				| terminator descriptors (dma_desc)
+ *				|  - Up (to USB host)
+ *				|  - Down (from USB host)
+ *				|  - TX (5x, to wifi)
+ *				|  - AMPDU TX retry
+ *				|  - RX (from wifi)
+ *				|  - CAB Queue
+ *				|  - FW cmd & req descriptor
+ *				|  - BlockAck descriptor
+ *				| total: AR9170_TERMINATOR_NUMBER
+ *				+--
+ *				| block descriptors (dma_desc)
+ *				| (AR9170_BLOCK_NUMBER)
+ * AR9170_BLOCK_BUFFER_BASE	+-- align to multiple of 64
+ *				| block buffers (AR9170_BLOCK_SIZE each)
+ *				| (AR9170_BLOCK_NUMBER)
+ * approx. 0x117c00		+--
+ *				| BA buffer (128 bytes)
+ *				+--
+ *				| CMD buffer (128 bytes)
+ *				| - used as NULLFRAME buffer (128 bytes) for WOL
+ *				+--
+ *				| RSP buffer (320 bytes)
+ *				+--
+ *				| BEACON buffer (256 bytes)
+ *				+--
+ *				| unaccounted space / padding
+ *				+--
+ * 0x18000
+ */
+
+#define CARL9170_SRAM_RESERVED		(sizeof(struct carl9170_sram_reserved))
+
+#define AR9170_FRAME_MEMORY_SIZE	(AR9170_SRAM_SIZE - CARL9170_SRAM_RESERVED)
+
+#define BLOCK_ALIGNMENT		64
+
+#define NONBLOCK_DESCRIPTORS_SIZE	\
+	(AR9170_DESCRIPTOR_SIZE * (AR9170_TERMINATOR_NUMBER))
+
+#define NONBLOCK_DESCRIPTORS_SIZE_ALIGNED	\
+	(ALIGN(NONBLOCK_DESCRIPTORS_SIZE, BLOCK_ALIGNMENT))
+
+#define AR9170_BLOCK_NUMBER	((AR9170_FRAME_MEMORY_SIZE - NONBLOCK_DESCRIPTORS_SIZE_ALIGNED) / \
+				 (AR9170_BLOCK_SIZE + AR9170_DESCRIPTOR_SIZE))
+
+struct ar9170_data_block {
+	uint8_t	data[AR9170_BLOCK_SIZE];
+};
+
+struct ar9170_dma_memory {
+	struct dma_desc			terminator[AR9170_TERMINATOR_NUMBER];
+	struct dma_desc			block[AR9170_BLOCK_NUMBER];
+	struct ar9170_data_block	data[AR9170_BLOCK_NUMBER] __aligned(BLOCK_ALIGNMENT);
+	struct carl9170_sram_reserved	reserved __aligned(BLOCK_ALIGNMENT);
+};
+
+extern struct ar9170_dma_memory dma_mem;
+
+#define AR9170_DOWN_BLOCK_RATIO	2
+#define AR9170_RX_BLOCK_RATIO	1
+/* Tx 16*2 = 32 packets => 32*(5*320) */
+#define AR9170_TX_BLOCK_NUMBER	(AR9170_BLOCK_NUMBER * AR9170_DOWN_BLOCK_RATIO / \
+				(AR9170_RX_BLOCK_RATIO + AR9170_DOWN_BLOCK_RATIO))
+#define AR9170_RX_BLOCK_NUMBER	(AR9170_BLOCK_NUMBER - AR9170_TX_BLOCK_NUMBER)
+
+/* Error code */
+#define AR9170_ERR_FS_BIT	1
+#define AR9170_ERR_LS_BIT	2
+#define AR9170_ERR_OWN_BITS	3
+#define AR9170_ERR_DATA_SIZE	4
+#define AR9170_ERR_TOTAL_LEN	5
+#define AR9170_ERR_DATA		6
+#define AR9170_ERR_SEQ		7
+#define AR9170_ERR_LEN		8
+
+/* Status bits definitions */
+/* Own bits definitions */
+#define AR9170_OWN_BITS		0x3
+#define AR9170_OWN_BITS_S	0
+#define AR9170_OWN_BITS_SW	0x0
+#define AR9170_OWN_BITS_HW	0x1
+#define AR9170_OWN_BITS_SE	0x2
+
+/* Control bits definitions */
+#define AR9170_CTRL_TXFAIL	1
+#define AR9170_CTRL_BAFAIL	2
+#define AR9170_CTRL_FAIL	(AR9170_CTRL_TXFAIL | AR9170_CTRL_BAFAIL)
+
+/* First segament bit */
+#define AR9170_CTRL_LS_BIT	0x100
+/* Last segament bit */
+#define AR9170_CTRL_FS_BIT	0x200
+
+struct dma_queue {
+	struct dma_desc *head;
+	struct dma_desc *terminator;
+};
+
+#define DESC_PAYLOAD(a)			((void *)a->dataAddr)
+#define DESC_PAYLOAD_OFF(a, offset)	((void *)((unsigned long)(a->_dataAddr) + offset))
+
+struct dma_desc *dma_unlink_head(struct dma_queue *queue);
+void dma_init_descriptors(void);
+void dma_reclaim(struct dma_queue *q, struct dma_desc *desc);
+void dma_put(struct dma_queue *q, struct dma_desc *desc);
+
+static inline __inline bool is_terminator(struct dma_queue *q, struct dma_desc *desc)
+{
+	return q->terminator == desc;
+}
+
+static inline __inline bool queue_empty(struct dma_queue *q)
+{
+	return q->head == q->terminator;
+}
+
+/*
+ * Get a completed packet with # descriptors. Return the first
+ * descriptor and pointer the head directly by lastAddr->nextAddr
+ */
+static inline __inline struct dma_desc *dma_dequeue_bits(struct dma_queue *q,
+						uint16_t bits)
+{
+	struct dma_desc *desc = NULL;
+
+	if ((q->head->status & AR9170_OWN_BITS) == bits)
+		desc = dma_unlink_head(q);
+
+	return desc;
+}
+
+static inline __inline struct dma_desc *dma_dequeue_not_bits(struct dma_queue *q,
+						    uint16_t bits)
+{
+	struct dma_desc *desc = NULL;
+
+	/* AR9170_OWN_BITS_HW will be filtered out here too. */
+	if ((q->head->status & AR9170_OWN_BITS) != bits)
+		desc = dma_unlink_head(q);
+
+	return desc;
+}
+
+#define for_each_desc_bits(desc, queue, bits)				\
+	while ((desc = dma_dequeue_bits(queue, bits)))
+
+#define for_each_desc_not_bits(desc, queue, bits)			\
+	while ((desc = dma_dequeue_not_bits(queue, bits)))
+
+#define for_each_desc(desc, queue)					\
+	while ((desc = dma_unlink_head(queue)))
+
+#define __for_each_desc_bits(desc, queue, bits)				\
+	for (desc = (queue)->head;					\
+	     (desc != (queue)->terminator &&				\
+	     (desc->status & AR9170_OWN_BITS) == bits);			\
+	     desc = desc->lastAddr->nextAddr)
+
+#define __while_desc_bits(desc, queue, bits)				\
+	for (desc = (queue)->head;					\
+	     (!queue_empty(queue) &&					\
+	     (desc->status & AR9170_OWN_BITS) == bits);			\
+	     desc = (queue)->head)
+
+#define __for_each_desc_continue(desc, queue)				\
+	for (; desc != (queue)->terminator;				\
+	     desc = (desc)->lastAddr->nextAddr)
+
+#define __for_each_desc(desc, queue)					\
+	for (desc = (queue)->head;					\
+	     desc != (queue)->terminator;				\
+	     desc = (desc)->lastAddr->nextAddr)
+
+#define __for_each_desc_safe(desc, tmp, queue)				\
+	for (desc = (queue)->head, tmp = desc->lastAddr->nextAddr;	\
+	     desc != (queue)->terminator;				\
+	     desc = tmp, tmp = tmp->lastAddr->nextAddr)
+
+#define __while_subdesc(desc, queue)					\
+	for (desc = (queue)->head;					\
+	     desc != (queue)->terminator;				\
+	     desc = (desc)->nextAddr)
+
+static inline __inline unsigned int queue_len(struct dma_queue *q)
+{
+	struct dma_desc *desc;
+	unsigned int i = 0;
+
+	__while_subdesc(desc, q)
+		i++;
+
+	return i;
+}
+
+/*
+ * rearm a completed packet, so it will be processed agian.
+ */
+static inline __inline void dma_rearm(struct dma_desc *desc)
+{
+	/* Set OWN bit to HW */
+	desc->status = ((desc->status & (~AR9170_OWN_BITS)) |
+			AR9170_OWN_BITS_HW);
+}
+
+static inline __inline void dma_fix_downqueue(struct dma_desc *desc)
+{
+	desc->status = AR9170_OWN_BITS_HW;
+	desc->ctrl = 0;
+	desc->dataSize = 0;
+	desc->totalLen = AR9170_BLOCK_SIZE;
+	desc->lastAddr = desc;
+}
+
+static inline void __check_desc(void)
+{
+	struct ar9170_dma_memory mem;
+	BUILD_BUG_ON(sizeof(struct ar9170_data_block) != AR9170_BLOCK_SIZE);
+	BUILD_BUG_ON(sizeof(struct dma_desc) != 20);
+
+	BUILD_BUG_ON(sizeof(mem) > AR9170_SRAM_SIZE);
+
+	BUILD_BUG_ON(offsetof(struct carl9170_sram_reserved, ba.buf) & (BLOCK_ALIGNMENT - 1));
+	BUILD_BUG_ON(offsetof(struct carl9170_sram_reserved, cmd.buf) & (BLOCK_ALIGNMENT - 1));
+	BUILD_BUG_ON(offsetof(struct carl9170_sram_reserved, rsp.buf) & (BLOCK_ALIGNMENT - 1));
+	BUILD_BUG_ON(offsetof(struct carl9170_sram_reserved, bcn.buf) & (BLOCK_ALIGNMENT - 1));
+	BUILD_BUG_ON(sizeof(struct carl9170_tx_null_superframe) > CARL9170_MAX_CMD_LEN);
+}
+
+#endif /* __CARL9170FW_DMA_H */
diff --git a/carl9170fw/carlfw/include/fwdsc.h b/carl9170fw/carlfw/include/fwdsc.h
new file mode 100644
index 0000000..936bfed
--- /dev/null
+++ b/carl9170fw/carlfw/include/fwdsc.h
@@ -0,0 +1,50 @@
+/*
+ * carl9170 firmware - used by the ar9170 wireless device
+ *
+ * Firmware definition
+ *
+ * Copyright 2009-2011 Christian Lamparter <chunkeey@googlemail.com>
+ *
+ * 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; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef __CARL9170FW_FWDSC_H
+#define __CARL9170FW_FWDSC_H
+
+#include "config.h"
+#include "compiler.h"
+#include "types.h"
+#include "fwdesc.h"
+
+struct carl9170_firmware_descriptor {
+	struct carl9170fw_otus_desc otus;
+	struct carl9170fw_txsq_desc txsq;
+#ifdef CONFIG_CARL9170FW_WOL
+	struct carl9170fw_wol_desc  wol;
+#endif /* CONFIG_CARL9170FW_WOL */
+	struct carl9170fw_motd_desc motd;
+	struct carl9170fw_dbg_desc  dbg;
+	struct carl9170fw_last_desc last;
+} __packed;
+
+extern const struct carl9170_firmware_descriptor carl9170fw_desc;
+
+static inline void __check_fw(void)
+{
+	BUILD_BUG_ON(sizeof(carl9170fw_desc) & 0x3);
+	BUILD_BUG_ON(sizeof(carl9170fw_desc) > CARL9170FW_DESC_MAX_LENGTH);
+}
+
+#endif /* __CARL9170FW_FWDSC_H */
diff --git a/carl9170fw/carlfw/include/gpio.h b/carl9170fw/carlfw/include/gpio.h
new file mode 100644
index 0000000..97c1927
--- /dev/null
+++ b/carl9170fw/carlfw/include/gpio.h
@@ -0,0 +1,45 @@
+/*
+ * carl9170 firmware - used by the ar9170 wireless device
+ *
+ * GPIO definitions
+ *
+ * Copyright 2009-2011 Christian Lamparter <chunkeey@googlemail.com>
+ *
+ * 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; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef __CARL9170FW_GPIO_H
+#define __CARL9170FW_GPIO_H
+
+#include "config.h"
+#include "hw.h"
+#include "io.h"
+
+static inline __inline void led_init(void)
+{
+	set(AR9170_GPIO_REG_PORT_TYPE, 3);
+}
+
+static inline __inline void led_set(const unsigned int ledstate)
+{
+	set(AR9170_GPIO_REG_PORT_DATA, ledstate);
+}
+
+#ifdef CONFIG_CARL9170FW_GPIO_INTERRUPT
+
+void gpio_timer(void);
+
+#endif /* CONFIG_CARL9170FW_GPIO_INTERRUPT */
+#endif /* __CARL9170FW_GPIO_H */
diff --git a/carl9170fw/carlfw/include/hostif.h b/carl9170fw/carlfw/include/hostif.h
new file mode 100644
index 0000000..8f9f139
--- /dev/null
+++ b/carl9170fw/carlfw/include/hostif.h
@@ -0,0 +1,47 @@
+/*
+ * carl9170 firmware - used by the ar9170 wireless device
+ *
+ * HostIF definition
+ *
+ * Copyright (c) 2000-2005 ZyDAS Technology Corporation
+ * Copyright (c) 2007-2009 Atheros Communications, Inc.
+ * Copyright	2009	Johannes Berg <johannes@sipsolutions.net>
+ * Copyright 2009-2011	Christian Lamparter <chunkeey@googlemail.com>
+ *
+ * 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; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef __CARL9170FW_HOSTIF_H
+#define __CARL9170FW_HOSTIF_H
+
+#include "config.h"
+#include "compiler.h"
+#include "types.h"
+#include "hw.h"
+#include "io.h"
+
+static inline __inline void down_trigger(void)
+{
+	set(AR9170_PTA_REG_DN_DMA_TRIGGER, 1);
+}
+
+static inline __inline void up_trigger(void)
+{
+	set(AR9170_PTA_REG_UP_DMA_TRIGGER, 1);
+}
+
+void handle_host_interface(void);
+
+#endif /* __CARL9170FW_HOSTIF_H */
diff --git a/carl9170fw/carlfw/include/io.h b/carl9170fw/carlfw/include/io.h
new file mode 100644
index 0000000..4ccdc6e
--- /dev/null
+++ b/carl9170fw/carlfw/include/io.h
@@ -0,0 +1,153 @@
+/*
+ * 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; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef __CARL9170FW_IO_H
+#define __CARL9170FW_IO_H
+
+#include "config.h"
+#include "types.h"
+#include "compiler.h"
+
+static inline __inline uint8_t readb(const volatile void *addr)
+{
+	return *(const volatile uint8_t *) addr;
+}
+
+static inline __inline uint16_t readw(const volatile void *addr)
+{
+	return *(const volatile uint16_t *) addr;
+}
+
+static inline __inline volatile void *readp(const volatile void *addr)
+{
+	return *(volatile void **) addr;
+}
+
+static inline __inline uint32_t readl(const volatile void *addr)
+{
+	return *(const volatile unsigned int *) addr;
+}
+
+static inline __inline void writeb(volatile void *addr, const volatile uint8_t val)
+{
+	*(volatile uint8_t *) addr = val;
+}
+
+static inline __inline void writew(volatile void *addr, const volatile uint16_t val)
+{
+	*(volatile uint16_t *) addr = val;
+}
+
+static inline __inline void writel(volatile void *addr, const volatile uint32_t val)
+{
+	*(volatile uint32_t *) addr = val;
+}
+
+static inline __inline void __orl(volatile void *addr, const volatile uint32_t val)
+{
+	*(volatile uint32_t *) addr |= val;
+}
+
+static inline __inline void __andl(volatile void *addr, const volatile uint32_t val)
+{
+	*(volatile uint32_t *) addr &= val;
+}
+
+static inline __inline void __xorl(volatile void *addr, const volatile uint32_t val)
+{
+	*(volatile uint32_t *) addr ^= val;
+}
+
+static inline __inline void __incl(volatile void *addr)
+{
+	(*(volatile uint32_t *)addr)++;
+}
+
+static inline __inline uint32_t readl_async(const volatile void *addr)
+{
+	uint32_t i = 0, read, tmp;
+
+	read = readl(addr);
+	do {
+		tmp = read;
+		tmp = readl(addr);
+		i++;
+	} while (tmp != read && i <= 10);
+
+	return read;
+}
+
+static inline __inline void set(const volatile uint32_t addr, const volatile uint32_t val)
+{
+	writel((volatile void *) addr, val);
+}
+
+static inline __inline void orl(volatile uint32_t addr, const volatile uint32_t val)
+{
+	__orl((volatile void *) addr, val);
+}
+
+static inline __inline void xorl(const volatile uint32_t addr, const volatile uint32_t val)
+{
+	__xorl((volatile void *) addr, val);
+}
+
+static inline __inline void andl(const volatile uint32_t addr, const volatile uint32_t val)
+{
+	__andl((volatile void *) addr, val);
+}
+
+static inline __inline void incl(const volatile uint32_t addr)
+{
+	__incl((volatile void *) addr);
+}
+
+static inline __inline uint32_t get(const volatile uint32_t addr)
+{
+	return readl((volatile void *) addr);
+}
+
+static inline __inline volatile void *getp(const volatile uint32_t addr)
+{
+	return readp((const volatile void *) addr);
+}
+
+static inline __inline uint32_t get_async(const volatile uint32_t addr)
+{
+	return readl_async((const volatile void *) addr);
+}
+
+static inline __inline void setb(const volatile uint32_t addr, const volatile uint8_t val)
+{
+	writeb((volatile void *) addr, val);
+}
+
+static inline __inline uint8_t getb(const volatile uint32_t addr)
+{
+	return readb((const volatile void *) addr);
+}
+
+static inline __inline void andb(const volatile uint32_t addr, const volatile uint8_t val)
+{
+	setb(addr, getb(addr) & val);
+}
+
+static inline __inline void orb(const volatile uint32_t addr, const volatile uint32_t val)
+{
+	setb(addr, getb(addr) | val);
+}
+
+#endif /* __CARL9170FW_IO_H */
diff --git a/carl9170fw/carlfw/include/printf.h b/carl9170fw/carlfw/include/printf.h
new file mode 100644
index 0000000..dd4559e
--- /dev/null
+++ b/carl9170fw/carlfw/include/printf.h
@@ -0,0 +1,107 @@
+/*
+ * carl9170 firmware - used by the ar9170 wireless device
+ *
+ * printf and his friends...
+ *
+ * Copyright (c) 2000-2005 ZyDAS Technology Corporation
+ * Copyright (c) 2007-2009 Atheros Communications, Inc.
+ * Copyright	2009	Johannes Berg <johannes@sipsolutions.net>
+ * Copyright 2009-2011	Christian Lamparter <chunkeey@googlemail.com>
+ *
+ * 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; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef __CARL9170FW_PRINTF_H
+#define __CARL9170FW_PRINTF_H
+
+#include <stdarg.h>
+#include <string.h>
+#include "config.h"
+#include "carl9170.h"
+#include "uart.h"
+#include "fwcmd.h"
+
+#ifdef CONFIG_CARL9170FW_PRINTF
+void __attribute__((format (printf, 1, 2))) tfp_printf(const char *fmt, ...);
+
+#define printf tfp_printf
+
+#else
+void __attribute__((format (printf, 1, 2))) min_printf(const char *fmt, ...);
+
+#define printf min_printf
+#endif /* CONFIG_CARL9170FW_PRINTF */
+
+#define PRINT(fmt, args...)						\
+	do {								\
+		printf(fmt, ## args);					\
+	} while (0)
+
+#define INFO(fmt, args...)	PRINT(fmt, ## args)
+
+#define ERR(fmt, args...)	PRINT(CARL9170_ERR_MAGIC fmt, ## args)
+
+#ifdef CONFIG_CARL9170FW_DEBUG
+#define DBG(fmt, args...)	PRINT(fmt, ## args)
+#else
+#define DBG(...)		do { } while (0);
+#endif
+
+/*
+ * NB: even though the MACRO is called "stall". It isn't supposed
+ * to stall since this will render the device unresponsive, until
+ * someone pulls the plug.
+ */
+#define STALL()
+
+#define BUG(fmt, args...)						\
+	do {								\
+		PRINT(CARL9170_BUG_MAGIC" %s()@%d \"" fmt "\"" ,	\
+		      __func__, __LINE__, ## args);			\
+		STALL()							\
+	} while (0);
+
+#define BUG_ON(condition)						\
+	({								\
+		int __ret = !!(condition);				\
+		if (unlikely(!!(__ret)))				\
+			BUG(#condition);				\
+		(__ret);						\
+	})
+
+static inline __inline void putcharacter(const char c __unused)
+{
+#ifdef CONFIG_CARL9170FW_DEBUG_USB
+	usb_putc(c);
+#endif /* CONFIG_CARL9170FW_DEBUG_USB */
+
+#ifdef CONFIG_CARL9170FW_DEBUG_UART
+	uart_putc(c);
+#endif /* CONFIG_CARL9170FW_DEBUG_UART */
+}
+
+static inline __inline void print_hex_dump(const void *buf __unused, int len __unused)
+{
+#ifdef CONFIG_CARL9170FW_DEBUG_USB
+	usb_print_hex_dump(buf, len);
+#endif /* CONFIG_CARL9170FW_DEBUG_USB */
+
+#ifdef CONFIG_CARL9170FW_DEBUG_UART
+	uart_print_hex_dump(buf, len);
+#endif /* CONFIG_CARL9170FW_DEBUG_UART */
+}
+
+#endif /* __CARL9170FW_PRINTF_H */
+
diff --git a/carl9170fw/carlfw/include/rf.h b/carl9170fw/carlfw/include/rf.h
new file mode 100644
index 0000000..4419bcb
--- /dev/null
+++ b/carl9170fw/carlfw/include/rf.h
@@ -0,0 +1,37 @@
+/*
+ * carl9170 firmware - used by the ar9170 wireless device
+ *
+ * RF routine definitions
+ *
+ * Copyright (c) 2000-2005 ZyDAS Technology Corporation
+ * Copyright (c) 2007-2009 Atheros Communications, Inc.
+ * Copyright	2009	Johannes Berg <johannes@sipsolutions.net>
+ * Copyright 2009-2011	Christian Lamparter <chunkeey@googlemail.com>
+ *
+ * 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; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef __CARL9170FW_RF_H
+#define __CARL9170FW_RF_H
+
+#include "config.h"
+
+#ifdef CONFIG_CARL9170FW_RADIO_FUNCTIONS
+void rf_notify_set_channel(void);
+void rf_cmd(const struct carl9170_cmd *cmd, struct carl9170_rsp *resp);
+void rf_psm(void);
+#endif /* CONFIG_CARL9170FW_RADIO_FUNCTIONS */
+
+#endif /* __CARL9170FW_RF_H */
diff --git a/carl9170fw/carlfw/include/rom.h b/carl9170fw/carlfw/include/rom.h
new file mode 100644
index 0000000..922c5c8
--- /dev/null
+++ b/carl9170fw/carlfw/include/rom.h
@@ -0,0 +1,82 @@
+/*
+ * carl9170 firmware - used by the ar9170 wireless device
+ *
+ * ROM layout
+ *
+ * Copyright (c) 2000-2005 ZyDAS Technology Corporation
+ * Copyright (c) 2007-2009 Atheros Communications, Inc.
+ * Copyright	2009	Johannes Berg <johannes@sipsolutions.net>
+ * Copyright 2009-2011	Christian Lamparter <chunkeey@googlemail.com>
+ *
+ * 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; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef __CARL9170FW_ROM_H
+#define __CARL9170FW_ROM_H
+
+#include "types.h"
+#include "config.h"
+#include "compiler.h"
+#include "usb.h"
+#include "eeprom.h"
+
+struct ar9170_hwtype {
+	/* 0x00001370 */
+	uint8_t data[4];
+
+	/* 0x00001374 */
+	struct ar9170_led_mode led_mode[AR9170_NUM_LEDS];
+
+	/* 0x00001378 */
+	uint8_t nulldata[2];
+
+	struct {
+		/* 0x0000137a */
+		struct usb_device_descriptor device_desc;
+
+		/* 0x0000138c */
+		uint8_t string0_desc[4];
+
+		/* 0x00001390 */
+		uint8_t string1_desc[32];
+
+		/* 0x000013b0 */
+		uint8_t string2_desc[48];
+
+		/* 0x000013e0 */
+		uint8_t string3_desc[32];
+	} usb;
+} __packed;
+
+struct ar9170_rom {
+	/* 0x00000000 */
+	uint32_t *irq_table[2];
+
+	/* 0x00000008 */
+	uint8_t bootcode[4968];
+
+	/* 0x00001370 */
+	struct ar9170_hwtype hw;
+
+	/* 0x00001400 */
+	uint8_t data[512];
+
+	/* eeprom */
+	struct ar9170_eeprom sys;
+} __packed;
+
+static const struct ar9170_rom rom __section(eeprom);
+
+#endif /* __CARL9170FW_ROM_H */
diff --git a/carl9170fw/carlfw/include/timer.h b/carl9170fw/carlfw/include/timer.h
new file mode 100644
index 0000000..1c1c6cd
--- /dev/null
+++ b/carl9170fw/carlfw/include/timer.h
@@ -0,0 +1,88 @@
+/*
+ * carl9170 firmware - used by the ar9170 wireless device
+ *
+ * Clock, Timer & Timing
+ *
+ * Copyright (c) 2000-2005 ZyDAS Technology Corporation
+ * Copyright (c) 2007-2009 Atheros Communications, Inc.
+ * Copyright	2009	Johannes Berg <johannes@sipsolutions.net>
+ * Copyright 2009-2011	Christian Lamparter <chunkeey@googlemail.com>
+ *
+ * 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; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef __CARL9170FW_TIMER_H
+#define __CARL9170FW_TIMER_H
+
+#include "config.h"
+
+enum cpu_clock_t {
+	AHB_40MHZ_OSC   = 0,
+	AHB_20_22MHZ    = 1,
+	AHB_40_44MHZ    = 2,
+	AHB_80_88MHZ    = 3
+};
+
+static inline __inline uint32_t get_clock_counter(void)
+{
+	return (get(AR9170_TIMER_REG_CLOCK_HIGH) << 16) | get(AR9170_TIMER_REG_CLOCK_LOW);
+}
+
+/*
+ * works only up to 97 secs [44 MHz] or 107 secs for 40 MHz
+ * Also, the delay wait will be affected by 2.4GHz<->5GHz
+ * band changes.
+ */
+static inline __inline bool is_after_msecs(const uint32_t t0, const uint32_t msecs)
+{
+	return ((get_clock_counter() - t0) / 1000) > (msecs * fw.ticks_per_usec);
+}
+
+/*
+ * Note: Be careful with [u]delay. They won't service the
+ * hardware watchdog timer. It might trigger if you
+ * wait long enough. Also they don't terminate if sec is
+ * above 97 sec [44MHz] or more than 107 sec [40MHz].
+ */
+static inline __inline void delay(const uint32_t msec)
+{
+	uint32_t t1, t2, dt, wt;
+
+	wt = msec * fw.ticks_per_usec;
+
+	t1 = get_clock_counter();
+	while (1) {
+		t2 = get_clock_counter();
+		dt = (t2 - t1) / 1000;
+		if (dt >= wt)
+			break;
+	}
+}
+
+static inline __inline void udelay(const uint32_t usec)
+{
+	uint32_t t1, t2, dt;
+
+	t1 = get_clock_counter();
+	while (1) {
+		t2 = get_clock_counter();
+		dt = (t2 - t1);
+		if (dt >= (usec * fw.ticks_per_usec))
+			break;
+	}
+}
+
+void clock_set(enum cpu_clock_t _clock, bool on);
+#endif /* __CARL9170FW_TIMER_H */
diff --git a/carl9170fw/carlfw/include/uart.h b/carl9170fw/carlfw/include/uart.h
new file mode 100644
index 0000000..1cfa29d
--- /dev/null
+++ b/carl9170fw/carlfw/include/uart.h
@@ -0,0 +1,37 @@
+/*
+ * carl9170 firmware - used by the ar9170 wireless device
+ *
+ * UART functions definition
+ *
+ * Copyright (c) 2000-2005 ZyDAS Technology Corporation
+ * Copyright (c) 2007-2009 Atheros Communications, Inc.
+ * Copyright	2009	Johannes Berg <johannes@sipsolutions.net>
+ * Copyright 2009-2011	Christian Lamparter <chunkeey@googlemail.com>
+ *
+ * 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; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef __CARL9170FW_UART_H
+#define __CARL9170FW_UART_H
+
+#include "config.h"
+
+#ifdef CONFIG_CARL9170FW_DEBUG_UART
+void uart_putc(const char c);
+void uart_print_hex_dump(const void *buf, const int len);
+void uart_init(void);
+#endif /* CONFIG_CARL9170FW_DEBUG_UART */
+
+#endif /* __CARL9170FW_UART_H */
diff --git a/carl9170fw/carlfw/include/usb.h b/carl9170fw/carlfw/include/usb.h
new file mode 100644
index 0000000..cea1d4d
--- /dev/null
+++ b/carl9170fw/carlfw/include/usb.h
@@ -0,0 +1,191 @@
+/*
+ * carl9170 firmware - used by the ar9170 wireless device
+ *
+ * USB definitions
+ *
+ * Copyright (c) 2000-2005 ZyDAS Technology Corporation
+ * Copyright (c) 2007-2009 Atheros Communications, Inc.
+ * Copyright	2009	Johannes Berg <johannes@sipsolutions.net>
+ * Copyright 2009-2011	Christian Lamparter <chunkeey@googlemail.com>
+ *
+ * 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; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef __CARL9170FW_USB_H
+#define __CARL9170FW_USB_H
+
+#include "config.h"
+#include "types.h"
+#include "io.h"
+#include "hw.h"
+#include "ch9.h"
+
+struct ar9170_usb_config {
+	struct usb_config_descriptor cfg;
+	struct usb_interface_descriptor intf;
+	struct usb_endpoint_descriptor ep[AR9170_USB_NUM_EXTRA_EP];
+} __packed;
+
+static inline __inline bool usb_detect_highspeed(void)
+{
+	return !!(getb(AR9170_USB_REG_MAIN_CTRL) &
+		  AR9170_USB_MAIN_CTRL_HIGHSPEED);
+}
+
+static inline __inline bool usb_configured(void)
+{
+	return !!(getb(AR9170_USB_REG_DEVICE_ADDRESS) &
+		  AR9170_USB_DEVICE_ADDRESS_CONFIGURE);
+}
+
+static inline __inline void usb_enable_remote_wakeup(void)
+{
+	orb(AR9170_USB_REG_MAIN_CTRL, AR9170_USB_MAIN_CTRL_REMOTE_WAKEUP);
+}
+
+static inline __inline void usb_disable_remote_wakeup(void)
+{
+	andb(AR9170_USB_REG_MAIN_CTRL, ~AR9170_USB_MAIN_CTRL_REMOTE_WAKEUP);
+}
+
+static inline __inline void usb_enable_global_int(void)
+{
+	orb(AR9170_USB_REG_MAIN_CTRL, AR9170_USB_MAIN_CTRL_ENABLE_GLOBAL_INT);
+}
+
+static inline __inline void usb_trigger_out(void)
+{
+	andb(AR9170_USB_REG_INTR_MASK_BYTE_4,
+		(uint8_t) ~AR9170_USB_INTR_DISABLE_OUT_INT);
+}
+
+static inline __inline void usb_reset_out(void)
+{
+	orb(AR9170_USB_REG_INTR_MASK_BYTE_4, AR9170_USB_INTR_DISABLE_OUT_INT);
+}
+
+static inline __inline void usb_trigger_in(void)
+{
+	andb(AR9170_USB_REG_INTR_MASK_BYTE_6, ~AR9170_USB_INTR_DISABLE_IN_INT);
+}
+
+static inline __inline void usb_reset_in(void)
+{
+	orb(AR9170_USB_REG_INTR_MASK_BYTE_6, AR9170_USB_INTR_DISABLE_IN_INT);
+}
+
+static inline __inline void usb_ep3_xfer_done(void)
+{
+	orb(AR9170_USB_REG_EP3_BYTE_COUNT_HIGH, 0x08);
+}
+
+static inline __inline void usb_suspend_ack(void)
+{
+	/*
+	 * uP must do-over everything it should handle
+	 * and do before into the suspend mode
+	 */
+	andb(AR9170_USB_REG_INTR_SOURCE_7, ~BIT(2));
+}
+
+static inline __inline void usb_resume_ack(void)
+{
+	/*
+	 * uP must do-over everything it should handle
+	 * and do before into the suspend mode
+	 */
+
+	andb(AR9170_USB_REG_INTR_SOURCE_7, ~BIT(3));
+}
+
+static inline __inline void usb_reset_ack(void)
+{
+	andb(AR9170_USB_REG_INTR_SOURCE_7, ~BIT(1));
+}
+
+static inline __inline void usb_data_out0Byte(void)
+{
+	andb(AR9170_USB_REG_INTR_SOURCE_7, (uint8_t) ~BIT(7));
+}
+
+static inline __inline void usb_data_in0Byte(void)
+{
+	andb(AR9170_USB_REG_INTR_SOURCE_7, ~BIT(6));
+}
+
+static inline __inline void usb_stop_down_queue(void)
+{
+	andl(AR9170_USB_REG_DMA_CTL, ~AR9170_USB_DMA_CTL_ENABLE_TO_DEVICE);
+}
+
+static inline __inline void usb_start_down_queue(void)
+{
+	orl(AR9170_USB_REG_DMA_CTL, AR9170_USB_DMA_CTL_ENABLE_TO_DEVICE);
+}
+
+static inline __inline void usb_clear_input_ep_toggle(unsigned int ep)
+{
+	andl(AR9170_USB_REG_EP_IN_MAX_SIZE_HIGH + (ep << 1),
+	     ~AR9170_USB_EP_IN_TOGGLE);
+}
+
+static inline __inline void usb_set_input_ep_toggle(unsigned int ep)
+{
+	orl(AR9170_USB_REG_EP_IN_MAX_SIZE_HIGH + (ep << 1),
+	    AR9170_USB_EP_IN_TOGGLE);
+}
+
+static inline __inline void usb_clear_output_ep_toggle(unsigned int ep)
+{
+	andl(AR9170_USB_REG_EP_OUT_MAX_SIZE_HIGH + (ep << 1),
+	     ~AR9170_USB_EP_OUT_TOGGLE);
+}
+
+static inline __inline void usb_set_output_ep_toggle(unsigned int ep)
+{
+	orl(AR9170_USB_REG_EP_OUT_MAX_SIZE_HIGH + (ep << 1),
+	    AR9170_USB_EP_OUT_TOGGLE);
+}
+
+static inline void usb_structure_check(void)
+{
+	BUILD_BUG_ON(sizeof(struct usb_config_descriptor) != USB_DT_CONFIG_SIZE);
+	BUILD_BUG_ON(sizeof(struct usb_device_descriptor) != USB_DT_DEVICE_SIZE);
+	BUILD_BUG_ON(sizeof(struct usb_endpoint_descriptor) != USB_DT_ENDPOINT_SIZE);
+	BUILD_BUG_ON(sizeof(struct usb_interface_descriptor) != USB_DT_INTERFACE_SIZE);
+}
+
+void __noreturn jump_to_bootcode(void);
+
+void send_cmd_to_host(const uint8_t len, const uint8_t type,
+		      const uint8_t ext, const uint8_t *body);
+
+void usb_init(void);
+void usb_ep0rx(void);
+void usb_ep0tx(void);
+void usb_ep0setup(void);
+void handle_usb(void);
+
+void usb_timer(void);
+void usb_putc(const char c);
+void usb_print_hex_dump(const void *buf, int len);
+
+void usb_init_highspeed_fifo_cfg(void);
+void usb_init_fullspeed_fifo_cfg(void);
+
+void __noreturn start(void);
+void __noreturn reboot(void);
+
+#endif /* __CARL9170FW_USB_H */
diff --git a/carl9170fw/carlfw/include/usb_fifo.h b/carl9170fw/carlfw/include/usb_fifo.h
new file mode 100644
index 0000000..5d84c88
--- /dev/null
+++ b/carl9170fw/carlfw/include/usb_fifo.h
@@ -0,0 +1,244 @@
+/*
+ * carl9170 firmware - used by the ar9170 wireless device
+ *
+ * USB definitions
+ *
+ * Copyright (c) 2000-2005 ZyDAS Technology Corporation
+ * Copyright (c) 2007-2009 Atheros Communications, Inc.
+ * Copyright	2009	Johannes Berg <johannes@sipsolutions.net>
+ * Copyright 2009-2011	Christian Lamparter <chunkeey@googlemail.com>
+ *
+ * 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; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef __CARL9170FW_USB_FIFO_H
+#define __CARL9170FW_USB_FIFO_H
+
+#include "config.h"
+
+#define MASK_F0             0xf0
+
+/* Block Size define */
+#define BLK512BYTE      1
+#define BLK1024BYTE     2
+
+#define BLK64BYTE       1
+#define BLK128BYTE      2
+
+/* Block toggle number define */
+#define SINGLE_BLK      1
+#define DOUBLE_BLK      2
+#define TRIBLE_BLK      3
+
+/* Endpoint transfer type */
+#define TF_TYPE_ISOCHRONOUS     1
+#define TF_TYPE_BULK            2
+#define TF_TYPE_INTERRUPT       3
+
+/* Endpoint or FIFO direction define */
+#define DIRECTION_IN    0
+#define DIRECTION_OUT   1
+
+#define HS_C1_I0_A0_EP1_MAX_PACKET              512
+#define HS_C1_I0_A0_EP1_bInterval               0
+
+#define HS_C1_I0_A0_EP_NUMBER                   0x04
+#define HS_C1_I0_A0_EP_LENGTH                   (EP_LENGTH * HS_C1_I0_A0_EP_NUMBER)
+#define HS_C1_I0_ALT_LENGTH                     (HS_C1_I0_A0_EP_LENGTH)
+#define HS_C1_INTERFACE_LENGTH                  (HS_C1_I0_ALT_LENGTH)
+
+#define HS_C1_CONFIG_TOTAL_LENGTH               (CONFIG_LENGTH + INTERFACE_LENGTH +  HS_C1_INTERFACE_LENGTH)
+#define FS_C1_CONFIG_TOTAL_LENGTH               (CONFIG_LENGTH + INTERFACE_LENGTH +  FS_C1_INTERFACE_LENGTH)
+
+#define FS_C1_I0_A0_EP1_MAX_PACKET              64
+/* #define FS_C1_I0_A0_EP1_bInterval               HS_C1_I0_A0_EP1_bInterval */
+
+#define HS_CONFIGURATION_NUMBER                 1
+#define FS_CONFIGURATION_NUMBER                 1
+
+#define fDOUBLE_BUF                             1
+#define fDOUBLE_BUF_IN                          0
+
+#define fFLASH_DISK                             0
+#define fENABLE_ISO                             0
+
+#define HS_C1_INTERFACE_NUMBER  0x01
+#define HS_C1                   0x01
+#define HS_C1_iConfiguration    0x00
+#define HS_C1_bmAttribute       0x80
+
+#define HS_C1_iMaxPower         0xFA
+
+/* Interface 0 */
+#define HS_C1_I0_ALT_NUMBER    0X01
+/* AlternateSetting 0 */
+#define HS_C1_I0_A0_bInterfaceNumber	0x00
+#define HS_C1_I0_A0_bAlternateSetting	0x00
+/* JWEI 2003/07/14 */
+#define HS_C1_I0_A0_EP_NUMBER		0x04
+#define HS_C1_I0_A0_bInterfaceClass	0xff
+#define HS_C1_I0_A0_bInterfaceSubClass	0x00
+#define HS_C1_I0_A0_bInterfaceProtocol	0x00
+#define HS_C1_I0_A0_iInterface		0x00
+
+/* EP 1 */
+#define HS_C1_I0_A0_EP1_BLKSIZE    512
+#define HS_C1_I0_A0_EP1_BLKNO      DOUBLE_BLK
+#define HS_C1_I0_A0_EP1_DIRECTION  DIRECTION_OUT
+#define HS_C1_I0_A0_EP1_TYPE       TF_TYPE_BULK
+
+#define HS_C1_I0_A0_EP1_MAX_PACKET 512
+#define HS_C1_I0_A0_EP1_bInterval  0
+
+/* EP 2 */
+#define HS_C1_I0_A0_EP2_BLKSIZE    512
+/* JWEI 2003/08/20 */
+#define HS_C1_I0_A0_EP2_BLKNO      SINGLE_BLK
+#define HS_C1_I0_A0_EP2_DIRECTION  DIRECTION_IN
+#define HS_C1_I0_A0_EP2_TYPE       TF_TYPE_BULK
+#define HS_C1_I0_A0_EP2_MAX_PACKET 512
+#define HS_C1_I0_A0_EP2_bInterval  0
+
+/* EP 3 */
+#define HS_C1_I0_A0_EP3_BLKSIZE    64
+#define HS_C1_I0_A0_EP3_BLKNO      SINGLE_BLK
+#define HS_C1_I0_A0_EP3_DIRECTION  DIRECTION_IN
+#define HS_C1_I0_A0_EP3_TYPE       TF_TYPE_INTERRUPT
+#define HS_C1_I0_A0_EP3_MAX_PACKET 0x0040
+#define HS_C1_I0_A0_EP3_bInterval  01
+
+/*
+ * Note: HS Bulk type require max pkt size = 512
+ *       ==> must use Interrupt type for max pkt size = 64
+ */
+
+/* EP 4 */
+#define HS_C1_I0_A0_EP4_BLKSIZE    64
+#define HS_C1_I0_A0_EP4_BLKNO      SINGLE_BLK
+#define HS_C1_I0_A0_EP4_DIRECTION  DIRECTION_OUT
+#define HS_C1_I0_A0_EP4_TYPE       TF_TYPE_INTERRUPT
+#define HS_C1_I0_A0_EP4_MAX_PACKET 0x0040
+#define HS_C1_I0_A0_EP4_bInterval  01
+
+#define HS_C1_I0_A0_EP_LENGTH           (EP_LENGTH * HS_C1_I0_A0_EP_NUMBER)
+/* EP 1 */
+#define HS_C1_I0_A0_EP1_FIFO_START  0
+#define HS_C1_I0_A0_EP1_FIFO_NO     (HS_C1_I0_A0_EP1_BLKNO * HS_C1_I0_A0_EP1_BLKSIZE)
+#define HS_C1_I0_A0_EP1_FIFO_CONFIG (uint8_t)(0x80 | ((HS_C1_I0_A0_EP1_BLKSIZE - 1) << 4) | ((HS_C1_I0_A0_EP1_BLKNO - 1) << 2) | HS_C1_I0_A0_EP1_TYPE)
+#define HS_C1_I0_A0_EP1_FIFO_MAP    (((1 - HS_C1_I0_A0_EP1_DIRECTION) << 4) | 1)
+#define HS_C1_I0_A0_EP1_MAP         (HS_C1_I0_A0_EP1_FIFO_START |   (HS_C1_I0_A0_EP1_FIFO_START << 4)   | (MASK_F0 >> (4*HS_C1_I0_A0_EP1_DIRECTION)))
+
+/* EP 2 */
+#define HS_C1_I0_A0_EP2_FIFO_START  (uint8_t)(HS_C1_I0_A0_EP1_FIFO_START + HS_C1_I0_A0_EP1_FIFO_NO)
+#define HS_C1_I0_A0_EP2_FIFO_NO     (uint8_t)(HS_C1_I0_A0_EP2_BLKNO * HS_C1_I0_A0_EP2_BLKSIZE)
+#define HS_C1_I0_A0_EP2_FIFO_CONFIG (uint8_t)(0x80 | ((HS_C1_I0_A0_EP2_BLKSIZE - 1) << 4) | ((HS_C1_I0_A0_EP2_BLKNO - 1) << 2) | HS_C1_I0_A0_EP2_TYPE)
+#define HS_C1_I0_A0_EP2_FIFO_MAP    (uint8_t)(((1 - HS_C1_I0_A0_EP2_DIRECTION) << 4) | 2)
+#define HS_C1_I0_A0_EP2_MAP         (uint8_t)(HS_C1_I0_A0_EP2_FIFO_START |   (HS_C1_I0_A0_EP2_FIFO_START << 4)   | (MASK_F0 >> (4*HS_C1_I0_A0_EP2_DIRECTION)))
+
+/* EP 3 */
+#define HS_C1_I0_A0_EP3_FIFO_START  14
+#define HS_C1_I0_A0_EP3_FIFO_NO     (HS_C1_I0_A0_EP3_BLKNO * HS_C1_I0_A0_EP3_BLKSIZE)
+#define HS_C1_I0_A0_EP3_FIFO_CONFIG (uint8_t)(0x80 | ((HS_C1_I0_A0_EP3_BLKSIZE - 1) << 4) | ((HS_C1_I0_A0_EP3_BLKNO - 1) << 2) | HS_C1_I0_A0_EP3_TYPE)
+#define HS_C1_I0_A0_EP3_FIFO_MAP    (uint8_t)(((1 - HS_C1_I0_A0_EP3_DIRECTION) << 4) | 3)
+#define HS_C1_I0_A0_EP3_MAP         (uint8_t)(HS_C1_I0_A0_EP3_FIFO_START |   (HS_C1_I0_A0_EP3_FIFO_START << 4)   | (MASK_F0 >> (4*HS_C1_I0_A0_EP3_DIRECTION)))
+
+/* EP 4 */
+#define HS_C1_I0_A0_EP4_FIFO_START  (HS_C1_I0_A0_EP3_FIFO_START + HS_C1_I0_A0_EP3_FIFO_NO)
+#define HS_C1_I0_A0_EP4_FIFO_NO     (HS_C1_I0_A0_EP4_BLKNO * HS_C1_I0_A0_EP4_BLKSIZE)
+#define HS_C1_I0_A0_EP4_FIFO_CONFIG (uint8_t)(0x80 | ((HS_C1_I0_A0_EP4_BLKSIZE - 1) << 4) | ((HS_C1_I0_A0_EP4_BLKNO - 1) << 2) | HS_C1_I0_A0_EP4_TYPE)
+#define HS_C1_I0_A0_EP4_FIFO_MAP    (((1 - HS_C1_I0_A0_EP4_DIRECTION) << 4) | 4)
+#define HS_C1_I0_A0_EP4_MAP         (uint8_t)(HS_C1_I0_A0_EP4_FIFO_START |   (HS_C1_I0_A0_EP4_FIFO_START << 4)   | (MASK_F0 >> (4*HS_C1_I0_A0_EP4_DIRECTION)))
+
+/* Configuration 1 */
+#define FS_C1_INTERFACE_NUMBER		0x01
+#define FS_C1				0x01
+#define FS_C1_iConfiguration		0x00
+#define FS_C1_bmAttribute		0x80
+#define FS_C1_iMaxPower			0xfa
+
+/* Interface 0 */
+#define FS_C1_I0_ALT_NUMBER		0x01
+/* AlternateSetting 0x00 */
+#define FS_C1_I0_A0_bInterfaceNumber	0x00
+#define FS_C1_I0_A0_bAlternateSetting	0x00
+#define FS_C1_I0_A0_EP_NUMBER		0x04
+#define FS_C1_I0_A0_bInterfaceClass	0xff
+#define FS_C1_I0_A0_bInterfaceSubClass	0x00
+#define FS_C1_I0_A0_bInterfaceProtocol	0x00
+
+/* EP 1 */
+#define FS_C1_I0_A0_EP1_BLKSIZE    512
+/* JWEI 2003/05/19 */
+#define FS_C1_I0_A0_EP1_BLKNO      DOUBLE_BLK
+#define FS_C1_I0_A0_EP1_DIRECTION  DIRECTION_OUT
+#define FS_C1_I0_A0_EP1_TYPE       TF_TYPE_BULK
+#define FS_C1_I0_A0_EP1_MAX_PACKET 64
+#define FS_C1_I0_A0_EP1_bInterval  0
+
+/* EP 2 */
+#define FS_C1_I0_A0_EP2_BLKSIZE    512
+/* JWEI 2003/08/20 */
+#define FS_C1_I0_A0_EP2_BLKNO      SINGLE_BLK
+#define FS_C1_I0_A0_EP2_DIRECTION  DIRECTION_IN
+#define FS_C1_I0_A0_EP2_TYPE       TF_TYPE_BULK
+#define FS_C1_I0_A0_EP2_MAX_PACKET 64
+#define FS_C1_I0_A0_EP2_bInterval  0
+
+/* EP 3 */
+#define FS_C1_I0_A0_EP3_BLKSIZE    64
+#define FS_C1_I0_A0_EP3_BLKNO      SINGLE_BLK
+#define FS_C1_I0_A0_EP3_DIRECTION  DIRECTION_IN
+#define FS_C1_I0_A0_EP3_TYPE       TF_TYPE_INTERRUPT
+#define FS_C1_I0_A0_EP3_MAX_PACKET 0x0040
+#define FS_C1_I0_A0_EP3_bInterval  1
+
+/* EP 4 */
+#define FS_C1_I0_A0_EP4_BLKSIZE    64
+#define FS_C1_I0_A0_EP4_BLKNO      SINGLE_BLK
+#define FS_C1_I0_A0_EP4_DIRECTION  DIRECTION_OUT
+#define FS_C1_I0_A0_EP4_TYPE       TF_TYPE_BULK
+#define FS_C1_I0_A0_EP4_MAX_PACKET 0x0040
+#define FS_C1_I0_A0_EP4_bInterval  0
+
+#define FS_C1_I0_A0_EP_LENGTH           (EP_LENGTH * FS_C1_I0_A0_EP_NUMBER)
+/* EP 1 */
+#define FS_C1_I0_A0_EP1_FIFO_START  0
+#define FS_C1_I0_A0_EP1_FIFO_NO     (uint8_t)(FS_C1_I0_A0_EP1_BLKNO * FS_C1_I0_A0_EP1_BLKSIZE)
+#define FS_C1_I0_A0_EP1_FIFO_CONFIG (uint8_t)(0x80 | ((FS_C1_I0_A0_EP1_BLKSIZE - 1) << 4) | ((FS_C1_I0_A0_EP1_BLKNO - 1) << 2) | FS_C1_I0_A0_EP1_TYPE)
+#define FS_C1_I0_A0_EP1_FIFO_MAP    (uint8_t)(((1 - FS_C1_I0_A0_EP1_DIRECTION) << 4) | 1)
+#define FS_C1_I0_A0_EP1_MAP         (uint8_t)(FS_C1_I0_A0_EP1_FIFO_START |   (FS_C1_I0_A0_EP1_FIFO_START << 4)   | (MASK_F0 >> (4*FS_C1_I0_A0_EP1_DIRECTION)))
+
+/* EP 2 */
+#define FS_C1_I0_A0_EP2_FIFO_START  (uint8_t)(FS_C1_I0_A0_EP1_FIFO_START + FS_C1_I0_A0_EP1_FIFO_NO)
+#define FS_C1_I0_A0_EP2_FIFO_NO     (uint8_t)(FS_C1_I0_A0_EP2_BLKNO * FS_C1_I0_A0_EP2_BLKSIZE)
+#define FS_C1_I0_A0_EP2_FIFO_CONFIG (uint8_t)(0x80 | ((FS_C1_I0_A0_EP2_BLKSIZE - 1) << 4) | ((FS_C1_I0_A0_EP2_BLKNO - 1) << 2) | FS_C1_I0_A0_EP2_TYPE)
+#define FS_C1_I0_A0_EP2_FIFO_MAP    (uint8_t)(((1 - FS_C1_I0_A0_EP2_DIRECTION) << 4) | 2)
+#define FS_C1_I0_A0_EP2_MAP         (uint8_t)(FS_C1_I0_A0_EP2_FIFO_START |   (FS_C1_I0_A0_EP2_FIFO_START << 4)   | (MASK_F0 >> (4*FS_C1_I0_A0_EP2_DIRECTION)))
+
+/* EP 3 */
+#define FS_C1_I0_A0_EP3_FIFO_START  14
+#define FS_C1_I0_A0_EP3_FIFO_NO     (uint8_t)(FS_C1_I0_A0_EP3_BLKNO * FS_C1_I0_A0_EP3_BLKSIZE)
+#define FS_C1_I0_A0_EP3_FIFO_CONFIG (uint8_t)(0x80 | ((FS_C1_I0_A0_EP3_BLKSIZE - 1) << 4) | ((FS_C1_I0_A0_EP3_BLKNO - 1) << 2) | FS_C1_I0_A0_EP3_TYPE)
+#define FS_C1_I0_A0_EP3_FIFO_MAP    (uint8_t)(((1 - FS_C1_I0_A0_EP3_DIRECTION) << 4) | 3)
+#define FS_C1_I0_A0_EP3_MAP         (uint8_t)(FS_C1_I0_A0_EP3_FIFO_START |   (FS_C1_I0_A0_EP3_FIFO_START << 4)   | (MASK_F0 >> (4*FS_C1_I0_A0_EP3_DIRECTION)))
+
+/* EP 4 */
+#define FS_C1_I0_A0_EP4_FIFO_START  (uint8_t)(FS_C1_I0_A0_EP3_FIFO_START + FS_C1_I0_A0_EP3_FIFO_NO)
+#define FS_C1_I0_A0_EP4_FIFO_NO     (uint8_t)(FS_C1_I0_A0_EP4_BLKNO * FS_C1_I0_A0_EP4_BLKSIZE)
+#define FS_C1_I0_A0_EP4_FIFO_CONFIG (uint8_t)(0x80 | ((FS_C1_I0_A0_EP4_BLKSIZE - 1) << 4) | ((FS_C1_I0_A0_EP4_BLKNO - 1) << 2) | FS_C1_I0_A0_EP4_TYPE)
+#define FS_C1_I0_A0_EP4_FIFO_MAP    (uint8_t)(((1 - FS_C1_I0_A0_EP4_DIRECTION) << 4) | 4)
+#define FS_C1_I0_A0_EP4_MAP         (uint8_t)(FS_C1_I0_A0_EP4_FIFO_START |   (FS_C1_I0_A0_EP4_FIFO_START << 4)   | (MASK_F0 >> (4*FS_C1_I0_A0_EP4_DIRECTION)))
+
+#endif /* __CARL9170FW_USB_FIFO_H */
diff --git a/carl9170fw/carlfw/include/wl.h b/carl9170fw/carlfw/include/wl.h
new file mode 100644
index 0000000..dd5b0a8
--- /dev/null
+++ b/carl9170fw/carlfw/include/wl.h
@@ -0,0 +1,296 @@
+/*
+ * carl9170 firmware - used by the ar9170 wireless device
+ *
+ * WLAN
+ *
+ * Copyright (c) 2000-2005 ZyDAS Technology Corporation
+ * Copyright (c) 2007-2009 Atheros Communications, Inc.
+ * Copyright	2009	Johannes Berg <johannes@sipsolutions.net>
+ * Copyright 2009-2011	Christian Lamparter <chunkeey@googlemail.com>
+ *
+ * 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; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef __CARL9170FW_WLAN_H
+#define __CARL9170FW_WLAN_H
+
+#include "config.h"
+#include "carl9170.h"
+#include "io.h"
+
+struct ieee80211_hdr;
+
+static inline __inline void set_wlan_txq_dma_addr(const unsigned int q, const uint32_t v)
+{
+	set(AR9170_MAC_REG_DMA_TXQ_ADDR + (q << 3), v);
+}
+
+static inline __inline void set_wlan_txq_dma_curr_addr(const unsigned int q, const uint32_t v)
+{
+	set(AR9170_MAC_REG_DMA_TXQ_CURR_ADDR + (q << 3), v);
+}
+
+static inline __inline volatile struct dma_desc *get_wlan_txq_dma_addr(const unsigned int q)
+{
+	return getp(AR9170_MAC_REG_DMA_TXQ_ADDR + (q << 3));
+}
+
+static inline __inline volatile struct dma_desc *get_wlan_txq_addr(const unsigned int q)
+{
+	return getp(AR9170_MAC_REG_DMA_TXQ_CURR_ADDR + (q << 3));
+}
+
+static inline __inline volatile struct dma_desc *get_wlan_txq_last_addr(const unsigned int q)
+{
+	return getp(AR9170_MAC_REG_DMA_TXQ_LAST_ADDR + (q << 2));
+}
+
+static inline __inline void wlan_trigger(const uint32_t queue_bit)
+{
+	set(AR9170_MAC_REG_DMA_TRIGGER, queue_bit);
+}
+
+static inline __inline uint8_t ar9170_get_rx_macstatus_status(struct dma_desc *desc)
+{
+	return *((uint8_t *) DESC_PAYLOAD_OFF(desc->lastAddr,
+		(unsigned int) desc->lastAddr->dataSize - 1));
+}
+
+static inline __inline uint8_t ar9170_get_rx_macstatus_error(struct dma_desc *desc)
+{
+	unsigned int offset;
+
+	if (desc->lastAddr->dataSize == 1) {
+		while (desc->lastAddr != desc->nextAddr)
+			desc = desc->nextAddr;
+
+		offset = (unsigned int) (desc->dataSize - 1);
+	} else {
+		desc = desc->lastAddr;
+		offset = desc->dataSize -
+			(sizeof(struct ar9170_rx_macstatus) -
+			 offsetof(struct ar9170_rx_macstatus, error));
+	}
+
+	return *((uint8_t *) DESC_PAYLOAD_OFF(desc, offset));
+}
+
+static inline __inline struct ieee80211_hdr *ar9170_get_rx_i3e(struct dma_desc *desc)
+{
+	if (!((ar9170_get_rx_macstatus_status(desc) &
+		AR9170_RX_STATUS_MPDU) & AR9170_RX_STATUS_MPDU_LAST)) {
+		return (void *)(DESC_PAYLOAD_OFF(desc,
+			offsetof(struct ar9170_rx_frame_head, i3e)));
+	} else {
+		return (void *)(DESC_PAYLOAD_OFF(desc,
+			offsetof(struct ar9170_rx_frame_tail, i3e)));
+	}
+}
+
+static inline __inline struct ar9170_rx_head *ar9170_get_rx_head(struct dma_desc *desc)
+{
+	if (!((ar9170_get_rx_macstatus_status(desc) &
+		AR9170_RX_STATUS_MPDU) & AR9170_RX_STATUS_MPDU_LAST)) {
+		return (void *)((uint8_t *)DESC_PAYLOAD(desc) +
+			offsetof(struct ar9170_rx_frame_head, phy_head));
+	} else {
+		return (void *) NULL;
+	}
+}
+
+static inline __inline uint32_t ar9170_rx_to_phy(struct dma_desc *rx)
+{
+	struct ar9170_tx_hw_phy_control phy;
+	struct ar9170_rx_head *head;
+	uint8_t mac_status;
+
+	phy.set = 0;
+
+	head = ar9170_get_rx_head(rx);
+	if (!head)
+		return le32_to_cpu(phy.set);
+
+	mac_status = ar9170_get_rx_macstatus_status(rx);
+
+	phy.modulation = mac_status & AR9170_RX_STATUS_MODULATION;
+	phy.chains = AR9170_TX_PHY_TXCHAIN_1;
+
+	switch (phy.modulation) {
+	case AR9170_RX_STATUS_MODULATION_CCK:
+		if (mac_status & AR9170_RX_STATUS_SHORT_PREAMBLE)
+			phy.preamble = 1;
+
+		switch (head->plcp[0]) {
+		case AR9170_RX_PHY_RATE_CCK_2M:
+			phy.mcs = AR9170_TX_PHY_RATE_CCK_2M;
+			break;
+
+		case AR9170_RX_PHY_RATE_CCK_5M:
+			phy.mcs = AR9170_TX_PHY_RATE_CCK_5M;
+			break;
+
+		case AR9170_RX_PHY_RATE_CCK_11M:
+			phy.mcs = AR9170_TX_PHY_RATE_CCK_11M;
+			break;
+
+		case AR9170_RX_PHY_RATE_CCK_1M:
+		default:
+			phy.mcs = AR9170_TX_PHY_RATE_CCK_1M;
+			break;
+
+		}
+		break;
+
+	case AR9170_RX_STATUS_MODULATION_DUPOFDM:
+	case AR9170_RX_STATUS_MODULATION_OFDM:
+		phy.mcs = head->plcp[0] & 0xf;
+		break;
+
+	case AR9170_RX_STATUS_MODULATION_HT:
+		if (head->plcp[3] & 0x80)
+			phy.bandwidth = 2;
+
+		if (head->plcp[6] & 0x80)
+			phy.short_gi = 1;
+
+		/* TODO: Enable both chains for MCS > 7 */
+		phy.mcs = head->plcp[6] & 0x7;
+		break;
+	}
+
+	return le32_to_cpu(phy.set);
+}
+
+static inline __inline unsigned int ar9170_get_rx_mpdu_len(struct dma_desc *desc)
+{
+	/*
+	 * WARNING: you have to check the error bits in macstatus first!
+	 */
+
+	unsigned int mpdu_len = desc->totalLen;
+
+	mpdu_len -= sizeof(struct ar9170_rx_macstatus);
+
+	switch (ar9170_get_rx_macstatus_status(desc) & AR9170_RX_STATUS_MPDU) {
+	case AR9170_RX_STATUS_MPDU_LAST:
+		mpdu_len -= sizeof(struct ar9170_rx_phystatus);
+		break;
+
+	case AR9170_RX_STATUS_MPDU_SINGLE:
+		mpdu_len -= sizeof(struct ar9170_rx_phystatus);
+
+	case AR9170_RX_STATUS_MPDU_FIRST:
+		mpdu_len -= sizeof(struct ar9170_rx_head);
+		break;
+
+	case AR9170_RX_STATUS_MPDU_MIDDLE:
+	default:
+		break;
+	}
+
+	return mpdu_len;
+}
+
+static inline __inline bool ar9170_tx_length_check(const uint16_t len)
+{
+	return len > (sizeof(struct carl9170_tx_superframe) + 24 +
+			 FCS_LEN);
+}
+
+static inline __inline struct carl9170_tx_superframe *get_super(struct dma_desc *desc)
+{
+	return container_of(DESC_PAYLOAD(desc), struct carl9170_tx_superframe,
+			    f);
+}
+
+static inline __inline struct carl9170_tx_superframe *__get_super(struct dma_desc *desc)
+{
+	return DESC_PAYLOAD(desc);
+}
+
+static inline __inline void hide_super(struct dma_desc *desc)
+{
+	desc->dataAddr = (uint8_t *)
+		(((unsigned long)(DESC_PAYLOAD(desc)) +
+		offsetof(struct carl9170_tx_superframe, f)));
+
+	desc->dataSize -= sizeof(struct carl9170_tx_superdesc);
+	desc->totalLen -= sizeof(struct carl9170_tx_superdesc);
+}
+
+static inline __inline void unhide_super(struct dma_desc *desc)
+{
+	desc->dataAddr = (uint8_t *) get_super(desc);
+	desc->dataSize += sizeof(struct carl9170_tx_superdesc);
+	desc->totalLen += sizeof(struct carl9170_tx_superdesc);
+}
+
+static inline __inline __hot void read_tsf(uint32_t *tsf)
+{
+	/*
+	 * "According to the [hardware] documentation:
+	 *  > when TSF_LOW is read, TSF_HI is automatically concurrently
+	 *  > copied into a temporary register so that an immediate read
+	 *  > of TSF_HI will get the value that was present when TSF_LOW
+	 *  > was read. "
+	 *
+	 * (David H. Lynch Jr. - mail from 2010-05-22)
+	 * http://permalink.gmane.org/gmane.linux.kernel.wireless.general/51249
+	 */
+
+	tsf[0] = get(AR9170_MAC_REG_TSF_L);
+	tsf[1] = get(AR9170_MAC_REG_TSF_H);
+}
+
+/* This function will only work on uint32_t-aligned pointers! */
+static inline bool compare_ether_address(const void *_d0, const void *_d1)
+{
+	const uint32_t *d0 = _d0;
+	const uint32_t *d1 = _d1;
+
+	/* BUG_ON((unsigned long)d0 & 3 || (unsigned long)d1 & 3)) */
+	return !((d0[0] ^ d1[0]) | (unsigned short)(d0[1] ^ d1[1]));
+}
+
+void wlan_tx(struct dma_desc *desc);
+void wlan_tx_fw(struct carl9170_tx_superdesc *super, fw_desc_callback_t cb);
+void wlan_timer(void);
+void handle_wlan(void);
+
+void wlan_cab_flush_queue(const unsigned int vif);
+void wlan_modify_beacon(const unsigned int vif,
+			const unsigned int bcn_addr,
+			const unsigned int bcn_len);
+
+void wlan_tx_complete(struct carl9170_tx_superframe *super, bool txs);
+void wlan_prepare_wol(void);
+
+static inline void __check_wlantx(void)
+{
+	BUILD_BUG_ON(CARL9170_TX_SUPERDESC_LEN & 3);
+	BUILD_BUG_ON(sizeof(struct carl9170_tx_superdesc) != CARL9170_TX_SUPERDESC_LEN);
+	BUILD_BUG_ON(sizeof(struct _carl9170_tx_superdesc) != CARL9170_TX_SUPERDESC_LEN);
+	BUILD_BUG_ON(sizeof(struct _carl9170_tx_superframe) != CARL9170_TX_SUPERFRAME_LEN);
+	BUILD_BUG_ON((offsetof(struct carl9170_tx_superframe, f) & 3) != 0);
+	BUILD_BUG_ON(offsetof(struct _carl9170_tx_superframe, f) !=
+		     (offsetof(struct _carl9170_tx_superframe, f)));
+	BUILD_BUG_ON(sizeof(struct ar9170_tx_hwdesc) != AR9170_TX_HWDESC_LEN);
+	BUILD_BUG_ON(sizeof(struct _ar9170_tx_hwdesc) != AR9170_TX_HWDESC_LEN);
+	BUILD_BUG_ON(sizeof(struct ar9170_rx_head) != AR9170_RX_HEAD_LEN);
+	BUILD_BUG_ON(sizeof(struct ar9170_rx_phystatus) != AR9170_RX_PHYSTATUS_LEN);
+	BUILD_BUG_ON(sizeof(struct ar9170_rx_macstatus) != AR9170_RX_MACSTATUS_LEN);
+}
+
+#endif /* __CARL9170FW_WLAN_H */
diff --git a/carl9170fw/carlfw/include/wol.h b/carl9170fw/carlfw/include/wol.h
new file mode 100644
index 0000000..829400a
--- /dev/null
+++ b/carl9170fw/carlfw/include/wol.h
@@ -0,0 +1,67 @@
+/*
+ * carl9170 firmware - used by the ar9170 wireless device
+ *
+ * WakeUp on WLAN definitions
+ *
+ * Copyright (c) 2000-2005 ZyDAS Technology Corporation
+ * Copyright (c) 2007-2009 Atheros Communications, Inc.
+ * Copyright	2009	Johannes Berg <johannes@sipsolutions.net>
+ * Copyright 2009-2011	Christian Lamparter <chunkeey@googlemail.com>
+ *
+ * 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; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef __CARL9170FW_WOL_H
+#define __CARL9170FW_WOL_H
+
+#include "config.h"
+#include "compiler.h"
+#include "types.h"
+
+#include "fwcmd.h"
+
+#ifdef CONFIG_CARL9170FW_WOL
+
+struct ieee80211_hdr;
+
+void wol_prepare(void);
+void wol_janitor(void);
+void wol_rx(const unsigned int rx_filter __unused,
+	    const struct ieee80211_hdr *hdr __unused,
+	    const unsigned int len __unused);
+void wol_cmd(const struct carl9170_wol_cmd *cmd);
+
+#else
+
+static inline void wol_cmd(const struct carl9170_wol_cmd *cmd __unused)
+{
+}
+
+static inline void wol_prepare(void)
+{
+}
+
+static inline void wol_janitor(void)
+{
+}
+
+static inline void wol_rx(const unsigned int rx_filter __unused,
+			  const struct ieee80211_hdr *hdr __unused,
+			  const unsigned int len __unused)
+{
+}
+#endif /* CONFIG_CARL9170FW_WOL */
+
+#endif /* __CARL9170FW_CMD_H */
diff --git a/carl9170fw/carlfw/src/ashlsi3.S b/carl9170fw/carlfw/src/ashlsi3.S
new file mode 100644
index 0000000..593d902
--- /dev/null
+++ b/carl9170fw/carlfw/src/ashlsi3.S
@@ -0,0 +1,193 @@
+/* Copyright (C) 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
+   2004, 2005, 2006
+   Free Software Foundation, Inc.
+
+This file 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, or (at your option) any
+later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+This file 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, write to
+the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+!! libgcc routines for the Renesas / SuperH SH CPUs.
+!! Contributed by Steve Chamberlain.
+!! sac@cygnus.com
+
+!! ashiftrt_r4_x, ___ashrsi3, ___ashlsi3, ___lshrsi3 routines
+!! recoded in assembly by Toshiyasu Morita
+!! tm@netcom.com
+
+/* SH2 optimizations for ___ashrsi3, ___ashlsi3, ___lshrsi3 and
+   ELF local label prefixes by J"orn Rennecke
+   amylaar@cygnus.com  */
+
+!
+! __ashlsi3
+!
+! Entry:
+!
+! r4: Value to shift
+! r5: Shifts
+!
+! Exit:
+!
+! r0: Result
+!
+! Destroys:
+!
+! (none)
+!
+	.global	___ashlsi3
+
+	.align	2
+___ashlsi3:
+	mov	#31,r0
+	and	r0,r5
+	mova	ashlsi3_table,r0
+	mov.b	@(r0,r5),r5
+#ifdef __sh1__
+	add	r5,r0
+	jmp	@r0
+#else
+	braf	r5
+#endif
+	mov	r4,r0
+
+	.align	2
+ashlsi3_table:
+	.byte		ashlsi3_0-ashlsi3_table
+	.byte		ashlsi3_1-ashlsi3_table
+	.byte		ashlsi3_2-ashlsi3_table
+	.byte		ashlsi3_3-ashlsi3_table
+	.byte		ashlsi3_4-ashlsi3_table
+	.byte		ashlsi3_5-ashlsi3_table
+	.byte		ashlsi3_6-ashlsi3_table
+	.byte		ashlsi3_7-ashlsi3_table
+	.byte		ashlsi3_8-ashlsi3_table
+	.byte		ashlsi3_9-ashlsi3_table
+	.byte		ashlsi3_10-ashlsi3_table
+	.byte		ashlsi3_11-ashlsi3_table
+	.byte		ashlsi3_12-ashlsi3_table
+	.byte		ashlsi3_13-ashlsi3_table
+	.byte		ashlsi3_14-ashlsi3_table
+	.byte		ashlsi3_15-ashlsi3_table
+	.byte		ashlsi3_16-ashlsi3_table
+	.byte		ashlsi3_17-ashlsi3_table
+	.byte		ashlsi3_18-ashlsi3_table
+	.byte		ashlsi3_19-ashlsi3_table
+	.byte		ashlsi3_20-ashlsi3_table
+	.byte		ashlsi3_21-ashlsi3_table
+	.byte		ashlsi3_22-ashlsi3_table
+	.byte		ashlsi3_23-ashlsi3_table
+	.byte		ashlsi3_24-ashlsi3_table
+	.byte		ashlsi3_25-ashlsi3_table
+	.byte		ashlsi3_26-ashlsi3_table
+	.byte		ashlsi3_27-ashlsi3_table
+	.byte		ashlsi3_28-ashlsi3_table
+	.byte		ashlsi3_29-ashlsi3_table
+	.byte		ashlsi3_30-ashlsi3_table
+	.byte		ashlsi3_31-ashlsi3_table
+
+ashlsi3_6:
+	shll2	r0
+ashlsi3_4:
+	shll2	r0
+ashlsi3_2:
+	rts
+	shll2	r0
+
+ashlsi3_7:
+	shll2	r0
+ashlsi3_5:
+	shll2	r0
+ashlsi3_3:
+	shll2	r0
+ashlsi3_1:
+	rts
+	shll	r0
+
+ashlsi3_14:
+	shll2	r0
+ashlsi3_12:
+	shll2	r0
+ashlsi3_10:
+	shll2	r0
+ashlsi3_8:
+	rts
+	shll8	r0
+
+ashlsi3_15:
+	shll2	r0
+ashlsi3_13:
+	shll2	r0
+ashlsi3_11:
+	shll2	r0
+ashlsi3_9:
+	shll8	r0
+	rts
+	shll	r0
+
+ashlsi3_22:
+	shll2	r0
+ashlsi3_20:
+	shll2	r0
+ashlsi3_18:
+	shll2	r0
+ashlsi3_16:
+	rts
+	shll16	r0
+
+ashlsi3_23:
+	shll2	r0
+ashlsi3_21:
+	shll2	r0
+ashlsi3_19:
+	shll2	r0
+ashlsi3_17:
+	shll16	r0
+	rts
+	shll	r0
+
+ashlsi3_30:
+	shll2	r0
+ashlsi3_28:
+	shll2	r0
+ashlsi3_26:
+	shll2	r0
+ashlsi3_24:
+	shll16	r0
+	rts
+	shll8	r0
+
+ashlsi3_31:
+	shll2	r0
+ashlsi3_29:
+	shll2	r0
+ashlsi3_27:
+	shll2	r0
+ashlsi3_25:
+	shll16	r0
+	shll8	r0
+	rts
+	shll	r0
+
+ashlsi3_0:
+	rts
+	nop
diff --git a/carl9170fw/carlfw/src/cam.c b/carl9170fw/carlfw/src/cam.c
new file mode 100644
index 0000000..7c0e61c
--- /dev/null
+++ b/carl9170fw/carlfw/src/cam.c
@@ -0,0 +1,161 @@
+/*
+ * carl9170 firmware - used by the ar9170 wireless device
+ *
+ * Security Engine
+ *
+ * Copyright (c) 2000-2005 ZyDAS Technology Corporation
+ * Copyright (c) 2007-2009 Atheros Communications, Inc.
+ * Copyright	2009	Johannes Berg <johannes@sipsolutions.net>
+ * Copyright 2009-2011	Christian Lamparter <chunkeey@googlemail.com>
+ *
+ * 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; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include "carl9170.h"
+#include "cam.h"
+
+#ifdef CONFIG_CARL9170FW_SECURITY_ENGINE
+static void disable_cam_user(const uint16_t userId)
+{
+	if (userId <= 31)
+		andl(AR9170_MAC_REG_CAM_ROLL_CALL_TBL_L, (~((uint32_t) 1 << userId)));
+	else if (userId <= 63)
+		andl(AR9170_MAC_REG_CAM_ROLL_CALL_TBL_H, (~((uint32_t) 1 << (userId - 32))));
+}
+
+static void enable_cam_user(const uint16_t userId)
+{
+	if (userId <= 31)
+		orl(AR9170_MAC_REG_CAM_ROLL_CALL_TBL_L, (((uint32_t) 1) << userId));
+	else if (userId <= 63)
+		orl(AR9170_MAC_REG_CAM_ROLL_CALL_TBL_H, (((uint32_t) 1) << (userId - 32)));
+}
+
+static void wait_for_cam_read_ready(void)
+{
+	while ((get(AR9170_MAC_REG_CAM_STATE) & AR9170_MAC_CAM_STATE_READ_PENDING) == 0) {
+		/*
+		 * wait
+		 */
+	}
+}
+
+static void wait_for_cam_write_ready(void)
+{
+	while ((get(AR9170_MAC_REG_CAM_STATE) & AR9170_MAC_CAM_STATE_WRITE_PENDING) == 0) {
+		/*
+		 * wait some more
+		 */
+	}
+}
+
+static void HW_CAM_Avail(void)
+{
+	uint32_t tmpValue;
+
+	do {
+		tmpValue = get(AR9170_MAC_REG_CAM_MODE);
+	} while (tmpValue & AR9170_MAC_CAM_HOST_PENDING);
+}
+
+static void HW_CAM_Write128(const uint32_t address, const uint32_t *data)
+{
+	HW_CAM_Avail();
+
+	set(AR9170_MAC_REG_CAM_DATA0, data[0]);
+	set(AR9170_MAC_REG_CAM_DATA1, data[1]);
+	set(AR9170_MAC_REG_CAM_DATA2, data[2]);
+	set(AR9170_MAC_REG_CAM_DATA3, data[3]);
+
+	set(AR9170_MAC_REG_CAM_ADDR, address | AR9170_MAC_CAM_ADDR_WRITE);
+
+	wait_for_cam_write_ready();
+}
+
+static void HW_CAM_Read128(const uint32_t address, uint32_t *data)
+{
+
+	HW_CAM_Avail();
+	set(AR9170_MAC_REG_CAM_ADDR, address);
+
+	wait_for_cam_read_ready();
+	HW_CAM_Avail();
+	data[0] = get(AR9170_MAC_REG_CAM_DATA0);
+	data[1] = get(AR9170_MAC_REG_CAM_DATA1);
+	data[2] = get(AR9170_MAC_REG_CAM_DATA2);
+	data[3] = get(AR9170_MAC_REG_CAM_DATA3);
+}
+
+void set_key(const struct carl9170_set_key_cmd *key)
+{
+	uint32_t data[4];
+	uint16_t row, wordId, nibbleId, i;
+
+	if (key->user > (AR9170_CAM_MAX_USER + 3))
+		return ;
+
+	if (key->keyId > 1)
+		return ;
+
+	/* Disable Key */
+	disable_cam_user(key->user);
+
+	/* Set encrypt type */
+	if (key->user >= AR9170_CAM_MAX_USER) {
+		/* default */
+		row = DEFAULT_ENCRY_TYPE;
+		wordId = 0;
+		nibbleId = (key->user - AR9170_CAM_MAX_USER) & 0x7;
+	} else {
+		row = ENCRY_TYPE_START_ADDR + (key->user >> 5);
+		wordId = (key->user >> 3) & 0x3;
+		nibbleId = key->user & 0x7;
+	}
+
+	HW_CAM_Read128(row, data);
+	data[wordId] &= (~(0xf << ((uint32_t) nibbleId * 4)));
+	data[wordId] |= (key->type << ((uint32_t) nibbleId * 4));
+	HW_CAM_Write128(row, data);
+
+	/* Set MAC address */
+	if (key->user < AR9170_CAM_MAX_USER) {
+		uint16_t byteId;
+		wordId = (key->user >> 2) & 0x3;
+		byteId = key->user & 0x3;
+		row = (key->user >> 4) * 6;
+
+		for (i = 0; i < 6; i++) {
+			HW_CAM_Read128(row + i, data);
+			data[wordId] &= (~(0xff << ((uint32_t) byteId * 8)));
+			data[wordId] |= (key->macAddr[i] << ((uint32_t) byteId * 8));
+			HW_CAM_Write128(row + i, data);
+		}
+	}
+
+	/* Set key */
+	row = KEY_START_ADDR + (key->user * 2) + key->keyId;
+
+	HW_CAM_Write128(row, key->key);
+
+	/* Enable Key */
+	enable_cam_user(key->user);
+}
+
+void disable_key(const struct carl9170_disable_key_cmd *key)
+{
+	disable_cam_user(key->user);
+}
+
+#endif /* CONFIG_CARL9170FW_SECURITY_ENGINE */
diff --git a/carl9170fw/carlfw/src/cmd.c b/carl9170fw/carlfw/src/cmd.c
new file mode 100644
index 0000000..5382083
--- /dev/null
+++ b/carl9170fw/carlfw/src/cmd.c
@@ -0,0 +1,154 @@
+/*
+ * carl9170 firmware - used by the ar9170 wireless device
+ *
+ * Code to handle commands from the host driver.
+ *
+ * Copyright (c) 2000-2005 ZyDAS Technology Corporation
+ * Copyright (c) 2007-2009 Atheros Communications, Inc.
+ * Copyright	2009	Johannes Berg <johannes@sipsolutions.net>
+ * Copyright 2009-2011	Christian Lamparter <chunkeey@googlemail.com>
+ *
+ * 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; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include "carl9170.h"
+#include "io.h"
+#include "cam.h"
+#include "rf.h"
+#include "printf.h"
+#include "timer.h"
+#include "wl.h"
+#include "wol.h"
+
+void handle_cmd(struct carl9170_rsp *resp)
+{
+	struct carl9170_cmd *cmd = &dma_mem.reserved.cmd.cmd;
+	unsigned int i;
+
+	/* copies cmd, len and extra fields */
+	resp->hdr.len = cmd->hdr.len;
+	resp->hdr.cmd = cmd->hdr.cmd;
+	resp->hdr.ext = cmd->hdr.ext;
+	resp->hdr.seq |= cmd->hdr.seq;
+
+	switch (cmd->hdr.cmd & ~CARL9170_CMD_ASYNC_FLAG) {
+	case CARL9170_CMD_RREG:
+		for (i = 0; i < (cmd->hdr.len / 4); i++)
+			resp->rreg_res.vals[i] = get(cmd->rreg.regs[i]);
+		break;
+
+	case CARL9170_CMD_WREG:
+		resp->hdr.len = 0;
+		for (i = 0; i < (cmd->hdr.len / 8); i++)
+			set(cmd->wreg.regs[i].addr, cmd->wreg.regs[i].val);
+		break;
+
+	case CARL9170_CMD_ECHO:
+		memcpy(resp->echo.vals, cmd->echo.vals, cmd->hdr.len);
+		break;
+
+	case CARL9170_CMD_SWRST:
+#ifdef CONFIG_CARL9170FW_FW_MAC_RESET
+		/*
+		 * Command has no payload, so the response
+		 * has no payload either.
+		 * resp->hdr.len = 0;
+		 */
+		fw.wlan.mac_reset = CARL9170_MAC_RESET_FORCE;
+#endif /* CONFIG_CARL9170FW_FW_MAC_RESET */
+		break;
+
+	case CARL9170_CMD_REBOOT:
+		/*
+		 * resp->len = 0;
+		 */
+		fw.reboot = 1;
+		break;
+
+	case CARL9170_CMD_READ_TSF:
+		resp->hdr.len = 8;
+		read_tsf((uint32_t *)resp->tsf.tsf);
+		break;
+
+	case CARL9170_CMD_RX_FILTER:
+		resp->hdr.len = 0;
+		fw.wlan.rx_filter = cmd->rx_filter.rx_filter;
+		break;
+
+	case CARL9170_CMD_WOL:
+		wol_cmd(&cmd->wol);
+		break;
+
+	case CARL9170_CMD_TALLY:
+		resp->hdr.len = sizeof(struct carl9170_tally_rsp);
+		memcpy(&resp->tally, &fw.tally, sizeof(struct carl9170_tally_rsp));
+		resp->tally.tick = fw.ticks_per_usec;
+		memset(&fw.tally, 0, sizeof(struct carl9170_tally_rsp));
+		break;
+
+#ifdef CONFIG_CARL9170FW_CAB_QUEUE
+	case CARL9170_CMD_BCN_CTRL:
+		resp->hdr.len = 0;
+
+		if (cmd->bcn_ctrl.mode & CARL9170_BCN_CTRL_CAB_TRIGGER) {
+			wlan_modify_beacon(cmd->bcn_ctrl.vif_id,
+				cmd->bcn_ctrl.bcn_addr, cmd->bcn_ctrl.bcn_len);
+			set(AR9170_MAC_REG_BCN_ADDR, cmd->bcn_ctrl.bcn_addr);
+			set(AR9170_MAC_REG_BCN_LENGTH, cmd->bcn_ctrl.bcn_len);
+			set(AR9170_MAC_REG_BCN_CTRL, AR9170_BCN_CTRL_READY);
+		} else {
+			wlan_cab_flush_queue(cmd->bcn_ctrl.vif_id);
+			fw.wlan.cab_flush_trigger[cmd->bcn_ctrl.vif_id] = CARL9170_CAB_TRIGGER_EMPTY;
+		}
+		break;
+#endif /* CONFIG_CARL9170FW_CAB_QUEUE */
+
+#ifdef CONFIG_CARL9170FW_SECURITY_ENGINE
+	case CARL9170_CMD_EKEY:
+		resp->hdr.len = 0;
+		set_key(&cmd->setkey);
+		break;
+
+	case CARL9170_CMD_DKEY:
+		resp->hdr.len = 0;
+		disable_key(&cmd->disablekey);
+		break;
+#endif /* CONFIG_CARL9170FW_SECURITY_ENGINE */
+
+#ifdef CONFIG_CARL9170FW_RADIO_FUNCTIONS
+	case CARL9170_CMD_FREQUENCY:
+	case CARL9170_CMD_RF_INIT:
+		rf_cmd(cmd, resp);
+		break;
+
+	case CARL9170_CMD_FREQ_START:
+		/*
+		 * resp->hdr.len = 0;
+		 */
+		rf_notify_set_channel();
+		break;
+
+	case CARL9170_CMD_PSM:
+		resp->hdr.len = 0;
+		fw.phy.psm.state = le32_to_cpu(cmd->psm.state);
+		rf_psm();
+		break;
+#endif /* CONFIG_CARL9170FW_RADIO_FUNCTIONS */
+
+	default:
+		BUG("Unknown command %x\n", cmd->hdr.cmd);
+		break;
+	}
+}
diff --git a/carl9170fw/carlfw/src/dma.c b/carl9170fw/carlfw/src/dma.c
new file mode 100644
index 0000000..9b83fcf
--- /dev/null
+++ b/carl9170fw/carlfw/src/dma.c
@@ -0,0 +1,255 @@
+/*
+ * carl9170 firmware - used by the ar9170 wireless device
+ *
+ * DMA descriptor handling functions
+ *
+ * Copyright (c) 2000-2005 ZyDAS Technology Corporation
+ * Copyright (c) 2007-2009 Atheros Communications, Inc.
+ * Copyright	2009	Johannes Berg <johannes@sipsolutions.net>
+ * Copyright 2009-2011	Christian Lamparter <chunkeey@googlemail.com>
+ *
+ * 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; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include "carl9170.h"
+#include "wl.h"
+#include "printf.h"
+
+struct ar9170_dma_memory dma_mem __section(sram);
+
+static void copy_dma_desc(struct dma_desc *dst,
+			  struct dma_desc *src)
+{
+	memcpy(dst, src, sizeof(struct dma_desc));
+}
+
+static void clear_descriptor(struct dma_desc *d)
+{
+	d->status = AR9170_OWN_BITS_SW;
+	d->ctrl = 0;
+	d->dataSize = 0;
+	d->totalLen = 0;
+	d->lastAddr = d;
+	d->dataAddr = NULL;
+	d->nextAddr = d;
+}
+
+static void fill_descriptor(struct dma_desc *d, uint16_t size, uint8_t *data)
+{
+	d->status = AR9170_OWN_BITS_SW;
+	d->ctrl = 0;
+	d->dataSize = size;
+	d->totalLen = 0;
+	d->lastAddr = d;
+	d->dataAddr = data;
+	d->nextAddr = NULL;
+}
+
+static void init_queue(struct dma_queue *q, struct dma_desc *d)
+{
+	q->head = q->terminator = d;
+}
+
+/*
+ *  - Init up_queue, down_queue, tx_queue[5], rx_queue.
+ *  - Setup descriptors and data buffer address.
+ *  - Ring descriptors rx_queue and down_queue by dma_reclaim().
+ *
+ * NOTE: LastAddr tempary point (same) to nextAddr after initialize.
+ *	 Because LastAddr is don't care in function dma_reclaim().
+ */
+void dma_init_descriptors(void)
+{
+	unsigned int i, j;
+
+	for (i = 0; i < ARRAY_SIZE(dma_mem.terminator); i++)
+		clear_descriptor(&dma_mem.terminator[i]);
+
+	/* Assign terminators to DMA queues */
+	i = 0;
+	init_queue(&fw.pta.up_queue, &dma_mem.terminator[i++]);
+	init_queue(&fw.pta.down_queue, &dma_mem.terminator[i++]);
+	for (j = 0; j < __AR9170_NUM_TX_QUEUES; j++)
+		init_queue(&fw.wlan.tx_queue[j], &dma_mem.terminator[i++]);
+	init_queue(&fw.wlan.tx_retry, &dma_mem.terminator[i++]);
+	init_queue(&fw.wlan.rx_queue, &dma_mem.terminator[i++]);
+	fw.usb.int_desc = &dma_mem.terminator[i++];
+	fw.wlan.fw_desc = &dma_mem.terminator[i++];
+
+#ifdef CONFIG_CARL9170FW_CAB_QUEUE
+	for (j = 0; j < CARL9170_INTF_NUM; j++)
+		init_queue(&fw.wlan.cab_queue[j], &dma_mem.terminator[i++]);
+#endif /* CONFIG_CARL9170FW_CAB_QUEUE */
+
+	BUG_ON(AR9170_TERMINATOR_NUMBER != i);
+
+	DBG("Blocks:%d [tx:%d, rx:%d] Terminators:%d/%d\n",
+	    AR9170_BLOCK_NUMBER, AR9170_TX_BLOCK_NUMBER,
+	    AR9170_RX_BLOCK_NUMBER, AR9170_TERMINATOR_NUMBER, i);
+
+	/* Init descriptors and memory blocks */
+	for (i = 0; i < AR9170_BLOCK_NUMBER; i++) {
+		fill_descriptor(&dma_mem.block[i], AR9170_BLOCK_SIZE, dma_mem.data[i].data);
+
+		if (i < AR9170_TX_BLOCK_NUMBER)
+			dma_reclaim(&fw.pta.down_queue, &dma_mem.block[i]);
+		else
+			dma_reclaim(&fw.wlan.rx_queue, &dma_mem.block[i]);
+	}
+
+	/* Set DMA address registers */
+	set(AR9170_PTA_REG_DN_DMA_ADDRH, (uint32_t) fw.pta.down_queue.head >> 16);
+	set(AR9170_PTA_REG_DN_DMA_ADDRL, (uint32_t) fw.pta.down_queue.head & 0xffff);
+	set(AR9170_PTA_REG_UP_DMA_ADDRH, (uint32_t) fw.pta.up_queue.head >> 16);
+	set(AR9170_PTA_REG_UP_DMA_ADDRL, (uint32_t) fw.pta.up_queue.head & 0xffff);
+
+	for (i = 0; i < __AR9170_NUM_TX_QUEUES; i++)
+		set_wlan_txq_dma_addr(i, (uint32_t) fw.wlan.tx_queue[i].head);
+
+	set(AR9170_MAC_REG_DMA_RXQ_ADDR, (uint32_t) fw.wlan.rx_queue.head);
+	fw.usb.int_desc->dataSize = AR9170_BLOCK_SIZE;
+	fw.usb.int_desc->dataAddr = (void *) &dma_mem.reserved.rsp;
+
+	memset(DESC_PAYLOAD(fw.usb.int_desc), 0xff,
+	       AR9170_INT_MAGIC_HEADER_SIZE);
+	memset(DESC_PAYLOAD_OFF(fw.usb.int_desc, AR9170_INT_MAGIC_HEADER_SIZE),
+	       0, AR9170_BLOCK_SIZE - AR9170_INT_MAGIC_HEADER_SIZE);
+
+	/* rsp is now available for use */
+	fw.usb.int_desc_available = 1;
+
+	memset(DESC_PAYLOAD(fw.wlan.fw_desc), 0, 128);
+	fw.wlan.fw_desc_available = 1;
+}
+
+/*
+ * Free descriptor.
+ *
+ * Exchange the terminator and the first descriptor of the packet
+ * for hardware ascy...
+ */
+void dma_reclaim(struct dma_queue *q, struct dma_desc *desc)
+{
+	struct dma_desc *tmpDesc, *last;
+	struct dma_desc tdesc;
+
+	/* 1. Set OWN bit to HW for all TDs to be added, clear ctrl and size */
+	tmpDesc = desc;
+	last = desc->lastAddr;
+
+	while (1) {
+		tmpDesc->status = AR9170_OWN_BITS_HW;
+		tmpDesc->ctrl = 0;
+		tmpDesc->totalLen = 0;
+		tmpDesc->dataSize = AR9170_BLOCK_SIZE;
+
+		/* TODO : Exception handle */
+
+		tmpDesc->lastAddr = tmpDesc;
+
+		if (tmpDesc == last)
+			break;
+
+		tmpDesc = tmpDesc->nextAddr;
+	}
+
+	/* 2. Next address of Last TD to be added = first TD */
+	tmpDesc->nextAddr = desc;
+
+	/* Link first TD to self */
+	desc->lastAddr = q->terminator;
+
+	/* 3. Copy first TD to be added to TTD */
+	copy_dma_desc(&tdesc, desc);
+
+	/* 4. Initialize new terminator */
+	clear_descriptor(desc);
+
+	/* 5. Copy TTD to last TD */
+	tdesc.status = 0;
+	copy_dma_desc((void *)q->terminator, (void *)&tdesc);
+	q->terminator->status |= AR9170_OWN_BITS_HW;
+
+	/* Update terminator pointer */
+	q->terminator = desc;
+}
+
+/*
+ * Put a complete packet into the tail of the Queue q.
+ * Exchange the terminator and the first descriptor of the packet
+ * for hardware ascy...
+ */
+void dma_put(struct dma_queue *q, struct dma_desc *desc)
+{
+	struct dma_desc *tmpDesc;
+	struct dma_desc tdesc;
+
+	tmpDesc = desc;
+
+	while (1) {
+		/* update totalLen */
+		tmpDesc->totalLen = desc->totalLen;
+
+		/* 1. Set OWN bit to HW for all TDs to be added */
+		tmpDesc->status = AR9170_OWN_BITS_HW;
+		/* TODO : Exception handle */
+
+		tmpDesc->lastAddr = desc->lastAddr;
+
+		if (desc->lastAddr == tmpDesc)
+			break;
+
+		tmpDesc = tmpDesc->nextAddr;
+	}
+
+	/* 2. Next address of Last TD to be added = first TD */
+	desc->lastAddr->nextAddr = desc;
+
+	/* If there is only one descriptor, update pointer of last descriptor */
+	if (desc->lastAddr == desc)
+		desc->lastAddr = q->terminator;
+
+	/* 3. Copy first TD to be added to TTD */
+	copy_dma_desc(&tdesc, desc);
+
+	/* 4. Initialize new terminator */
+	clear_descriptor(desc);
+
+	/* 5. Copy TTD to last TD */
+	tdesc.status &= (~AR9170_OWN_BITS);
+	copy_dma_desc((void *)q->terminator, (void *)&tdesc);
+	q->terminator->status |= AR9170_OWN_BITS_HW;
+
+	/* Update terminator pointer */
+	q->terminator = desc;
+}
+
+struct dma_desc *dma_unlink_head(struct dma_queue *queue)
+{
+	struct dma_desc *desc;
+
+	if (queue_empty(queue))
+		return NULL;
+
+	desc = queue->head;
+
+	queue->head = desc->lastAddr->nextAddr;
+
+	/* poison nextAddr address */
+	desc->lastAddr->nextAddr = desc->lastAddr;
+	desc->lastAddr->lastAddr = desc->lastAddr;
+
+	return desc;
+}
diff --git a/carl9170fw/carlfw/src/fw.c b/carl9170fw/carlfw/src/fw.c
new file mode 100644
index 0000000..5bde675
--- /dev/null
+++ b/carl9170fw/carlfw/src/fw.c
@@ -0,0 +1,116 @@
+/*
+ * carl9170 firmware - used by the ar9170 wireless device
+ *
+ * Firmware descriptor
+ *
+ * Copyright 2009-2011 Christian Lamparter <chunkeey@googlemail.com>
+ *
+ * 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; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+#include "carl9170.h"
+#include "fwdsc.h"
+
+#define FILL(small, big, more...)					\
+	.small = {							\
+		CARL9170FW_FILL_DESC(big##_MAGIC,			\
+			sizeof(struct carl9170fw_## small##_desc),	\
+			CARL9170FW_## big##_DESC_MIN_VER,		\
+			CARL9170FW_## big##_DESC_CUR_VER),		\
+		more							\
+	}
+
+const struct carl9170_firmware_descriptor __section(fwdsc) carl9170fw_desc = {
+	FILL(otus, OTUS,
+	     .feature_set = cpu_to_le32(BIT(CARL9170FW_DUMMY_FEATURE) |
+					BIT(CARL9170FW_USB_RESP_EP2) |
+					BIT(CARL9170FW_HANDLE_BACK_REQ) |
+					BIT(CARL9170FW_RX_FILTER) |
+					BIT(CARL9170FW_HW_COUNTERS) |
+					BIT(CARL9170FW_RX_BA_FILTER) |
+					BIT(CARL9170FW_USB_INIT_FIRMWARE) |
+#ifdef CONFIG_CARL9170FW_USB_UP_STREAM
+					BIT(CARL9170FW_USB_UP_STREAM) |
+#endif /* CONFIG_CARL9170FW_USB_UP_STREAM */
+#ifdef CONFIG_CARL9170FW_USB_DOWN_STREAM
+					BIT(CARL9170FW_USB_DOWN_STREAM) |
+#endif /* CONFIG_CARL9170FW_USB_DOWN_STREAM */
+#ifdef CONFIG_CARL9170FW_RADIO_FUNCTIONS
+					BIT(CARL9170FW_COMMAND_PHY) |
+					BIT(CARL9170FW_PSM) |
+					BIT(CARL9170FW_FIXED_5GHZ_PSM) |
+#endif /* CONFIG_CARL9170FW_RADIO_FUNCTIONS */
+#ifdef CONFIG_CARL9170FW_SECURITY_ENGINE
+					BIT(CARL9170FW_COMMAND_CAM) |
+#endif /* CONFIG_CARL9170FW_SECURITY_ENGINE */
+#ifdef CONFIG_CARL9170FW_CAB_QUEUE
+					BIT(CARL9170FW_WLANTX_CAB) |
+#endif /* CONFIG_CARL9170FW_CAB_QUEUE */
+#ifdef CONFIG_CARL9170FW_UNUSABLE
+					BIT(CARL9170FW_UNUSABLE) |
+#endif /* CONFIG_CARL9170FW_UNUSABLE */
+#ifdef CONFIG_CARL9170FW_GPIO_INTERRUPT
+					BIT(CARL9170FW_GPIO_INTERRUPT) |
+#endif /* CONFIG_CARL9170FW_GPIO_INTERRUPT */
+#ifdef CONFIG_CARL9170FW_WOL
+					BIT(CARL9170FW_WOL) |
+#endif /* CONFIG_CARL9170FW_WOL */
+					(0)),
+
+	     .miniboot_size = cpu_to_le16(0),
+	     .tx_descs = AR9170_TX_BLOCK_NUMBER,
+	     .cmd_bufs = CARL9170_INT_RQ_CACHES,
+	     .rx_max_frame_len = cpu_to_le16(CONFIG_CARL9170FW_RX_FRAME_LEN),
+	     .tx_frag_len = cpu_to_le16(AR9170_BLOCK_SIZE),
+	     .fw_address = cpu_to_le32(AR9170_PRAM_OFFSET),
+	     .bcn_addr = (__le32) cpu_to_le32(&dma_mem.reserved.bcn),
+	     .bcn_len = (__le16) cpu_to_le16(sizeof(dma_mem.reserved.bcn)),
+	     .vif_num = CARL9170_INTF_NUM,
+	     .api_ver = CONFIG_CARL9170FW_RELEASE_VERSION,
+	),
+
+	FILL(txsq, TXSQ,
+	     .seq_table_addr = cpu_to_le32(&fw.wlan.sequence),
+	),
+
+#ifdef CONFIG_CARL9170FW_WOL
+	FILL(wol, WOL,
+	     .supported_triggers = BIT(CARL9170_WOL_DISCONNECT) |
+				   BIT(CARL9170_WOL_MAGIC_PKT),
+	),
+#endif /* CONFIG_CARL9170FW_WOL */
+
+
+	FILL(motd, MOTD,
+	     .fw_year_month_day = cpu_to_le32(
+			CARL9170FW_SET_DAY(CARL9170FW_VERSION_DAY) +
+			CARL9170FW_SET_MONTH(CARL9170FW_VERSION_MONTH) +
+			CARL9170FW_SET_YEAR(CARL9170FW_VERSION_YEAR)),
+	     .desc = "Community AR9170 Linux",
+	     .release = CARL9170FW_VERSION_GIT),
+
+	FILL(dbg, DBG,
+	     .bogoclock_addr = cpu_to_le32(0),
+	     .counter_addr = cpu_to_le32(&fw.counter),
+	     .rx_total_addr = cpu_to_le32(0),
+	     .rx_overrun_addr = cpu_to_le32(0),
+	     .rx_filter = cpu_to_le32(&fw.wlan.rx_filter),
+	),
+
+	FILL(last, LAST),
+};
+
+#undef FILL
+
+struct firmware_context_struct fw;
diff --git a/carl9170fw/carlfw/src/gpio.c b/carl9170fw/carlfw/src/gpio.c
new file mode 100644
index 0000000..85cd81f
--- /dev/null
+++ b/carl9170fw/carlfw/src/gpio.c
@@ -0,0 +1,52 @@
+/*
+ * carl9170 firmware - used by the ar9170 wireless device
+ *
+ * GPIO interrupt service
+ *
+ * Copyright (c) 2000-2005 ZyDAS Technology Corporation
+ * Copyright (c) 2007-2009 Atheros Communications, Inc.
+ * Copyright	2009	Johannes Berg <johannes@sipsolutions.net>
+ * Copyright 2009-2011	Christian Lamparter <chunkeey@googlemail.com>
+ *
+ * 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; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include "carl9170.h"
+#include "gpio.h"
+
+#ifdef CONFIG_CARL9170FW_GPIO_INTERRUPT
+void gpio_timer(void)
+{
+	uint32_t cur;
+
+	cur = get(AR9170_GPIO_REG_PORT_DATA) & CARL9170_GPIO_MASK;
+
+	if (cur != fw.cached_gpio_state.gpio) {
+		fw.cached_gpio_state.gpio = cur;
+
+		send_cmd_to_host(sizeof(struct carl9170_gpio),
+				 CARL9170_RSP_GPIO, 0x00,
+				 (uint8_t *)&fw.cached_gpio_state);
+
+# ifdef CONFIG_CARL9170FW_WATCHDOG_BUTTON
+		for (;;) {
+			/*
+			 * Loop forever... Until the watchdog triggers.
+			 */
+		}
+# endif /* CONFIG_CARL9170FW_WATCHDOG_BUTTON */
+	}
+}
+#endif /* CONFIG_CARL9170FW_GPIO_INTERRUPT */
diff --git a/carl9170fw/carlfw/src/hostif.c b/carl9170fw/carlfw/src/hostif.c
new file mode 100644
index 0000000..e445d5f
--- /dev/null
+++ b/carl9170fw/carlfw/src/hostif.c
@@ -0,0 +1,165 @@
+/*
+ * carl9170 firmware - used by the ar9170 wireless device
+ *
+ * Host interface routines
+ *
+ * Copyright (c) 2000-2005 ZyDAS Technology Corporation
+ * Copyright (c) 2007-2009 Atheros Communications, Inc.
+ * Copyright	2009	Johannes Berg <johannes@sipsolutions.net>
+ * Copyright 2009-2011	Christian Lamparter <chunkeey@googlemail.com>
+ *
+ * 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; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include "carl9170.h"
+#include "hostif.h"
+#include "printf.h"
+#include "wl.h"
+
+static bool length_check(struct dma_desc *desc)
+{
+	volatile struct carl9170_tx_superframe *super = __get_super(desc);
+
+	if (unlikely(desc->totalLen < sizeof(struct carl9170_tx_superdesc)))
+		return false;
+
+	/*
+	 * check if the DMA is complete, or clipped.
+	 *
+	 * NB: The hardware aligns the descriptor length to
+	 * a 4 byte boundary. This makes the direct comparison
+	 * difficult, or unnecessary complex for a hot-path.
+	 */
+	if (unlikely(super->s.len > desc->totalLen))
+		return false;
+
+	return true;
+}
+
+static void handle_download(void)
+{
+	struct dma_desc *desc;
+
+	/*
+	 * Under normal conditions, all completed descs should have
+	 * the AR9170_OWN_BITS_SE status flag set.
+	 * However there seems to be a undocumented case where the flag
+	 * is _SW ( handle_download_exception )
+	 */
+
+	for_each_desc_not_bits(desc, &fw.pta.down_queue, AR9170_OWN_BITS_HW) {
+		if (unlikely((length_check(desc) == false))) {
+			/*
+			 * There is no easy way of telling what was lost.
+			 *
+			 * Therefore we just reclaim the data.
+			 * The driver has to have some sort frame
+			 * timeout mechanism.
+			 */
+
+			wlan_tx_complete(__get_super(desc), false);
+			dma_reclaim(&fw.pta.down_queue, desc);
+			down_trigger();
+		} else {
+			wlan_tx(desc);
+		}
+	}
+
+#ifdef CONFIG_CARL9170FW_DEBUG_LED_HEARTBEAT
+	xorl(AR9170_GPIO_REG_PORT_DATA, 2);
+#endif /* CONFIG_CARL9170FW_DEBUG_LED_HEARTBEAT */
+}
+
+static void handle_upload(void)
+{
+	struct dma_desc *desc;
+
+	for_each_desc_not_bits(desc, &fw.pta.up_queue, AR9170_OWN_BITS_HW) {
+		/*
+		 * BIG FAT NOTE:
+		 *
+		 * DO NOT compare the descriptor addresses.
+		 */
+		if (DESC_PAYLOAD(desc) == (void *) &dma_mem.reserved.rsp) {
+			fw.usb.int_desc = desc;
+			fw.usb.int_desc_available = 1;
+		} else {
+			dma_reclaim(&fw.wlan.rx_queue, desc);
+			wlan_trigger(AR9170_DMA_TRIGGER_RXQ);
+		}
+	}
+
+#ifdef CONFIG_CARL9170FW_DEBUG_LED_HEARTBEAT
+	xorl(AR9170_GPIO_REG_PORT_DATA, 2);
+#endif /* CONFIG_CARL9170FW_DEBUG_LED_HEARTBEAT */
+}
+
+static void handle_download_exception(void)
+{
+	struct dma_desc *desc, *target;
+
+	/* actually, the queue should be stopped by now? */
+	usb_stop_down_queue();
+
+	target = (void *)((get(AR9170_PTA_REG_DN_CURR_ADDRH) << 16) |
+		  get(AR9170_PTA_REG_DN_CURR_ADDRL));
+
+	/*
+	 * Put "forgotten" packets from the head of the queue, back
+	 * to the current position
+	 */
+	__while_desc_bits(desc, &fw.pta.down_queue, AR9170_OWN_BITS_HW) {
+		if (desc == target)
+			break;
+
+		dma_reclaim(&fw.pta.down_queue,
+		    dma_unlink_head(&fw.pta.down_queue));
+	}
+
+	__for_each_desc_continue(desc, &fw.pta.down_queue) {
+		if ((desc->status & AR9170_OWN_BITS) == AR9170_OWN_BITS_SW)
+			dma_fix_downqueue(desc);
+	}
+
+
+	usb_start_down_queue();
+
+	down_trigger();
+}
+
+/* handle interrupts from DMA chip */
+void handle_host_interface(void)
+{
+	uint32_t pta_int;
+
+	pta_int = get(AR9170_PTA_REG_INT_FLAG);
+
+#define HANDLER(intr, flag, func)			\
+	do {						\
+		if ((intr & flag) != 0) {		\
+			func();				\
+		}					\
+	} while (0)
+
+	HANDLER(pta_int, AR9170_PTA_INT_FLAG_DN, handle_download);
+
+	HANDLER(pta_int, AR9170_PTA_INT_FLAG_UP, handle_upload);
+
+	/* This is just guesswork and MAGIC */
+	pta_int = get(AR9170_PTA_REG_DMA_STATUS);
+	HANDLER(pta_int, 0x1, handle_download_exception);
+
+#undef HANDLER
+}
diff --git a/carl9170fw/carlfw/src/main.c b/carl9170fw/carlfw/src/main.c
new file mode 100644
index 0000000..17cbaf9
--- /dev/null
+++ b/carl9170fw/carlfw/src/main.c
@@ -0,0 +1,256 @@
+/*
+ * carl9170 firmware - used by the ar9170 wireless device
+ *
+ * initialization and main() loop
+ *
+ * Copyright (c) 2000-2005 ZyDAS Technology Corporation
+ * Copyright (c) 2007-2009 Atheros Communications, Inc.
+ * Copyright	2009	Johannes Berg <johannes@sipsolutions.net>
+ * Copyright 2009-2011	Christian Lamparter <chunkeey@googlemail.com>
+ *
+ * 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; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include "carl9170.h"
+#include "timer.h"
+#include "hostif.h"
+#include "printf.h"
+#include "gpio.h"
+#include "wl.h"
+#include "rf.h"
+#include "usb.h"
+
+#define AR9170_WATCH_DOG_TIMER		   0x100
+
+static void timer_init(const unsigned int timer, const unsigned int interval)
+{
+	/* Set timer to periodic mode */
+	orl(AR9170_TIMER_REG_CONTROL, BIT(timer));
+
+	/* Set time interval */
+	set(AR9170_TIMER_REG_TIMER0 + (timer << 2), interval - 1);
+
+	/* Clear timer interrupt flag */
+	orl(AR9170_TIMER_REG_INTERRUPT, BIT(timer));
+}
+
+void clock_set(enum cpu_clock_t clock_, bool on)
+{
+	/*
+	 * Word of Warning!
+	 * This setting does more than just mess with the CPU Clock.
+	 * So watch out, if you need _stable_ timer interrupts.
+	 */
+#ifdef CONFIG_CARL9170FW_RADIO_FUNCTIONS
+	if (fw.phy.frequency < 3000000)
+		set(AR9170_PWR_REG_PLL_ADDAC, 0x5163);
+	else
+		set(AR9170_PWR_REG_PLL_ADDAC, 0x5143);
+#else
+	set(AR9170_PWR_REG_PLL_ADDAC, 0x5163);
+#endif /* CONFIG_CARL9170FW_RADIO_FUNCTIONS */
+
+	fw.ticks_per_usec = GET_VAL(AR9170_PWR_PLL_ADDAC_DIV,
+		get(AR9170_PWR_REG_PLL_ADDAC));
+
+	set(AR9170_PWR_REG_CLOCK_SEL, (uint32_t) ((on ? 0x70 : 0x600) | clock_));
+
+	switch (clock_) {
+	case AHB_20_22MHZ:
+		fw.ticks_per_usec >>= 1;
+	case AHB_40MHZ_OSC:
+	case AHB_40_44MHZ:
+		fw.ticks_per_usec >>= 1;
+	case AHB_80_88MHZ:
+		break;
+	}
+}
+
+static void init(void)
+{
+	led_init();
+
+#ifdef CONFIG_CARL9170FW_DEBUG_UART
+	uart_init();
+#endif /* CONFIG_CARL9170FW_DEBUG_UART */
+
+	/* 25/50/100ms timer (depends on cpu clock) */
+	timer_init(0, 50000);
+
+	/* USB init */
+	usb_init();
+
+	/* initialize DMA memory */
+	memset(&dma_mem, 0, sizeof(dma_mem));
+
+	/* fill DMA rings */
+	dma_init_descriptors();
+
+	/* clear all interrupt */
+	set(AR9170_MAC_REG_INT_CTRL, 0xffff);
+
+	orl(AR9170_MAC_REG_AFTER_PNP, 1);
+
+	/* Init watch dog control flag */
+	fw.watchdog_enable = 1;
+
+	set(AR9170_TIMER_REG_WATCH_DOG, AR9170_WATCH_DOG_TIMER);
+
+#ifdef CONFIG_CARL9170FW_GPIO_INTERRUPT
+	fw.cached_gpio_state.gpio = get(AR9170_GPIO_REG_PORT_DATA) &
+				    CARL9170_GPIO_MASK;
+#endif /* CONFIG_CARL9170FW_GPIO_INTERRUPT */
+
+	/* this will get the downqueue moving. */
+	down_trigger();
+}
+
+static void handle_fw(void)
+{
+	if (fw.watchdog_enable == 1)
+		set(AR9170_TIMER_REG_WATCH_DOG, AR9170_WATCH_DOG_TIMER);
+
+	if (fw.reboot)
+		reboot();
+}
+
+static void timer0_isr(void)
+{
+	wlan_timer();
+
+#ifdef CONFIG_CARL9170FW_GPIO_INTERRUPT
+	gpio_timer();
+#endif /* CONFIG_CARL9170FW_GPIO_INTERRUPT */
+
+#ifdef CONFIG_CARL9170FW_DEBUG_LED_HEARTBEAT
+	set(AR9170_GPIO_REG_PORT_DATA, get(AR9170_GPIO_REG_PORT_DATA) ^ 1);
+#endif /* CONFIG_CARL9170FW_DEBUG_LED_HEARTBEAT */
+}
+
+static void handle_timer(void)
+{
+	uint32_t intr;
+
+	intr = get(AR9170_TIMER_REG_INTERRUPT);
+
+	/* ACK timer interrupt */
+	set(AR9170_TIMER_REG_INTERRUPT, intr);
+
+#define HANDLER(intr, flag, func)			\
+	do {						\
+		if ((intr & flag) != 0) {		\
+			intr &= ~flag;			\
+			func();				\
+		}					\
+	} while (0)
+
+	HANDLER(intr, BIT(0), timer0_isr);
+
+	if (intr)
+		DBG("Unhandled Timer Event %x", (unsigned int) intr);
+
+#undef HANDLER
+}
+
+static void tally_update(void)
+{
+	unsigned int boff, time, delta;
+
+	time = get_clock_counter();
+	if (fw.phy.state == CARL9170_PHY_ON) {
+		delta = (time - fw.tally_clock);
+
+		fw.tally.active += delta;
+
+		boff = get(AR9170_MAC_REG_BACKOFF_STATUS);
+		if (boff & AR9170_MAC_BACKOFF_TX_PE)
+			fw.tally.tx_time += delta;
+		if (boff & AR9170_MAC_BACKOFF_CCA)
+			fw.tally.cca += delta;
+	}
+
+	fw.tally_clock = time;
+	fw.counter++;
+}
+
+static void __noreturn main_loop(void)
+{
+	/* main loop */
+	while (1) {
+		handle_fw();
+
+		/*
+		 * Due to frame order persevation, the wlan subroutines
+		 * must be executed before handle_host_interface.
+		 */
+		handle_wlan();
+
+		handle_host_interface();
+
+		handle_usb();
+
+		handle_timer();
+
+		tally_update();
+	}
+}
+
+/*
+ * The bootcode will work with the device driver to load the firmware
+ * onto the device's Program SRAM. The Program SRAM has a size of 16 KB
+ * and also contains the stack, which grows down from 0x204000.
+ *
+ * The Program SRAM starts at address 0x200000 on the device.
+ * The firmware entry point (0x200004) is located in boot.S.
+ * we put _start() there with the linker script carl9170.lds.
+ */
+
+void __section(boot) start(void)
+{
+	clock_set(AHB_40MHZ_OSC, true);
+
+	/* watchdog magic pattern check */
+	if ((get(AR9170_PWR_REG_WATCH_DOG_MAGIC) & 0xffff0000) == 0x12340000) {
+		/* watch dog warm start */
+		incl(AR9170_PWR_REG_WATCH_DOG_MAGIC);
+		usb_trigger_out();
+	} else if ((get(AR9170_PWR_REG_WATCH_DOG_MAGIC) & 0xffff0000) == 0x98760000) {
+		/* suspend/resume */
+	}
+
+	/* write the magic pattern for watch dog */
+	andl(AR9170_PWR_REG_WATCH_DOG_MAGIC, 0xFFFF);
+	orl(AR9170_PWR_REG_WATCH_DOG_MAGIC, 0x12340000);
+
+	init();
+
+#ifdef CONFIG_CARL9170FW_DEBUG
+
+	BUG("TEST BUG");
+	BUG_ON(0x2b || !0x2b);
+	INFO("INFO MESSAGE");
+
+	/* a set of unique characters to detect transfer data corruptions */
+	DBG("AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz"
+	    " ~`!1@2#3$4%%5^6&7*8(9)0_-+={[}]|\\:;\"'<,>.?/");
+#endif /* CONFIG_CARL9170FW_DEBUG */
+
+	/*
+	 * Tell the host, that the firmware has booted and is
+	 * now ready to process requests.
+	 */
+	send_cmd_to_host(0, CARL9170_RSP_BOOT, 0x00, NULL);
+	main_loop();
+}
diff --git a/carl9170fw/carlfw/src/memcpy.S b/carl9170fw/carlfw/src/memcpy.S
new file mode 100644
index 0000000..9539a6b
--- /dev/null
+++ b/carl9170fw/carlfw/src/memcpy.S
@@ -0,0 +1,228 @@
+/* $Id: memcpy.S,v 1.3 2001/07/27 11:50:52 gniibe Exp $
+ *
+ * "memcpy" implementation of SuperH
+ *
+ * Copyright (C) 1999  Niibe Yutaka
+ *
+ */
+
+/*
+ * void *memcpy(void *dst, const void *src, size_t n);
+ * No overlap between the memory of DST and of SRC are assumed.
+ */
+
+	.globl _memcpy
+	.align 2
+	_memcpy:
+	tst	r6,r6
+	bt/s	9f		! if n=0, do nothing
+	 mov	r4,r0
+	sub	r4,r5		! From here, r5 has the distance to r0
+	add	r6,r0		! From here, r0 points the end of copying point
+	mov	#12,r1
+	cmp/gt	r6,r1
+	bt/s	7f		! if it's too small, copy a byte at once
+	 add	#-1,r5
+	add	#1,r5
+	!			From here, r6 is free
+	!
+	!      r4   -->  [ ...  ] DST             [ ...  ] SRC
+	!	         [ ...  ]                 [ ...  ]
+	!	           :                        :
+	!      r0   -->  [ ...  ]       r0+r5 --> [ ...  ]
+	!
+	!
+	mov	r5,r1
+	mov	#3,r2
+	and	r2,r1
+	shll2	r1
+	mov	r0,r3		! Save the value on R0 to R3
+	mova	jmptable,r0
+	add	r1,r0
+	mov.l	@r0,r1
+	jmp	@r1
+	 mov	r3,r0		! and back to R0
+	.balign	4
+jmptable:
+	.long	case0
+	.long	case1
+	.long	case2
+	.long	case3
+
+	! copy a byte at once
+7:	mov	r4,r2
+	add	#1,r2
+8:
+	cmp/hi	r2,r0
+	mov.b	@(r0,r5),r1
+	bt/s	8b			! while (r0>r2)
+	 mov.b	r1,@-r0
+9:
+	rts
+	 nop
+
+case0:
+	!
+	!	GHIJ KLMN OPQR -->  GHIJ KLMN OPQR
+	!
+	! First, align to long word boundary
+	mov	r0,r3
+	and	r2,r3
+	tst	r3,r3
+	bt/s	2f
+	 add	#-4,r5
+	add	#3,r5
+1:	dt	r3
+	mov.b	@(r0,r5),r1
+	bf/s	1b
+	 mov.b	r1,@-r0
+	!
+	add	#-3,r5
+2:	! Second, copy a long word at once
+	mov	r4,r2
+	add	#7,r2
+3:	mov.l	@(r0,r5),r1
+	cmp/hi	r2,r0
+	bt/s	3b
+	 mov.l	r1,@-r0
+	!
+	! Third, copy a byte at once, if necessary
+	cmp/eq	r4,r0
+	bt/s	9b
+	 add	#3,r5
+	bra	8b
+	 add	#-6,r2
+
+case1:
+	!
+	!	GHIJ KLMN OPQR -->  ...G HIJK LMNO PQR.
+	!
+	! First, align to long word boundary
+	mov	r0,r3
+	and	r2,r3
+	tst	r3,r3
+	bt/s	2f
+	 add	#-1,r5
+1:	dt	r3
+	mov.b	@(r0,r5),r1
+	bf/s	1b
+	 mov.b	r1,@-r0
+	!
+2:	! Second, read a long word and write a long word at once
+	mov.l	@(r0,r5),r1
+	add	#-4,r5
+	mov	r4,r2
+	add	#7,r2
+	!
+#ifdef __LITTLE_ENDIAN__
+3:	mov	r1,r3		! RQPO
+	shll16	r3
+	shll8	r3		! Oxxx
+	mov.l	@(r0,r5),r1	! NMLK
+	mov	r1,r6
+	shlr8	r6		! xNML
+	or	r6,r3		! ONML
+	cmp/hi	r2,r0
+	bt/s	3b
+	 mov.l	r3,@-r0
+#else
+3:	mov	r1,r3		! OPQR
+	shlr16	r3
+	shlr8	r3		! xxxO
+	mov.l	@(r0,r5),r1	! KLMN
+	mov	r1,r6
+	shll8	r6		! LMNx
+	or	r6,r3		! LMNO
+	cmp/hi	r2,r0
+	bt/s	3b
+	 mov.l	r3,@-r0
+#endif
+	!
+	! Third, copy a byte at once, if necessary
+	cmp/eq	r4,r0
+	bt/s	9b
+	 add	#4,r5
+	bra	8b
+	 add	#-6,r2
+
+case2:
+	!
+	!	GHIJ KLMN OPQR -->  ..GH IJKL MNOP QR..
+	!
+	! First, align to word boundary
+	tst	#1,r0
+	bt/s	2f
+	 add	#-1,r5
+	mov.b	@(r0,r5),r1
+	mov.b	r1,@-r0
+	!
+2:	! Second, read a word and write a word at once
+	add	#-1,r5
+	mov	r4,r2
+	add	#3,r2
+	!
+3:	mov.w	@(r0,r5),r1
+	cmp/hi	r2,r0
+	bt/s	3b
+	 mov.w	r1,@-r0
+	!
+	! Third, copy a byte at once, if necessary
+	cmp/eq	r4,r0
+	bt/s	9b
+	 add	#1,r5
+	mov.b	@(r0,r5),r1
+	rts
+	 mov.b	r1,@-r0
+
+case3:
+	!
+	!	GHIJ KLMN OPQR -->  .GHI JKLM NOPQ R...
+	!
+	! First, align to long word boundary
+	mov	r0,r3
+	and	r2,r3
+	tst	r3,r3
+	bt/s	2f
+	 add	#-1,r5
+1:	dt	r3
+	mov.b	@(r0,r5),r1
+	bf/s	1b
+	 mov.b	r1,@-r0
+	!
+2:	! Second, read a long word and write a long word at once
+	add	#-2,r5
+	mov.l	@(r0,r5),r1
+	add	#-4,r5
+	mov	r4,r2
+	add	#7,r2
+	!
+#ifdef __LITTLE_ENDIAN__
+3:	mov	r1,r3		! RQPO
+	shll8	r3		! QPOx
+	mov.l	@(r0,r5),r1	! NMLK
+	mov	r1,r6
+	shlr16	r6
+	shlr8	r6		! xxxN
+	or	r6,r3		! QPON
+	cmp/hi	r2,r0
+	bt/s	3b
+	 mov.l	r3,@-r0
+#else
+3:	mov	r1,r3		! OPQR
+	shlr8	r3		! xOPQ
+	mov.l	@(r0,r5),r1	! KLMN
+	mov	r1,r6
+	shll16	r6
+	shll8	r6		! Nxxx
+	or	r6,r3		! NOPQ
+	cmp/hi	r2,r0
+	bt/s	3b
+	 mov.l	r3,@-r0
+#endif
+	!
+	! Third, copy a byte at once, if necessary
+	cmp/eq	r4,r0
+	bt/s	9b
+	 add	#6,r5
+	bra	8b
+	 add	#-6,r2
diff --git a/carl9170fw/carlfw/src/memset.S b/carl9170fw/carlfw/src/memset.S
new file mode 100644
index 0000000..d39c8a6
--- /dev/null
+++ b/carl9170fw/carlfw/src/memset.S
@@ -0,0 +1,58 @@
+/* $Id: memset.S,v 1.1 2000/04/14 16:49:01 mjd Exp $
+ *
+ * "memset" implementation of SuperH
+ *
+ * Copyright (C) 1999  Niibe Yutaka
+ *
+ */
+
+/*
+ *            void *memset(void *s, int c, size_t n);
+ */
+
+	.globl _memset
+	.align 2
+	_memset:
+	tst	r6,r6
+	bt/s	5f		! if n=0, do nothing
+	 add	r6,r4
+	mov	#12,r0
+	cmp/gt	r6,r0
+	bt/s	4f		! if it's too small, set a byte at once
+	 mov	r4,r0
+	and	#3,r0
+	cmp/eq	#0,r0
+	bt/s	2f		! It's aligned
+	 sub	r0,r6
+1:
+	dt	r0
+	bf/s	1b
+	 mov.b	r5,@-r4
+2:				! make VVVV
+	extu.b	r5,r5
+	swap.b	r5,r0		!   V0
+	or	r0,r5		!   VV
+	swap.w	r5,r0		! VV00
+	or	r0,r5		! VVVV
+	!
+	mov	r6,r0
+	shlr2	r0
+	shlr	r0		! r0 = r6 >> 3
+3:
+	dt	r0
+	mov.l	r5,@-r4		! set 8-byte at once
+	bf/s	3b
+	 mov.l	r5,@-r4
+	!
+	mov	#7,r0
+	and	r0,r6
+	tst	r6,r6
+	bt	5f
+	! fill bytes
+4:
+	dt	r6
+	bf/s	4b
+	 mov.b	r5,@-r4
+5:
+	rts
+	 mov	r4,r0
diff --git a/carl9170fw/carlfw/src/printf.c b/carl9170fw/carlfw/src/printf.c
new file mode 100755
index 0000000..3ff05c4
--- /dev/null
+++ b/carl9170fw/carlfw/src/printf.c
@@ -0,0 +1,161 @@
+/*
+ * Copyright (C) 2004,2008  Kustaa Nyholm
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include "carl9170.h"
+#include "printf.h"
+
+#ifdef CONFIG_CARL9170FW_PRINTF
+static char *bf;
+static char buf[12];
+static unsigned int num;
+static char uc;
+static char zs;
+
+static void out(const char c)
+{
+	*bf++ = c;
+}
+
+static void outDgt(const char dgt)
+{
+	out(dgt + (dgt < 10 ? '0' : (uc ? 'A' : 'a') - 10));
+	zs = 1;
+}
+
+static void divOut(const unsigned int d)
+{
+	unsigned char dgt = 0;
+
+	while (num >= d) {
+		num -= d;
+		dgt++;
+	}
+
+	if (zs || dgt > 0)
+		outDgt(dgt);
+}
+
+void tfp_printf(const char *fmt, ...)
+{
+	va_list va;
+	char *p;
+	unsigned int i;
+	char ch;
+
+	va_start(va, fmt);
+
+	while ((ch = *(fmt++))) {
+		if (ch != '%') {
+			putcharacter(ch);
+		} else {
+			char lz = 0;
+			char w = 0;
+			ch = *(fmt++);
+
+			if (ch == '0') {
+				ch = *(fmt++);
+				lz = 1;
+			}
+
+			if (ch >= '0' && ch <= '9') {
+				w = 0;
+				while (ch >= '0' && ch <= '9') {
+					w = (((w << 2) + w) << 1) + ch - '0';
+					ch = *fmt++;
+					}
+			}
+
+			bf = buf;
+			p = bf;
+			zs = 0;
+
+			switch (ch) {
+			case 0:
+				goto abort;
+
+			case 'u':
+			case 'd':
+				num = va_arg(va, unsigned int);
+				if (ch == 'd' && (int) num < 0) {
+					num = -(int)num;
+					out('-');
+				}
+
+				for (i = 100000000; i != 1; i /= 10)
+					divOut(i);
+
+				outDgt(num);
+				break;
+
+			case 'p':
+			case 'x':
+			case 'X':
+				uc = ch == 'X';
+				num = va_arg(va, unsigned int);
+				for (i = 0x10000000; i != 0x1; i >>= 4)
+					divOut(i);
+
+				outDgt(num);
+				break;
+
+			case 'c':
+				out((char)(va_arg(va, int)));
+				break;
+
+			case 's':
+				p = va_arg(va, char*);
+				break;
+			case '%':
+				out('%');
+				break;
+
+			default:
+				break;
+				}
+
+			*bf = 0;
+			bf = p;
+			while (*bf++ && w > 0)
+				w--;
+
+			while (w-- > 0)
+				putcharacter(lz ? '0' : ' ');
+
+			while ((ch = *p++))
+				putcharacter(ch);
+		}
+	}
+
+abort:
+	putcharacter('\0');
+	va_end(va);
+}
+
+#else
+
+void min_printf(const char *fmt, ...)
+{
+	char ch;
+
+	do {
+		ch = *(fmt++);
+		putcharacter(ch);
+	} while (ch);
+}
+
+#endif /* CONFIG_CARL9170FW_PRINTF */
diff --git a/carl9170fw/carlfw/src/reboot.S b/carl9170fw/carlfw/src/reboot.S
new file mode 100644
index 0000000..14c1813
--- /dev/null
+++ b/carl9170fw/carlfw/src/reboot.S
@@ -0,0 +1,11 @@
+	.globl _jump_to_bootcode
+	.type  _jump_to_bootcode, @function
+	_jump_to_bootcode:
+		mov.l stack_start, r0
+		mov.l @r0, sp
+		mov.l eeprom_start, r0
+		mov.l @r0, r0
+		jmp @r0
+	.align 4
+stack_start:	.long 0x00000004
+eeprom_start:	.long 0x00000000
diff --git a/carl9170fw/carlfw/src/rf.c b/carl9170fw/carlfw/src/rf.c
new file mode 100644
index 0000000..e031dd8
--- /dev/null
+++ b/carl9170fw/carlfw/src/rf.c
@@ -0,0 +1,277 @@
+/*
+ * carl9170 firmware - used by the ar9170 wireless device
+ *
+ * PHY and RF functions
+ *
+ * Copyright (c) 2000-2005 ZyDAS Technology Corporation
+ * Copyright (c) 2007-2009 Atheros Communications, Inc.
+ * Copyright	2009	Johannes Berg <johannes@sipsolutions.net>
+ * Copyright 2009-2011	Christian Lamparter <chunkeey@googlemail.com>
+ *
+ * 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; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include "carl9170.h"
+#include "timer.h"
+#include "printf.h"
+#include "rf.h"
+#include "shared/phy.h"
+
+#ifdef CONFIG_CARL9170FW_RADIO_FUNCTIONS
+static void set_channel_end(void)
+{
+	/* Manipulate CCA threshold to resume transmission */
+	set(AR9170_PHY_REG_CCA_THRESHOLD, 0x0);
+	/* Disable Virtual CCA */
+	andl(AR9170_MAC_REG_QOS_PRIORITY_VIRTUAL_CCA,
+	     ~AR9170_MAC_VIRTUAL_CCA_ALL);
+
+	fw.phy.state = CARL9170_PHY_ON;
+}
+
+void rf_notify_set_channel(void)
+{
+	/* Manipulate CCA threshold to stop transmission */
+	set(AR9170_PHY_REG_CCA_THRESHOLD, 0x300);
+	/* Enable Virtual CCA */
+	orl(AR9170_MAC_REG_QOS_PRIORITY_VIRTUAL_CCA,
+	    AR9170_MAC_VIRTUAL_CCA_ALL);
+
+	/* reset CCA stats */
+	fw.tally.active = 0;
+	fw.tally.cca = 0;
+	fw.tally.tx_time = 0;
+	fw.phy.state = CARL9170_PHY_OFF;
+}
+
+/*
+ * Update delta slope coeff man and exp
+ */
+static void hw_turn_off_dyn(const uint32_t delta_slope_coeff_exp,
+			    const uint32_t delta_slope_coeff_man,
+			    const uint32_t delta_slope_coeff_exp_shgi,
+			    const uint32_t delta_slope_coeff_man_shgi)
+{
+	uint32_t tmp;
+
+	tmp = get_async(AR9170_PHY_REG_TIMING3) & 0x00001fff;
+	tmp |= (delta_slope_coeff_man << AR9170_PHY_TIMING3_DSC_MAN_S) &
+		AR9170_PHY_TIMING3_DSC_MAN;
+	tmp |= (delta_slope_coeff_exp << AR9170_PHY_TIMING3_DSC_EXP_S) &
+		AR9170_PHY_TIMING3_DSC_EXP;
+
+	set(AR9170_PHY_REG_TIMING3, tmp);
+
+	tmp = (delta_slope_coeff_man_shgi << AR9170_PHY_HALFGI_DSC_MAN_S) &
+		AR9170_PHY_HALFGI_DSC_MAN;
+
+	tmp |= (delta_slope_coeff_exp_shgi << AR9170_PHY_HALFGI_DSC_EXP_S) &
+		AR9170_PHY_HALFGI_DSC_EXP;
+
+	set(AR9170_PHY_REG_HALFGI, tmp);
+}
+
+static void program_ADDAC(void)
+{
+	/* ??? Select Internal ADDAC ??? (is external radio) */
+	set(AR9170_PHY_REG_ADC_SERIAL_CTL, AR9170_PHY_ADC_SCTL_SEL_EXTERNAL_RADIO);
+
+	delay(10);
+
+	set(0x1c589c, 0x00000000);	/*# 7-0 */
+	set(0x1c589c, 0x00000000);	/*# 15-8 */
+	set(0x1c589c, 0x00000000);	/*# 23-16 */
+	set(0x1c589c, 0x00000000);	/*# 31- */
+
+	set(0x1c589c, 0x00000000);	/*# 39- */
+	set(0x1c589c, 0x00000000);	/*# 47- */
+	set(0x1c589c, 0x00000000);	/*# 55- [48]:doubles the xtalosc bias current */
+	set(0x1c589c, 0x00000000);	/*# 63- */
+
+	set(0x1c589c, 0x00000000);	/*# 71- */
+	set(0x1c589c, 0x00000000);	/*# 79- */
+	set(0x1c589c, 0x00000000);	/*# 87- */
+	set(0x1c589c, 0x00000000);	/*# 95- */
+
+	set(0x1c589c, 0x00000000);	/*# 103- */
+	set(0x1c589c, 0x00000000);	/*# 111- */
+	set(0x1c589c, 0x00000000);	/*# 119- */
+	set(0x1c589c, 0x00000000);	/*# 127- */
+
+	set(0x1c589c, 0x00000000);	/*# 135- */
+	set(0x1c589c, 0x00000000);	/*# 143- */
+	set(0x1c589c, 0x00000000);	/*# 151- */
+	set(0x1c589c, 0x00000030);	/*# 159- #[158:156]=xlnabufmode */
+
+	set(0x1c589c, 0x00000004);	/*# 167-  [162]:disable clkp_driver to flow */
+	set(0x1c589c, 0x00000000);	/*# 175- */
+	set(0x1c589c, 0x00000000);	/*# 183-176 */
+	set(0x1c589c, 0x00000000);	/*# 191-184 */
+
+	set(0x1c589c, 0x00000000);	/*# 199- */
+	set(0x1c589c, 0x00000000);	/*# 207- */
+	set(0x1c589c, 0x00000000);	/*# 215- */
+	set(0x1c589c, 0x00000000);	/*# 223- */
+
+	set(0x1c589c, 0x00000000);	/*# 231- */
+	set(0x1c58c4, 0x00000000);	/*# 233-232 */
+
+	delay(10);
+
+	/* Select External Flow ???? (is internal addac??) */
+	set(AR9170_PHY_REG_ADC_SERIAL_CTL, AR9170_PHY_ADC_SCTL_SEL_INTERNAL_ADDAC);
+}
+
+static uint32_t AGC_calibration(uint32_t loop)
+{
+	uint32_t wrdata;
+	uint32_t ret;
+
+#define AGC_CAL_NF	(AR9170_PHY_AGC_CONTROL_CAL | AR9170_PHY_AGC_CONTROL_NF)
+
+	wrdata = get_async(AR9170_PHY_REG_AGC_CONTROL) | AGC_CAL_NF;
+	set(AR9170_PHY_REG_AGC_CONTROL, wrdata);
+
+	ret = get_async(AR9170_PHY_REG_AGC_CONTROL) & AGC_CAL_NF;
+
+	/* sitesurvey : 100 ms / current connected 200 ms */
+	while ((ret != 0) && loop--) {
+		udelay(100);
+
+		ret = get_async(AR9170_PHY_REG_AGC_CONTROL) & AGC_CAL_NF;
+	}
+
+	/* return the AGC/Noise calibration state to the driver */
+	return ret;
+}
+
+#define EIGHTY_FLAG (CARL9170FW_PHY_HT_ENABLE | CARL9170FW_PHY_HT_DYN2040)
+
+static uint32_t rf_init(const uint32_t delta_slope_coeff_exp,
+			const uint32_t delta_slope_coeff_man,
+			const uint32_t delta_slope_coeff_exp_shgi,
+			const uint32_t delta_slope_coeff_man_shgi,
+			const uint32_t finiteLoopCount,
+			const bool initialize)
+{
+	uint32_t ret;
+
+	hw_turn_off_dyn(delta_slope_coeff_exp,
+			delta_slope_coeff_man,
+			delta_slope_coeff_exp_shgi,
+			delta_slope_coeff_man_shgi);
+
+	if (initialize) {
+		/* Real Chip */
+		program_ADDAC();
+
+		/* inverse chain 0 <-> chain 2 */
+		set(AR9170_PHY_REG_ANALOG_SWAP, AR9170_PHY_ANALOG_SWAP_AB);
+
+		/* swap chain 0 and chain 2 */
+		set(AR9170_PHY_REG_ANALOG_SWAP, AR9170_PHY_ANALOG_SWAP_AB |
+						AR9170_PHY_ANALOG_SWAP_ALT_CHAIN);
+
+		/* Activate BB */
+		set(AR9170_PHY_REG_ACTIVE, AR9170_PHY_ACTIVE_EN);
+		delay(10);
+	}
+
+	ret = AGC_calibration(finiteLoopCount);
+
+	set_channel_end();
+	return ret;
+}
+
+void rf_cmd(const struct carl9170_cmd *cmd, struct carl9170_rsp *resp)
+{
+	uint32_t ret;
+
+	fw.phy.ht_settings = cmd->rf_init.ht_settings;
+	fw.phy.frequency = cmd->rf_init.freq;
+
+	/*
+	 * Is the clock controlled by the PHY?
+	 */
+	if ((fw.phy.ht_settings & EIGHTY_FLAG) == EIGHTY_FLAG)
+		clock_set(AHB_80_88MHZ, true);
+	else
+		clock_set(AHB_40_44MHZ, true);
+
+	ret = rf_init(le32_to_cpu(cmd->rf_init.delta_slope_coeff_exp),
+		      le32_to_cpu(cmd->rf_init.delta_slope_coeff_man),
+		      le32_to_cpu(cmd->rf_init.delta_slope_coeff_exp_shgi),
+		      le32_to_cpu(cmd->rf_init.delta_slope_coeff_man_shgi),
+		      le32_to_cpu(cmd->rf_init.finiteLoopCount),
+		      cmd->hdr.cmd == CARL9170_CMD_RF_INIT);
+
+	resp->hdr.len = sizeof(struct carl9170_rf_init_result);
+	resp->rf_init_res.ret = cpu_to_le32(ret);
+}
+
+void rf_psm(void)
+{
+	u32 bank3;
+
+	if (fw.phy.psm.state == CARL9170_PSM_SOFTWARE) {
+		/* not enabled by the driver */
+		return;
+	}
+
+	if (fw.phy.psm.state & CARL9170_PSM_SLEEP) {
+		fw.phy.psm.state &= ~CARL9170_PSM_SLEEP;
+
+		/* disable all agc gain and offset updates to a2 */
+		set(AR9170_PHY_REG_TEST2, 0x8000000);
+
+		/* power down ADDAC */
+		set(AR9170_PHY_REG_ADC_CTL,
+		    AR9170_PHY_ADC_CTL_OFF_PWDDAC |
+		    AR9170_PHY_ADC_CTL_OFF_PWDADC |
+		    0xa0000000);
+
+		/* Synthesizer off + RX off */
+		bank3 = 0x00400018;
+
+		fw.phy.state = CARL9170_PHY_OFF;
+	} else {
+		/* advance to the next PSM step */
+		fw.phy.psm.state--;
+
+		if (fw.phy.psm.state == CARL9170_PSM_WAKE) {
+			/* wake up ADDAC */
+			set(AR9170_PHY_REG_ADC_CTL,
+			    AR9170_PHY_ADC_CTL_OFF_PWDDAC |
+			    AR9170_PHY_ADC_CTL_OFF_PWDADC);
+
+			/* enable all agc gain and offset updates to a2 */
+			set(AR9170_PHY_REG_TEST2, 0x0);
+
+			/* Synthesizer on + RX on */
+			bank3 = 0x01420098;
+
+			fw.phy.state = CARL9170_PHY_ON;
+		} else {
+			return ;
+		}
+	}
+
+	if (fw.phy.frequency < 3000000)
+		bank3 |= 0x00800000;
+
+	set(0x1c58f0, bank3);
+}
+
+#endif /* CONFIG_CARL9170FW_RADIO_FUNCTIONS */
diff --git a/carl9170fw/carlfw/src/uart.c b/carl9170fw/carlfw/src/uart.c
new file mode 100644
index 0000000..58f6486
--- /dev/null
+++ b/carl9170fw/carlfw/src/uart.c
@@ -0,0 +1,76 @@
+/*
+ * carl9170 firmware - used by the ar9170 wireless device
+ *
+ * UART debug interface functions.
+ *
+ * Copyright (c) 2000-2005 ZyDAS Technology Corporation
+ * Copyright (c) 2007-2009 Atheros Communications, Inc.
+ * Copyright	2009	Johannes Berg <johannes@sipsolutions.net>
+ * Copyright 2009-2011	Christian Lamparter <chunkeey@googlemail.com>
+ *
+ * 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; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include "carl9170.h"
+#include "uart.h"
+#include "io.h"
+
+#ifdef CONFIG_CARL9170FW_DEBUG_UART
+void uart_putc(const char c)
+{
+	set(AR9170_UART_REG_TX_HOLDING, c);
+
+	while (get(AR9170_UART_REG_LINE_STATUS) &
+	       AR9170_UART_LINE_STS_TX_FIFO_ALMOST_EMPTY) {
+		/*
+		 * wait until the byte has made it
+		 */
+	}
+}
+
+void uart_print_hex_dump(const void *buf, const int len)
+{
+	unsigned int offset = 0;
+
+	uart_putc('H');
+	uart_putc('D');
+	uart_putc(':');
+
+	while (len > 0) {
+		uart_putc(*((uint8_t *) buf + offset));
+		offset++;
+	}
+}
+
+void uart_init(void)
+{
+	unsigned int timeout = 0;
+
+#ifdef CONFIG_CARL9170FW_UART_CLOCK_25M
+	set(AR9170_UART_REG_DIVISOR_LSB, 0xc);
+#elif CONFIG_CARL9170FW_UART_CLOCK_40M
+	set(AR9170_UART_REG_DIVISOR_LSB, 0x14);	/* 40 MHz */
+	set(AR9170_UART_REG_REMAINDER, 0xb38e);
+#else
+#error "Unsupported UART clock"
+#endif /* CARL9170FW_UART_CLOCK_25M */
+
+	while (get(AR9170_UART_REG_LINE_STATUS) &
+	       AR9170_UART_LINE_STS_TRANSMITTER_EMPTY) {
+		if (timeout++ >= 10000)
+			break;
+	}
+}
+#endif /* CONFIG_CARL9170FW_DEBUG_UART */
diff --git a/carl9170fw/carlfw/src/udivsi3_i4i-Os.S b/carl9170fw/carlfw/src/udivsi3_i4i-Os.S
new file mode 100644
index 0000000..7bbec4c
--- /dev/null
+++ b/carl9170fw/carlfw/src/udivsi3_i4i-Os.S
@@ -0,0 +1,149 @@
+/* Copyright (C) 2006 Free Software Foundation, Inc.
+
+This file 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, or (at your option) any
+later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+This file 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, write to
+the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+/* Moderately Space-optimized libgcc routines for the Renesas SH /
+   STMicroelectronics ST40 CPUs.
+   Contributed by J"orn Rennecke joern.rennecke@st.com.  */
+
+/* Size: 186 bytes jointly for udivsi3_i4i and sdivsi3_i4i
+   sh4-200 run times:
+   udiv small divisor: 55 cycles
+   udiv large divisor: 52 cycles
+   sdiv small divisor, positive result: 59 cycles
+   sdiv large divisor, positive result: 56 cycles
+   sdiv small divisor, negative result: 65 cycles (*)
+   sdiv large divisor, negative result: 62 cycles (*)
+   (*): r2 is restored in the rts delay slot and has a lingering latency
+        of two more cycles.  */
+	.balign 4
+	.global	___udivsi3_i4i
+	.global	___udivsi3_i4
+	.set	___udivsi3_i4, ___udivsi3_i4i
+	.type	___udivsi3_i4i, @function
+	.type	___sdivsi3_i4i, @function
+___udivsi3_i4i:
+	sts pr,r1
+	mov.l r4,@-r15
+	extu.w r5,r0
+	cmp/eq r5,r0
+	swap.w r4,r0
+	shlr16 r4
+	bf/s large_divisor
+	div0u
+	mov.l r5,@-r15
+	shll16 r5
+sdiv_small_divisor:
+	div1 r5,r4
+	bsr div6
+	div1 r5,r4
+	div1 r5,r4
+	bsr div6
+	div1 r5,r4
+	xtrct r4,r0
+	xtrct r0,r4
+	bsr div7
+	swap.w r4,r4
+	div1 r5,r4
+	bsr div7
+	div1 r5,r4
+	xtrct r4,r0
+	mov.l @r15+,r5
+	swap.w r0,r0
+	mov.l @r15+,r4
+	jmp @r1
+	rotcl r0
+div7:
+	div1 r5,r4
+div6:
+	            div1 r5,r4; div1 r5,r4; div1 r5,r4
+	div1 r5,r4; div1 r5,r4; rts;        div1 r5,r4
+
+divx3:
+	rotcl r0
+	div1 r5,r4
+	rotcl r0
+	div1 r5,r4
+	rotcl r0
+	rts
+	div1 r5,r4
+
+large_divisor:
+	mov.l r5,@-r15
+sdiv_large_divisor:
+	xor r4,r0
+	.rept 4
+	rotcl r0
+	bsr divx3
+	div1 r5,r4
+	.endr
+	mov.l @r15+,r5
+	mov.l @r15+,r4
+	jmp @r1
+	rotcl r0
+
+	.global	__sdivsi3_i4i
+	.global __sdivsi3_i4
+	.global __sdivsi3
+	.set	__sdivsi3_i4, __sdivsi3_i4i
+	.set	__sdivsi3, __sdivsi3_i4i
+__sdivsi3_i4i:
+	mov.l r4,@-r15
+	cmp/pz r5
+	mov.l r5,@-r15
+	bt/s pos_divisor
+	cmp/pz r4
+	neg r5,r5
+	extu.w r5,r0
+	bt/s neg_result
+	cmp/eq r5,r0
+	neg r4,r4
+pos_result:
+	swap.w r4,r0
+	bra sdiv_check_divisor
+	sts pr,r1
+pos_divisor:
+	extu.w r5,r0
+	bt/s pos_result
+	cmp/eq r5,r0
+	neg r4,r4
+neg_result:
+	mova negate_result,r0
+	;
+	mov r0,r1
+	swap.w r4,r0
+	lds r2,macl
+	sts pr,r2
+sdiv_check_divisor:
+	shlr16 r4
+	bf/s sdiv_large_divisor
+	div0u
+	bra sdiv_small_divisor
+	shll16 r5
+	.balign 4
+negate_result:
+	neg r0,r0
+	jmp @r2
+	sts macl,r2
diff --git a/carl9170fw/carlfw/src/wlan.c b/carl9170fw/carlfw/src/wlan.c
new file mode 100644
index 0000000..d3328d6
--- /dev/null
+++ b/carl9170fw/carlfw/src/wlan.c
@@ -0,0 +1,1211 @@
+/*
+ * carl9170 firmware - used by the ar9170 wireless device
+ *
+ * Interface to the WLAN part of the chip
+ *
+ * Copyright (c) 2000-2005 ZyDAS Technology Corporation
+ * Copyright (c) 2007-2009 Atheros Communications, Inc.
+ * Copyright	2009	Johannes Berg <johannes@sipsolutions.net>
+ * Copyright 2009-2011	Christian Lamparter <chunkeey@googlemail.com>
+ *
+ * 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; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include "carl9170.h"
+#include "shared/phy.h"
+#include "hostif.h"
+#include "timer.h"
+#include "wl.h"
+#include "printf.h"
+#include "rf.h"
+#include "linux/ieee80211.h"
+#include "wol.h"
+
+static void wlan_txunstuck(unsigned int queue)
+{
+	set_wlan_txq_dma_addr(queue, ((uint32_t) fw.wlan.tx_queue[queue].head) | 1);
+}
+
+#ifdef CONFIG_CARL9170FW_DMA_QUEUE_BUMP
+static void wlan_txupdate(unsigned int queue)
+{
+	set_wlan_txq_dma_addr(queue, ((uint32_t) fw.wlan.tx_queue[queue].head));
+}
+
+static void wlan_dma_bump(unsigned int qidx)
+{
+	unsigned int offset = qidx;
+	uint32_t status, trigger;
+
+	status = get(AR9170_MAC_REG_DMA_STATUS) >> 12;
+	trigger = get(AR9170_MAC_REG_DMA_TRIGGER) >> 12;
+
+	while (offset != 0) {
+		status >>= 4;
+		trigger >>= 4;
+		offset--;
+	}
+
+	status &= 0xf;
+	trigger &= 0xf;
+
+	if ((trigger == 0xa) && (status == 0x8)) {
+		DBG("UNSTUCK");
+		wlan_txunstuck(qidx);
+	} else {
+		DBG("UPDATE");
+		wlan_txupdate(qidx);
+	}
+}
+#endif /* CONFIG_CARL9170FW_DMA_QUEUE_BUMP */
+
+#ifdef CONFIG_CARL9170FW_DEBUG
+static void wlan_dump_queue(unsigned int qidx)
+{
+
+	struct dma_desc *desc;
+	struct carl9170_tx_superframe *super;
+	int entries = 0;
+
+	__for_each_desc(desc, &fw.wlan.tx_queue[qidx]) {
+		super = get_super(desc);
+		DBG("%d: %p s:%x c:%x tl:%x ds:%x n:%p l:%p ", entries, desc,
+		    desc->status, desc->ctrl, desc->totalLen,
+		    desc->dataSize, desc->nextAddr, desc->lastAddr);
+
+		DBG("c:%x tr:%d ri:%d l:%x m:%x p:%x fc:%x",
+		    super->s.cookie, super->s.cnt, super->s.rix,
+		    super->f.hdr.length, super->f.hdr.mac.set,
+		    (unsigned int) le32_to_cpu(super->f.hdr.phy.set),
+		    super->f.data.i3e.frame_control);
+
+		entries++;
+	}
+
+	desc = get_wlan_txq_addr(qidx);
+
+	DBG("Queue: %d: te:%d td:%d h:%p c:%p t:%p",
+	    qidx, entries, queue_len(&fw.wlan.tx_queue[qidx]),
+	    fw.wlan.tx_queue[qidx].head,
+	    desc, fw.wlan.tx_queue[qidx].terminator);
+
+	DBG("HW: t:%x s:%x ac:%x c:%x",
+	    (unsigned int) get(AR9170_MAC_REG_DMA_TRIGGER),
+	    (unsigned int) get(AR9170_MAC_REG_DMA_STATUS),
+	    (unsigned int) get(AR9170_MAC_REG_AMPDU_COUNT),
+	    (unsigned int) get(AR9170_MAC_REG_DMA_TXQX_ADDR_CURR));
+}
+#endif /* CONFIG_CARL9170FW_DEBUG */
+
+static void wlan_send_buffered_tx_status(void)
+{
+	unsigned int len;
+
+	while (fw.wlan.tx_status_pending) {
+		len = min((unsigned int)fw.wlan.tx_status_pending,
+			  CARL9170_RSP_TX_STATUS_NUM);
+		len = min(len, CARL9170_TX_STATUS_NUM -	fw.wlan.tx_status_head_idx);
+
+		/*
+		 * rather than memcpy each individual request into a large buffer,
+		 * we _splice_ them all together.
+		 *
+		 * The only downside is however that we have to be careful around
+		 * the edges of the tx_status_cache.
+		 *
+		 * Note:
+		 * Each tx_status is about 2 bytes. However every command package
+		 * must have a size which is a multiple of 4.
+		 */
+
+		send_cmd_to_host((len * sizeof(struct carl9170_tx_status) + 3) & ~3,
+				 CARL9170_RSP_TXCOMP, len, (void *)
+				 &fw.wlan.tx_status_cache[fw.wlan.tx_status_head_idx]);
+
+		fw.wlan.tx_status_pending -= len;
+		fw.wlan.tx_status_head_idx += len;
+		fw.wlan.tx_status_head_idx %= CARL9170_TX_STATUS_NUM;
+	}
+}
+
+static struct carl9170_tx_status *wlan_get_tx_status_buffer(void)
+{
+	struct carl9170_tx_status *tmp;
+
+	tmp = &fw.wlan.tx_status_cache[fw.wlan.tx_status_tail_idx++];
+	fw.wlan.tx_status_tail_idx %= CARL9170_TX_STATUS_NUM;
+
+	if (fw.wlan.tx_status_pending == CARL9170_TX_STATUS_NUM)
+		wlan_send_buffered_tx_status();
+
+	fw.wlan.tx_status_pending++;
+
+	return tmp;
+}
+
+/* generate _aggregated_ tx_status for the host */
+void wlan_tx_complete(struct carl9170_tx_superframe *super,
+		      bool txs)
+{
+	struct carl9170_tx_status *status;
+
+	status = wlan_get_tx_status_buffer();
+
+	/*
+	 * The *unique* cookie and AC_ID is used by the driver for
+	 * frame lookup.
+	 */
+	status->cookie = super->s.cookie;
+	status->queue = super->s.queue;
+	super->s.cookie = 0;
+
+	/*
+	 * This field holds the number of tries of the rate in
+	 * the rate index field (rix).
+	 */
+	status->rix = super->s.rix;
+	status->tries = super->s.cnt;
+	status->success = (txs) ? 1 : 0;
+}
+
+static bool wlan_tx_consume_retry(struct carl9170_tx_superframe *super)
+{
+	/* check if this was the last possible retry with this rate */
+	if (unlikely(super->s.cnt >= super->s.ri[super->s.rix].tries)) {
+		/* end of the road - indicate tx failure */
+		if (unlikely(super->s.rix == CARL9170_TX_MAX_RETRY_RATES))
+			return false;
+
+		/* check if there are alternative rates available */
+		if (!super->s.rr[super->s.rix].set)
+			return false;
+
+		/* try next retry rate */
+		super->f.hdr.phy.set = super->s.rr[super->s.rix].set;
+
+		/* finally - mark the old rate as USED */
+		super->s.rix++;
+
+		/* update MAC flags */
+		super->f.hdr.mac.erp_prot = super->s.ri[super->s.rix].erp_prot;
+		super->f.hdr.mac.ampdu = super->s.ri[super->s.rix].ampdu;
+
+		/* reinitialize try counter */
+		super->s.cnt = 1;
+	} else {
+		/* just increase retry counter */
+		super->s.cnt++;
+	}
+
+	return true;
+}
+
+static inline u16 get_tid(struct ieee80211_hdr *hdr)
+{
+	return (ieee80211_get_qos_ctl(hdr))[0] & IEEE80211_QOS_CTL_TID_MASK;
+}
+
+/* This function will only work on uint32_t-aligned pointers! */
+static bool same_hdr(const void *_d0, const void *_d1)
+{
+	const uint32_t *d0 = _d0;
+	const uint32_t *d1 = _d1;
+
+	/* BUG_ON((unsigned long)d0 & 3 || (unsigned long)d1 & 3)) */
+	return !((d0[0] ^ d1[0]) |			/* FC + DU */
+		 (d0[1] ^ d1[1]) |			/* addr1 */
+		 (d0[2] ^ d1[2]) | (d0[3] ^ d1[3]) |	/* addr2 + addr3 */
+		 (d0[4] ^ d1[4]));			/* addr3 */
+}
+
+static inline bool same_aggr(struct ieee80211_hdr *a, struct ieee80211_hdr *b)
+{
+	return (get_tid(a) == get_tid(b)) || same_hdr(a, b);
+}
+
+static void wlan_tx_ampdu_reset(unsigned int qidx)
+{
+	fw.wlan.ampdu_prev[qidx] = NULL;
+}
+
+static void wlan_tx_ampdu_end(unsigned int qidx)
+{
+	struct carl9170_tx_superframe *ht_prev = fw.wlan.ampdu_prev[qidx];
+
+	if (ht_prev)
+		ht_prev->f.hdr.mac.ba_end = 1;
+
+	wlan_tx_ampdu_reset(qidx);
+}
+
+static void wlan_tx_ampdu(struct carl9170_tx_superframe *super)
+{
+	unsigned int qidx = super->s.queue;
+	struct carl9170_tx_superframe *ht_prev = fw.wlan.ampdu_prev[qidx];
+
+	if (super->f.hdr.mac.ampdu) {
+		if (ht_prev &&
+		    !same_aggr(&super->f.data.i3e, &ht_prev->f.data.i3e))
+			ht_prev->f.hdr.mac.ba_end = 1;
+		else
+			super->f.hdr.mac.ba_end = 0;
+
+		fw.wlan.ampdu_prev[qidx] = super;
+	} else {
+		wlan_tx_ampdu_end(qidx);
+	}
+}
+
+/* for all tries */
+static void __wlan_tx(struct dma_desc *desc)
+{
+	struct carl9170_tx_superframe *super = get_super(desc);
+
+	if (unlikely(super->s.fill_in_tsf)) {
+		struct ieee80211_mgmt *mgmt = (void *) &super->f.data.i3e;
+		uint32_t *tsf = (uint32_t *) &mgmt->u.probe_resp.timestamp;
+
+		/*
+		 * Truth be told: this is a hack.
+		 *
+		 * The *real* TSF is definitely going to be higher/older.
+		 * But this hardware emulation code is head and shoulders
+		 * above anything a driver can possibly do.
+		 *
+		 * (even, if it's got an accurate atomic clock source).
+		 */
+
+		read_tsf(tsf);
+	}
+
+	wlan_tx_ampdu(super);
+
+#ifdef CONFIG_CARL9170FW_DEBUG
+	BUG_ON(fw.phy.psm.state != CARL9170_PSM_WAKE);
+#endif /* CONFIG_CARL9170FW_DEBUG */
+
+	/* insert desc into the right queue */
+	dma_put(&fw.wlan.tx_queue[super->s.queue], desc);
+}
+
+static void wlan_assign_seq(struct ieee80211_hdr *hdr, unsigned int vif)
+{
+	hdr->seq_ctrl &= cpu_to_le16(~IEEE80211_SCTL_SEQ);
+	hdr->seq_ctrl |= cpu_to_le16(fw.wlan.sequence[vif]);
+
+	if (ieee80211_is_first_frag(hdr->seq_ctrl))
+		fw.wlan.sequence[vif] += 0x10;
+}
+
+/* prepares frame for the first transmission */
+static void _wlan_tx(struct dma_desc *desc)
+{
+	struct carl9170_tx_superframe *super = get_super(desc);
+
+	if (unlikely(super->s.assign_seq))
+		wlan_assign_seq(&super->f.data.i3e, super->s.vif_id);
+
+	if (unlikely(super->s.ampdu_commit_density)) {
+		set(AR9170_MAC_REG_AMPDU_DENSITY,
+		    MOD_VAL(AR9170_MAC_AMPDU_DENSITY,
+			    get(AR9170_MAC_REG_AMPDU_DENSITY),
+			    super->s.ampdu_density));
+	}
+
+	if (unlikely(super->s.ampdu_commit_factor)) {
+		set(AR9170_MAC_REG_AMPDU_FACTOR,
+		    MOD_VAL(AR9170_MAC_AMPDU_FACTOR,
+			    get(AR9170_MAC_REG_AMPDU_FACTOR),
+			    8 << super->s.ampdu_factor));
+	}
+}
+
+/* propagate transmission status back to the driver */
+static bool wlan_tx_status(struct dma_queue *queue,
+			   struct dma_desc *desc)
+{
+	struct carl9170_tx_superframe *super = get_super(desc);
+	unsigned int qidx = super->s.queue;
+	bool txfail = false, success;
+
+	success = true;
+
+	/* update hangcheck */
+	fw.wlan.last_super_num[qidx] = 0;
+
+	/*
+	 * Note:
+	 * There could be a corner case when the TXFAIL is set
+	 * even though the frame was properly ACKed by the peer:
+	 *   a BlockAckReq with the immediate policy will cause
+	 *   the receiving peer to produce a BlockACK unfortunately
+	 *   the MAC in this chip seems to be expecting a legacy
+	 *   ACK and marks the BAR as failed!
+	 */
+
+	if (!!(desc->ctrl & AR9170_CTRL_FAIL)) {
+		txfail = !!(desc->ctrl & AR9170_CTRL_TXFAIL);
+
+		/* reset retry indicator flags */
+		desc->ctrl &= ~(AR9170_CTRL_TXFAIL | AR9170_CTRL_BAFAIL);
+
+		/*
+		 * Note: wlan_tx_consume_retry will override the old
+		 * phy [CCK,OFDM, HT, BW20/40, MCS...] and mac vectors
+		 * [AMPDU,RTS/CTS,...] therefore be careful when they
+		 * are used.
+		 */
+		if (wlan_tx_consume_retry(super)) {
+			/*
+			 * retry for simple and aggregated 802.11 frames.
+			 *
+			 * Note: We must not mess up the original frame
+			 * order.
+			 */
+
+			if (!super->f.hdr.mac.ampdu) {
+				/*
+				 * 802.11 - 7.1.3.1.5.
+				 * set "Retry Field" for consecutive attempts
+				 *
+				 * Note: For AMPDU see:
+				 * 802.11n 9.9.1.6 "Retransmit Procedures"
+				 */
+				super->f.data.i3e.frame_control |=
+					cpu_to_le16(IEEE80211_FCTL_RETRY);
+			}
+
+			if (txfail) {
+				/* Normal TX Failure */
+
+				/* demise descriptor ownership back to the hardware */
+				dma_rearm(desc);
+
+				/*
+				 * And this will get the queue going again.
+				 * To understand why: you have to get the HW
+				 * specs... But sadly I never saw them.
+				 */
+				wlan_txunstuck(qidx);
+
+				/* abort cycle - this is necessary due to HW design */
+				return false;
+			} else {
+				/* (HT-) BlockACK failure */
+
+				/*
+				 * Unlink the failed attempt and put it into
+				 * the retry queue. The caller routine must
+				 * be aware of this so the frames don't get lost.
+				 */
+
+#ifndef CONFIG_CARL9170FW_DEBUG
+				dma_unlink_head(queue);
+#else /* CONFIG_CARL9170FW_DEBUG */
+				BUG_ON(dma_unlink_head(queue) != desc);
+#endif /* CONFIG_CARL9170FW_DEBUG */
+				dma_put(&fw.wlan.tx_retry, desc);
+				return true;
+			}
+		} else {
+			/* out of frame attempts - discard frame */
+			success = false;
+		}
+	}
+
+#ifndef CONFIG_CARL9170FW_DEBUG
+	dma_unlink_head(queue);
+#else /* CONFIG_CARL9170FW_DEBUG */
+	BUG_ON(dma_unlink_head(queue) != desc);
+#endif /* CONFIG_CARL9170FW_DEBUG */
+	if (txfail) {
+		/*
+		 * Issue the queue bump,
+		 * We need to do this in case this was the frame's last
+		 * possible retry attempt and it unfortunately: it failed.
+		 */
+
+		wlan_txunstuck(qidx);
+	}
+
+	unhide_super(desc);
+
+	if (unlikely(super == fw.wlan.fw_desc_data)) {
+		fw.wlan.fw_desc = desc;
+		fw.wlan.fw_desc_available = 1;
+
+		if (fw.wlan.fw_desc_callback)
+			fw.wlan.fw_desc_callback(super, success);
+
+		return true;
+	}
+
+#ifdef CONFIG_CARL9170FW_CAB_QUEUE
+	if (unlikely(super->s.cab))
+		fw.wlan.cab_queue_len[super->s.vif_id]--;
+#endif /* CONFIG_CARL9170FW_CAB_QUEUE */
+
+	wlan_tx_complete(super, success);
+
+	if (ieee80211_is_back_req(super->f.data.i3e.frame_control)) {
+		fw.wlan.queued_bar--;
+	}
+
+	/* recycle freed descriptors */
+	dma_reclaim(&fw.pta.down_queue, desc);
+	down_trigger();
+	return true;
+}
+
+static void handle_tx_completion(void)
+{
+	struct dma_desc *desc;
+	int i;
+
+	for (i = AR9170_TXQ_SPECIAL; i >= AR9170_TXQ0; i--) {
+		__while_desc_bits(desc, &fw.wlan.tx_queue[i], AR9170_OWN_BITS_SW) {
+			if (!wlan_tx_status(&fw.wlan.tx_queue[i], desc)) {
+				/* termination requested. */
+				break;
+			}
+		}
+
+		wlan_tx_ampdu_reset(i);
+
+		for_each_desc(desc, &fw.wlan.tx_retry)
+			__wlan_tx(desc);
+
+		wlan_tx_ampdu_end(i);
+		if (!queue_empty(&fw.wlan.tx_queue[i]))
+			wlan_trigger(BIT(i));
+	}
+}
+
+void __hot wlan_tx(struct dma_desc *desc)
+{
+	struct carl9170_tx_superframe *super = DESC_PAYLOAD(desc);
+
+	if (ieee80211_is_back_req(super->f.data.i3e.frame_control)) {
+		fw.wlan.queued_bar++;
+	}
+
+	/* initialize rate control struct */
+	super->s.rix = 0;
+	super->s.cnt = 1;
+	hide_super(desc);
+
+#ifdef CONFIG_CARL9170FW_CAB_QUEUE
+	if (unlikely(super->s.cab)) {
+		fw.wlan.cab_queue_len[super->s.vif_id]++;
+		dma_put(&fw.wlan.cab_queue[super->s.vif_id], desc);
+		return;
+	}
+#endif /* CONFIG_CARL9170FW_CAB_QUEUE */
+
+	_wlan_tx(desc);
+	__wlan_tx(desc);
+	wlan_trigger(BIT(super->s.queue));
+}
+
+void wlan_tx_fw(struct carl9170_tx_superdesc *super, fw_desc_callback_t cb)
+{
+	if (!fw.wlan.fw_desc_available)
+		return;
+
+	fw.wlan.fw_desc_available = 0;
+
+	/* Format BlockAck */
+	fw.wlan.fw_desc->ctrl = AR9170_CTRL_FS_BIT | AR9170_CTRL_LS_BIT;
+	fw.wlan.fw_desc->status = AR9170_OWN_BITS_SW;
+
+	fw.wlan.fw_desc->totalLen = fw.wlan.fw_desc->dataSize = super->len;
+	fw.wlan.fw_desc_data = fw.wlan.fw_desc->dataAddr = super;
+	fw.wlan.fw_desc->nextAddr = fw.wlan.fw_desc->lastAddr =
+		fw.wlan.fw_desc;
+	fw.wlan.fw_desc_callback = cb;
+	wlan_tx(fw.wlan.fw_desc);
+}
+
+static void wlan_send_buffered_ba(void)
+{
+	struct carl9170_tx_ba_superframe *baf = &dma_mem.reserved.ba.ba;
+	struct ieee80211_ba *ba = (struct ieee80211_ba *) &baf->f.ba;
+	struct carl9170_bar_ctx *ctx;
+
+	if (likely(!fw.wlan.queued_ba))
+		return;
+
+	/* there's no point to continue when the ba_desc is not available. */
+	if (!fw.wlan.fw_desc_available)
+		return;
+
+	ctx = &fw.wlan.ba_cache[fw.wlan.ba_head_idx];
+	fw.wlan.ba_head_idx++;
+	fw.wlan.ba_head_idx %= CONFIG_CARL9170FW_BACK_REQS_NUM;
+	fw.wlan.queued_ba--;
+
+	baf->s.len = sizeof(struct carl9170_tx_superdesc) +
+		     sizeof(struct ar9170_tx_hwdesc) +
+		     sizeof(struct ieee80211_ba);
+	baf->s.ri[0].tries = 1;
+	baf->s.cookie = 0;
+	baf->s.queue = AR9170_TXQ_VO;
+	baf->f.hdr.length = sizeof(struct ieee80211_ba) + FCS_LEN;
+
+	baf->f.hdr.mac.no_ack = 1;
+
+	baf->f.hdr.phy.modulation = 1; /* OFDM */
+	baf->f.hdr.phy.tx_power = 34; /* 17 dBm */
+	baf->f.hdr.phy.chains = 1;
+	baf->f.hdr.phy.mcs = AR9170_TXRX_PHY_RATE_OFDM_6M;
+
+	/* format outgoing BA */
+	ba->frame_control = cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_BACK);
+	ba->duration = cpu_to_le16(0);
+
+	/* the BAR contains all necessary MACs. All we need is to swap them */
+	memcpy(ba->ra, ctx->ta, 6);
+	memcpy(ba->ta, ctx->ra, 6);
+
+	/*
+	 * Unfortunately, we cannot look into the hardware's scoreboard.
+	 * Therefore we have to proceed as described in 802.11n 9.10.7.5
+	 * and send a null BlockAck.
+	 */
+	memset(ba->bitmap, 0x0, sizeof(ba->bitmap));
+
+	/*
+	 * Both, the original firmare and ath9k set the NO ACK flag in
+	 * the BA Ack Policy subfield.
+	 */
+	ba->control = ctx->control | cpu_to_le16(1);
+	ba->start_seq_num = ctx->start_seq_num;
+	wlan_tx_fw(&baf->s, NULL);
+}
+
+static struct carl9170_bar_ctx *wlan_get_bar_cache_buffer(void)
+{
+	struct carl9170_bar_ctx *tmp;
+
+	tmp = &fw.wlan.ba_cache[fw.wlan.ba_tail_idx];
+	fw.wlan.ba_tail_idx++;
+	fw.wlan.ba_tail_idx %= CONFIG_CARL9170FW_BACK_REQS_NUM;
+	if (fw.wlan.queued_ba < CONFIG_CARL9170FW_BACK_REQS_NUM)
+		fw.wlan.queued_ba++;
+
+	return tmp;
+}
+
+static void handle_bar(struct dma_desc *desc __unused, struct ieee80211_hdr *hdr,
+		       unsigned int len, unsigned int mac_err)
+{
+	struct ieee80211_bar *bar;
+	struct carl9170_bar_ctx *ctx;
+
+	if (unlikely(mac_err)) {
+		/*
+		 * This check does a number of things:
+		 * 1. checks if the frame is in good nick
+		 * 2. checks if the RA (MAC) matches
+		 */
+		return ;
+	}
+
+	if (unlikely(len < (sizeof(struct ieee80211_bar) + FCS_LEN))) {
+		/*
+		 * Sneaky, corrupted BARs... but not with us!
+		 */
+
+		return ;
+	}
+
+	bar = (void *) hdr;
+
+	if ((bar->control & cpu_to_le16(IEEE80211_BAR_CTRL_MULTI_TID)) ||
+	    !(bar->control & cpu_to_le16(IEEE80211_BAR_CTRL_CBMTID_COMPRESSED_BA))) {
+		/* not implemented yet */
+
+		return ;
+	}
+
+	ctx = wlan_get_bar_cache_buffer();
+
+	memcpy(ctx->ra, bar->ra, 6);
+	memcpy(ctx->ta, bar->ta, 6);
+	ctx->control = bar->control;
+	ctx->start_seq_num = bar->start_seq_num;
+}
+
+static void wlan_check_rx_overrun(void)
+{
+	uint32_t overruns, total;
+
+	fw.tally.rx_total += total = get(AR9170_MAC_REG_RX_TOTAL);
+	fw.tally.rx_overrun += overruns = get(AR9170_MAC_REG_RX_OVERRUN);
+	if (unlikely(overruns)) {
+		if (overruns == total) {
+			DBG("RX Overrun");
+			fw.wlan.mac_reset++;
+		}
+
+		wlan_trigger(AR9170_DMA_TRIGGER_RXQ);
+	}
+}
+
+static unsigned int wlan_rx_filter(struct dma_desc *desc)
+{
+	struct ieee80211_hdr *hdr;
+	unsigned int data_len;
+	unsigned int rx_filter;
+	unsigned int mac_err;
+
+	data_len = ar9170_get_rx_mpdu_len(desc);
+	mac_err = ar9170_get_rx_macstatus_error(desc);
+
+#define AR9170_RX_ERROR_BAD (AR9170_RX_ERROR_FCS | AR9170_RX_ERROR_PLCP)
+
+	if (unlikely(data_len < (4 + 6 + FCS_LEN) ||
+	    desc->totalLen > CONFIG_CARL9170FW_RX_FRAME_LEN) ||
+	    mac_err & AR9170_RX_ERROR_BAD) {
+		/*
+		 * This frame is too damaged to do anything
+		 * useful with it.
+		 */
+
+		return CARL9170_RX_FILTER_BAD;
+	}
+
+	rx_filter = 0;
+	if (mac_err & AR9170_RX_ERROR_WRONG_RA)
+		rx_filter |= CARL9170_RX_FILTER_OTHER_RA;
+
+	if (mac_err & AR9170_RX_ERROR_DECRYPT)
+		rx_filter |= CARL9170_RX_FILTER_DECRY_FAIL;
+
+	hdr = ar9170_get_rx_i3e(desc);
+	if (likely(ieee80211_is_data(hdr->frame_control))) {
+		rx_filter |= CARL9170_RX_FILTER_DATA;
+	} else if (ieee80211_is_ctl(hdr->frame_control)) {
+		switch (le16_to_cpu(hdr->frame_control) & IEEE80211_FCTL_STYPE) {
+		case IEEE80211_STYPE_BACK_REQ:
+			handle_bar(desc, hdr, data_len, mac_err);
+			rx_filter |= CARL9170_RX_FILTER_CTL_BACKR;
+			break;
+		case IEEE80211_STYPE_PSPOLL:
+			rx_filter |= CARL9170_RX_FILTER_CTL_PSPOLL;
+			break;
+		case IEEE80211_STYPE_BACK:
+			if (fw.wlan.queued_bar) {
+				/*
+				 * Don't filter block acks when the application
+				 * has queued BARs. This is because the firmware
+				 * can't do the accouting and the application
+				 * has to sort out if the BA belongs to any BARs.
+				 */
+				break;
+			}
+			/* otherwise fall through */
+		default:
+			rx_filter |= CARL9170_RX_FILTER_CTL_OTHER;
+			break;
+		}
+	} else {
+		/* ieee80211_is_mgmt */
+		rx_filter |= CARL9170_RX_FILTER_MGMT;
+	}
+
+	if (unlikely(fw.suspend_mode == CARL9170_HOST_SUSPENDED)) {
+		wol_rx(rx_filter, hdr, min(data_len,
+			(unsigned int)AR9170_BLOCK_SIZE));
+	}
+
+#undef AR9170_RX_ERROR_BAD
+
+	return rx_filter;
+}
+
+static void handle_rx(void)
+{
+	struct dma_desc *desc;
+
+	for_each_desc_not_bits(desc, &fw.wlan.rx_queue, AR9170_OWN_BITS_HW) {
+		if (!(wlan_rx_filter(desc) & fw.wlan.rx_filter)) {
+			dma_put(&fw.pta.up_queue, desc);
+			up_trigger();
+		} else {
+			dma_reclaim(&fw.wlan.rx_queue, desc);
+			wlan_trigger(AR9170_DMA_TRIGGER_RXQ);
+		}
+	}
+}
+
+#ifdef CONFIG_CARL9170FW_CAB_QUEUE
+void wlan_cab_flush_queue(const unsigned int vif)
+{
+	struct dma_queue *cab_queue = &fw.wlan.cab_queue[vif];
+	struct dma_desc *desc;
+
+	/* move queued frames into the main tx queues */
+	for_each_desc(desc, cab_queue) {
+		struct carl9170_tx_superframe *super = get_super(desc);
+		if (!queue_empty(cab_queue)) {
+			/*
+			 * Set MOREDATA flag for all,
+			 * but the last queued frame.
+			 * see: 802.11-2007 11.2.1.5 f)
+			 *
+			 * This is actually the reason to why
+			 * we need to prevent the reentry.
+			 */
+
+			super->f.data.i3e.frame_control |=
+				cpu_to_le16(IEEE80211_FCTL_MOREDATA);
+		} else {
+			super->f.data.i3e.frame_control &=
+				cpu_to_le16(~IEEE80211_FCTL_MOREDATA);
+		}
+
+		/* ready to roll! */
+		_wlan_tx(desc);
+		__wlan_tx(desc);
+		wlan_trigger(BIT(super->s.queue));
+	}
+}
+
+static uint8_t *beacon_find_ie(uint8_t ie, void *addr,
+			       const unsigned int len)
+{
+	struct ieee80211_mgmt *mgmt = addr;
+	uint8_t *pos, *end;
+
+	pos = mgmt->u.beacon.variable;
+	end = (uint8_t *) ((unsigned long)mgmt + (len - FCS_LEN));
+	while (pos < end) {
+		if (pos + 2 + pos[1] > end)
+			return NULL;
+
+		if (pos[0] == ie)
+			return pos;
+
+		pos += pos[1] + 2;
+	}
+
+	return NULL;
+}
+
+void wlan_modify_beacon(const unsigned int vif,
+	const unsigned int addr, const unsigned int len)
+{
+	uint8_t *_ie;
+	struct ieee80211_tim_ie *ie;
+
+	_ie = beacon_find_ie(WLAN_EID_TIM, (void *)addr, len);
+	if (likely(_ie)) {
+		ie = (struct ieee80211_tim_ie *) &_ie[2];
+
+		if (!queue_empty(&fw.wlan.cab_queue[vif]) && (ie->dtim_count == 0)) {
+			/* schedule DTIM transfer */
+			fw.wlan.cab_flush_trigger[vif] = CARL9170_CAB_TRIGGER_ARMED;
+		} else if ((fw.wlan.cab_queue_len[vif] == 0) && (fw.wlan.cab_flush_trigger[vif])) {
+			/* undo all chances to the beacon structure */
+			ie->bitmap_ctrl &= ~0x1;
+			fw.wlan.cab_flush_trigger[vif] = CARL9170_CAB_TRIGGER_EMPTY;
+		}
+
+		/* Triggered by CARL9170_CAB_TRIGGER_ARMED || CARL9170_CAB_TRIGGER_DEFER */
+		if (fw.wlan.cab_flush_trigger[vif]) {
+			/* Set the almighty Multicast Traffic Indication Bit. */
+			ie->bitmap_ctrl |= 0x1;
+		}
+	}
+
+	/*
+	 * Ideally, the sequence number should be assigned by the TX arbiter
+	 * hardware. But AFAIK that's not possible, so we have to go for the
+	 * next best thing and write it into the beacon fifo during the open
+	 * beacon update window.
+	 */
+
+	wlan_assign_seq((struct ieee80211_hdr *)addr, vif);
+}
+
+static void wlan_send_buffered_cab(void)
+{
+	unsigned int i;
+
+	for (i = 0; i < CARL9170_INTF_NUM; i++) {
+		if (unlikely(fw.wlan.cab_flush_trigger[i] == CARL9170_CAB_TRIGGER_ARMED)) {
+			/*
+			 * This is hardcoded into carl9170usb driver.
+			 *
+			 * The driver must set the PRETBTT event to beacon_interval -
+			 * CARL9170_PRETBTT_KUS (usually 6) Kus.
+			 *
+			 * But still, we can only do so much about 802.11-2007 9.3.2.1 &
+			 * 11.2.1.6. Let's hope the current solution is adequate enough.
+			 */
+
+			if (is_after_msecs(fw.wlan.cab_flush_time, (CARL9170_TBTT_DELTA))) {
+				wlan_cab_flush_queue(i);
+
+				/*
+				 * This prevents the code from sending new BC/MC frames
+				 * which were queued after the previous buffered traffic
+				 * has been sent out... They will have to wait until the
+				 * next DTIM beacon comes along.
+				 */
+				fw.wlan.cab_flush_trigger[i] = CARL9170_CAB_TRIGGER_DEFER;
+			}
+		}
+
+	}
+}
+#endif /* CONFIG_CARL9170FW_CAB_QUEUE */
+
+static void handle_beacon_config(void)
+{
+	uint32_t bcn_count;
+
+	bcn_count = get(AR9170_MAC_REG_BCN_COUNT);
+	send_cmd_to_host(4, CARL9170_RSP_BEACON_CONFIG, 0x00,
+			 (uint8_t *) &bcn_count);
+}
+
+static void handle_pretbtt(void)
+{
+#ifdef CONFIG_CARL9170FW_CAB_QUEUE
+	fw.wlan.cab_flush_time = get_clock_counter();
+#endif /* CONFIG_CARL9170FW_CAB_QUEUE */
+
+#ifdef CONFIG_CARL9170FW_RADIO_FUNCTIONS
+	rf_psm();
+
+	send_cmd_to_host(4, CARL9170_RSP_PRETBTT, 0x00,
+			 (uint8_t *) &fw.phy.psm.state);
+#endif /* CONFIG_CARL9170FW_RADIO_FUNCTIONS */
+}
+
+static void handle_atim(void)
+{
+	send_cmd_to_host(0, CARL9170_RSP_ATIM, 0x00, NULL);
+}
+
+#ifdef CONFIG_CARL9170FW_DEBUG
+static void handle_qos(void)
+{
+	/*
+	 * What is the QoS Bit used for?
+	 * Is it only an indicator for TXOP & Burst, or
+	 * should we do something here?
+	 */
+}
+
+static void handle_radar(void)
+{
+	send_cmd_to_host(0, CARL9170_RSP_RADAR, 0x00, NULL);
+}
+#endif /* CONFIG_CARL9170FW_DEBUG */
+
+static void wlan_janitor(void)
+{
+#ifdef CONFIG_CARL9170FW_CAB_QUEUE
+	wlan_send_buffered_cab();
+#endif /* CONFIG_CARL9170FW_CAB_QUEUE */
+
+	wlan_send_buffered_tx_status();
+
+	wlan_send_buffered_ba();
+
+	wol_janitor();
+}
+
+void handle_wlan(void)
+{
+	uint32_t intr;
+
+	intr = get(AR9170_MAC_REG_INT_CTRL);
+	/* ACK Interrupt */
+	set(AR9170_MAC_REG_INT_CTRL, intr);
+
+#define HANDLER(intr, flag, func)			\
+	do {						\
+		if ((intr & flag) != 0) {		\
+			func();				\
+		}					\
+	} while (0)
+
+	intr |= fw.wlan.soft_int;
+	fw.wlan.soft_int = 0;
+
+	HANDLER(intr, AR9170_MAC_INT_PRETBTT, handle_pretbtt);
+
+	HANDLER(intr, AR9170_MAC_INT_ATIM, handle_atim);
+
+	HANDLER(intr, AR9170_MAC_INT_RXC, handle_rx);
+
+	HANDLER(intr, (AR9170_MAC_INT_TXC | AR9170_MAC_INT_RETRY_FAIL),
+		handle_tx_completion);
+
+#ifdef CONFIG_CARL9170FW_DEBUG
+	HANDLER(intr, AR9170_MAC_INT_QOS, handle_qos);
+
+	HANDLER(intr, AR9170_MAC_INT_RADAR, handle_radar);
+#endif /* CONFIG_CARL9170FW_DEBUG */
+
+	HANDLER(intr, AR9170_MAC_INT_CFG_BCN, handle_beacon_config);
+
+	if (unlikely(intr))
+		DBG("Unhandled Interrupt %x\n", (unsigned int) intr);
+
+	wlan_janitor();
+
+#undef HANDLER
+}
+
+enum {
+	CARL9170FW_TX_MAC_BUMP = 4,
+	CARL9170FW_TX_MAC_DEBUG = 6,
+	CARL9170FW_TX_MAC_RESET = 7,
+};
+
+static void wlan_check_hang(void)
+{
+	struct dma_desc *desc;
+	int i;
+
+	for (i = AR9170_TXQ_SPECIAL; i >= AR9170_TXQ0; i--) {
+		if (queue_empty(&fw.wlan.tx_queue[i])) {
+			/* Nothing to do here... move along */
+			continue;
+		}
+
+		/* fetch the current DMA queue position */
+		desc = (struct dma_desc *)get_wlan_txq_addr(i);
+
+		/* Stuck frame detection */
+		if (unlikely(DESC_PAYLOAD(desc) == fw.wlan.last_super[i])) {
+			fw.wlan.last_super_num[i]++;
+
+			if (unlikely(fw.wlan.last_super_num[i] >= CARL9170FW_TX_MAC_RESET)) {
+				/*
+				 * schedule MAC reset (aka OFF/ON => dead)
+				 *
+				 * This will almost certainly kill
+				 * the device for good, but it's the
+				 * recommended thing to do...
+				 */
+
+				fw.wlan.mac_reset++;
+			}
+
+#ifdef CONFIG_CARL9170FW_DEBUG
+			if (unlikely(fw.wlan.last_super_num[i] >= CARL9170FW_TX_MAC_DEBUG)) {
+				/*
+				 * Sigh, the queue is almost certainly
+				 * dead. Dump the queue content to the
+				 * user, maybe we find out why it got
+				 * so stuck.
+				 */
+
+				wlan_dump_queue(i);
+			}
+#endif /* CONFIG_CARL9170FW_DEBUG */
+
+#ifdef CONFIG_CARL9170FW_DMA_QUEUE_BUMP
+			if (unlikely(fw.wlan.last_super_num[i] >= CARL9170FW_TX_MAC_BUMP)) {
+				/*
+				 * Hrrm, bump the queue a bit.
+				 * maybe this will get it going again.
+				 */
+
+				wlan_dma_bump(i);
+				wlan_trigger(BIT(i));
+			}
+#endif /* CONFIG_CARL9170FW_DMA_QUEUE_BUMP */
+		} else {
+			/* Nothing stuck */
+			fw.wlan.last_super[i] = DESC_PAYLOAD(desc);
+			fw.wlan.last_super_num[i] = 0;
+		}
+	}
+}
+
+#ifdef CONFIG_CARL9170FW_FW_MAC_RESET
+/*
+ * NB: Resetting the MAC is a two-edged sword.
+ * On most occasions, it does what it is supposed to do.
+ * But there is a chance that this will make it
+ * even worse and the radio dies silently.
+ */
+static void wlan_mac_reset(void)
+{
+	uint32_t val;
+	uint32_t agg_wait_counter;
+	uint32_t agg_density;
+	uint32_t bcn_start_addr;
+	uint32_t rctl, rcth;
+	uint32_t cam_mode;
+	uint32_t ack_power;
+	uint32_t rts_cts_tpc;
+	uint32_t rts_cts_rate;
+	int i;
+
+#ifdef CONFIG_CARL9170FW_RADIO_FUNCTIONS
+	uint32_t rx_BB;
+#endif /* CONFIG_CARL9170FW_RADIO_FUNCTIONS */
+
+#ifdef CONFIG_CARL9170FW_NOISY_MAC_RESET
+	INFO("MAC RESET");
+#endif /* CONFIG_CARL9170FW_NOISY_MAC_RESET */
+
+	/* Save aggregation parameters */
+	agg_wait_counter = get(AR9170_MAC_REG_AMPDU_FACTOR);
+	agg_density = get(AR9170_MAC_REG_AMPDU_DENSITY);
+
+	bcn_start_addr = get(AR9170_MAC_REG_BCN_ADDR);
+
+	cam_mode = get(AR9170_MAC_REG_CAM_MODE);
+	rctl = get(AR9170_MAC_REG_CAM_ROLL_CALL_TBL_L);
+	rcth = get(AR9170_MAC_REG_CAM_ROLL_CALL_TBL_H);
+
+	ack_power = get(AR9170_MAC_REG_ACK_TPC);
+	rts_cts_tpc = get(AR9170_MAC_REG_RTS_CTS_TPC);
+	rts_cts_rate = get(AR9170_MAC_REG_RTS_CTS_RATE);
+
+#ifdef CONFIG_CARL9170FW_RADIO_FUNCTIONS
+	/* 0x1c8960 write only */
+	rx_BB = get(AR9170_PHY_REG_SWITCH_CHAIN_0);
+#endif /* CONFIG_CARL9170FW_RADIO_FUNCTIONS */
+
+	/* TX/RX must be stopped by now */
+	val = get(AR9170_MAC_REG_POWER_STATE_CTRL);
+
+	val |= AR9170_MAC_POWER_STATE_CTRL_RESET;
+
+	/*
+	 * Manipulate CCA threshold to stop transmission
+	 *
+	 * set(AR9170_PHY_REG_CCA_THRESHOLD, 0x300);
+	 */
+
+	/*
+	 * check Rx state in 0(idle) 9(disable)
+	 *
+	 * chState = (get(AR9170_MAC_REG_MISC_684) >> 16) & 0xf;
+	 * while( (chState != 0) && (chState != 9)) {
+	 *	chState = (get(AR9170_MAC_REG_MISC_684) >> 16) & 0xf;
+	 * }
+	 */
+
+	set(AR9170_MAC_REG_POWER_STATE_CTRL, val);
+
+	delay(2);
+
+	/* Restore aggregation parameters */
+	set(AR9170_MAC_REG_AMPDU_FACTOR, agg_wait_counter);
+	set(AR9170_MAC_REG_AMPDU_DENSITY, agg_density);
+
+	set(AR9170_MAC_REG_BCN_ADDR, bcn_start_addr);
+	set(AR9170_MAC_REG_CAM_MODE, cam_mode);
+	set(AR9170_MAC_REG_CAM_ROLL_CALL_TBL_L, rctl);
+	set(AR9170_MAC_REG_CAM_ROLL_CALL_TBL_H, rcth);
+
+	set(AR9170_MAC_REG_RTS_CTS_TPC, rts_cts_tpc);
+	set(AR9170_MAC_REG_ACK_TPC, ack_power);
+	set(AR9170_MAC_REG_RTS_CTS_RATE, rts_cts_rate);
+
+#ifdef CONFIG_CARL9170FW_RADIO_FUNCTIONS
+	set(AR9170_PHY_REG_SWITCH_CHAIN_2, rx_BB);
+#endif /* CONFIG_CARL9170FW_RADIO_FUNCTIONS */
+
+	/*
+	 * Manipulate CCA threshold to resume transmission
+	 *
+	 * set(AR9170_PHY_REG_CCA_THRESHOLD, 0x0);
+	 */
+
+	val = AR9170_DMA_TRIGGER_RXQ;
+	/* Reinitialize all WLAN TX DMA queues. */
+	for (i = AR9170_TXQ_SPECIAL; i >= AR9170_TXQ0; i--) {
+		struct dma_desc *iter;
+
+		__for_each_desc_bits(iter, &fw.wlan.tx_queue[i], AR9170_OWN_BITS_SW);
+
+		/* kill the stuck frame */
+		if (!is_terminator(&fw.wlan.tx_queue[i], iter) &&
+		    fw.wlan.last_super_num[i] >= CARL9170FW_TX_MAC_RESET &&
+		    fw.wlan.last_super[i] == DESC_PAYLOAD(iter)) {
+			struct carl9170_tx_superframe *super = get_super(iter);
+
+			iter->status = AR9170_OWN_BITS_SW;
+			/*
+			 * Mark the frame as failed.
+			 * The BAFAIL flag allows the frame to sail through
+			 * wlan_tx_status without much "unstuck" trouble.
+			 */
+			iter->ctrl &= ~(AR9170_CTRL_FAIL);
+			iter->ctrl |= AR9170_CTRL_BAFAIL;
+
+			super->s.cnt = CARL9170_TX_MAX_RATE_TRIES;
+			super->s.rix = CARL9170_TX_MAX_RETRY_RATES;
+
+			fw.wlan.last_super_num[i] = 0;
+			fw.wlan.last_super[i] = NULL;
+			iter = iter->lastAddr->nextAddr;
+		}
+
+		set_wlan_txq_dma_addr(i, (uint32_t) iter);
+		if (!is_terminator(&fw.wlan.tx_queue[i], iter))
+			val |= BIT(i);
+
+		DBG("Q:%d l:%d h:%p t:%p cu:%p it:%p ct:%x st:%x\n", i, queue_len(&fw.wlan.tx_queue[i]),
+		     fw.wlan.tx_queue[i].head, fw.wlan.tx_queue[i].terminator,
+		     get_wlan_txq_addr(i), iter, iter->ctrl, iter->status);
+	}
+
+	fw.wlan.soft_int |= AR9170_MAC_INT_RXC | AR9170_MAC_INT_TXC |
+			    AR9170_MAC_INT_RETRY_FAIL;
+
+	set(AR9170_MAC_REG_DMA_RXQ_ADDR, (uint32_t) fw.wlan.rx_queue.head);
+	wlan_trigger(val);
+}
+#else
+static void wlan_mac_reset(void)
+{
+	/* The driver takes care of reinitializing the device */
+	BUG("MAC RESET");
+}
+#endif /* CONFIG_CARL9170FW_FW_MAC_RESET */
+
+void __cold wlan_timer(void)
+{
+	unsigned int cached_mac_reset;
+
+	cached_mac_reset = fw.wlan.mac_reset;
+
+	/* TX Queue Hang check */
+	wlan_check_hang();
+
+	/* RX Overrun check */
+	wlan_check_rx_overrun();
+
+	if (unlikely(fw.wlan.mac_reset >= CARL9170_MAC_RESET_RESET)) {
+		wlan_mac_reset();
+		fw.wlan.mac_reset = CARL9170_MAC_RESET_OFF;
+	} else {
+		if (fw.wlan.mac_reset && cached_mac_reset == fw.wlan.mac_reset)
+			fw.wlan.mac_reset--;
+	}
+}
diff --git a/carl9170fw/carlfw/src/wol.c b/carl9170fw/carlfw/src/wol.c
new file mode 100644
index 0000000..7afb8e5
--- /dev/null
+++ b/carl9170fw/carlfw/src/wol.c
@@ -0,0 +1,287 @@
+/*
+ * carl9170 firmware - used by the ar9170 wireless device
+ *
+ * WakeUp on WLAN functions
+ *
+ * Copyright 2011	Christian Lamparter <chunkeey@googlemail.com>
+ *
+ * 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; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include "carl9170.h"
+#include "shared/phy.h"
+#include "timer.h"
+#include "wl.h"
+#include "printf.h"
+#include "rf.h"
+#include "wol.h"
+#include "linux/ieee80211.h"
+
+#ifdef CONFIG_CARL9170FW_WOL
+
+void wol_cmd(const struct carl9170_wol_cmd *cmd)
+{
+	memcpy(&fw.wol.cmd, cmd, sizeof(cmd));
+}
+
+void wol_prepare(void)
+{
+	/* set MAC filter */
+	memcpy((void *)AR9170_MAC_REG_MAC_ADDR_L, fw.wol.cmd.mac, 6);
+	memcpy((void *)AR9170_MAC_REG_BSSID_L, fw.wol.cmd.bssid, 6);
+	set(AR9170_MAC_REG_RX_CONTROL, AR9170_MAC_RX_CTRL_DEAGG);
+
+	/* set filter policy to: discard everything */
+	fw.wlan.rx_filter = CARL9170_RX_FILTER_EVERYTHING;
+
+	/* reenable rx dma */
+	wlan_trigger(AR9170_DMA_TRIGGER_RXQ);
+
+	/* initialize the last_beacon timer */
+	fw.wol.last_null = fw.wol.last_beacon = get_clock_counter();
+}
+
+#ifdef CONFIG_CARL9170FW_WOL_NL80211_TRIGGERS
+static bool wlan_rx_wol_magic_packet(const struct ieee80211_hdr *hdr, const unsigned int len)
+{
+	const unsigned char *data, *end, *mac;
+	unsigned int found = 0;
+
+	/*
+	 * LIMITATION:
+	 * We can only scan the first AR9170_BLOCK_SIZE [=~320] bytes
+	 * for MAGIC patterns!
+	 */
+
+	mac = (const unsigned char *) AR9170_MAC_REG_MAC_ADDR_L;
+
+	data = (u8 *)((unsigned long)hdr + ieee80211_hdrlen(hdr->frame_control));
+	end = (u8 *)((unsigned long)hdr + len);
+
+	/*
+	 * scan for standard WOL Magic frame
+	 *
+	 * "A physical WakeOnLAN (Magic Packet) will look like this:
+	 * ---------------------------------------------------------------
+	 * | Synchronization Stream | Target MAC |  Password (optional)	 |
+	 * |	6 octets	    | 96 octets  |   0, 4 or 6		 |
+	 * ---------------------------------------------------------------
+	 *
+	 * The Synchronization Stream is defined as 6 bytes of FFh.
+	 * The Target MAC block contains 16 duplications of the IEEEaddress
+	 * of the target, with no breaks or interruptions.
+	 *
+	 * The Password field is optional, but if present, contains either
+	 * 4 bytes or 6 bytes. The WakeOnLAN dissector was implemented to
+	 * dissect the password, if present, according to the command-line
+	 * format that ether-wake uses, therefore, if a 4-byte password is
+	 * present, it will be dissected as an IPv4 address and if a 6-byte
+	 * password is present, it will be dissected as an Ethernet address.
+	 *
+	 * <http://wiki.wireshark.org/WakeOnLAN>
+	 */
+
+	while (data < end) {
+		if (found >= 6) {
+			if (*data == mac[found % 6])
+				found++;
+			else
+				found = 0;
+		}
+
+		/* previous check might reset found counter */
+		if (found < 6) {
+			if (*data == 0xff)
+				found++;
+			else
+				found = 0;
+		}
+
+		if (found == (6 + 16 * 6))
+			return true;
+
+		data++;
+	}
+
+	return false;
+}
+
+static void wlan_wol_connect_callback(void __unused *dummy, bool success)
+{
+	if (success)
+		fw.wol.lost_null = 0;
+	else
+		fw.wol.lost_null++;
+}
+
+static void wlan_wol_connection_monitor(void)
+{
+	struct carl9170_tx_null_superframe *nullf = &dma_mem.reserved.cmd.null;
+	struct ieee80211_hdr *null = (struct ieee80211_hdr *) &nullf->f.null;
+
+	if (!fw.wlan.fw_desc_available)
+		return;
+
+	memset(nullf, 0, sizeof(*nullf));
+
+	nullf->s.len = sizeof(struct carl9170_tx_superdesc) +
+		     sizeof(struct ar9170_tx_hwdesc) +
+		     sizeof(struct ieee80211_hdr);
+	nullf->s.ri[0].tries = 3;
+	nullf->s.assign_seq = true;
+	nullf->s.queue = AR9170_TXQ_VO;
+	nullf->f.hdr.length = sizeof(struct ieee80211_hdr) + FCS_LEN;
+
+	nullf->f.hdr.mac.backoff = 1;
+	nullf->f.hdr.mac.hw_duration = 1;
+	nullf->f.hdr.mac.erp_prot = AR9170_TX_MAC_PROT_RTS;
+
+	nullf->f.hdr.phy.modulation = AR9170_TX_PHY_MOD_OFDM;
+	nullf->f.hdr.phy.bandwidth = AR9170_TX_PHY_BW_20MHZ;
+	nullf->f.hdr.phy.chains = AR9170_TX_PHY_TXCHAIN_2;
+	nullf->f.hdr.phy.tx_power = 29; /* 14.5 dBm */
+	nullf->f.hdr.phy.mcs = AR9170_TXRX_PHY_RATE_OFDM_6M;
+
+	/* format outgoing nullfunc */
+	null->frame_control = cpu_to_le16(IEEE80211_FTYPE_DATA |
+		IEEE80211_STYPE_NULLFUNC | IEEE80211_FCTL_TODS);
+
+	memcpy(null->addr1, fw.wol.cmd.bssid, 6);
+	memcpy(null->addr2, fw.wol.cmd.mac, 6);
+	memcpy(null->addr3, fw.wol.cmd.bssid, 6);
+
+	wlan_tx_fw(&nullf->s, wlan_wol_connect_callback);
+}
+
+static bool wlan_rx_wol_disconnect(const unsigned int rx_filter,
+				   const struct ieee80211_hdr *hdr,
+				   const unsigned int __unused len)
+{
+	const unsigned char *bssid;
+	bssid = (const unsigned char *) AR9170_MAC_REG_BSSID_L;
+
+	/* should catch both broadcast and unicast MLMEs */
+	if (!(rx_filter & CARL9170_RX_FILTER_OTHER_RA)) {
+		if (ieee80211_is_deauth(hdr->frame_control) ||
+		    ieee80211_is_disassoc(hdr->frame_control))
+			return true;
+	}
+
+	if (ieee80211_is_beacon(hdr->frame_control) &&
+	    compare_ether_address(hdr->addr3, bssid)) {
+		fw.wol.last_beacon = get_clock_counter();
+	}
+
+	return false;
+}
+
+#endif /* CARL9170FW_WOL_NL80211_TRIGGERS */
+
+#ifdef CONFIG_CARL9170FW_WOL_PROBE_REQUEST
+
+/*
+ * Note: CONFIG_CARL9170FW_WOL_PROBE_REQUEST_SSID is not a real
+ * string. We have to be careful not to add a \0 at the end.
+ */
+static const struct {
+	u8 ssid_ie;
+	u8 ssid_len;
+	u8 ssid[sizeof(CONFIG_CARL9170FW_WOL_PROBE_REQUEST_SSID) - 1];
+} __packed probe_req = {
+	.ssid_ie = WLAN_EID_SSID,
+	.ssid_len = sizeof(CONFIG_CARL9170FW_WOL_PROBE_REQUEST_SSID) - 1,
+	.ssid = CONFIG_CARL9170FW_WOL_PROBE_REQUEST_SSID,
+};
+
+static bool wlan_rx_wol_probe_ssid(const struct ieee80211_hdr *hdr, const unsigned int len)
+{
+	const unsigned char *data, *end, *scan = (void *) &probe_req;
+
+	/*
+	 * IEEE 802.11-2007 7.3.2.1 specifies that the SSID is no
+	 * longer than 32 octets.
+	 */
+	BUILD_BUG_ON((sizeof(CONFIG_CARL9170FW_WOL_PROBE_REQUEST_SSID) - 1) > 32);
+
+	if (ieee80211_is_probe_req(hdr->frame_control)) {
+		unsigned int i;
+		end = (u8 *)((unsigned long)hdr + len);
+
+		/*
+		 * The position of the SSID information element inside
+		 * a probe request frame is more or less "fixed".
+		 */
+		data = (u8 *)((struct ieee80211_mgmt *)hdr)->u.probe_req.variable;
+		for (i = 0; i < (unsigned int)(probe_req.ssid_len + 1); i++) {
+			if (data > end || scan[i] != data[i])
+				return false;
+		}
+
+		return true;
+	}
+
+	return false;
+}
+#endif /* CONFIG_CARL9170FW_WOL_PROBE_REQUEST */
+
+void wol_rx(const unsigned int rx_filter __unused, const struct ieee80211_hdr *hdr __unused, const unsigned int len __unused)
+{
+#ifdef CONFIG_CARL9170FW_WOL_NL80211_TRIGGERS
+	/* Disconnect is always enabled */
+	if (fw.wol.cmd.flags & CARL9170_WOL_DISCONNECT &&
+	    rx_filter & CARL9170_RX_FILTER_MGMT)
+		fw.wol.wake_up |= wlan_rx_wol_disconnect(rx_filter, hdr, len);
+
+	if (fw.wol.cmd.flags & CARL9170_WOL_MAGIC_PKT &&
+	    rx_filter & CARL9170_RX_FILTER_DATA)
+		fw.wol.wake_up |= wlan_rx_wol_magic_packet(hdr, len);
+#endif /* CONFIG_CARL9170FW_WOL_NL80211_TRIGGERS */
+
+#ifdef CONFIG_CARL9170FW_WOL_PROBE_REQUEST
+	if (rx_filter & CARL9170_RX_FILTER_MGMT)
+		fw.wol.wake_up |= wlan_rx_wol_probe_ssid(hdr, len);
+#endif /* CONFIG_CARL9170FW_WOL_PROBE_REQUEST */
+}
+
+void wol_janitor(void)
+{
+	if (unlikely(fw.suspend_mode == CARL9170_HOST_SUSPENDED)) {
+#ifdef CONFIG_CARL9170FW_WOL_NL80211_TRIGGERS
+		if (fw.wol.cmd.flags & CARL9170_WOL_DISCONNECT) {
+			/*
+			 * connection lost after 10sec without receiving
+			 * a beacon
+			  */
+			if (is_after_msecs(fw.wol.last_beacon, 10000))
+				fw.wol.wake_up |= true;
+
+			if (fw.wol.cmd.null_interval &&
+			    is_after_msecs(fw.wol.last_null, fw.wol.cmd.null_interval))
+				wlan_wol_connection_monitor();
+
+			if (fw.wol.lost_null >= 5)
+				fw.wol.wake_up |= true;
+		}
+#endif /* CONFIG_CARL9170FW_WOL_NL80211_TRIGGERS */
+
+		if (fw.wol.wake_up) {
+			fw.suspend_mode = CARL9170_AWAKE_HOST;
+			set(AR9170_USB_REG_WAKE_UP, AR9170_USB_WAKE_UP_WAKE);
+		}
+	}
+}
+#else
+
+#endif /* CONFIG_CARL9170FW_WOL */
diff --git a/carl9170fw/carlfw/usb/Kconfig b/carl9170fw/carlfw/usb/Kconfig
new file mode 100644
index 0000000..dc70776
--- /dev/null
+++ b/carl9170fw/carlfw/usb/Kconfig
@@ -0,0 +1,37 @@
+menu "USB Firmware Configuration Settings"
+
+config CARL9170FW_USB_STANDARD_CMDS
+	def_bool y
+	prompt "Basic USB Interface"
+	---help---
+	 Allows the device to be queried about Standard USB 2.0 Device
+	 Description Descriptors.
+
+	 Say Y, unless you don't care if lsusb -v fails.
+
+config CARL9170FW_USB_UP_STREAM
+	def_bool y
+	prompt "USB Upload Stream"
+	---help---
+	 This features allows the USB silicon to combine small, single
+	 frames into bigger transfers. This can help to reduce
+	 some per-transfer overhead in the application.
+
+	 Say Y, unless you have experienced strange rx corruptions.
+
+config CARL9170FW_USB_DN_STREAM
+	def_bool n
+	prompt "USB Download Stream"
+
+config CARL9170FW_DEBUG_USB
+	def_bool y
+	prompt "Pass debug messages through USB transport"
+	---help---
+	 Report all firmware messages through the USB transport.
+	 But there is a catch: In case of a BUG, the USB transport
+	 needs to be functional, otherwise the application won't
+	 receive anything.
+
+	 Say Y.
+
+endmenu
diff --git a/carl9170fw/carlfw/usb/fifo.c b/carl9170fw/carlfw/usb/fifo.c
new file mode 100644
index 0000000..d5c2e12
--- /dev/null
+++ b/carl9170fw/carlfw/usb/fifo.c
@@ -0,0 +1,206 @@
+/*
+ * carl9170 firmware - used by the ar9170 wireless device
+ *
+ * Copyright (c) 2000-2005  ZyDAS Technology Corporation
+ * Copyright (c) 2007-2009 Atheros Communications, Inc.
+ * Copyright	2009	Johannes Berg <johannes@sipsolutions.net>
+ * Copyright 2009-2011	Christian Lamparter <chunkeey@googlemail.com>
+ *
+ * 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; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include "carl9170.h"
+#include "printf.h"
+#include "rom.h"
+#include "usb_fifo.h"
+
+/* TODO / TOTEST */
+#ifdef CONFIG_CARL9170FW_USB_MODESWITCH
+static inline void usb_ep_map(const uint8_t ep, const uint8_t map)
+{
+	setb(AR9170_USB_REG_EP_MAP + (ep - 1), map);
+}
+
+static inline void usb_fifo_map(const uint8_t fifo, const uint8_t map)
+{
+	setb(AR9170_USB_REG_FIFO_MAP + (fifo - 1), map);
+}
+
+static inline void usb_fifo_config(const uint8_t fifo, const uint8_t cfg)
+{
+	setb(AR9170_USB_REG_FIFO_CONFIG + (fifo - 1), cfg);
+}
+
+static inline void usb_ep_packet_size_hi(const uint8_t ep, const uint8_t dir,
+			     const uint16_t size)
+{
+	setb(AR9170_USB_REG_EP_IN_MAX_SIZE_HIGH + (((dir * 0x20) + ep) << 1),
+	     (size >> 8) & 0xf);
+}
+
+static inline void usb_ep_packet_size_lo(const uint8_t ep, const uint8_t dir,
+			    const uint16_t size)
+{
+	setb(AR9170_USB_REG_EP_IN_MAX_SIZE_LOW + (((dir * 0x20) + ep) << 1),
+	     size & 0xff);
+}
+
+static void usb_ep_in_highbandset(const uint8_t ep, const uint8_t dir,
+				const uint16_t size)
+{
+	andb(AR9170_USB_REG_EP_IN_MAX_SIZE_HIGH + (ep << 1), ~(BIT(6) | BIT(5)));
+
+	switch (dir) {
+	case DIRECTION_IN:
+		setb(AR9170_USB_REG_EP_IN_MAX_SIZE_HIGH + (ep << 1),
+		     ((size >> 11) + 1) << 5);
+		break;
+	case DIRECTION_OUT:
+	default:
+		break;
+	}
+}
+
+/*
+ *      vUsbFIFO_EPxCfg_HS(void)
+ *      Description:
+ *          1. Configure the FIFO and EPx map
+ *      input: none
+ *      output: none
+ */
+
+void usb_init_highspeed_fifo_cfg(void)
+{
+	int i;
+
+	/* EP 1 */
+	usb_ep_map(1, HS_C1_I0_A0_EP1_MAP);
+	usb_fifo_map(HS_C1_I0_A0_EP1_FIFO_START, HS_C1_I0_A0_EP1_FIFO_MAP);
+	usb_fifo_config(HS_C1_I0_A0_EP1_FIFO_START, HS_C1_I0_A0_EP1_FIFO_CONFIG);
+
+	for (i = HS_C1_I0_A0_EP1_FIFO_START + 1;
+	     i < HS_C1_I0_A0_EP1_FIFO_START + HS_C1_I0_A0_EP1_FIFO_NO; i++) {
+		usb_fifo_config(i, (HS_C1_I0_A0_EP1_FIFO_CONFIG & (~BIT(7))));
+	}
+
+	usb_ep_packet_size_hi(1, HS_C1_I0_A0_EP1_DIRECTION, (HS_C1_I0_A0_EP1_MAX_PACKET & 0x7ff));
+	usb_ep_packet_size_lo(1, HS_C1_I0_A0_EP1_DIRECTION, (HS_C1_I0_A0_EP1_MAX_PACKET & 0x7ff));
+	usb_ep_in_highbandset(1, HS_C1_I0_A0_EP1_DIRECTION, HS_C1_I0_A0_EP1_MAX_PACKET);
+
+	/* EP 2 */
+	usb_ep_map(2, HS_C1_I0_A0_EP2_MAP);
+	usb_fifo_map(HS_C1_I0_A0_EP2_FIFO_START, HS_C1_I0_A0_EP2_FIFO_MAP);
+	usb_fifo_config(HS_C1_I0_A0_EP2_FIFO_START, HS_C1_I0_A0_EP2_FIFO_CONFIG);
+
+	for (i = HS_C1_I0_A0_EP2_FIFO_START + 1;
+	     i < HS_C1_I0_A0_EP2_FIFO_START + HS_C1_I0_A0_EP2_FIFO_NO; i++) {
+		usb_fifo_config(i, (HS_C1_I0_A0_EP2_FIFO_CONFIG & (~BIT(7))));
+	}
+
+	usb_ep_packet_size_hi(2, HS_C1_I0_A0_EP2_DIRECTION, (HS_C1_I0_A0_EP2_MAX_PACKET & 0x7ff));
+	usb_ep_packet_size_lo(2, HS_C1_I0_A0_EP2_DIRECTION, (HS_C1_I0_A0_EP2_MAX_PACKET & 0x7ff));
+	usb_ep_in_highbandset(2, HS_C1_I0_A0_EP2_DIRECTION, HS_C1_I0_A0_EP2_MAX_PACKET);
+
+	/* EP 3 */
+	usb_ep_map(3, HS_C1_I0_A0_EP3_MAP);
+	usb_fifo_map(HS_C1_I0_A0_EP3_FIFO_START, HS_C1_I0_A0_EP3_FIFO_MAP);
+	usb_fifo_config(HS_C1_I0_A0_EP3_FIFO_START, HS_C1_I0_A0_EP3_FIFO_CONFIG);
+
+	for (i = HS_C1_I0_A0_EP3_FIFO_START + 1;
+	     i < HS_C1_I0_A0_EP3_FIFO_START + HS_C1_I0_A0_EP3_FIFO_NO; i++) {
+		usb_fifo_config(i, (HS_C1_I0_A0_EP3_FIFO_CONFIG & (~BIT(7))));
+	}
+
+	usb_ep_packet_size_hi(3, HS_C1_I0_A0_EP3_DIRECTION, (HS_C1_I0_A0_EP3_MAX_PACKET & 0x7ff));
+	usb_ep_packet_size_lo(3, HS_C1_I0_A0_EP3_DIRECTION, (HS_C1_I0_A0_EP3_MAX_PACKET & 0x7ff));
+	usb_ep_in_highbandset(3, HS_C1_I0_A0_EP3_DIRECTION, HS_C1_I0_A0_EP3_MAX_PACKET);
+
+	/* EP 4 */
+	usb_ep_map(4, HS_C1_I0_A0_EP4_MAP);
+	usb_fifo_map(HS_C1_I0_A0_EP4_FIFO_START, HS_C1_I0_A0_EP4_FIFO_MAP);
+	usb_fifo_config(HS_C1_I0_A0_EP4_FIFO_START, HS_C1_I0_A0_EP4_FIFO_CONFIG);
+
+	for (i = HS_C1_I0_A0_EP4_FIFO_START + 1;
+	     i < HS_C1_I0_A0_EP4_FIFO_START + HS_C1_I0_A0_EP4_FIFO_NO; i++) {
+		usb_fifo_config(i, (HS_C1_I0_A0_EP4_FIFO_CONFIG & (~BIT(7))));
+	}
+
+	usb_ep_packet_size_hi(4, HS_C1_I0_A0_EP4_DIRECTION, (HS_C1_I0_A0_EP4_MAX_PACKET & 0x7ff));
+	usb_ep_packet_size_lo(4, HS_C1_I0_A0_EP4_DIRECTION, (HS_C1_I0_A0_EP4_MAX_PACKET & 0x7ff));
+	usb_ep_in_highbandset(4, HS_C1_I0_A0_EP4_DIRECTION, HS_C1_I0_A0_EP4_MAX_PACKET);
+}
+
+void usb_init_fullspeed_fifo_cfg(void)
+{
+	int i;
+
+	/* EP 1 */
+	usb_ep_map(1, FS_C1_I0_A0_EP1_MAP);
+	usb_fifo_map(FS_C1_I0_A0_EP1_FIFO_START, FS_C1_I0_A0_EP1_FIFO_MAP);
+	usb_fifo_config(FS_C1_I0_A0_EP1_FIFO_START, FS_C1_I0_A0_EP1_FIFO_CONFIG);
+
+	for (i = FS_C1_I0_A0_EP1_FIFO_START + 1;
+	     i < FS_C1_I0_A0_EP1_FIFO_START + FS_C1_I0_A0_EP1_FIFO_NO; i++) {
+		usb_fifo_config(i, (FS_C1_I0_A0_EP1_FIFO_CONFIG & (~BIT(7))));
+	}
+
+	usb_ep_packet_size_hi(1, FS_C1_I0_A0_EP1_DIRECTION, (FS_C1_I0_A0_EP1_MAX_PACKET & 0x7ff));
+	usb_ep_packet_size_lo(1, FS_C1_I0_A0_EP1_DIRECTION, (FS_C1_I0_A0_EP1_MAX_PACKET & 0x7ff));
+	/* ``.JWEI 2003/04/29 */
+	usb_ep_in_highbandset(1, FS_C1_I0_A0_EP1_DIRECTION, FS_C1_I0_A0_EP1_MAX_PACKET);
+
+	/* EP 2 */
+	usb_ep_map(2, FS_C1_I0_A0_EP2_MAP);
+	usb_fifo_map(FS_C1_I0_A0_EP2_FIFO_START, FS_C1_I0_A0_EP2_FIFO_MAP);
+	usb_fifo_config(FS_C1_I0_A0_EP2_FIFO_START, FS_C1_I0_A0_EP2_FIFO_CONFIG);
+
+	for (i = FS_C1_I0_A0_EP2_FIFO_START + 1;
+	     i < FS_C1_I0_A0_EP2_FIFO_START + FS_C1_I0_A0_EP2_FIFO_NO; i++) {
+		usb_fifo_config(i, (FS_C1_I0_A0_EP2_FIFO_CONFIG & (~BIT(7))));
+	}
+
+	usb_ep_packet_size_hi(2, FS_C1_I0_A0_EP2_DIRECTION, (FS_C1_I0_A0_EP2_MAX_PACKET & 0x7ff));
+	usb_ep_packet_size_lo(2, FS_C1_I0_A0_EP2_DIRECTION, (FS_C1_I0_A0_EP2_MAX_PACKET & 0x7ff));
+	usb_ep_in_highbandset(2, FS_C1_I0_A0_EP2_DIRECTION, FS_C1_I0_A0_EP2_MAX_PACKET);
+
+	/* EP 3 */
+	usb_ep_map(3, FS_C1_I0_A0_EP3_MAP);
+	usb_fifo_map(FS_C1_I0_A0_EP3_FIFO_START, FS_C1_I0_A0_EP3_FIFO_MAP);
+	usb_fifo_config(FS_C1_I0_A0_EP3_FIFO_START, FS_C1_I0_A0_EP3_FIFO_CONFIG);
+
+	for (i = FS_C1_I0_A0_EP3_FIFO_START + 1;
+	     i < FS_C1_I0_A0_EP3_FIFO_START + FS_C1_I0_A0_EP3_FIFO_NO; i++) {
+		usb_fifo_config(i, (FS_C1_I0_A0_EP3_FIFO_CONFIG & (~BIT(7))));
+	}
+
+	usb_ep_packet_size_hi(3, FS_C1_I0_A0_EP3_DIRECTION, (FS_C1_I0_A0_EP3_MAX_PACKET & 0x7ff));
+	usb_ep_packet_size_lo(3, FS_C1_I0_A0_EP3_DIRECTION, (FS_C1_I0_A0_EP3_MAX_PACKET & 0x7ff));
+	usb_ep_in_highbandset(3, FS_C1_I0_A0_EP3_DIRECTION, FS_C1_I0_A0_EP3_MAX_PACKET);
+
+	/* EP 4 */
+	usb_ep_map(4, FS_C1_I0_A0_EP4_MAP);
+	usb_fifo_map(FS_C1_I0_A0_EP4_FIFO_START, FS_C1_I0_A0_EP4_FIFO_MAP);
+	usb_fifo_config(FS_C1_I0_A0_EP4_FIFO_START, FS_C1_I0_A0_EP4_FIFO_CONFIG);
+
+	for (i = FS_C1_I0_A0_EP4_FIFO_START + 1;
+	     i < FS_C1_I0_A0_EP4_FIFO_START + FS_C1_I0_A0_EP4_FIFO_NO; i++) {
+		usb_fifo_config(i, (FS_C1_I0_A0_EP4_FIFO_CONFIG & (~BIT(7))));
+	}
+
+	usb_ep_packet_size_hi(4, FS_C1_I0_A0_EP4_DIRECTION, (FS_C1_I0_A0_EP4_MAX_PACKET & 0x7ff));
+	usb_ep_packet_size_lo(4, FS_C1_I0_A0_EP4_DIRECTION, (FS_C1_I0_A0_EP4_MAX_PACKET & 0x7ff));
+	usb_ep_in_highbandset(4, FS_C1_I0_A0_EP4_DIRECTION, FS_C1_I0_A0_EP4_MAX_PACKET);
+}
+#endif /* CONFIG_CARL9170FW_USB_MODESWITCH */
diff --git a/carl9170fw/carlfw/usb/main.c b/carl9170fw/carlfw/usb/main.c
new file mode 100644
index 0000000..890970c
--- /dev/null
+++ b/carl9170fw/carlfw/usb/main.c
@@ -0,0 +1,432 @@
+/*
+ * carl9170 firmware - used by the ar9170 wireless device
+ *
+ * Copyright (c) 2000-2005 ZyDAS Technology Corporation
+ * Copyright (c) 2007-2009 Atheros Communications, Inc.
+ * Copyright	2009	Johannes Berg <johannes@sipsolutions.net>
+ * Copyright 2009-2011	Christian Lamparter <chunkeey@googlemail.com>
+ *
+ * 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; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include "carl9170.h"
+
+#include "shared/phy.h"
+#include "hostif.h"
+#include "printf.h"
+#include "timer.h"
+#include "rom.h"
+#include "wl.h"
+#include "wol.h"
+
+#ifdef CONFIG_CARL9170FW_DEBUG_USB
+void usb_putc(const char c)
+{
+	fw.usb.put_buffer[fw.usb.put_index++] = (uint8_t) c;
+
+	if (fw.usb.put_index == CARL9170_MAX_CMD_PAYLOAD_LEN || c == '\0') {
+		fw.usb.put_buffer[fw.usb.put_index] = 0;
+
+		send_cmd_to_host(__roundup(fw.usb.put_index, 4),
+				 CARL9170_RSP_TEXT, fw.usb.put_index,
+				 fw.usb.put_buffer);
+		fw.usb.put_index = 0;
+	}
+}
+
+void usb_print_hex_dump(const void *buf, int len)
+{
+	unsigned int offset = 0, block = 0;
+	while (len > 0) {
+		block = min(__roundup(len, 4), CARL9170_MAX_CMD_PAYLOAD_LEN);
+
+		send_cmd_to_host(block, CARL9170_RSP_HEXDUMP, len,
+				 (const uint8_t *) buf + offset);
+
+		offset += block;
+		len -= block;
+	}
+}
+#endif /* CONFIG_CARL9170FW_DEBUG_USB */
+
+/* grab a buffer from the interrupt in queue ring-buffer */
+static struct carl9170_rsp *get_int_buf(void)
+{
+	struct carl9170_rsp *tmp;
+
+	/* fetch the _oldest_ buffer from the ring */
+	tmp = &fw.usb.int_buf[fw.usb.int_tail_index];
+
+	/* assign a unique sequence for every response/trap */
+	tmp->hdr.seq = fw.usb.int_tail_index;
+
+	fw.usb.int_tail_index++;
+
+	fw.usb.int_tail_index %= CARL9170_INT_RQ_CACHES;
+	if (fw.usb.int_pending != CARL9170_INT_RQ_CACHES)
+		fw.usb.int_pending++;
+
+	return tmp;
+}
+
+/* Pop up data from Interrupt IN Queue to USB Response buffer */
+static struct carl9170_rsp *dequeue_int_buf(unsigned int space)
+{
+	struct carl9170_rsp *tmp = NULL;
+
+	if (fw.usb.int_pending > 0) {
+		tmp = &fw.usb.int_buf[fw.usb.int_head_index];
+
+		if ((unsigned int)(tmp->hdr.len + 8) > space)
+			return NULL;
+
+		fw.usb.int_head_index++;
+		fw.usb.int_head_index %= CARL9170_INT_RQ_CACHES;
+		fw.usb.int_pending--;
+	}
+
+	return tmp;
+}
+
+static void usb_data_in(void)
+{
+}
+
+static void usb_reg_out(void)
+{
+	uint32_t *regaddr = (uint32_t *) &dma_mem.reserved.cmd;
+	uint16_t usbfifolen, i;
+
+	usb_reset_out();
+
+	usbfifolen = getb(AR9170_USB_REG_EP4_BYTE_COUNT_LOW) |
+		     getb(AR9170_USB_REG_EP4_BYTE_COUNT_HIGH) << 8;
+
+	if (usbfifolen & 0x3)
+		usbfifolen = (usbfifolen >> 2) + 1;
+	else
+		usbfifolen = usbfifolen >> 2;
+
+	for (i = 0; i < usbfifolen; i++)
+		*regaddr++ = get(AR9170_USB_REG_EP4_DATA);
+
+	handle_cmd(get_int_buf());
+
+	usb_trigger_in();
+}
+
+static void usb_status_in(void)
+{
+	struct carl9170_rsp *rsp;
+	unsigned int rem, tlen, elen;
+
+	if (!fw.usb.int_desc_available)
+		return ;
+
+	fw.usb.int_desc_available = 0;
+
+	rem = AR9170_BLOCK_SIZE - AR9170_INT_MAGIC_HEADER_SIZE;
+	tlen = AR9170_INT_MAGIC_HEADER_SIZE;
+
+	usb_reset_in();
+
+	while (fw.usb.int_pending) {
+		rsp = dequeue_int_buf(rem);
+		if (!rsp)
+			break;
+
+		elen = rsp->hdr.len + 4;
+
+		memcpy(DESC_PAYLOAD_OFF(fw.usb.int_desc, tlen), rsp, elen);
+
+		rem -= elen;
+		tlen += elen;
+	}
+
+	if (tlen == AR9170_INT_MAGIC_HEADER_SIZE) {
+		DBG("attempted to send an empty int response!\n");
+		goto reclaim;
+	}
+
+	fw.usb.int_desc->ctrl = AR9170_CTRL_FS_BIT | AR9170_CTRL_LS_BIT;
+	fw.usb.int_desc->totalLen = tlen;
+	fw.usb.int_desc->dataSize = tlen;
+
+	/* Put to UpQ */
+	dma_put(&fw.pta.up_queue, fw.usb.int_desc);
+
+	/* Trigger PTA UP DMA */
+	set(AR9170_PTA_REG_UP_DMA_TRIGGER, 1);
+	usb_trigger_out();
+
+	return ;
+
+reclaim:
+	/* TODO: not sure what to do here */
+	fw.usb.int_desc_available = 1;
+}
+
+void send_cmd_to_host(const uint8_t len, const uint8_t type,
+		      const uint8_t ext, const uint8_t *body)
+{
+	struct carl9170_cmd *resp;
+
+#ifdef CONFIG_CARL9170FW_DEBUG
+	if (unlikely(len > sizeof(resp->data))) {
+		DBG("CMD too long:%x %d\n", type, len);
+		return ;
+	}
+
+	/* Element length must be a multiple of 4. */
+	if (unlikely(len & 0x3)) {
+		DBG("CMD length not mult. of 4:%x %d\n", type, len);
+		return ;
+	}
+#endif /* CONFIG_CARL9170FW_DEBUG */
+
+	resp = (struct carl9170_cmd *) get_int_buf();
+	if (unlikely(resp == NULL)) {
+		/* not very helpful for NON UART users */
+		DBG("out of msg buffers\n");
+		return ;
+	}
+
+	resp->hdr.len = len;
+	resp->hdr.cmd = type;
+	resp->hdr.ext = ext;
+
+	memcpy(resp->data, body, len);
+	usb_trigger_in();
+}
+
+/* Turn off ADDA/RF power, PLL */
+static void turn_power_off(void)
+{
+	set(AR9170_PHY_REG_ACTIVE, AR9170_PHY_ACTIVE_DIS);
+	set(AR9170_PHY_REG_ADC_CTL, 0xa0000000 |
+	    AR9170_PHY_ADC_CTL_OFF_PWDADC | AR9170_PHY_ADC_CTL_OFF_PWDDAC);
+
+	/* This will also turn-off the LEDs */
+	set(AR9170_GPIO_REG_PORT_DATA, 0);
+	set(AR9170_GPIO_REG_PORT_TYPE, 0xf);
+
+	set(AR9170_PWR_REG_BASE, 0x40021);
+
+	set(AR9170_MAC_REG_DMA_TRIGGER, 0);
+
+	andl(AR9170_USB_REG_DMA_CTL, ~(AR9170_USB_DMA_CTL_ENABLE_TO_DEVICE |
+				       AR9170_USB_DMA_CTL_ENABLE_FROM_DEVICE |
+				       AR9170_USB_DMA_CTL_UP_PACKET_MODE |
+				       AR9170_USB_DMA_CTL_DOWN_STREAM));
+
+	/* Do a software reset to PTA component */
+	orl(AR9170_PTA_REG_DMA_MODE_CTRL, AR9170_PTA_DMA_MODE_CTRL_RESET);
+	andl(AR9170_PTA_REG_DMA_MODE_CTRL, ~AR9170_PTA_DMA_MODE_CTRL_RESET);
+
+	orl(AR9170_PTA_REG_DMA_MODE_CTRL, AR9170_PTA_DMA_MODE_CTRL_DISABLE_USB);
+
+	set(AR9170_MAC_REG_POWER_STATE_CTRL,
+	    AR9170_MAC_POWER_STATE_CTRL_RESET);
+
+	/* Reset USB FIFO */
+	set(AR9170_PWR_REG_RESET, AR9170_PWR_RESET_COMMIT_RESET_MASK |
+				  AR9170_PWR_RESET_DMA_MASK |
+				  AR9170_PWR_RESET_WLAN_MASK);
+	set(AR9170_PWR_REG_RESET, 0x0);
+
+	clock_set(AHB_20_22MHZ, false);
+
+	set(AR9170_PWR_REG_PLL_ADDAC, 0x5163);	/* 0x502b; */
+	set(AR9170_PHY_REG_ADC_SERIAL_CTL, AR9170_PHY_ADC_SCTL_SEL_EXTERNAL_RADIO);
+	set(0x1c589c, 0);	/* 7-0 */
+	set(0x1c589c, 0);	/* 15-8 */
+	set(0x1c589c, 0);	/* 23-16 */
+	set(0x1c589c, 0);	/* 31- */
+	set(0x1c589c, 0);	/* 39- */
+	set(0x1c589c, 0);	/* 47- */
+	set(0x1c589c, 0);	/* 55- */
+	set(0x1c589c, 0xf8);	/* 63- */
+	set(0x1c589c, 0x27);	/* 0x24;	71-	modified */
+	set(0x1c589c, 0xf9);	/* 79- */
+	set(0x1c589c, 0x90);	/* 87- */
+	set(0x1c589c, 0x04);	/* 95- */
+	set(0x1c589c, 0x48);	/* 103- */
+	set(0x1c589c, 0x19);	/* 0;		111-	modified */
+	set(0x1c589c, 0);	/* 119- */
+	set(0x1c589c, 0);	/* 127- */
+	set(0x1c589c, 0);	/* 135- */
+	set(0x1c589c, 0);	/* 143- */
+	set(0x1c589c, 0);	/* 151- */
+	set(0x1c589c, 0x70);	/* 159- */
+	set(0x1c589c, 0x0c);	/* 167- */
+	set(0x1c589c, 0);	/* 175- */
+	set(0x1c589c, 0);	/* 183-176 */
+	set(0x1c589c, 0);	/* 191-184 */
+	set(0x1c589c, 0);	/* 199- */
+	set(0x1c589c, 0);	/* 207- */
+	set(0x1c589c, 0);	/* 215- */
+	set(0x1c589c, 0);	/* 223- */
+	set(0x1c589c, 0);	/* 231- */
+	set(0x1c58c4, 0);	/* 233- 232 */
+	set(AR9170_PHY_REG_ADC_SERIAL_CTL, AR9170_PHY_ADC_SCTL_SEL_INTERNAL_ADDAC);
+}
+
+static void disable_watchdog(void)
+{
+	if (!fw.watchdog_enable)
+		return;
+
+	/* write watchdog magic pattern for suspend  */
+	andl(AR9170_PWR_REG_WATCH_DOG_MAGIC, 0xffff);
+	orl(AR9170_PWR_REG_WATCH_DOG_MAGIC, 0x98760000);
+
+	/* Disable watchdog */
+	set(AR9170_TIMER_REG_WATCH_DOG, 0xffff);
+}
+
+void __noreturn reboot(void)
+{
+	disable_watchdog();
+
+	/* Turn off power */
+	turn_power_off();
+
+	/* clean bootloader workspace */
+	memset(&dma_mem, 0, sizeof(dma_mem));
+
+	/* add by ygwei for work around USB PHY chirp sequence problem */
+	set(0x10f100, 0x12345678);
+
+	/* Jump to boot code */
+	jump_to_bootcode();
+}
+
+/* service USB events and re-enable USB interrupt */
+static void usb_handler(uint8_t usb_interrupt_level1)
+{
+	uint8_t usb_interrupt_level2;
+
+	if (usb_interrupt_level1 & BIT(5))
+		usb_data_in();
+
+	if (usb_interrupt_level1 & BIT(4))
+		usb_reg_out();
+
+	if (usb_interrupt_level1 & BIT(6))
+		usb_status_in();
+
+	if (usb_interrupt_level1 & BIT(0)) {
+		usb_interrupt_level2 = getb(AR9170_USB_REG_INTR_SOURCE_0);
+
+		if (usb_interrupt_level2 & AR9170_USB_INTR_SRC0_SETUP)
+			usb_ep0setup();
+
+		if (usb_interrupt_level2 & AR9170_USB_INTR_SRC0_IN)
+			usb_ep0tx();
+
+		if (usb_interrupt_level2 & AR9170_USB_INTR_SRC0_OUT)
+			usb_ep0rx();
+
+		if (usb_interrupt_level2 & AR9170_USB_INTR_SRC0_ABORT) {
+			/* Clear the command abort interrupt */
+			andb(AR9170_USB_REG_INTR_SOURCE_0, (uint8_t)
+			     ~AR9170_USB_INTR_SRC0_ABORT);
+		}
+
+		if (usb_interrupt_level2 & AR9170_USB_INTR_SRC0_FAIL ||
+		    fw.usb.ep0_action & CARL9170_EP0_STALL) {
+			/*
+			 * transmission failure.
+			 * stall ep 0
+			 */
+			setb(AR9170_USB_REG_CX_CONFIG_STATUS, BIT(2));
+			fw.usb.ep0_action &= ~CARL9170_EP0_STALL;
+		}
+
+		if (usb_interrupt_level2 & AR9170_USB_INTR_SRC0_END ||
+		    fw.usb.ep0_action & CARL9170_EP0_TRIGGER) {
+			/*
+			 * transmission done.
+			 * set DONE bit.
+			 */
+			setb(AR9170_USB_REG_CX_CONFIG_STATUS, BIT(0));
+			fw.usb.ep0_action &= ~CARL9170_EP0_TRIGGER;
+		}
+	}
+
+	if (usb_interrupt_level1 & BIT(7)) {
+		usb_interrupt_level2 = getb(AR9170_USB_REG_INTR_SOURCE_7);
+
+		if (usb_interrupt_level2 & AR9170_USB_INTR_SRC7_RX0BYTE)
+			usb_data_out0Byte();
+
+		if (usb_interrupt_level2 & AR9170_USB_INTR_SRC7_TX0BYTE)
+			usb_data_in0Byte();
+
+		if (usb_interrupt_level2 & AR9170_USB_INTR_SRC7_USB_RESET) {
+			usb_reset_ack();
+			reboot();
+		}
+
+		if (usb_interrupt_level2 & AR9170_USB_INTR_SRC7_USB_SUSPEND) {
+			usb_suspend_ack();
+
+			fw.suspend_mode = CARL9170_HOST_SUSPENDED;
+
+#ifdef CONFIG_CARL9170FW_WOL
+			if (!(fw.usb.device_feature & USB_DEVICE_REMOTE_WAKEUP) ||
+			    !fw.wol.cmd.flags) {
+				disable_watchdog();
+
+				/* GO_TO_SUSPEND stops the CPU clock too. */
+				orb(AR9170_USB_REG_MAIN_CTRL, AR9170_USB_MAIN_CTRL_GO_TO_SUSPEND);
+			} else {
+				wol_prepare();
+			}
+#else /* CONFIG_CARL9170FW_WOL */
+			disable_watchdog();
+
+			/* GO_TO_SUSPEND stops the CPU clock too. */
+			orb(AR9170_USB_REG_MAIN_CTRL, AR9170_USB_MAIN_CTRL_GO_TO_SUSPEND);
+#endif /* CONFIG_CARL9170FW_WOL */
+		}
+
+		if (usb_interrupt_level2 & AR9170_USB_INTR_SRC7_USB_RESUME) {
+			usb_resume_ack();
+
+			fw.suspend_mode = CARL9170_HOST_AWAKE;
+			set(AR9170_USB_REG_WAKE_UP, 0);
+
+			reboot();
+		}
+	}
+}
+
+void handle_usb(void)
+{
+	uint8_t usb_interrupt_level1;
+
+	usb_interrupt_level1 = getb(AR9170_USB_REG_INTR_GROUP);
+
+	if (usb_interrupt_level1)
+		usb_handler(usb_interrupt_level1);
+
+	if (fw.usb.int_pending > 0)
+		usb_trigger_in();
+}
+
+void usb_timer(void)
+{
+}
diff --git a/carl9170fw/carlfw/usb/usb.c b/carl9170fw/carlfw/usb/usb.c
new file mode 100644
index 0000000..74b8f8c
--- /dev/null
+++ b/carl9170fw/carlfw/usb/usb.c
@@ -0,0 +1,758 @@
+/*
+ * carl9170 firmware - used by the ar9170 wireless device
+ *
+ * USB Controller
+ *
+ * Copyright (c) 2000-2005  ZyDAS Technology Corporation
+ * Copyright (c) 2007-2009 Atheros Communications, Inc.
+ * Copyright	2009	Johannes Berg <johannes@sipsolutions.net>
+ * Copyright 2009-2011	Christian Lamparter <chunkeey@googlemail.com>
+ *
+ * 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; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+#include "carl9170.h"
+#include "usb.h"
+#include "printf.h"
+#include "rom.h"
+
+/*
+ * NB: The firmware has to write into these structures
+ * so don't try to make them "const".
+ */
+
+static struct ar9170_usb_config usb_config_highspeed = {
+	.cfg = {
+		.bLength = USB_DT_CONFIG_SIZE,
+		.bDescriptorType = USB_DT_CONFIG,
+		.wTotalLength = cpu_to_le16(sizeof(usb_config_highspeed)),
+		.bNumInterfaces = 1,
+		.bConfigurationValue = 1,
+		.iConfiguration = 0,
+		.bmAttributes = USB_CONFIG_ATT_ONE |
+#ifdef CONFIG_CARL9170FW_WOL
+				USB_CONFIG_ATT_WAKEUP |
+#endif /* CONFIG_CARL9170FW_WOL */
+				0,
+		.bMaxPower = 0xfa, /* 500 mA */
+	},
+
+	.intf = {
+		.bLength = USB_DT_INTERFACE_SIZE,
+		.bDescriptorType = USB_DT_INTERFACE,
+		.bInterfaceNumber = 0,
+		.bAlternateSetting = 0,
+		.bNumEndpoints = AR9170_USB_NUM_EXTRA_EP,
+		.bInterfaceClass = USB_CLASS_VENDOR_SPEC,
+		.bInterfaceSubClass = USB_SUBCLASS_VENDOR_SPEC,
+		.bInterfaceProtocol = 0,
+		.iInterface = 0,
+	},
+
+	.ep = {
+		{	/* EP 1 */
+			.bLength = USB_DT_ENDPOINT_SIZE,
+			.bDescriptorType = USB_DT_ENDPOINT,
+			.bEndpointAddress = USB_DIR_OUT | AR9170_USB_EP_TX,
+			.bmAttributes = USB_ENDPOINT_XFER_BULK,
+			.wMaxPacketSize = cpu_to_le16(512),
+			.bInterval = 0,
+		},
+
+		{	/* EP 2 */
+			.bLength = USB_DT_ENDPOINT_SIZE,
+			.bDescriptorType = USB_DT_ENDPOINT,
+			.bEndpointAddress = USB_DIR_IN | AR9170_USB_EP_RX,
+			.bmAttributes = USB_ENDPOINT_XFER_BULK,
+			.wMaxPacketSize = cpu_to_le16(512),
+			.bInterval = 0,
+		},
+
+		{	/* EP 3 */
+			.bLength = USB_DT_ENDPOINT_SIZE,
+			.bDescriptorType = USB_DT_ENDPOINT,
+			.bEndpointAddress = USB_DIR_IN | AR9170_USB_EP_IRQ,
+			.bmAttributes = USB_ENDPOINT_XFER_INT,
+			.wMaxPacketSize = cpu_to_le16(64),
+			.bInterval = 1,
+		},
+
+		{	/* EP 4 */
+			.bLength = USB_DT_ENDPOINT_SIZE,
+			.bDescriptorType = USB_DT_ENDPOINT,
+			.bEndpointAddress = USB_DIR_OUT | AR9170_USB_EP_CMD,
+			.bmAttributes = USB_ENDPOINT_XFER_INT,
+			.wMaxPacketSize = cpu_to_le16(64),
+			.bInterval = 1,
+		},
+	},
+};
+
+static struct ar9170_usb_config usb_config_fullspeed = {
+	.cfg = {
+		.bLength = USB_DT_CONFIG_SIZE,
+		.bDescriptorType = USB_DT_CONFIG,
+		.wTotalLength = cpu_to_le16(sizeof(usb_config_fullspeed)),
+		.bNumInterfaces = 1,
+		.bConfigurationValue = 1,
+		.iConfiguration = 0,
+		.bmAttributes = USB_CONFIG_ATT_ONE |
+#ifdef CONFIG_CARL9170FW_WOL
+				USB_CONFIG_ATT_WAKEUP |
+#endif /* CONFIG_CARL9170FW_WOL */
+				0,
+		.bMaxPower = 0xfa, /* 500 mA */
+	},
+
+	.intf = {
+		.bLength = USB_DT_INTERFACE_SIZE,
+		.bDescriptorType = USB_DT_INTERFACE,
+		.bInterfaceNumber = 0,
+		.bAlternateSetting = 0,
+		.bNumEndpoints = AR9170_USB_NUM_EXTRA_EP,
+		.bInterfaceClass = USB_CLASS_VENDOR_SPEC,
+		.bInterfaceSubClass = USB_SUBCLASS_VENDOR_SPEC,
+		.bInterfaceProtocol = 0,
+		.iInterface = 0,
+	},
+
+	.ep = {
+		{	/* EP 1 */
+			.bLength = USB_DT_ENDPOINT_SIZE,
+			.bDescriptorType = USB_DT_ENDPOINT,
+			.bEndpointAddress = USB_DIR_OUT | AR9170_USB_EP_TX,
+			.bmAttributes = USB_ENDPOINT_XFER_BULK,
+			.wMaxPacketSize = cpu_to_le16(64),
+			.bInterval = 0,
+		},
+
+		{	/* EP 2 */
+			.bLength = USB_DT_ENDPOINT_SIZE,
+			.bDescriptorType = USB_DT_ENDPOINT,
+			.bEndpointAddress = USB_DIR_IN | AR9170_USB_EP_RX,
+			.bmAttributes = USB_ENDPOINT_XFER_BULK,
+			.wMaxPacketSize = cpu_to_le16(64),
+			.bInterval = 0,
+		},
+
+		{	/* EP 3 */
+			.bLength = USB_DT_ENDPOINT_SIZE,
+			.bDescriptorType = USB_DT_ENDPOINT,
+			.bEndpointAddress = USB_DIR_IN | AR9170_USB_EP_IRQ,
+			.bmAttributes = USB_ENDPOINT_XFER_INT,
+			.wMaxPacketSize = cpu_to_le16(64),
+			.bInterval = 1,
+		},
+
+		{	/* EP 4 */
+			.bLength = USB_DT_ENDPOINT_SIZE,
+			.bDescriptorType = USB_DT_ENDPOINT,
+			.bEndpointAddress = USB_DIR_OUT | AR9170_USB_EP_CMD,
+			.bmAttributes = USB_ENDPOINT_XFER_INT,
+			.wMaxPacketSize = cpu_to_le16(64),
+			.bInterval = 1,
+		},
+	},
+};
+
+#ifdef CONFIG_CARL9170FW_USB_MODESWITCH
+static void usb_reset_eps(void)
+{
+	unsigned int i;
+
+	/* clear all EPs' toggle bit */
+	for (i = 1; i < __AR9170_USB_NUM_MAX_EP; i++) {
+		usb_set_input_ep_toggle(i);
+		usb_clear_input_ep_toggle(i);
+	}
+
+	/*
+	 * NB: I've no idea why this cannot be integrated into the
+	 * previous loop?
+	 */
+	for (i = 1; i < __AR9170_USB_NUM_MAX_EP; i++) {
+		usb_set_output_ep_toggle(i);
+		usb_clear_output_ep_toggle(i);
+	}
+}
+#endif /* CONFIG_CARL9170FW_USB_MODESWITCH */
+
+
+static void usb_pta_init(void)
+{
+	unsigned int usb_dma_ctrl = 0;
+	/* Set PTA mode to USB */
+	andl(AR9170_PTA_REG_DMA_MODE_CTRL,
+		~AR9170_PTA_DMA_MODE_CTRL_DISABLE_USB);
+
+	/* Do a software reset to PTA component */
+	orl(AR9170_PTA_REG_DMA_MODE_CTRL, AR9170_PTA_DMA_MODE_CTRL_RESET);
+	andl(AR9170_PTA_REG_DMA_MODE_CTRL, ~AR9170_PTA_DMA_MODE_CTRL_RESET);
+
+	if (usb_detect_highspeed()) {
+		fw.usb.os_cfg_desc = &usb_config_fullspeed;
+		fw.usb.cfg_desc = &usb_config_highspeed;
+
+		/* 512 Byte DMA transfers */
+		usb_dma_ctrl |= AR9170_USB_DMA_CTL_HIGH_SPEED;
+	} else {
+		fw.usb.cfg_desc = &usb_config_fullspeed;
+		fw.usb.os_cfg_desc = &usb_config_highspeed;
+	}
+
+#ifdef CONFIG_CARL9170FW_USB_UP_STREAM
+# if (CONFIG_CARL9170FW_RX_FRAME_LEN == 4096)
+	usb_dma_ctrl |= AR9170_USB_DMA_CTL_UP_STREAM_4K;
+# elif (CONFIG_CARL9170FW_RX_FRAME_LEN == 8192)
+	usb_dma_ctrl |= AR9170_USB_DMA_CTL_UP_STREAM_8K;
+# elif (CONFIG_CARL9170FW_RX_FRAME_LEN == 16384)
+	usb_dma_ctrl |= AR9170_USB_DMA_CTL_UP_STREAM_16K;
+# elif (CONFIG_CARL9170FW_RX_FRAME_LEN == 32768)
+	usb_dma_ctrl |= AR9170_USB_DMA_CTL_UP_STREAM_32K;
+# else
+#	error "Invalid AR9170_RX_FRAME_LEN setting"
+# endif
+
+#else /* CONFIG_CARL9170FW_USB_UP_STREAM */
+	usb_dma_ctrl |= AR9170_USB_DMA_CTL_UP_PACKET_MODE;
+#endif /* CONFIG_CARL9170FW_USB_UP_STREAM */
+
+#ifdef CONFIG_CARL9170FW_USB_DOWN_STREAM
+	/* Enable down stream mode */
+	usb_dma_ctrl |= AR9170_USB_DMA_CTL_DOWN_STREAM;
+#endif /* CONFIG_CARL9170FW_USB_DOWN_STREAM */
+
+#ifdef CONFIG_CARL9170FW_USB_UP_STREAM
+	/* Set the up stream mode maximum aggregate number */
+	set(AR9170_USB_REG_MAX_AGG_UPLOAD, 4);
+
+	/*
+	 * Set the up stream mode timeout value.
+	 * NB: The vendor driver (otus) set 0x80?
+	 */
+	set(AR9170_USB_REG_UPLOAD_TIME_CTL, 0x80);
+#endif /* CONFIG_CARL9170FW_USB_UP_STREAM */
+
+	/* Enable up stream and down stream */
+	usb_dma_ctrl |= AR9170_USB_DMA_CTL_ENABLE_TO_DEVICE |
+	    AR9170_USB_DMA_CTL_ENABLE_FROM_DEVICE;
+
+	set(AR9170_USB_REG_DMA_CTL, usb_dma_ctrl);
+}
+
+void usb_init(void)
+{
+	usb_pta_init();
+
+	fw.usb.config = 1;
+	/*
+	 * The fw structure is always initialized with "0"
+	 * during boot(); No need to waste precious bytes here.
+	 *
+	 * fw.usb.interface_setting = 0;
+	 * fw.usb.alternate_interface_setting = 0;
+	 * fw.usb.device_feature = 0;
+	 */
+
+#ifdef CONFIG_CARL9170FW_WOL
+	fw.usb.device_feature |= USB_DEVICE_REMOTE_WAKEUP;
+	usb_enable_remote_wakeup();
+#endif /* CONFIG_CARL9170FW_WOL */
+}
+
+#define GET_ARRAY(a, o)	((uint32_t *) (((unsigned long) data) + offset))
+
+static void usb_ep0rx_data(const void *data, const unsigned int len)
+{
+	unsigned int offset;
+	uint32_t value;
+
+	BUG_ON(len > AR9170_USB_EP_CTRL_MAX);
+	BUILD_BUG_ON(len > AR9170_USB_EP_CTRL_MAX);
+
+	for (offset = 0; offset < ((len + 3) & ~3); offset += 4) {
+		value = get(AR9170_USB_REG_EP0_DATA);
+		memcpy(GET_ARRAY(data, offset), &value,
+		       min(len - offset, (unsigned int)4));
+	}
+}
+
+static int usb_ep0tx_data(const void *data, const unsigned int len)
+{
+	unsigned int offset = 0, block, last_block = 0;
+	uint32_t value;
+
+	BUG_ON(len > AR9170_USB_EP_CTRL_MAX);
+	BUILD_BUG_ON(len > AR9170_USB_EP_CTRL_MAX);
+
+	block = min(len, (unsigned int) 4);
+	offset = 0;
+	while (offset < len) {
+
+		if (last_block != block || block < 4)
+			setb(AR9170_USB_REG_FIFO_SIZE, (1 << block) - 1);
+
+		memcpy(&value, GET_ARRAY(data, offset), block);
+
+		set(AR9170_USB_REG_EP0_DATA, value);
+
+		offset += block;
+		last_block = block = min(len - offset, (unsigned int) 4);
+	}
+
+	setb(AR9170_USB_REG_FIFO_SIZE, 0xf);
+
+	/* this will push the data to the host */
+	return 1;
+}
+#undef GET_ARRAY
+
+#ifdef CONFIG_CARL9170FW_USB_STANDARD_CMDS
+static int usb_get_status(const struct usb_ctrlrequest *ctrl)
+{
+	__le16 status = cpu_to_le16(fw.usb.device_feature);
+
+	if ((ctrl->bRequestType & USB_DIR_MASK) != USB_DIR_IN)
+		return -1;
+
+	switch (ctrl->bRequestType & USB_RECIP_MASK) {
+	case USB_RECIP_DEVICE:
+		status &= cpu_to_le16(~USB_DEVICE_SELF_POWERED);
+		status &= cpu_to_le16(~USB_DEVICE_REMOTE_WAKEUP);
+		break;
+
+	case USB_RECIP_INTERFACE:
+		/* USB spec: This is reserved for future use. */
+		status = cpu_to_le16(0);
+		break;
+
+	case USB_RECIP_ENDPOINT:
+	case USB_RECIP_OTHER:
+	default:
+		break;
+	}
+
+	return usb_ep0tx_data((const void *) &status, sizeof(status));
+}
+
+static int usb_get_string_desc(const struct usb_ctrlrequest *ctrl)
+{
+	const struct usb_string_descriptor *string_desc = NULL;
+
+	switch (le16_to_cpu(ctrl->wValue) & 0xff) {
+	case 0x00:
+		string_desc = (const struct usb_string_descriptor *)
+			rom.hw.usb.string0_desc;
+		break;
+
+	case 0x10:
+		string_desc = (const struct usb_string_descriptor *)
+			rom.hw.usb.string1_desc;
+		break;
+
+	case 0x20:
+		string_desc = (const struct usb_string_descriptor *)
+			rom.hw.usb.string2_desc;
+		break;
+
+	case 0x30:
+		string_desc = (const struct usb_string_descriptor *)
+			rom.hw.usb.string3_desc;
+		break;
+
+	default:
+		break;
+	}
+
+	if (string_desc)
+		return usb_ep0tx_data(string_desc, string_desc->bLength);
+
+	return -1;
+}
+
+static int usb_get_device_desc(const struct usb_ctrlrequest *ctrl __unused)
+{
+	return usb_ep0tx_data(&rom.hw.usb.device_desc,
+			      rom.hw.usb.device_desc.bLength);
+}
+
+static int usb_get_config_desc(const struct usb_ctrlrequest *ctrl __unused)
+{
+	fw.usb.cfg_desc->cfg.bDescriptorType = USB_DT_CONFIG;
+
+	return usb_ep0tx_data(fw.usb.cfg_desc,
+		le16_to_cpu(fw.usb.cfg_desc->cfg.wTotalLength));
+}
+
+#ifdef CONFIG_CARL9170FW_USB_MODESWITCH
+static int usb_get_otherspeed_desc(const struct usb_ctrlrequest *ctrl __unused)
+{
+
+	fw.usb.os_cfg_desc->cfg.bDescriptorType = USB_DT_OTHER_SPEED_CONFIG;
+
+	return usb_ep0tx_data(fw.usb.os_cfg_desc,
+		le16_to_cpu(fw.usb.os_cfg_desc->cfg.wTotalLength));
+}
+#endif /* CONFIG_CARL9170FW_USB_MODESWITCH */
+
+static int usb_get_qualifier_desc(const struct usb_ctrlrequest *ctrl __unused)
+{
+	struct usb_qualifier_descriptor qual;
+
+	/*
+	 * The qualifier descriptor shares some structural details
+	 * with the main device descriptor.
+	 */
+
+	memcpy(&qual, &rom.hw.usb.device_desc, sizeof(qual));
+
+	/* (Re)-Initialize fields */
+	qual.bDescriptorType = USB_DT_DEVICE_QUALIFIER;
+	qual.bLength = sizeof(qual);
+	qual.bNumConfigurations = rom.hw.usb.device_desc.bNumConfigurations;
+	qual.bRESERVED = 0;
+
+	return usb_ep0tx_data(&qual, qual.bLength);
+}
+
+#define USB_CHECK_REQTYPE(ctrl, recip, dir)			\
+	(((ctrl->bRequestType & USB_RECIP_MASK) != recip) ||	\
+	 ((ctrl->bRequestType & USB_DIR_MASK) != dir))
+
+static int usb_get_descriptor(const struct usb_ctrlrequest *ctrl)
+{
+	int status = -1;
+
+	if (USB_CHECK_REQTYPE(ctrl, USB_RECIP_DEVICE, USB_DIR_IN))
+		return status;
+
+	switch (le16_to_cpu(ctrl->wValue) >> 8) {
+	case USB_DT_DEVICE:
+		status = usb_get_device_desc(ctrl);
+		break;
+
+	case USB_DT_CONFIG:
+		status = usb_get_config_desc(ctrl);
+		break;
+
+	case USB_DT_STRING:
+		status = usb_get_string_desc(ctrl);
+		break;
+
+	case USB_DT_INTERFACE:
+		break;
+
+	case USB_DT_ENDPOINT:
+		break;
+
+	case USB_DT_DEVICE_QUALIFIER:
+		status = usb_get_qualifier_desc(ctrl);
+		break;
+
+#ifdef CONFIG_CARL9170FW_USB_MODESWITCH
+	case USB_DT_OTHER_SPEED_CONFIG:
+		status = usb_get_otherspeed_desc(ctrl);
+		break;
+#endif /* CONFIG_CARL9170FW_USB_MODESWITCH */
+	default:
+		break;
+
+	}
+
+	return status;
+}
+
+static int usb_get_configuration(const struct usb_ctrlrequest *ctrl)
+{
+	if (USB_CHECK_REQTYPE(ctrl, USB_RECIP_DEVICE, USB_DIR_IN))
+		return -1;
+
+	return usb_ep0tx_data(&fw.usb.config, 1);
+}
+
+static int usb_set_configuration(const struct usb_ctrlrequest *ctrl)
+{
+	unsigned int config;
+
+	if (USB_CHECK_REQTYPE(ctrl, USB_RECIP_DEVICE, USB_DIR_OUT))
+		return -1;
+
+	config = le16_to_cpu(ctrl->wValue);
+	switch (config) {
+	case 0:
+		/* Disable Device */
+		andb(AR9170_USB_REG_DEVICE_ADDRESS,
+		      (uint8_t) ~(AR9170_USB_DEVICE_ADDRESS_CONFIGURE));
+#ifdef CONFIG_CARL9170FW_USB_MODESWITCH
+	case 1:
+		fw.usb.config = config;
+
+		if (usb_detect_highspeed()) {
+			/* High Speed Configuration */
+			usb_init_highspeed_fifo_cfg();
+		} else {
+			/* Full Speed Configuration */
+			usb_init_fullspeed_fifo_cfg();
+		}
+		break;
+
+	default:
+		return -1;
+	}
+	/* usb_pta_init() ? */
+
+	usb_reset_eps();
+	orb(AR9170_USB_REG_DEVICE_ADDRESS,
+	    (AR9170_USB_DEVICE_ADDRESS_CONFIGURE));
+
+	usb_enable_global_int();
+	usb_trigger_out();
+	return 1;
+#else
+	default:
+		return -1;
+	}
+#endif /* CONFIG_CARL9170FW_USB_MODESWITCH */
+}
+
+static int usb_set_address(const struct usb_ctrlrequest *ctrl)
+{
+	unsigned int address;
+
+	if (USB_CHECK_REQTYPE(ctrl, USB_RECIP_DEVICE, USB_DIR_OUT))
+		return -1;
+
+	address = le16_to_cpu(ctrl->wValue);
+
+	/*
+	 * The original firmware used 0x100 (which is, of course,
+	 * too big to fit into uint8_t).
+	 * However based on the available information (hw.h), BIT(7)
+	 * is used as some sort of flag and should not be
+	 * part of the device address.
+	 */
+	if (address >= BIT(7))
+		return -1;
+
+	setb(AR9170_USB_REG_DEVICE_ADDRESS, (uint8_t) address);
+	return 1;
+}
+
+static int usb_get_interface(const struct usb_ctrlrequest *ctrl)
+{
+	if (USB_CHECK_REQTYPE(ctrl, USB_RECIP_INTERFACE, USB_DIR_IN))
+		return -1;
+
+	if (usb_configured() == false)
+		return -1;
+
+	switch (fw.usb.config) {
+	case 1:
+		break;
+
+	default:
+		return -1;
+	}
+
+	return usb_ep0tx_data(&fw.usb.alternate_interface_setting, 1);
+}
+
+static int usb_manipulate_feature(const struct usb_ctrlrequest *ctrl, bool __unused clear)
+{
+	unsigned int feature;
+	if (USB_CHECK_REQTYPE(ctrl, USB_RECIP_DEVICE, USB_DIR_OUT))
+		return -1;
+
+	if (usb_configured() == false)
+		return -1;
+
+	feature = le16_to_cpu(ctrl->wValue);
+
+#ifdef CONFIG_CARL9170FW_WOL
+	if (feature & USB_DEVICE_REMOTE_WAKEUP) {
+		if (clear)
+			usb_disable_remote_wakeup();
+		else
+			usb_enable_remote_wakeup();
+	}
+#endif /* CONFIG_CARL9170FW_WOL */
+
+	if (clear)
+		fw.usb.device_feature &= ~feature;
+	else
+		fw.usb.device_feature |= feature;
+
+	return 1;
+}
+
+#ifdef CONFIG_CARL9170FW_USB_MODESWITCH
+static int usb_set_interface(const struct usb_ctrlrequest *ctrl)
+{
+	unsigned int intf, alt_intf;
+	if (USB_CHECK_REQTYPE(ctrl, USB_RECIP_INTERFACE, USB_DIR_OUT))
+		return -1;
+
+	if (usb_configured() == false)
+		return -1;
+
+	intf = le16_to_cpu(ctrl->wIndex);
+	alt_intf = le16_to_cpu(ctrl->wValue);
+
+	switch (intf) {
+	case 0:
+		if (alt_intf != fw.usb.cfg_desc->intf.bAlternateSetting)
+			return -1;
+
+		fw.usb.interface_setting = (uint8_t) intf;
+		fw.usb.alternate_interface_setting = (uint8_t) alt_intf;
+		if (usb_detect_highspeed())
+			usb_init_highspeed_fifo_cfg();
+		else
+			usb_init_fullspeed_fifo_cfg();
+
+		usb_reset_eps();
+		usb_enable_global_int();
+		usb_trigger_out();
+		return 1;
+
+	default:
+		return -1;
+	}
+}
+#endif /* CONFIG_CARL9170FW_USB_MODESWITCH */
+#endif /* CONFIG_CARL9170FW_USB_STANDARD_CMDS */
+
+static int usb_standard_command(const struct usb_ctrlrequest *ctrl __unused)
+{
+	int status = -1;
+
+#ifdef CONFIG_CARL9170FW_USB_STANDARD_CMDS
+	switch (ctrl->bRequest) {
+	case USB_REQ_GET_STATUS:
+		status = usb_get_status(ctrl);
+		break;
+
+	case USB_REQ_CLEAR_FEATURE:
+	case USB_REQ_SET_FEATURE:
+		usb_manipulate_feature(ctrl, ctrl->bRequest == USB_REQ_CLEAR_FEATURE);
+		break;
+
+	case USB_REQ_SET_ADDRESS:
+		status = usb_set_address(ctrl);
+		break;
+
+	case USB_REQ_GET_DESCRIPTOR:
+		status = usb_get_descriptor(ctrl);
+		break;
+
+	case USB_REQ_SET_DESCRIPTOR:
+		break;
+
+	case USB_REQ_GET_CONFIGURATION:
+		status = usb_get_configuration(ctrl);
+		break;
+
+	case USB_REQ_SET_CONFIGURATION:
+		status = usb_set_configuration(ctrl);
+		break;
+
+	case USB_REQ_GET_INTERFACE:
+		status = usb_get_interface(ctrl);
+		break;
+
+	case USB_REQ_SET_INTERFACE:
+#ifdef CONFIG_CARL9170FW_USB_MODESWITCH
+		status = usb_set_interface(ctrl);
+#endif /* CONFIG_CARL9170FW_USB_MODESWITCH */
+		break;
+
+	case USB_REQ_SYNCH_FRAME:
+		break;
+
+	default:
+		break;
+
+	}
+#endif /* CONFIG_CARL9170FW_USB_STANDARD_CMDS */
+
+	return status;
+}
+
+static int usb_class_command(const struct usb_ctrlrequest *ctrl __unused)
+{
+	return -1;
+}
+
+static int usb_vendor_command(const struct usb_ctrlrequest *ctrl __unused)
+{
+	/*
+	 * Note: Firmware upload/boot is not implemented.
+	 * It's impossible to replace the current image
+	 * in place.
+	 */
+
+	return -1;
+}
+
+#undef USB_CHECK_TYPE
+
+void usb_ep0setup(void)
+{
+	struct usb_ctrlrequest ctrl;
+	int status = -1;
+	usb_ep0rx_data(&ctrl, sizeof(ctrl));
+
+	switch (ctrl.bRequestType & USB_TYPE_MASK) {
+	case USB_TYPE_STANDARD:
+		status = usb_standard_command(&ctrl);
+		break;
+
+	case USB_TYPE_CLASS:
+		status = usb_class_command(&ctrl);
+		break;
+
+	case USB_TYPE_VENDOR:
+		status = usb_vendor_command(&ctrl);
+		break;
+
+	default:
+		break;
+
+	}
+
+	if (status < 0)
+		fw.usb.ep0_action |= CARL9170_EP0_STALL;
+#ifdef CONFIG_CARL9170FW_USB_STANDARD_CMDS
+	if (status > 0)
+		fw.usb.ep0_action |= CARL9170_EP0_TRIGGER;
+#endif /* CONFIG_CARL9170FW_USB_STANDARD_CMDS */
+}
+
+void usb_ep0rx(void)
+{
+	if (BUG_ON(!fw.usb.ep0_txrx_buffer || !fw.usb.ep0_txrx_len))
+		return ;
+
+	usb_ep0rx_data(fw.usb.ep0_txrx_buffer, fw.usb.ep0_txrx_len);
+	fw.usb.ep0_txrx_pos = fw.usb.ep0_txrx_len;
+}
+
+void usb_ep0tx(void)
+{
+	if (BUG_ON(!fw.usb.ep0_txrx_buffer || !fw.usb.ep0_txrx_len))
+		return ;
+
+	usb_ep0tx_data(fw.usb.ep0_txrx_buffer, fw.usb.ep0_txrx_len);
+	fw.usb.ep0_txrx_pos = fw.usb.ep0_txrx_len;
+}
diff --git a/carl9170fw/config/CMakeLists.txt b/carl9170fw/config/CMakeLists.txt
new file mode 100644
index 0000000..9e2ddeb
--- /dev/null
+++ b/carl9170fw/config/CMakeLists.txt
@@ -0,0 +1,27 @@
+cmake_minimum_required(VERSION 2.8)
+
+project(config)
+
+#set(CMAKE_VERBOSE_MAKEFILE ON)
+
+find_package(BISON REQUIRED)
+find_package(FLEX REQUIRED)
+
+include_directories(${CMAKE_CURRENT_SOURCE_DIR})
+
+file(MAKE_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../include/generated")
+
+LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../extra")
+FIND_PACKAGE(GPERF REQUIRED)
+
+BISON_TARGET(zconf zconf.y zconf.tab.c COMPILE_FLAGS "-l -b zconf -p zconf -t")
+FLEX_TARGET(zconfscan zconf.l zconf.lex.c COMPILE_FLAGS "-Pzconf -L")
+GPERF_TARGET(zconfhash zconf.gperf zconf.hash.c)
+
+SET(zconf_deps ${FLEX_zconfscan_OUTPUTS} ${GPERF_zconfhash_OUTPUTS})
+SET_SOURCE_FILES_PROPERTIES(${BISON_zconf_OUTPUTS}
+      PROPERTIES OBJECT_DEPENDS "${zconf_deps}")
+
+set(conf_src conf.c ${BISON_zconf_OUTPUTS})
+
+add_executable(conf ${conf_src})
diff --git a/carl9170fw/config/conf.c b/carl9170fw/config/conf.c
new file mode 100644
index 0000000..6fdacb3
--- /dev/null
+++ b/carl9170fw/config/conf.c
@@ -0,0 +1,646 @@
+/*
+ * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
+ * Released under the terms of the GNU GPL v2.0.
+ */
+
+#include <locale.h>
+#include <ctype.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include <unistd.h>
+#include <getopt.h>
+#include <sys/stat.h>
+#include <sys/time.h>
+
+#include "lkc.h"
+
+static void conf(struct menu *menu);
+static void check_conf(struct menu *menu);
+static void xfgets(char *str, int size, FILE *in);
+
+enum input_mode {
+	oldaskconfig,
+	oldconfig,
+	allnoconfig,
+	allyesconfig,
+	allmodconfig,
+	alldefconfig,
+	randconfig,
+	defconfig,
+	savedefconfig,
+	listnewconfig,
+	oldnoconfig,
+} input_mode = oldaskconfig;
+
+static int indent = 1;
+static int valid_stdin = 1;
+static int conf_cnt;
+static char line[128];
+static struct menu *rootEntry;
+
+static void print_help(struct menu *menu)
+{
+	struct gstr help = str_new();
+
+	menu_get_ext_help(menu, &help);
+
+	printf("\n%s\n", str_get(&help));
+	str_free(&help);
+}
+
+static void strip(char *str)
+{
+	char *p = str;
+	int l;
+
+	while ((isspace(*p)))
+		p++;
+	l = strlen(p);
+	if (p != str)
+		memmove(str, p, l + 1);
+	if (!l)
+		return;
+	p = str + l - 1;
+	while ((isspace(*p)))
+		*p-- = 0;
+}
+
+static void check_stdin(void)
+{
+	if (!valid_stdin) {
+		printf(_("aborted!\n\n"));
+		printf(_("Console input/output is redirected. "));
+		printf(_("Run 'make config' to update configuration.\n\n"));
+		exit(1);
+	}
+}
+
+static int conf_askvalue(struct symbol *sym, const char *def)
+{
+	enum symbol_type type = sym_get_type(sym);
+
+	if (!sym_has_value(sym))
+		printf(_("(NEW) "));
+
+	line[0] = '\n';
+	line[1] = 0;
+
+	if (!sym_is_changable(sym)) {
+		printf("%s\n", def);
+		line[0] = '\n';
+		line[1] = 0;
+		return 0;
+	}
+
+	switch (input_mode) {
+	case oldconfig:
+		if (sym_has_value(sym)) {
+			printf("%s\n", def);
+			return 0;
+		}
+		check_stdin();
+		/* fall through */
+	case oldaskconfig:
+		fflush(stdout);
+		xfgets(line, 128, stdin);
+		return 1;
+	default:
+		break;
+	}
+
+	switch (type) {
+	case S_INT:
+	case S_HEX:
+	case S_STRING:
+		printf("%s\n", def);
+		return 1;
+	default:
+		;
+	}
+	printf("%s", line);
+	return 1;
+}
+
+static int conf_string(struct menu *menu)
+{
+	struct symbol *sym = menu->sym;
+	const char *def;
+
+	while (1) {
+		printf("%*s%s ", indent - 1, "", _(menu->prompt->text));
+		printf("(%s) ", sym->name);
+		def = sym_get_string_value(sym);
+		if (sym_get_string_value(sym))
+			printf("[%s] ", def);
+		if (!conf_askvalue(sym, def))
+			return 0;
+		switch (line[0]) {
+		case '\n':
+			break;
+		case '?':
+			/* print help */
+			if (line[1] == '\n') {
+				print_help(menu);
+				def = NULL;
+				break;
+			}
+			/* fall through */
+		default:
+			line[strlen(line)-1] = 0;
+			def = line;
+		}
+		if (def && sym_set_string_value(sym, def))
+			return 0;
+	}
+}
+
+static int conf_sym(struct menu *menu)
+{
+	struct symbol *sym = menu->sym;
+	tristate oldval, newval;
+
+	while (1) {
+		printf("%*s%s ", indent - 1, "", _(menu->prompt->text));
+		if (sym->name)
+			printf("(%s) ", sym->name);
+		putchar('[');
+		oldval = sym_get_tristate_value(sym);
+		switch (oldval) {
+		case no:
+			putchar('N');
+			break;
+		case mod:
+			putchar('M');
+			break;
+		case yes:
+			putchar('Y');
+			break;
+		}
+		if (oldval != no && sym_tristate_within_range(sym, no))
+			printf("/n");
+		if (oldval != mod && sym_tristate_within_range(sym, mod))
+			printf("/m");
+		if (oldval != yes && sym_tristate_within_range(sym, yes))
+			printf("/y");
+		if (menu_has_help(menu))
+			printf("/?");
+		printf("] ");
+		if (!conf_askvalue(sym, sym_get_string_value(sym)))
+			return 0;
+		strip(line);
+
+		switch (line[0]) {
+		case 'n':
+		case 'N':
+			newval = no;
+			if (!line[1] || !strcmp(&line[1], "o"))
+				break;
+			continue;
+		case 'm':
+		case 'M':
+			newval = mod;
+			if (!line[1])
+				break;
+			continue;
+		case 'y':
+		case 'Y':
+			newval = yes;
+			if (!line[1] || !strcmp(&line[1], "es"))
+				break;
+			continue;
+		case 0:
+			newval = oldval;
+			break;
+		case '?':
+			goto help;
+		default:
+			continue;
+		}
+		if (sym_set_tristate_value(sym, newval))
+			return 0;
+help:
+		print_help(menu);
+	}
+}
+
+static int conf_choice(struct menu *menu)
+{
+	struct symbol *sym, *def_sym;
+	struct menu *child;
+	bool is_new;
+
+	sym = menu->sym;
+	is_new = !sym_has_value(sym);
+	if (sym_is_changable(sym)) {
+		conf_sym(menu);
+		sym_calc_value(sym);
+		switch (sym_get_tristate_value(sym)) {
+		case no:
+			return 1;
+		case mod:
+			return 0;
+		case yes:
+			break;
+		}
+	} else {
+		switch (sym_get_tristate_value(sym)) {
+		case no:
+			return 1;
+		case mod:
+			printf("%*s%s\n", indent - 1, "", _(menu_get_prompt(menu)));
+			return 0;
+		case yes:
+			break;
+		}
+	}
+
+	while (1) {
+		int cnt, def;
+
+		printf("%*s%s\n", indent - 1, "", _(menu_get_prompt(menu)));
+		def_sym = sym_get_choice_value(sym);
+		cnt = def = 0;
+		line[0] = 0;
+		for (child = menu->list; child; child = child->next) {
+			if (!menu_is_visible(child))
+				continue;
+			if (!child->sym) {
+				printf("%*c %s\n", indent, '*', _(menu_get_prompt(child)));
+				continue;
+			}
+			cnt++;
+			if (child->sym == def_sym) {
+				def = cnt;
+				printf("%*c", indent, '>');
+			} else
+				printf("%*c", indent, ' ');
+			printf(" %d. %s", cnt, _(menu_get_prompt(child)));
+			if (child->sym->name)
+				printf(" (%s)", child->sym->name);
+			if (!sym_has_value(child->sym))
+				printf(_(" (NEW)"));
+			printf("\n");
+		}
+		printf(_("%*schoice"), indent - 1, "");
+		if (cnt == 1) {
+			printf("[1]: 1\n");
+			goto conf_childs;
+		}
+		printf("[1-%d", cnt);
+		if (menu_has_help(menu))
+			printf("?");
+		printf("]: ");
+		switch (input_mode) {
+		case oldconfig:
+			if (!is_new) {
+				cnt = def;
+				printf("%d\n", cnt);
+				break;
+			}
+			check_stdin();
+			/* fall through */
+		case oldaskconfig:
+			fflush(stdout);
+			xfgets(line, 128, stdin);
+			strip(line);
+			if (line[0] == '?') {
+				print_help(menu);
+				continue;
+			}
+			if (!line[0])
+				cnt = def;
+			else if (isdigit(line[0]))
+				cnt = atoi(line);
+			else
+				continue;
+			break;
+		default:
+			break;
+		}
+
+	conf_childs:
+		for (child = menu->list; child; child = child->next) {
+			if (!child->sym || !menu_is_visible(child))
+				continue;
+			if (!--cnt)
+				break;
+		}
+		if (!child)
+			continue;
+		if (line[0] && line[strlen(line) - 1] == '?') {
+			print_help(child);
+			continue;
+		}
+		sym_set_choice_value(sym, child->sym);
+		for (child = child->list; child; child = child->next) {
+			indent += 2;
+			conf(child);
+			indent -= 2;
+		}
+		return 1;
+	}
+}
+
+static void conf(struct menu *menu)
+{
+	struct symbol *sym;
+	struct property *prop;
+	struct menu *child;
+
+	if (!menu_is_visible(menu))
+		return;
+
+	sym = menu->sym;
+	prop = menu->prompt;
+	if (prop) {
+		const char *prompt;
+
+		switch (prop->type) {
+		case P_MENU:
+			if ((input_mode == listnewconfig ||
+			     input_mode == oldnoconfig) &&
+			    rootEntry != menu) {
+				check_conf(menu);
+				return;
+			}
+			/* fall through */
+		case P_COMMENT:
+			prompt = menu_get_prompt(menu);
+			if (prompt)
+				printf("%*c\n%*c %s\n%*c\n",
+					indent, '*',
+					indent, '*', _(prompt),
+					indent, '*');
+		default:
+			;
+		}
+	}
+
+	if (!sym)
+		goto conf_childs;
+
+	if (sym_is_choice(sym)) {
+		conf_choice(menu);
+		if (sym->curr.tri != mod)
+			return;
+		goto conf_childs;
+	}
+
+	switch (sym->type) {
+	case S_INT:
+	case S_HEX:
+	case S_STRING:
+		conf_string(menu);
+		break;
+	default:
+		conf_sym(menu);
+		break;
+	}
+
+conf_childs:
+	if (sym)
+		indent += 2;
+	for (child = menu->list; child; child = child->next)
+		conf(child);
+	if (sym)
+		indent -= 2;
+}
+
+static void check_conf(struct menu *menu)
+{
+	struct symbol *sym;
+	struct menu *child;
+
+	if (!menu_is_visible(menu))
+		return;
+
+	sym = menu->sym;
+	if (sym && !sym_has_value(sym)) {
+		if (sym_is_changable(sym) ||
+		    (sym_is_choice(sym) && sym_get_tristate_value(sym) == yes)) {
+			if (input_mode == listnewconfig) {
+				if (sym->name && !sym_is_choice_value(sym)) {
+					printf("%s%s\n", CONFIG_, sym->name);
+				}
+			} else if (input_mode != oldnoconfig) {
+				if (!conf_cnt++)
+					printf(_("*\n* Restart config...\n*\n"));
+				rootEntry = menu_get_parent_menu(menu);
+				conf(rootEntry);
+			}
+		}
+	}
+
+	for (child = menu->list; child; child = child->next)
+		check_conf(child);
+}
+
+static struct option long_opts[] = {
+	{"askconfig",       no_argument,       NULL, oldaskconfig},
+	{"config",          no_argument,       NULL, oldconfig},
+	{"defconfig",       optional_argument, NULL, defconfig},
+	{"savedefconfig",   required_argument, NULL, savedefconfig},
+	{"allnoconfig",     no_argument,       NULL, allnoconfig},
+	{"allyesconfig",    no_argument,       NULL, allyesconfig},
+	{"allmodconfig",    no_argument,       NULL, allmodconfig},
+	{"alldefconfig",    no_argument,       NULL, alldefconfig},
+	{"randconfig",      no_argument,       NULL, randconfig},
+	{"listnewconfig",   no_argument,       NULL, listnewconfig},
+	{"noconfig",        no_argument,       NULL, oldnoconfig},
+	{NULL, 0, NULL, 0}
+};
+
+static void conf_usage(const char *progname)
+{
+
+	printf("Usage: %s [option] <kconfig-file>\n", progname);
+	printf("[option] is _one_ of the following:\n");
+	printf("  --listnewconfig         List new options\n");
+	printf("  --askconfig             Start a new configuration using a line-oriented program\n");
+	printf("  --config                Update a configuration using a provided .config as base\n");
+	printf("  --silentconfig          Same as config, but quietly, additionally update deps\n");
+	printf("  --noconfig              Same as silentconfig but set new symbols to no\n");
+	printf("  --defconfig <file>      New config with default defined in <file>\n");
+	printf("  --savedefconfig <file>  Save the minimal current configuration to <file>\n");
+	printf("  --allnoconfig           New config where all options are answered with no\n");
+	printf("  --allyesconfig          New config where all options are answered with yes\n");
+	printf("  --allmodconfig          New config where all options are answered with mod\n");
+	printf("  --alldefconfig          New config with all symbols set to default\n");
+	printf("  --randconfig            New config with random answer to all options\n");
+}
+
+int main(int ac, char **av)
+{
+	const char *progname = av[0];
+	int opt;
+	const char *name, *defconfig_file = NULL /* gcc uninit */;
+	struct stat tmpstat;
+
+	setlocale(LC_ALL, "");
+	bindtextdomain(PACKAGE, LOCALEDIR);
+	textdomain(PACKAGE);
+
+	while ((opt = getopt_long(ac, av, "", long_opts, NULL)) != -1) {
+		input_mode = (enum input_mode)opt;
+		switch (opt) {
+		case defconfig:
+		case savedefconfig:
+			defconfig_file = optarg;
+			break;
+		case randconfig:
+		{
+			struct timeval now;
+			unsigned int seed;
+
+			/*
+			 * Use microseconds derived seed,
+			 * compensate for systems where it may be zero
+			 */
+			gettimeofday(&now, NULL);
+
+			seed = (unsigned int)((now.tv_sec + 1) * (now.tv_usec + 1));
+			srand(seed);
+			break;
+		}
+		case oldaskconfig:
+		case oldconfig:
+		case allnoconfig:
+		case allyesconfig:
+		case allmodconfig:
+		case alldefconfig:
+		case listnewconfig:
+		case oldnoconfig:
+			break;
+		case '?':
+			conf_usage(progname);
+			exit(1);
+			break;
+		}
+	}
+	if (ac == optind) {
+		printf(_("%s: Kconfig file missing\n"), av[0]);
+		conf_usage(progname);
+		exit(1);
+	}
+	name = av[optind];
+	conf_parse(name);
+	//zconfdump(stdout);
+
+	switch (input_mode) {
+	case defconfig:
+		if (!defconfig_file)
+			defconfig_file = conf_get_default_confname();
+		if (conf_read(defconfig_file)) {
+			printf(_("***\n"
+				"*** Can't find default configuration \"%s\"!\n"
+				"***\n"), defconfig_file);
+			exit(1);
+		}
+		break;
+	case savedefconfig:
+	case oldaskconfig:
+	case oldconfig:
+	case listnewconfig:
+	case oldnoconfig:
+		conf_read(NULL);
+		break;
+	case allnoconfig:
+	case allyesconfig:
+	case allmodconfig:
+	case alldefconfig:
+	case randconfig:
+		name = getenv("KCONFIG_ALLCONFIG");
+		if (name && !stat(name, &tmpstat)) {
+			conf_read_simple(name, S_DEF_USER);
+			break;
+		}
+		switch (input_mode) {
+		case allnoconfig:	name = "allno.config"; break;
+		case allyesconfig:	name = "allyes.config"; break;
+		case allmodconfig:	name = "allmod.config"; break;
+		case alldefconfig:	name = "alldef.config"; break;
+		case randconfig:	name = "allrandom.config"; break;
+		default: break;
+		}
+		if (!stat(name, &tmpstat))
+			conf_read_simple(name, S_DEF_USER);
+		else if (!stat("all.config", &tmpstat))
+			conf_read_simple("all.config", S_DEF_USER);
+		break;
+	default:
+		break;
+	}
+
+	valid_stdin = isatty(0) && isatty(1) && isatty(2);
+
+	switch (input_mode) {
+	case allnoconfig:
+		conf_set_all_new_symbols(def_no);
+		break;
+	case allyesconfig:
+		conf_set_all_new_symbols(def_yes);
+		break;
+	case allmodconfig:
+		conf_set_all_new_symbols(def_mod);
+		break;
+	case alldefconfig:
+		conf_set_all_new_symbols(def_default);
+		break;
+	case randconfig:
+		conf_set_all_new_symbols(def_random);
+		break;
+	case defconfig:
+		conf_set_all_new_symbols(def_default);
+		break;
+	case savedefconfig:
+		break;
+	case oldaskconfig:
+		rootEntry = &rootmenu;
+		conf(&rootmenu);
+		input_mode = oldconfig;
+		/* fall through */
+	case oldconfig:
+	case listnewconfig:
+	case oldnoconfig:
+		/* Update until a loop caused no more changes */
+		do {
+			conf_cnt = 0;
+			check_conf(&rootmenu);
+		} while (conf_cnt &&
+			 (input_mode != listnewconfig &&
+			  input_mode != oldnoconfig));
+		break;
+	}
+
+	if (input_mode == savedefconfig) {
+		if (conf_write_defconfig(defconfig_file)) {
+			fprintf(stderr, _("n*** Error while saving defconfig to: %s\n\n"),
+			        defconfig_file);
+			return 1;
+		}
+	} else if (input_mode != listnewconfig) {
+		/*
+		 * build so we shall update autoconf.
+		 */
+		if (conf_write(NULL)) {
+			fprintf(stderr, _("\n*** Error during writing of the configuration.\n\n"));
+			exit(1);
+		}
+		if (conf_write_autoconf()) {
+			fprintf(stderr, _("\n*** Error during update of the configuration.\n\n"));
+			return 1;
+		}
+	}
+	return 0;
+}
+
+/*
+ * Helper function to facilitate fgets() by Jean Sacren.
+ */
+void xfgets(char *str, int size, FILE *in)
+{
+	if (fgets(str, size, in) == NULL)
+		fprintf(stderr, "\nError in reading or end of file.\n");
+}
diff --git a/carl9170fw/config/confdata.c b/carl9170fw/config/confdata.c
new file mode 100644
index 0000000..d45c37e
--- /dev/null
+++ b/carl9170fw/config/confdata.c
@@ -0,0 +1,1170 @@
+/*
+ * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
+ * Released under the terms of the GNU GPL v2.0.
+ */
+
+#include <sys/stat.h>
+#include <ctype.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include <unistd.h>
+
+#include "lkc.h"
+
+static void conf_warning(const char *fmt, ...)
+	__attribute__ ((format (printf, 1, 2)));
+
+static void conf_message(const char *fmt, ...)
+	__attribute__ ((format (printf, 1, 2)));
+
+static const char *conf_filename;
+static int conf_lineno, conf_warnings, conf_unsaved;
+
+const char conf_defname[] = "include/generated/defconfig";
+
+static void conf_warning(const char *fmt, ...)
+{
+	va_list ap;
+	va_start(ap, fmt);
+	fprintf(stderr, "%s:%d:warning: ", conf_filename, conf_lineno);
+	vfprintf(stderr, fmt, ap);
+	fprintf(stderr, "\n");
+	va_end(ap);
+	conf_warnings++;
+}
+
+static void conf_default_message_callback(const char *fmt, va_list ap)
+{
+	printf("#\n# ");
+	vprintf(fmt, ap);
+	printf("\n#\n");
+}
+
+static void (*conf_message_callback) (const char *fmt, va_list ap) =
+	conf_default_message_callback;
+void conf_set_message_callback(void (*fn) (const char *fmt, va_list ap))
+{
+	conf_message_callback = fn;
+}
+
+static void conf_message(const char *fmt, ...)
+{
+	va_list ap;
+
+	va_start(ap, fmt);
+	if (conf_message_callback)
+		conf_message_callback(fmt, ap);
+}
+
+const char *conf_get_configname(void)
+{
+	char *name = getenv("KCONFIG_CONFIG");
+
+	return name ? name : ".config";
+}
+
+const char *conf_get_autoconfig_name(void)
+{
+	char *name = getenv("KCONFIG_AUTOCONFIG");
+
+	return name ? name : "include/generated/auto.conf";
+}
+
+static char *conf_expand_value(const char *in)
+{
+	struct symbol *sym;
+	const char *src;
+	static char res_value[SYMBOL_MAXLENGTH];
+	char *dst, name[SYMBOL_MAXLENGTH];
+
+	res_value[0] = 0;
+	dst = name;
+	while ((src = strchr(in, '$'))) {
+		strncat(res_value, in, src - in);
+		src++;
+		dst = name;
+		while (isalnum(*src) || *src == '_')
+			*dst++ = *src++;
+		*dst = 0;
+		sym = sym_lookup(name, 0);
+		sym_calc_value(sym);
+		strcat(res_value, sym_get_string_value(sym));
+		in = src;
+	}
+	strcat(res_value, in);
+
+	return res_value;
+}
+
+char *conf_get_default_confname(void)
+{
+	struct stat buf;
+	static char fullname[PATH_MAX+1];
+	char *env, *name;
+
+	name = conf_expand_value(conf_defname);
+	env = getenv(SRCTREE);
+	if (env) {
+		sprintf(fullname, "%s/%s", env, name);
+		if (!stat(fullname, &buf))
+			return fullname;
+	}
+	return name;
+}
+
+static int conf_set_sym_val(struct symbol *sym, int def, int def_flags, char *p)
+{
+	char *p2;
+
+	switch (sym->type) {
+	case S_TRISTATE:
+		if (p[0] == 'm') {
+			sym->def[def].tri = mod;
+			sym->flags |= def_flags;
+			break;
+		}
+		/* fall through */
+	case S_BOOLEAN:
+		if (p[0] == 'y') {
+			sym->def[def].tri = yes;
+			sym->flags |= def_flags;
+			break;
+		}
+		if (p[0] == 'n') {
+			sym->def[def].tri = no;
+			sym->flags |= def_flags;
+			break;
+		}
+		conf_warning("symbol value '%s' invalid for %s", p, sym->name);
+		return 1;
+	case S_OTHER:
+		if (*p != '"') {
+			for (p2 = p; *p2 && !isspace(*p2); p2++)
+				;
+			sym->type = S_STRING;
+			goto done;
+		}
+		/* fall through */
+	case S_STRING:
+		if (*p++ != '"')
+			break;
+		for (p2 = p; (p2 = strpbrk(p2, "\"\\")); p2++) {
+			if (*p2 == '"') {
+				*p2 = 0;
+				break;
+			}
+			memmove(p2, p2 + 1, strlen(p2));
+		}
+		if (!p2) {
+			conf_warning("invalid string found");
+			return 1;
+		}
+		/* fall through */
+	case S_INT:
+	case S_HEX:
+	done:
+		if (sym_string_valid(sym, p)) {
+			sym->def[def].val = strdup(p);
+			sym->flags |= def_flags;
+		} else {
+			conf_warning("symbol value '%s' invalid for %s", p, sym->name);
+			return 1;
+		}
+		break;
+	default:
+		;
+	}
+	return 0;
+}
+
+int conf_read_simple(const char *name, int def)
+{
+	FILE *in = NULL;
+	char line[1024];
+	char *p, *p2;
+	struct symbol *sym;
+	int i, def_flags;
+
+	if (name) {
+		in = zconf_fopen(name);
+	} else {
+		struct property *prop;
+
+		name = conf_get_configname();
+		in = zconf_fopen(name);
+		if (in)
+			goto load;
+		sym_add_change_count(1);
+		if (!sym_defconfig_list) {
+			if (modules_sym)
+				sym_calc_value(modules_sym);
+			return 1;
+		}
+
+		for_all_defaults(sym_defconfig_list, prop) {
+			if (expr_calc_value(prop->visible.expr) == no ||
+			    prop->expr->type != E_SYMBOL)
+				continue;
+			name = conf_expand_value(prop->expr->left.sym->name);
+			in = zconf_fopen(name);
+			if (in) {
+				conf_message(_("using defaults found in %s"),
+					 name);
+				goto load;
+			}
+		}
+	}
+	if (!in)
+		return 1;
+
+load:
+	conf_filename = name;
+	conf_lineno = 0;
+	conf_warnings = 0;
+	conf_unsaved = 0;
+
+	def_flags = SYMBOL_DEF << def;
+	for_all_symbols(i, sym) {
+		sym->flags |= SYMBOL_CHANGED;
+		sym->flags &= ~(def_flags|SYMBOL_VALID);
+		if (sym_is_choice(sym))
+			sym->flags |= def_flags;
+		switch (sym->type) {
+		case S_INT:
+		case S_HEX:
+		case S_STRING:
+			if (sym->def[def].val)
+				free(sym->def[def].val);
+			/* fall through */
+		default:
+			sym->def[def].val = NULL;
+			sym->def[def].tri = no;
+		}
+	}
+
+	while (fgets(line, sizeof(line), in)) {
+		conf_lineno++;
+		sym = NULL;
+		if (line[0] == '#') {
+			if (memcmp(line + 2, CONFIG_, strlen(CONFIG_)))
+				continue;
+			p = strchr(line + 2 + strlen(CONFIG_), ' ');
+			if (!p)
+				continue;
+			*p++ = 0;
+			if (strncmp(p, "is not set", 10))
+				continue;
+			if (def == S_DEF_USER) {
+				sym = sym_find(line + 2 + strlen(CONFIG_));
+				if (!sym) {
+					sym_add_change_count(1);
+					goto setsym;
+				}
+			} else {
+				sym = sym_lookup(line + 2 + strlen(CONFIG_), 0);
+				if (sym->type == S_UNKNOWN)
+					sym->type = S_BOOLEAN;
+			}
+			if (sym->flags & def_flags) {
+				conf_warning("override: reassigning to symbol %s", sym->name);
+			}
+			switch (sym->type) {
+			case S_BOOLEAN:
+			case S_TRISTATE:
+				sym->def[def].tri = no;
+				sym->flags |= def_flags;
+				break;
+			default:
+				;
+			}
+		} else if (memcmp(line, CONFIG_, strlen(CONFIG_)) == 0) {
+			p = strchr(line + strlen(CONFIG_), '=');
+			if (!p)
+				continue;
+			*p++ = 0;
+			p2 = strchr(p, '\n');
+			if (p2) {
+				*p2-- = 0;
+				if (*p2 == '\r')
+					*p2 = 0;
+			}
+			if (def == S_DEF_USER) {
+				sym = sym_find(line + strlen(CONFIG_));
+				if (!sym) {
+					sym_add_change_count(1);
+					goto setsym;
+				}
+			} else {
+				sym = sym_lookup(line + strlen(CONFIG_), 0);
+				if (sym->type == S_UNKNOWN)
+					sym->type = S_OTHER;
+			}
+			if (sym->flags & def_flags) {
+				conf_warning("override: reassigning to symbol %s", sym->name);
+			}
+			if (conf_set_sym_val(sym, def, def_flags, p))
+				continue;
+		} else {
+			if (line[0] != '\r' && line[0] != '\n')
+				conf_warning("unexpected data");
+			continue;
+		}
+setsym:
+		if (sym && sym_is_choice_value(sym)) {
+			struct symbol *cs = prop_get_symbol(sym_get_choice_prop(sym));
+			switch (sym->def[def].tri) {
+			case no:
+				break;
+			case mod:
+				if (cs->def[def].tri == yes) {
+					conf_warning("%s creates inconsistent choice state", sym->name);
+					cs->flags &= ~def_flags;
+				}
+				break;
+			case yes:
+				if (cs->def[def].tri != no)
+					conf_warning("override: %s changes choice state", sym->name);
+				cs->def[def].val = sym;
+				break;
+			}
+			cs->def[def].tri = EXPR_OR(cs->def[def].tri, sym->def[def].tri);
+		}
+	}
+	fclose(in);
+
+	if (modules_sym)
+		sym_calc_value(modules_sym);
+	return 0;
+}
+
+int conf_read(const char *name)
+{
+	struct symbol *sym;
+	int i;
+
+	sym_set_change_count(0);
+
+	if (conf_read_simple(name, S_DEF_USER))
+		return 1;
+
+	for_all_symbols(i, sym) {
+		sym_calc_value(sym);
+		if (sym_is_choice(sym) || (sym->flags & SYMBOL_AUTO))
+			continue;
+		if (sym_has_value(sym) && (sym->flags & SYMBOL_WRITE)) {
+			/* check that calculated value agrees with saved value */
+			switch (sym->type) {
+			case S_BOOLEAN:
+			case S_TRISTATE:
+				if (sym->def[S_DEF_USER].tri != sym_get_tristate_value(sym))
+					break;
+				if (!sym_is_choice(sym))
+					continue;
+				/* fall through */
+			default:
+				if (!strcmp(sym->curr.val, sym->def[S_DEF_USER].val))
+					continue;
+				break;
+			}
+		} else if (!sym_has_value(sym) && !(sym->flags & SYMBOL_WRITE))
+			/* no previous value and not saved */
+			continue;
+		conf_unsaved++;
+		/* maybe print value in verbose mode... */
+	}
+
+	for_all_symbols(i, sym) {
+		if (sym_has_value(sym) && !sym_is_choice_value(sym)) {
+			/* Reset values of generates values, so they'll appear
+			 * as new, if they should become visible, but that
+			 * doesn't quite work if the Kconfig and the saved
+			 * configuration disagree.
+			 */
+			if (sym->visible == no && !conf_unsaved)
+				sym->flags &= ~SYMBOL_DEF_USER;
+			switch (sym->type) {
+			case S_STRING:
+			case S_INT:
+			case S_HEX:
+				/* Reset a string value if it's out of range */
+				if (sym_string_within_range(sym, sym->def[S_DEF_USER].val))
+					break;
+				sym->flags &= ~(SYMBOL_VALID|SYMBOL_DEF_USER);
+				conf_unsaved++;
+				break;
+			default:
+				break;
+			}
+		}
+	}
+
+	sym_add_change_count(conf_warnings || conf_unsaved);
+
+	return 0;
+}
+
+/*
+ * Kconfig configuration printer
+ *
+ * This printer is used when generating the resulting configuration after
+ * kconfig invocation and `defconfig' files. Unset symbol might be omitted by
+ * passing a non-NULL argument to the printer.
+ *
+ */
+static void
+kconfig_print_symbol(FILE *fp, struct symbol *sym, const char *value, void *arg)
+{
+
+	switch (sym->type) {
+	case S_BOOLEAN:
+	case S_TRISTATE:
+		if (*value == 'n') {
+			bool skip_unset = (arg != NULL);
+
+			if (!skip_unset)
+				fprintf(fp, "# %s%s is not set\n",
+				    CONFIG_, sym->name);
+			return;
+		}
+		break;
+	default:
+		break;
+	}
+
+	fprintf(fp, "%s%s=%s\n", CONFIG_, sym->name, value);
+}
+
+static void
+kconfig_print_cmake_symbol(FILE *fp, struct symbol *sym, const char *value, void *arg)
+{
+
+	switch (sym->type) {
+	case S_BOOLEAN:
+	case S_TRISTATE:
+		if (*value == 'n') {
+			bool skip_unset = (arg != NULL);
+
+			if (!skip_unset)
+				fprintf(fp, "set(%s%s false)\n",
+					CONFIG_, sym->name, value);
+			return;
+		} else if (*value == 'm') {
+			abort();
+		} else {
+			fprintf(fp, "set(%s%s true)\n", CONFIG_, sym->name, value);
+		}
+		break;
+	case S_HEX: {
+		const char *prefix = "";
+
+		if (value[0] != '0' || (value[1] != 'x' && value[1] != 'X'))
+			prefix = "0x";
+		fprintf(fp, "set(%s%s %s%s)\n",
+		    CONFIG_, sym->name, prefix, value);
+		break;
+	}
+	case S_STRING:
+	case S_INT:
+		fprintf(fp, "set(%s%s %s)\n",
+		    CONFIG_, sym->name, value);
+		break;
+	default:
+		break;
+	}
+
+}
+
+static void
+kconfig_print_comment(FILE *fp, const char *value, void *arg)
+{
+	const char *p = value;
+	size_t l;
+
+	for (;;) {
+		l = strcspn(p, "\n");
+		fprintf(fp, "#");
+		if (l) {
+			fprintf(fp, " ");
+			xfwrite(p, l, 1, fp);
+			p += l;
+		}
+		fprintf(fp, "\n");
+		if (*p++ == '\0')
+			break;
+	}
+}
+
+static struct conf_printer kconfig_printer_cb =
+{
+	.print_symbol = kconfig_print_symbol,
+	.print_comment = kconfig_print_comment,
+};
+
+static struct conf_printer kconfig_printer_cmake_cb =
+{
+	.print_symbol = kconfig_print_cmake_symbol,
+	.print_comment = kconfig_print_comment,
+};
+
+/*
+ * Header printer
+ *
+ * This printer is used when generating the `include/generated/autoconf.h' file.
+ */
+static void
+header_print_symbol(FILE *fp, struct symbol *sym, const char *value, void *arg)
+{
+
+	switch (sym->type) {
+	case S_BOOLEAN:
+	case S_TRISTATE: {
+		const char *suffix = "";
+
+		switch (*value) {
+		case 'n':
+			break;
+		case 'm':
+			suffix = "_MODULE";
+			/* fall through */
+		default:
+			fprintf(fp, "#define %s%s%s 1\n",
+			    CONFIG_, sym->name, suffix);
+		}
+		break;
+	}
+	case S_HEX: {
+		const char *prefix = "";
+
+		if (value[0] != '0' || (value[1] != 'x' && value[1] != 'X'))
+			prefix = "0x";
+		fprintf(fp, "#define %s%s %s%s\n",
+		    CONFIG_, sym->name, prefix, value);
+		break;
+	}
+	case S_STRING:
+	case S_INT:
+		fprintf(fp, "#define %s%s %s\n",
+		    CONFIG_, sym->name, value);
+		break;
+	default:
+		break;
+	}
+
+}
+
+static void
+header_print_comment(FILE *fp, const char *value, void *arg)
+{
+	const char *p = value;
+	size_t l;
+
+	fprintf(fp, "/*\n");
+	for (;;) {
+		l = strcspn(p, "\n");
+		fprintf(fp, " *");
+		if (l) {
+			fprintf(fp, " ");
+			xfwrite(p, l, 1, fp);
+			p += l;
+		}
+		fprintf(fp, "\n");
+		if (*p++ == '\0')
+			break;
+	}
+	fprintf(fp, " */\n");
+}
+
+static struct conf_printer header_printer_cb =
+{
+	.print_symbol = header_print_symbol,
+	.print_comment = header_print_comment,
+};
+
+/*
+ * Tristate printer
+ *
+ * This printer is used when generating the `include/generated/tristate.conf' file.
+ */
+static void
+tristate_print_symbol(FILE *fp, struct symbol *sym, const char *value, void *arg)
+{
+
+	if (sym->type == S_TRISTATE && *value != 'n')
+		fprintf(fp, "%s%s=%c\n", CONFIG_, sym->name, (char)toupper(*value));
+}
+
+static struct conf_printer tristate_printer_cb =
+{
+	.print_symbol = tristate_print_symbol,
+	.print_comment = kconfig_print_comment,
+};
+
+static void conf_write_symbol(FILE *fp, struct symbol *sym,
+			      struct conf_printer *printer, void *printer_arg)
+{
+	const char *str;
+
+	switch (sym->type) {
+	case S_OTHER:
+	case S_UNKNOWN:
+		break;
+	case S_STRING:
+		str = sym_get_string_value(sym);
+		str = sym_escape_string_value(str);
+		printer->print_symbol(fp, sym, str, printer_arg);
+		free((void *)str);
+		break;
+	default:
+		str = sym_get_string_value(sym);
+		printer->print_symbol(fp, sym, str, printer_arg);
+	}
+}
+
+static void
+conf_write_heading(FILE *fp, struct conf_printer *printer, void *printer_arg)
+{
+	char buf[256];
+
+	snprintf(buf, sizeof(buf),
+	    "\n"
+	    "Automatically generated file; DO NOT EDIT.\n"
+	    "%s\n",
+	    rootmenu.prompt->text);
+
+	printer->print_comment(fp, buf, printer_arg);
+}
+
+/*
+ * Write out a minimal config.
+ * All values that has default values are skipped as this is redundant.
+ */
+int conf_write_defconfig(const char *filename)
+{
+	struct symbol *sym;
+	struct menu *menu;
+	FILE *out;
+
+	out = fopen(filename, "w");
+	if (!out)
+		return 1;
+
+	sym_clear_all_valid();
+
+	/* Traverse all menus to find all relevant symbols */
+	menu = rootmenu.list;
+
+	while (menu != NULL)
+	{
+		sym = menu->sym;
+		if (sym == NULL) {
+			if (!menu_is_visible(menu))
+				goto next_menu;
+		} else if (!sym_is_choice(sym)) {
+			sym_calc_value(sym);
+			if (!(sym->flags & SYMBOL_WRITE))
+				goto next_menu;
+			sym->flags &= ~SYMBOL_WRITE;
+			/* If we cannot change the symbol - skip */
+			if (!sym_is_changable(sym))
+				goto next_menu;
+			/* If symbol equals to default value - skip */
+			if (strcmp(sym_get_string_value(sym), sym_get_string_default(sym)) == 0)
+				goto next_menu;
+
+			/*
+			 * If symbol is a choice value and equals to the
+			 * default for a choice - skip.
+			 * But only if value is bool and equal to "y" and
+			 * choice is not "optional".
+			 * (If choice is "optional" then all values can be "n")
+			 */
+			if (sym_is_choice_value(sym)) {
+				struct symbol *cs;
+				struct symbol *ds;
+
+				cs = prop_get_symbol(sym_get_choice_prop(sym));
+				ds = sym_choice_default(cs);
+				if (!sym_is_optional(cs) && sym == ds) {
+					if ((sym->type == S_BOOLEAN) &&
+					    sym_get_tristate_value(sym) == yes)
+						goto next_menu;
+				}
+			}
+			conf_write_symbol(out, sym, &kconfig_printer_cb, NULL);
+		}
+next_menu:
+		if (menu->list != NULL) {
+			menu = menu->list;
+		}
+		else if (menu->next != NULL) {
+			menu = menu->next;
+		} else {
+			while ((menu = menu->parent)) {
+				if (menu->next != NULL) {
+					menu = menu->next;
+					break;
+				}
+			}
+		}
+	}
+	fclose(out);
+	return 0;
+}
+
+int conf_write(const char *name)
+{
+	FILE *out;
+	struct symbol *sym;
+	struct menu *menu;
+	const char *basename;
+	const char *str;
+	char dirname[PATH_MAX+1], tmpname[PATH_MAX+1], newname[PATH_MAX+1];
+	char *env;
+
+	dirname[0] = 0;
+	if (name && name[0]) {
+		struct stat st;
+		char *slash;
+
+		if (!stat(name, &st) && S_ISDIR(st.st_mode)) {
+			strcpy(dirname, name);
+			strcat(dirname, "/");
+			basename = conf_get_configname();
+		} else if ((slash = strrchr(name, '/'))) {
+			int size = slash - name + 1;
+			memcpy(dirname, name, size);
+			dirname[size] = 0;
+			if (slash[1])
+				basename = slash + 1;
+			else
+				basename = conf_get_configname();
+		} else
+			basename = name;
+	} else
+		basename = conf_get_configname();
+
+	sprintf(newname, "%s%s", dirname, basename);
+	env = getenv("KCONFIG_OVERWRITECONFIG");
+	if (!env || !*env) {
+		sprintf(tmpname, "%s.tmpconfig.%d", dirname, (int)getpid());
+		out = fopen(tmpname, "w");
+	} else {
+		*tmpname = 0;
+		out = fopen(newname, "w");
+	}
+	if (!out)
+		return 1;
+
+	conf_write_heading(out, &kconfig_printer_cb, NULL);
+
+	if (!conf_get_changed())
+		sym_clear_all_valid();
+
+	menu = rootmenu.list;
+	while (menu) {
+		sym = menu->sym;
+		if (!sym) {
+			if (!menu_is_visible(menu))
+				goto next;
+			str = menu_get_prompt(menu);
+			fprintf(out, "\n"
+				     "#\n"
+				     "# %s\n"
+				     "#\n", str);
+		} else if (!(sym->flags & SYMBOL_CHOICE)) {
+			sym_calc_value(sym);
+			if (!(sym->flags & SYMBOL_WRITE))
+				goto next;
+			sym->flags &= ~SYMBOL_WRITE;
+
+			conf_write_symbol(out, sym, &kconfig_printer_cb, NULL);
+		}
+
+next:
+		if (menu->list) {
+			menu = menu->list;
+			continue;
+		}
+		if (menu->next)
+			menu = menu->next;
+		else while ((menu = menu->parent)) {
+			if (menu->next) {
+				menu = menu->next;
+				break;
+			}
+		}
+	}
+	fclose(out);
+
+	if (*tmpname) {
+		strcat(dirname, basename);
+		strcat(dirname, ".old");
+		rename(newname, dirname);
+		if (rename(tmpname, newname))
+			return 1;
+	}
+
+	conf_message(_("configuration written to %s"), newname);
+
+	sym_set_change_count(0);
+
+	return 0;
+}
+
+static int conf_split_config(void)
+{
+	const char *name;
+	char path[PATH_MAX+1];
+	char *s, *d, c;
+	struct symbol *sym;
+	struct stat sb;
+	int res, i, fd;
+
+	name = conf_get_autoconfig_name();
+	conf_read_simple(name, S_DEF_AUTO);
+
+	if (chdir("include/generated"))
+		return 1;
+
+	res = 0;
+	for_all_symbols(i, sym) {
+		sym_calc_value(sym);
+		if ((sym->flags & SYMBOL_AUTO) || !sym->name)
+			continue;
+		if (sym->flags & SYMBOL_WRITE) {
+			if (sym->flags & SYMBOL_DEF_AUTO) {
+				/*
+				 * symbol has old and new value,
+				 * so compare them...
+				 */
+				switch (sym->type) {
+				case S_BOOLEAN:
+				case S_TRISTATE:
+					if (sym_get_tristate_value(sym) ==
+					    sym->def[S_DEF_AUTO].tri)
+						continue;
+					break;
+				case S_STRING:
+				case S_HEX:
+				case S_INT:
+					if (!strcmp(sym_get_string_value(sym),
+						    sym->def[S_DEF_AUTO].val))
+						continue;
+					break;
+				default:
+					break;
+				}
+			} else {
+				/*
+				 * If there is no old value, only 'no' (unset)
+				 * is allowed as new value.
+				 */
+				switch (sym->type) {
+				case S_BOOLEAN:
+				case S_TRISTATE:
+					if (sym_get_tristate_value(sym) == no)
+						continue;
+					break;
+				default:
+					break;
+				}
+			}
+		} else if (!(sym->flags & SYMBOL_DEF_AUTO))
+			/* There is neither an old nor a new value. */
+			continue;
+		/* else
+		 *	There is an old value, but no new value ('no' (unset)
+		 *	isn't saved in auto.conf, so the old value is always
+		 *	different from 'no').
+		 */
+
+		/* Replace all '_' and append ".h" */
+		s = sym->name;
+		d = path;
+		while ((c = *s++)) {
+			c = tolower(c);
+			*d++ = (c == '_') ? '/' : c;
+		}
+		strcpy(d, ".h");
+
+		/* Assume directory path already exists. */
+		fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, 0644);
+		if (fd == -1) {
+			if (errno != ENOENT) {
+				res = 1;
+				break;
+			}
+			/*
+			 * Create directory components,
+			 * unless they exist already.
+			 */
+			d = path;
+			while ((d = strchr(d, '/'))) {
+				*d = 0;
+				if (stat(path, &sb) && mkdir(path, 0755)) {
+					res = 1;
+					goto out;
+				}
+				*d++ = '/';
+			}
+			/* Try it again. */
+			fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, 0644);
+			if (fd == -1) {
+				res = 1;
+				break;
+			}
+		}
+		close(fd);
+	}
+out:
+	if (chdir("../.."))
+		return 1;
+
+	return res;
+}
+
+int conf_write_autoconf(void)
+{
+	struct symbol *sym;
+	const char *name;
+	FILE *out, *tristate, *out_h, *out_c;
+	int i;
+
+	sym_clear_all_valid();
+
+	file_write_dep("include/generated/auto.conf.cmd");
+
+	if (conf_split_config())
+		return 1;
+
+	out = fopen(".tmpconfig", "w");
+	if (!out)
+		return 1;
+
+	tristate = fopen(".tmpconfig_tristate", "w");
+	if (!tristate) {
+		fclose(out);
+		return 1;
+	}
+
+	out_h = fopen(".tmpconfig.h", "w");
+	if (!out_h) {
+		fclose(out);
+		fclose(tristate);
+		return 1;
+	}
+
+	out_c = fopen(".tmpconfig.cmake", "w");
+	if (!out_c) {
+		fclose(out);
+		fclose(tristate);
+		fclose(out_h);
+	}
+
+	conf_write_heading(out, &kconfig_printer_cb, NULL);
+
+	conf_write_heading(tristate, &tristate_printer_cb, NULL);
+
+	conf_write_heading(out_h, &header_printer_cb, NULL);
+
+	conf_write_heading(out_c, &kconfig_printer_cmake_cb, NULL);
+
+	for_all_symbols(i, sym) {
+		sym_calc_value(sym);
+		if (!(sym->flags & SYMBOL_WRITE) || !sym->name)
+			continue;
+
+		/* write symbol to auto.conf, tristate and header files */
+		conf_write_symbol(out, sym, &kconfig_printer_cb, (void *)1);
+
+		conf_write_symbol(tristate, sym, &tristate_printer_cb, (void *)1);
+
+		conf_write_symbol(out_h, sym, &header_printer_cb, NULL);
+
+		conf_write_symbol(out_c, sym, &kconfig_printer_cmake_cb, NULL);
+	}
+	fclose(out);
+	fclose(tristate);
+	fclose(out_h);
+	fclose(out_c);
+
+	name = getenv("KCONFIG_AUTOHEADER");
+	if (!name)
+		name = "include/generated/autoconf.h";
+	if (rename(".tmpconfig.h", name))
+		return 1;
+	name = getenv("KCONFIG_TRISTATE");
+	if (!name)
+		name = "include/generated/tristate.conf";
+	if (rename(".tmpconfig_tristate", name))
+		return 1;
+	name = getenv("KCONFIG_CMAKE");
+	if (!name)
+		name = "config.cmake";
+	if (rename(".tmpconfig.cmake", name))
+		return 1;
+	name = conf_get_autoconfig_name();
+	/*
+	 * This must be the last step, kbuild has a dependency on auto.conf
+	 * and this marks the successful completion of the previous steps.
+	 */
+	if (rename(".tmpconfig", name))
+		return 1;
+
+	return 0;
+}
+
+static int sym_change_count;
+static void (*conf_changed_callback)(void);
+
+void sym_set_change_count(int count)
+{
+	int _sym_change_count = sym_change_count;
+	sym_change_count = count;
+	if (conf_changed_callback &&
+	    (bool)_sym_change_count != (bool)count)
+		conf_changed_callback();
+}
+
+void sym_add_change_count(int count)
+{
+	sym_set_change_count(count + sym_change_count);
+}
+
+bool conf_get_changed(void)
+{
+	return sym_change_count;
+}
+
+void conf_set_changed_callback(void (*fn)(void))
+{
+	conf_changed_callback = fn;
+}
+
+static void randomize_choice_values(struct symbol *csym)
+{
+	struct property *prop;
+	struct symbol *sym;
+	struct expr *e;
+	int cnt, def;
+
+	/*
+	 * If choice is mod then we may have more items selected
+	 * and if no then no-one.
+	 * In both cases stop.
+	 */
+	if (csym->curr.tri != yes)
+		return;
+
+	prop = sym_get_choice_prop(csym);
+
+	/* count entries in choice block */
+	cnt = 0;
+	expr_list_for_each_sym(prop->expr, e, sym)
+		cnt++;
+
+	/*
+	 * find a random value and set it to yes,
+	 * set the rest to no so we have only one set
+	 */
+	def = (rand() % cnt);
+
+	cnt = 0;
+	expr_list_for_each_sym(prop->expr, e, sym) {
+		if (def == cnt++) {
+			sym->def[S_DEF_USER].tri = yes;
+			csym->def[S_DEF_USER].val = sym;
+		}
+		else {
+			sym->def[S_DEF_USER].tri = no;
+		}
+	}
+	csym->flags |= SYMBOL_DEF_USER;
+	/* clear VALID to get value calculated */
+	csym->flags &= ~(SYMBOL_VALID);
+}
+
+static void set_all_choice_values(struct symbol *csym)
+{
+	struct property *prop;
+	struct symbol *sym;
+	struct expr *e;
+
+	prop = sym_get_choice_prop(csym);
+
+	/*
+	 * Set all non-assinged choice values to no
+	 */
+	expr_list_for_each_sym(prop->expr, e, sym) {
+		if (!sym_has_value(sym))
+			sym->def[S_DEF_USER].tri = no;
+	}
+	csym->flags |= SYMBOL_DEF_USER;
+	/* clear VALID to get value calculated */
+	csym->flags &= ~(SYMBOL_VALID);
+}
+
+void conf_set_all_new_symbols(enum conf_def_mode mode)
+{
+	struct symbol *sym, *csym;
+	int i, cnt;
+
+	for_all_symbols(i, sym) {
+		if (sym_has_value(sym))
+			continue;
+		switch (sym_get_type(sym)) {
+		case S_BOOLEAN:
+		case S_TRISTATE:
+			switch (mode) {
+			case def_yes:
+				sym->def[S_DEF_USER].tri = yes;
+				break;
+			case def_mod:
+				sym->def[S_DEF_USER].tri = mod;
+				break;
+			case def_no:
+				sym->def[S_DEF_USER].tri = no;
+				break;
+			case def_random:
+				cnt = sym_get_type(sym) == S_TRISTATE ? 3 : 2;
+				sym->def[S_DEF_USER].tri = (tristate)(rand() % cnt);
+				break;
+			default:
+				continue;
+			}
+			if (!(sym_is_choice(sym) && mode == def_random))
+				sym->flags |= SYMBOL_DEF_USER;
+			break;
+		default:
+			break;
+		}
+
+	}
+
+	sym_clear_all_valid();
+
+	/*
+	 * We have different type of choice blocks.
+	 * If curr.tri equals to mod then we can select several
+	 * choice symbols in one block.
+	 * In this case we do nothing.
+	 * If curr.tri equals yes then only one symbol can be
+	 * selected in a choice block and we set it to yes,
+	 * and the rest to no.
+	 */
+	for_all_symbols(i, csym) {
+		if (sym_has_value(csym) || !sym_is_choice(csym))
+			continue;
+
+		sym_calc_value(csym);
+		if (mode == def_random)
+			randomize_choice_values(csym);
+		else
+			set_all_choice_values(csym);
+	}
+}
diff --git a/carl9170fw/config/expr.c b/carl9170fw/config/expr.c
new file mode 100644
index 0000000..290ce41
--- /dev/null
+++ b/carl9170fw/config/expr.c
@@ -0,0 +1,1168 @@
+/*
+ * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
+ * Released under the terms of the GNU GPL v2.0.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "lkc.h"
+
+#define DEBUG_EXPR	0
+
+struct expr *expr_alloc_symbol(struct symbol *sym)
+{
+	struct expr *e = calloc(1, sizeof(*e));
+	e->type = E_SYMBOL;
+	e->left.sym = sym;
+	return e;
+}
+
+struct expr *expr_alloc_one(enum expr_type type, struct expr *ce)
+{
+	struct expr *e = calloc(1, sizeof(*e));
+	e->type = type;
+	e->left.expr = ce;
+	return e;
+}
+
+struct expr *expr_alloc_two(enum expr_type type, struct expr *e1, struct expr *e2)
+{
+	struct expr *e = calloc(1, sizeof(*e));
+	e->type = type;
+	e->left.expr = e1;
+	e->right.expr = e2;
+	return e;
+}
+
+struct expr *expr_alloc_comp(enum expr_type type, struct symbol *s1, struct symbol *s2)
+{
+	struct expr *e = calloc(1, sizeof(*e));
+	e->type = type;
+	e->left.sym = s1;
+	e->right.sym = s2;
+	return e;
+}
+
+struct expr *expr_alloc_and(struct expr *e1, struct expr *e2)
+{
+	if (!e1)
+		return e2;
+	return e2 ? expr_alloc_two(E_AND, e1, e2) : e1;
+}
+
+struct expr *expr_alloc_or(struct expr *e1, struct expr *e2)
+{
+	if (!e1)
+		return e2;
+	return e2 ? expr_alloc_two(E_OR, e1, e2) : e1;
+}
+
+struct expr *expr_copy(const struct expr *org)
+{
+	struct expr *e;
+
+	if (!org)
+		return NULL;
+
+	e = malloc(sizeof(*org));
+	memcpy(e, org, sizeof(*org));
+	switch (org->type) {
+	case E_SYMBOL:
+		e->left = org->left;
+		break;
+	case E_NOT:
+		e->left.expr = expr_copy(org->left.expr);
+		break;
+	case E_EQUAL:
+	case E_UNEQUAL:
+		e->left.sym = org->left.sym;
+		e->right.sym = org->right.sym;
+		break;
+	case E_AND:
+	case E_OR:
+	case E_LIST:
+		e->left.expr = expr_copy(org->left.expr);
+		e->right.expr = expr_copy(org->right.expr);
+		break;
+	default:
+		printf("can't copy type %d\n", e->type);
+		free(e);
+		e = NULL;
+		break;
+	}
+
+	return e;
+}
+
+void expr_free(struct expr *e)
+{
+	if (!e)
+		return;
+
+	switch (e->type) {
+	case E_SYMBOL:
+		break;
+	case E_NOT:
+		expr_free(e->left.expr);
+		return;
+	case E_EQUAL:
+	case E_UNEQUAL:
+		break;
+	case E_OR:
+	case E_AND:
+		expr_free(e->left.expr);
+		expr_free(e->right.expr);
+		break;
+	default:
+		printf("how to free type %d?\n", e->type);
+		break;
+	}
+	free(e);
+}
+
+static int trans_count;
+
+#define e1 (*ep1)
+#define e2 (*ep2)
+
+static void __expr_eliminate_eq(enum expr_type type, struct expr **ep1, struct expr **ep2)
+{
+	if (e1->type == type) {
+		__expr_eliminate_eq(type, &e1->left.expr, &e2);
+		__expr_eliminate_eq(type, &e1->right.expr, &e2);
+		return;
+	}
+	if (e2->type == type) {
+		__expr_eliminate_eq(type, &e1, &e2->left.expr);
+		__expr_eliminate_eq(type, &e1, &e2->right.expr);
+		return;
+	}
+	if (e1->type == E_SYMBOL && e2->type == E_SYMBOL &&
+	    e1->left.sym == e2->left.sym &&
+	    (e1->left.sym == &symbol_yes || e1->left.sym == &symbol_no))
+		return;
+	if (!expr_eq(e1, e2))
+		return;
+	trans_count++;
+	expr_free(e1); expr_free(e2);
+	switch (type) {
+	case E_OR:
+		e1 = expr_alloc_symbol(&symbol_no);
+		e2 = expr_alloc_symbol(&symbol_no);
+		break;
+	case E_AND:
+		e1 = expr_alloc_symbol(&symbol_yes);
+		e2 = expr_alloc_symbol(&symbol_yes);
+		break;
+	default:
+		;
+	}
+}
+
+void expr_eliminate_eq(struct expr **ep1, struct expr **ep2)
+{
+	if (!e1 || !e2)
+		return;
+	switch (e1->type) {
+	case E_OR:
+	case E_AND:
+		__expr_eliminate_eq(e1->type, ep1, ep2);
+	default:
+		;
+	}
+	if (e1->type != e2->type) switch (e2->type) {
+	case E_OR:
+	case E_AND:
+		__expr_eliminate_eq(e2->type, ep1, ep2);
+	default:
+		;
+	}
+	e1 = expr_eliminate_yn(e1);
+	e2 = expr_eliminate_yn(e2);
+}
+
+#undef e1
+#undef e2
+
+int expr_eq(struct expr *e1, struct expr *e2)
+{
+	int res, old_count;
+
+	if (e1->type != e2->type)
+		return 0;
+	switch (e1->type) {
+	case E_EQUAL:
+	case E_UNEQUAL:
+		return e1->left.sym == e2->left.sym && e1->right.sym == e2->right.sym;
+	case E_SYMBOL:
+		return e1->left.sym == e2->left.sym;
+	case E_NOT:
+		return expr_eq(e1->left.expr, e2->left.expr);
+	case E_AND:
+	case E_OR:
+		e1 = expr_copy(e1);
+		e2 = expr_copy(e2);
+		old_count = trans_count;
+		expr_eliminate_eq(&e1, &e2);
+		res = (e1->type == E_SYMBOL && e2->type == E_SYMBOL &&
+		       e1->left.sym == e2->left.sym);
+		expr_free(e1);
+		expr_free(e2);
+		trans_count = old_count;
+		return res;
+	case E_LIST:
+	case E_RANGE:
+	case E_NONE:
+		/* panic */;
+	}
+
+	if (DEBUG_EXPR) {
+		expr_fprint(e1, stdout);
+		printf(" = ");
+		expr_fprint(e2, stdout);
+		printf(" ?\n");
+	}
+
+	return 0;
+}
+
+struct expr *expr_eliminate_yn(struct expr *e)
+{
+	struct expr *tmp;
+
+	if (e) switch (e->type) {
+	case E_AND:
+		e->left.expr = expr_eliminate_yn(e->left.expr);
+		e->right.expr = expr_eliminate_yn(e->right.expr);
+		if (e->left.expr->type == E_SYMBOL) {
+			if (e->left.expr->left.sym == &symbol_no) {
+				expr_free(e->left.expr);
+				expr_free(e->right.expr);
+				e->type = E_SYMBOL;
+				e->left.sym = &symbol_no;
+				e->right.expr = NULL;
+				return e;
+			} else if (e->left.expr->left.sym == &symbol_yes) {
+				free(e->left.expr);
+				tmp = e->right.expr;
+				*e = *(e->right.expr);
+				free(tmp);
+				return e;
+			}
+		}
+		if (e->right.expr->type == E_SYMBOL) {
+			if (e->right.expr->left.sym == &symbol_no) {
+				expr_free(e->left.expr);
+				expr_free(e->right.expr);
+				e->type = E_SYMBOL;
+				e->left.sym = &symbol_no;
+				e->right.expr = NULL;
+				return e;
+			} else if (e->right.expr->left.sym == &symbol_yes) {
+				free(e->right.expr);
+				tmp = e->left.expr;
+				*e = *(e->left.expr);
+				free(tmp);
+				return e;
+			}
+		}
+		break;
+	case E_OR:
+		e->left.expr = expr_eliminate_yn(e->left.expr);
+		e->right.expr = expr_eliminate_yn(e->right.expr);
+		if (e->left.expr->type == E_SYMBOL) {
+			if (e->left.expr->left.sym == &symbol_no) {
+				free(e->left.expr);
+				tmp = e->right.expr;
+				*e = *(e->right.expr);
+				free(tmp);
+				return e;
+			} else if (e->left.expr->left.sym == &symbol_yes) {
+				expr_free(e->left.expr);
+				expr_free(e->right.expr);
+				e->type = E_SYMBOL;
+				e->left.sym = &symbol_yes;
+				e->right.expr = NULL;
+				return e;
+			}
+		}
+		if (e->right.expr->type == E_SYMBOL) {
+			if (e->right.expr->left.sym == &symbol_no) {
+				free(e->right.expr);
+				tmp = e->left.expr;
+				*e = *(e->left.expr);
+				free(tmp);
+				return e;
+			} else if (e->right.expr->left.sym == &symbol_yes) {
+				expr_free(e->left.expr);
+				expr_free(e->right.expr);
+				e->type = E_SYMBOL;
+				e->left.sym = &symbol_yes;
+				e->right.expr = NULL;
+				return e;
+			}
+		}
+		break;
+	default:
+		;
+	}
+	return e;
+}
+
+/*
+ * bool FOO!=n => FOO
+ */
+struct expr *expr_trans_bool(struct expr *e)
+{
+	if (!e)
+		return NULL;
+	switch (e->type) {
+	case E_AND:
+	case E_OR:
+	case E_NOT:
+		e->left.expr = expr_trans_bool(e->left.expr);
+		e->right.expr = expr_trans_bool(e->right.expr);
+		break;
+	case E_UNEQUAL:
+		// FOO!=n -> FOO
+		if (e->left.sym->type == S_TRISTATE) {
+			if (e->right.sym == &symbol_no) {
+				e->type = E_SYMBOL;
+				e->right.sym = NULL;
+			}
+		}
+		break;
+	default:
+		;
+	}
+	return e;
+}
+
+/*
+ * e1 || e2 -> ?
+ */
+static struct expr *expr_join_or(struct expr *e1, struct expr *e2)
+{
+	struct expr *tmp;
+	struct symbol *sym1, *sym2;
+
+	if (expr_eq(e1, e2))
+		return expr_copy(e1);
+	if (e1->type != E_EQUAL && e1->type != E_UNEQUAL && e1->type != E_SYMBOL && e1->type != E_NOT)
+		return NULL;
+	if (e2->type != E_EQUAL && e2->type != E_UNEQUAL && e2->type != E_SYMBOL && e2->type != E_NOT)
+		return NULL;
+	if (e1->type == E_NOT) {
+		tmp = e1->left.expr;
+		if (tmp->type != E_EQUAL && tmp->type != E_UNEQUAL && tmp->type != E_SYMBOL)
+			return NULL;
+		sym1 = tmp->left.sym;
+	} else
+		sym1 = e1->left.sym;
+	if (e2->type == E_NOT) {
+		if (e2->left.expr->type != E_SYMBOL)
+			return NULL;
+		sym2 = e2->left.expr->left.sym;
+	} else
+		sym2 = e2->left.sym;
+	if (sym1 != sym2)
+		return NULL;
+	if (sym1->type != S_BOOLEAN && sym1->type != S_TRISTATE)
+		return NULL;
+	if (sym1->type == S_TRISTATE) {
+		if (e1->type == E_EQUAL && e2->type == E_EQUAL &&
+		    ((e1->right.sym == &symbol_yes && e2->right.sym == &symbol_mod) ||
+		     (e1->right.sym == &symbol_mod && e2->right.sym == &symbol_yes))) {
+			// (a='y') || (a='m') -> (a!='n')
+			return expr_alloc_comp(E_UNEQUAL, sym1, &symbol_no);
+		}
+		if (e1->type == E_EQUAL && e2->type == E_EQUAL &&
+		    ((e1->right.sym == &symbol_yes && e2->right.sym == &symbol_no) ||
+		     (e1->right.sym == &symbol_no && e2->right.sym == &symbol_yes))) {
+			// (a='y') || (a='n') -> (a!='m')
+			return expr_alloc_comp(E_UNEQUAL, sym1, &symbol_mod);
+		}
+		if (e1->type == E_EQUAL && e2->type == E_EQUAL &&
+		    ((e1->right.sym == &symbol_mod && e2->right.sym == &symbol_no) ||
+		     (e1->right.sym == &symbol_no && e2->right.sym == &symbol_mod))) {
+			// (a='m') || (a='n') -> (a!='y')
+			return expr_alloc_comp(E_UNEQUAL, sym1, &symbol_yes);
+		}
+	}
+	if (sym1->type == S_BOOLEAN && sym1 == sym2) {
+		if ((e1->type == E_NOT && e1->left.expr->type == E_SYMBOL && e2->type == E_SYMBOL) ||
+		    (e2->type == E_NOT && e2->left.expr->type == E_SYMBOL && e1->type == E_SYMBOL))
+			return expr_alloc_symbol(&symbol_yes);
+	}
+
+	if (DEBUG_EXPR) {
+		printf("optimize (");
+		expr_fprint(e1, stdout);
+		printf(") || (");
+		expr_fprint(e2, stdout);
+		printf(")?\n");
+	}
+	return NULL;
+}
+
+static struct expr *expr_join_and(struct expr *e1, struct expr *e2)
+{
+	struct expr *tmp;
+	struct symbol *sym1, *sym2;
+
+	if (expr_eq(e1, e2))
+		return expr_copy(e1);
+	if (e1->type != E_EQUAL && e1->type != E_UNEQUAL && e1->type != E_SYMBOL && e1->type != E_NOT)
+		return NULL;
+	if (e2->type != E_EQUAL && e2->type != E_UNEQUAL && e2->type != E_SYMBOL && e2->type != E_NOT)
+		return NULL;
+	if (e1->type == E_NOT) {
+		tmp = e1->left.expr;
+		if (tmp->type != E_EQUAL && tmp->type != E_UNEQUAL && tmp->type != E_SYMBOL)
+			return NULL;
+		sym1 = tmp->left.sym;
+	} else
+		sym1 = e1->left.sym;
+	if (e2->type == E_NOT) {
+		if (e2->left.expr->type != E_SYMBOL)
+			return NULL;
+		sym2 = e2->left.expr->left.sym;
+	} else
+		sym2 = e2->left.sym;
+	if (sym1 != sym2)
+		return NULL;
+	if (sym1->type != S_BOOLEAN && sym1->type != S_TRISTATE)
+		return NULL;
+
+	if ((e1->type == E_SYMBOL && e2->type == E_EQUAL && e2->right.sym == &symbol_yes) ||
+	    (e2->type == E_SYMBOL && e1->type == E_EQUAL && e1->right.sym == &symbol_yes))
+		// (a) && (a='y') -> (a='y')
+		return expr_alloc_comp(E_EQUAL, sym1, &symbol_yes);
+
+	if ((e1->type == E_SYMBOL && e2->type == E_UNEQUAL && e2->right.sym == &symbol_no) ||
+	    (e2->type == E_SYMBOL && e1->type == E_UNEQUAL && e1->right.sym == &symbol_no))
+		// (a) && (a!='n') -> (a)
+		return expr_alloc_symbol(sym1);
+
+	if ((e1->type == E_SYMBOL && e2->type == E_UNEQUAL && e2->right.sym == &symbol_mod) ||
+	    (e2->type == E_SYMBOL && e1->type == E_UNEQUAL && e1->right.sym == &symbol_mod))
+		// (a) && (a!='m') -> (a='y')
+		return expr_alloc_comp(E_EQUAL, sym1, &symbol_yes);
+
+	if (sym1->type == S_TRISTATE) {
+		if (e1->type == E_EQUAL && e2->type == E_UNEQUAL) {
+			// (a='b') && (a!='c') -> 'b'='c' ? 'n' : a='b'
+			sym2 = e1->right.sym;
+			if ((e2->right.sym->flags & SYMBOL_CONST) && (sym2->flags & SYMBOL_CONST))
+				return sym2 != e2->right.sym ? expr_alloc_comp(E_EQUAL, sym1, sym2)
+							     : expr_alloc_symbol(&symbol_no);
+		}
+		if (e1->type == E_UNEQUAL && e2->type == E_EQUAL) {
+			// (a='b') && (a!='c') -> 'b'='c' ? 'n' : a='b'
+			sym2 = e2->right.sym;
+			if ((e1->right.sym->flags & SYMBOL_CONST) && (sym2->flags & SYMBOL_CONST))
+				return sym2 != e1->right.sym ? expr_alloc_comp(E_EQUAL, sym1, sym2)
+							     : expr_alloc_symbol(&symbol_no);
+		}
+		if (e1->type == E_UNEQUAL && e2->type == E_UNEQUAL &&
+			   ((e1->right.sym == &symbol_yes && e2->right.sym == &symbol_no) ||
+			    (e1->right.sym == &symbol_no && e2->right.sym == &symbol_yes)))
+			// (a!='y') && (a!='n') -> (a='m')
+			return expr_alloc_comp(E_EQUAL, sym1, &symbol_mod);
+
+		if (e1->type == E_UNEQUAL && e2->type == E_UNEQUAL &&
+			   ((e1->right.sym == &symbol_yes && e2->right.sym == &symbol_mod) ||
+			    (e1->right.sym == &symbol_mod && e2->right.sym == &symbol_yes)))
+			// (a!='y') && (a!='m') -> (a='n')
+			return expr_alloc_comp(E_EQUAL, sym1, &symbol_no);
+
+		if (e1->type == E_UNEQUAL && e2->type == E_UNEQUAL &&
+			   ((e1->right.sym == &symbol_mod && e2->right.sym == &symbol_no) ||
+			    (e1->right.sym == &symbol_no && e2->right.sym == &symbol_mod)))
+			// (a!='m') && (a!='n') -> (a='m')
+			return expr_alloc_comp(E_EQUAL, sym1, &symbol_yes);
+
+		if ((e1->type == E_SYMBOL && e2->type == E_EQUAL && e2->right.sym == &symbol_mod) ||
+		    (e2->type == E_SYMBOL && e1->type == E_EQUAL && e1->right.sym == &symbol_mod) ||
+		    (e1->type == E_SYMBOL && e2->type == E_UNEQUAL && e2->right.sym == &symbol_yes) ||
+		    (e2->type == E_SYMBOL && e1->type == E_UNEQUAL && e1->right.sym == &symbol_yes))
+			return NULL;
+	}
+
+	if (DEBUG_EXPR) {
+		printf("optimize (");
+		expr_fprint(e1, stdout);
+		printf(") && (");
+		expr_fprint(e2, stdout);
+		printf(")?\n");
+	}
+	return NULL;
+}
+
+static void expr_eliminate_dups1(enum expr_type type, struct expr **ep1, struct expr **ep2)
+{
+#define e1 (*ep1)
+#define e2 (*ep2)
+	struct expr *tmp;
+
+	if (e1->type == type) {
+		expr_eliminate_dups1(type, &e1->left.expr, &e2);
+		expr_eliminate_dups1(type, &e1->right.expr, &e2);
+		return;
+	}
+	if (e2->type == type) {
+		expr_eliminate_dups1(type, &e1, &e2->left.expr);
+		expr_eliminate_dups1(type, &e1, &e2->right.expr);
+		return;
+	}
+	if (e1 == e2)
+		return;
+
+	switch (e1->type) {
+	case E_OR: case E_AND:
+		expr_eliminate_dups1(e1->type, &e1, &e1);
+	default:
+		;
+	}
+
+	switch (type) {
+	case E_OR:
+		tmp = expr_join_or(e1, e2);
+		if (tmp) {
+			expr_free(e1); expr_free(e2);
+			e1 = expr_alloc_symbol(&symbol_no);
+			e2 = tmp;
+			trans_count++;
+		}
+		break;
+	case E_AND:
+		tmp = expr_join_and(e1, e2);
+		if (tmp) {
+			expr_free(e1); expr_free(e2);
+			e1 = expr_alloc_symbol(&symbol_yes);
+			e2 = tmp;
+			trans_count++;
+		}
+		break;
+	default:
+		;
+	}
+#undef e1
+#undef e2
+}
+
+static void expr_eliminate_dups2(enum expr_type type, struct expr **ep1, struct expr **ep2)
+{
+#define e1 (*ep1)
+#define e2 (*ep2)
+	struct expr *tmp, *tmp1, *tmp2;
+
+	if (e1->type == type) {
+		expr_eliminate_dups2(type, &e1->left.expr, &e2);
+		expr_eliminate_dups2(type, &e1->right.expr, &e2);
+		return;
+	}
+	if (e2->type == type) {
+		expr_eliminate_dups2(type, &e1, &e2->left.expr);
+		expr_eliminate_dups2(type, &e1, &e2->right.expr);
+	}
+	if (e1 == e2)
+		return;
+
+	switch (e1->type) {
+	case E_OR:
+		expr_eliminate_dups2(e1->type, &e1, &e1);
+		// (FOO || BAR) && (!FOO && !BAR) -> n
+		tmp1 = expr_transform(expr_alloc_one(E_NOT, expr_copy(e1)));
+		tmp2 = expr_copy(e2);
+		tmp = expr_extract_eq_and(&tmp1, &tmp2);
+		if (expr_is_yes(tmp1)) {
+			expr_free(e1);
+			e1 = expr_alloc_symbol(&symbol_no);
+			trans_count++;
+		}
+		expr_free(tmp2);
+		expr_free(tmp1);
+		expr_free(tmp);
+		break;
+	case E_AND:
+		expr_eliminate_dups2(e1->type, &e1, &e1);
+		// (FOO && BAR) || (!FOO || !BAR) -> y
+		tmp1 = expr_transform(expr_alloc_one(E_NOT, expr_copy(e1)));
+		tmp2 = expr_copy(e2);
+		tmp = expr_extract_eq_or(&tmp1, &tmp2);
+		if (expr_is_no(tmp1)) {
+			expr_free(e1);
+			e1 = expr_alloc_symbol(&symbol_yes);
+			trans_count++;
+		}
+		expr_free(tmp2);
+		expr_free(tmp1);
+		expr_free(tmp);
+		break;
+	default:
+		;
+	}
+#undef e1
+#undef e2
+}
+
+struct expr *expr_eliminate_dups(struct expr *e)
+{
+	int oldcount;
+	if (!e)
+		return e;
+
+	oldcount = trans_count;
+	while (1) {
+		trans_count = 0;
+		switch (e->type) {
+		case E_OR: case E_AND:
+			expr_eliminate_dups1(e->type, &e, &e);
+			expr_eliminate_dups2(e->type, &e, &e);
+		default:
+			;
+		}
+		if (!trans_count)
+			break;
+		e = expr_eliminate_yn(e);
+	}
+	trans_count = oldcount;
+	return e;
+}
+
+struct expr *expr_transform(struct expr *e)
+{
+	struct expr *tmp;
+
+	if (!e)
+		return NULL;
+	switch (e->type) {
+	case E_EQUAL:
+	case E_UNEQUAL:
+	case E_SYMBOL:
+	case E_LIST:
+		break;
+	default:
+		e->left.expr = expr_transform(e->left.expr);
+		e->right.expr = expr_transform(e->right.expr);
+	}
+
+	switch (e->type) {
+	case E_EQUAL:
+		if (e->left.sym->type != S_BOOLEAN)
+			break;
+		if (e->right.sym == &symbol_no) {
+			e->type = E_NOT;
+			e->left.expr = expr_alloc_symbol(e->left.sym);
+			e->right.sym = NULL;
+			break;
+		}
+		if (e->right.sym == &symbol_mod) {
+			printf("boolean symbol %s tested for 'm'? test forced to 'n'\n", e->left.sym->name);
+			e->type = E_SYMBOL;
+			e->left.sym = &symbol_no;
+			e->right.sym = NULL;
+			break;
+		}
+		if (e->right.sym == &symbol_yes) {
+			e->type = E_SYMBOL;
+			e->right.sym = NULL;
+			break;
+		}
+		break;
+	case E_UNEQUAL:
+		if (e->left.sym->type != S_BOOLEAN)
+			break;
+		if (e->right.sym == &symbol_no) {
+			e->type = E_SYMBOL;
+			e->right.sym = NULL;
+			break;
+		}
+		if (e->right.sym == &symbol_mod) {
+			printf("boolean symbol %s tested for 'm'? test forced to 'y'\n", e->left.sym->name);
+			e->type = E_SYMBOL;
+			e->left.sym = &symbol_yes;
+			e->right.sym = NULL;
+			break;
+		}
+		if (e->right.sym == &symbol_yes) {
+			e->type = E_NOT;
+			e->left.expr = expr_alloc_symbol(e->left.sym);
+			e->right.sym = NULL;
+			break;
+		}
+		break;
+	case E_NOT:
+		switch (e->left.expr->type) {
+		case E_NOT:
+			// !!a -> a
+			tmp = e->left.expr->left.expr;
+			free(e->left.expr);
+			free(e);
+			e = tmp;
+			e = expr_transform(e);
+			break;
+		case E_EQUAL:
+		case E_UNEQUAL:
+			// !a='x' -> a!='x'
+			tmp = e->left.expr;
+			free(e);
+			e = tmp;
+			e->type = e->type == E_EQUAL ? E_UNEQUAL : E_EQUAL;
+			break;
+		case E_OR:
+			// !(a || b) -> !a && !b
+			tmp = e->left.expr;
+			e->type = E_AND;
+			e->right.expr = expr_alloc_one(E_NOT, tmp->right.expr);
+			tmp->type = E_NOT;
+			tmp->right.expr = NULL;
+			e = expr_transform(e);
+			break;
+		case E_AND:
+			// !(a && b) -> !a || !b
+			tmp = e->left.expr;
+			e->type = E_OR;
+			e->right.expr = expr_alloc_one(E_NOT, tmp->right.expr);
+			tmp->type = E_NOT;
+			tmp->right.expr = NULL;
+			e = expr_transform(e);
+			break;
+		case E_SYMBOL:
+			if (e->left.expr->left.sym == &symbol_yes) {
+				// !'y' -> 'n'
+				tmp = e->left.expr;
+				free(e);
+				e = tmp;
+				e->type = E_SYMBOL;
+				e->left.sym = &symbol_no;
+				break;
+			}
+			if (e->left.expr->left.sym == &symbol_mod) {
+				// !'m' -> 'm'
+				tmp = e->left.expr;
+				free(e);
+				e = tmp;
+				e->type = E_SYMBOL;
+				e->left.sym = &symbol_mod;
+				break;
+			}
+			if (e->left.expr->left.sym == &symbol_no) {
+				// !'n' -> 'y'
+				tmp = e->left.expr;
+				free(e);
+				e = tmp;
+				e->type = E_SYMBOL;
+				e->left.sym = &symbol_yes;
+				break;
+			}
+			break;
+		default:
+			;
+		}
+		break;
+	default:
+		;
+	}
+	return e;
+}
+
+int expr_contains_symbol(struct expr *dep, struct symbol *sym)
+{
+	if (!dep)
+		return 0;
+
+	switch (dep->type) {
+	case E_AND:
+	case E_OR:
+		return expr_contains_symbol(dep->left.expr, sym) ||
+		       expr_contains_symbol(dep->right.expr, sym);
+	case E_SYMBOL:
+		return dep->left.sym == sym;
+	case E_EQUAL:
+	case E_UNEQUAL:
+		return dep->left.sym == sym ||
+		       dep->right.sym == sym;
+	case E_NOT:
+		return expr_contains_symbol(dep->left.expr, sym);
+	default:
+		;
+	}
+	return 0;
+}
+
+bool expr_depends_symbol(struct expr *dep, struct symbol *sym)
+{
+	if (!dep)
+		return false;
+
+	switch (dep->type) {
+	case E_AND:
+		return expr_depends_symbol(dep->left.expr, sym) ||
+		       expr_depends_symbol(dep->right.expr, sym);
+	case E_SYMBOL:
+		return dep->left.sym == sym;
+	case E_EQUAL:
+		if (dep->left.sym == sym) {
+			if (dep->right.sym == &symbol_yes || dep->right.sym == &symbol_mod)
+				return true;
+		}
+		break;
+	case E_UNEQUAL:
+		if (dep->left.sym == sym) {
+			if (dep->right.sym == &symbol_no)
+				return true;
+		}
+		break;
+	default:
+		;
+	}
+ 	return false;
+}
+
+struct expr *expr_extract_eq_and(struct expr **ep1, struct expr **ep2)
+{
+	struct expr *tmp = NULL;
+	expr_extract_eq(E_AND, &tmp, ep1, ep2);
+	if (tmp) {
+		*ep1 = expr_eliminate_yn(*ep1);
+		*ep2 = expr_eliminate_yn(*ep2);
+	}
+	return tmp;
+}
+
+struct expr *expr_extract_eq_or(struct expr **ep1, struct expr **ep2)
+{
+	struct expr *tmp = NULL;
+	expr_extract_eq(E_OR, &tmp, ep1, ep2);
+	if (tmp) {
+		*ep1 = expr_eliminate_yn(*ep1);
+		*ep2 = expr_eliminate_yn(*ep2);
+	}
+	return tmp;
+}
+
+void expr_extract_eq(enum expr_type type, struct expr **ep, struct expr **ep1, struct expr **ep2)
+{
+#define e1 (*ep1)
+#define e2 (*ep2)
+	if (e1->type == type) {
+		expr_extract_eq(type, ep, &e1->left.expr, &e2);
+		expr_extract_eq(type, ep, &e1->right.expr, &e2);
+		return;
+	}
+	if (e2->type == type) {
+		expr_extract_eq(type, ep, ep1, &e2->left.expr);
+		expr_extract_eq(type, ep, ep1, &e2->right.expr);
+		return;
+	}
+	if (expr_eq(e1, e2)) {
+		*ep = *ep ? expr_alloc_two(type, *ep, e1) : e1;
+		expr_free(e2);
+		if (type == E_AND) {
+			e1 = expr_alloc_symbol(&symbol_yes);
+			e2 = expr_alloc_symbol(&symbol_yes);
+		} else if (type == E_OR) {
+			e1 = expr_alloc_symbol(&symbol_no);
+			e2 = expr_alloc_symbol(&symbol_no);
+		}
+	}
+#undef e1
+#undef e2
+}
+
+struct expr *expr_trans_compare(struct expr *e, enum expr_type type, struct symbol *sym)
+{
+	struct expr *e1, *e2;
+
+	if (!e) {
+		e = expr_alloc_symbol(sym);
+		if (type == E_UNEQUAL)
+			e = expr_alloc_one(E_NOT, e);
+		return e;
+	}
+	switch (e->type) {
+	case E_AND:
+		e1 = expr_trans_compare(e->left.expr, E_EQUAL, sym);
+		e2 = expr_trans_compare(e->right.expr, E_EQUAL, sym);
+		if (sym == &symbol_yes)
+			e = expr_alloc_two(E_AND, e1, e2);
+		if (sym == &symbol_no)
+			e = expr_alloc_two(E_OR, e1, e2);
+		if (type == E_UNEQUAL)
+			e = expr_alloc_one(E_NOT, e);
+		return e;
+	case E_OR:
+		e1 = expr_trans_compare(e->left.expr, E_EQUAL, sym);
+		e2 = expr_trans_compare(e->right.expr, E_EQUAL, sym);
+		if (sym == &symbol_yes)
+			e = expr_alloc_two(E_OR, e1, e2);
+		if (sym == &symbol_no)
+			e = expr_alloc_two(E_AND, e1, e2);
+		if (type == E_UNEQUAL)
+			e = expr_alloc_one(E_NOT, e);
+		return e;
+	case E_NOT:
+		return expr_trans_compare(e->left.expr, type == E_EQUAL ? E_UNEQUAL : E_EQUAL, sym);
+	case E_UNEQUAL:
+	case E_EQUAL:
+		if (type == E_EQUAL) {
+			if (sym == &symbol_yes)
+				return expr_copy(e);
+			if (sym == &symbol_mod)
+				return expr_alloc_symbol(&symbol_no);
+			if (sym == &symbol_no)
+				return expr_alloc_one(E_NOT, expr_copy(e));
+		} else {
+			if (sym == &symbol_yes)
+				return expr_alloc_one(E_NOT, expr_copy(e));
+			if (sym == &symbol_mod)
+				return expr_alloc_symbol(&symbol_yes);
+			if (sym == &symbol_no)
+				return expr_copy(e);
+		}
+		break;
+	case E_SYMBOL:
+		return expr_alloc_comp(type, e->left.sym, sym);
+	case E_LIST:
+	case E_RANGE:
+	case E_NONE:
+		/* panic */;
+	}
+	return NULL;
+}
+
+tristate expr_calc_value(struct expr *e)
+{
+	tristate val1, val2;
+	const char *str1, *str2;
+
+	if (!e)
+		return yes;
+
+	switch (e->type) {
+	case E_SYMBOL:
+		sym_calc_value(e->left.sym);
+		return e->left.sym->curr.tri;
+	case E_AND:
+		val1 = expr_calc_value(e->left.expr);
+		val2 = expr_calc_value(e->right.expr);
+		return EXPR_AND(val1, val2);
+	case E_OR:
+		val1 = expr_calc_value(e->left.expr);
+		val2 = expr_calc_value(e->right.expr);
+		return EXPR_OR(val1, val2);
+	case E_NOT:
+		val1 = expr_calc_value(e->left.expr);
+		return EXPR_NOT(val1);
+	case E_EQUAL:
+		sym_calc_value(e->left.sym);
+		sym_calc_value(e->right.sym);
+		str1 = sym_get_string_value(e->left.sym);
+		str2 = sym_get_string_value(e->right.sym);
+		return !strcmp(str1, str2) ? yes : no;
+	case E_UNEQUAL:
+		sym_calc_value(e->left.sym);
+		sym_calc_value(e->right.sym);
+		str1 = sym_get_string_value(e->left.sym);
+		str2 = sym_get_string_value(e->right.sym);
+		return !strcmp(str1, str2) ? no : yes;
+	default:
+		printf("expr_calc_value: %d?\n", e->type);
+		return no;
+	}
+}
+
+int expr_compare_type(enum expr_type t1, enum expr_type t2)
+{
+#if 0
+	return 1;
+#else
+	if (t1 == t2)
+		return 0;
+	switch (t1) {
+	case E_EQUAL:
+	case E_UNEQUAL:
+		if (t2 == E_NOT)
+			return 1;
+	case E_NOT:
+		if (t2 == E_AND)
+			return 1;
+	case E_AND:
+		if (t2 == E_OR)
+			return 1;
+	case E_OR:
+		if (t2 == E_LIST)
+			return 1;
+	case E_LIST:
+		if (t2 == 0)
+			return 1;
+	default:
+		return -1;
+	}
+	printf("[%dgt%d?]", t1, t2);
+	return 0;
+#endif
+}
+
+static inline struct expr *
+expr_get_leftmost_symbol(const struct expr *e)
+{
+
+	if (e == NULL)
+		return NULL;
+
+	while (e->type != E_SYMBOL)
+		e = e->left.expr;
+
+	return expr_copy(e);
+}
+
+/*
+ * Given expression `e1' and `e2', returns the leaf of the longest
+ * sub-expression of `e1' not containing 'e2.
+ */
+struct expr *expr_simplify_unmet_dep(struct expr *e1, struct expr *e2)
+{
+	struct expr *ret;
+
+	switch (e1->type) {
+	case E_OR:
+		return expr_alloc_and(
+		    expr_simplify_unmet_dep(e1->left.expr, e2),
+		    expr_simplify_unmet_dep(e1->right.expr, e2));
+	case E_AND: {
+		struct expr *e;
+		e = expr_alloc_and(expr_copy(e1), expr_copy(e2));
+		e = expr_eliminate_dups(e);
+		ret = (!expr_eq(e, e1)) ? e1 : NULL;
+		expr_free(e);
+		break;
+		}
+	default:
+		ret = e1;
+		break;
+	}
+
+	return expr_get_leftmost_symbol(ret);
+}
+
+void expr_print(struct expr *e, void (*fn)(void *, struct symbol *, const char *), void *data, int prevtoken)
+{
+	if (!e) {
+		fn(data, NULL, "y");
+		return;
+	}
+
+	if (expr_compare_type(prevtoken, e->type) > 0)
+		fn(data, NULL, "(");
+	switch (e->type) {
+	case E_SYMBOL:
+		if (e->left.sym->name)
+			fn(data, e->left.sym, e->left.sym->name);
+		else
+			fn(data, NULL, "<choice>");
+		break;
+	case E_NOT:
+		fn(data, NULL, "!");
+		expr_print(e->left.expr, fn, data, E_NOT);
+		break;
+	case E_EQUAL:
+		if (e->left.sym->name)
+			fn(data, e->left.sym, e->left.sym->name);
+		else
+			fn(data, NULL, "<choice>");
+		fn(data, NULL, "=");
+		fn(data, e->right.sym, e->right.sym->name);
+		break;
+	case E_UNEQUAL:
+		if (e->left.sym->name)
+			fn(data, e->left.sym, e->left.sym->name);
+		else
+			fn(data, NULL, "<choice>");
+		fn(data, NULL, "!=");
+		fn(data, e->right.sym, e->right.sym->name);
+		break;
+	case E_OR:
+		expr_print(e->left.expr, fn, data, E_OR);
+		fn(data, NULL, " || ");
+		expr_print(e->right.expr, fn, data, E_OR);
+		break;
+	case E_AND:
+		expr_print(e->left.expr, fn, data, E_AND);
+		fn(data, NULL, " && ");
+		expr_print(e->right.expr, fn, data, E_AND);
+		break;
+	case E_LIST:
+		fn(data, e->right.sym, e->right.sym->name);
+		if (e->left.expr) {
+			fn(data, NULL, " ^ ");
+			expr_print(e->left.expr, fn, data, E_LIST);
+		}
+		break;
+	case E_RANGE:
+		fn(data, NULL, "[");
+		fn(data, e->left.sym, e->left.sym->name);
+		fn(data, NULL, " ");
+		fn(data, e->right.sym, e->right.sym->name);
+		fn(data, NULL, "]");
+		break;
+	default:
+	  {
+		char buf[32];
+		sprintf(buf, "<unknown type %d>", e->type);
+		fn(data, NULL, buf);
+		break;
+	  }
+	}
+	if (expr_compare_type(prevtoken, e->type) > 0)
+		fn(data, NULL, ")");
+}
+
+static void expr_print_file_helper(void *data, struct symbol *sym, const char *str)
+{
+	xfwrite(str, strlen(str), 1, data);
+}
+
+void expr_fprint(struct expr *e, FILE *out)
+{
+	expr_print(e, expr_print_file_helper, out, E_NONE);
+}
+
+static void expr_print_gstr_helper(void *data, struct symbol *sym, const char *str)
+{
+	struct gstr *gs = (struct gstr*)data;
+	const char *sym_str = NULL;
+
+	if (sym)
+		sym_str = sym_get_string_value(sym);
+
+	if (gs->max_width) {
+		unsigned extra_length = strlen(str);
+		const char *last_cr = strrchr(gs->s, '\n');
+		unsigned last_line_length;
+
+		if (sym_str)
+			extra_length += 4 + strlen(sym_str);
+
+		if (!last_cr)
+			last_cr = gs->s;
+
+		last_line_length = strlen(gs->s) - (last_cr - gs->s);
+
+		if ((last_line_length + extra_length) > gs->max_width)
+			str_append(gs, "\\\n");
+	}
+
+	str_append(gs, str);
+	if (sym && sym->type != S_UNKNOWN)
+		str_printf(gs, " [=%s]", sym_str);
+}
+
+void expr_gstr_print(struct expr *e, struct gstr *gs)
+{
+	expr_print(e, expr_print_gstr_helper, gs, E_NONE);
+}
diff --git a/carl9170fw/config/expr.h b/carl9170fw/config/expr.h
new file mode 100644
index 0000000..d4ecce8
--- /dev/null
+++ b/carl9170fw/config/expr.h
@@ -0,0 +1,225 @@
+/*
+ * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
+ * Released under the terms of the GNU GPL v2.0.
+ */
+
+#ifndef EXPR_H
+#define EXPR_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <assert.h>
+#include <stdio.h>
+#ifndef __cplusplus
+#include <stdbool.h>
+#endif
+
+struct file {
+	struct file *next;
+	struct file *parent;
+	const char *name;
+	int lineno;
+};
+
+typedef enum tristate {
+	no, mod, yes
+} tristate;
+
+enum expr_type {
+	E_NONE, E_OR, E_AND, E_NOT, E_EQUAL, E_UNEQUAL, E_LIST, E_SYMBOL, E_RANGE
+};
+
+union expr_data {
+	struct expr *expr;
+	struct symbol *sym;
+};
+
+struct expr {
+	enum expr_type type;
+	union expr_data left, right;
+};
+
+#define EXPR_OR(dep1, dep2)	(((dep1)>(dep2))?(dep1):(dep2))
+#define EXPR_AND(dep1, dep2)	(((dep1)<(dep2))?(dep1):(dep2))
+#define EXPR_NOT(dep)		(2-(dep))
+
+#define expr_list_for_each_sym(l, e, s) \
+	for (e = (l); e && (s = e->right.sym); e = e->left.expr)
+
+struct expr_value {
+	struct expr *expr;
+	tristate tri;
+};
+
+struct symbol_value {
+	void *val;
+	tristate tri;
+};
+
+enum symbol_type {
+	S_UNKNOWN, S_BOOLEAN, S_TRISTATE, S_INT, S_HEX, S_STRING, S_OTHER
+};
+
+/* enum values are used as index to symbol.def[] */
+enum {
+	S_DEF_USER,		/* main user value */
+	S_DEF_AUTO,		/* values read from auto.conf */
+	S_DEF_DEF3,		/* Reserved for UI usage */
+	S_DEF_DEF4,		/* Reserved for UI usage */
+	S_DEF_COUNT
+};
+
+struct symbol {
+	struct symbol *next;
+	char *name;
+	enum symbol_type type;
+	struct symbol_value curr;
+	struct symbol_value def[S_DEF_COUNT];
+	tristate visible;
+	int flags;
+	struct property *prop;
+	struct expr_value dir_dep;
+	struct expr_value rev_dep;
+};
+
+#define for_all_symbols(i, sym) for (i = 0; i < SYMBOL_HASHSIZE; i++) for (sym = symbol_hash[i]; sym; sym = sym->next) if (sym->type != S_OTHER)
+
+#define SYMBOL_CONST      0x0001  /* symbol is const */
+#define SYMBOL_CHECK      0x0008  /* used during dependency checking */
+#define SYMBOL_CHOICE     0x0010  /* start of a choice block (null name) */
+#define SYMBOL_CHOICEVAL  0x0020  /* used as a value in a choice block */
+#define SYMBOL_VALID      0x0080  /* set when symbol.curr is calculated */
+#define SYMBOL_OPTIONAL   0x0100  /* choice is optional - values can be 'n' */
+#define SYMBOL_WRITE      0x0200  /* ? */
+#define SYMBOL_CHANGED    0x0400  /* ? */
+#define SYMBOL_AUTO       0x1000  /* value from environment variable */
+#define SYMBOL_CHECKED    0x2000  /* used during dependency checking */
+#define SYMBOL_WARNED     0x8000  /* warning has been issued */
+
+/* Set when symbol.def[] is used */
+#define SYMBOL_DEF        0x10000  /* First bit of SYMBOL_DEF */
+#define SYMBOL_DEF_USER   0x10000  /* symbol.def[S_DEF_USER] is valid */
+#define SYMBOL_DEF_AUTO   0x20000  /* symbol.def[S_DEF_AUTO] is valid */
+#define SYMBOL_DEF3       0x40000  /* symbol.def[S_DEF_3] is valid */
+#define SYMBOL_DEF4       0x80000  /* symbol.def[S_DEF_4] is valid */
+
+#define SYMBOL_MAXLENGTH	256
+#define SYMBOL_HASHSIZE		9973
+
+/* A property represent the config options that can be associated
+ * with a config "symbol".
+ * Sample:
+ * config FOO
+ *         default y
+ *         prompt "foo prompt"
+ *         select BAR
+ * config BAZ
+ *         int "BAZ Value"
+ *         range 1..255
+ */
+enum prop_type {
+	P_UNKNOWN,
+	P_PROMPT,   /* prompt "foo prompt" or "BAZ Value" */
+	P_COMMENT,  /* text associated with a comment */
+	P_MENU,     /* prompt associated with a menuconfig option */
+	P_DEFAULT,  /* default y */
+	P_CHOICE,   /* choice value */
+	P_SELECT,   /* select BAR */
+	P_RANGE,    /* range 7..100 (for a symbol) */
+	P_ENV,      /* value from environment variable */
+	P_SYMBOL,   /* where a symbol is defined */
+};
+
+struct property {
+	struct property *next;     /* next property - null if last */
+	struct symbol *sym;        /* the symbol for which the property is associated */
+	enum prop_type type;       /* type of property */
+	const char *text;          /* the prompt value - P_PROMPT, P_MENU, P_COMMENT */
+	struct expr_value visible;
+	struct expr *expr;         /* the optional conditional part of the property */
+	struct menu *menu;         /* the menu the property are associated with
+	                            * valid for: P_SELECT, P_RANGE, P_CHOICE,
+	                            * P_PROMPT, P_DEFAULT, P_MENU, P_COMMENT */
+	struct file *file;         /* what file was this property defined */
+	int lineno;                /* what lineno was this property defined */
+};
+
+#define for_all_properties(sym, st, tok) \
+	for (st = sym->prop; st; st = st->next) \
+		if (st->type == (tok))
+#define for_all_defaults(sym, st) for_all_properties(sym, st, P_DEFAULT)
+#define for_all_choices(sym, st) for_all_properties(sym, st, P_CHOICE)
+#define for_all_prompts(sym, st) \
+	for (st = sym->prop; st; st = st->next) \
+		if (st->text)
+
+struct menu {
+	struct menu *next;
+	struct menu *parent;
+	struct menu *list;
+	struct symbol *sym;
+	struct property *prompt;
+	struct expr *visibility;
+	struct expr *dep;
+	unsigned int flags;
+	char *help;
+	struct file *file;
+	int lineno;
+	void *data;
+};
+
+#define MENU_CHANGED		0x0001
+#define MENU_ROOT		0x0002
+
+extern struct file *file_list;
+extern struct file *current_file;
+struct file *lookup_file(const char *name);
+
+extern struct symbol symbol_yes, symbol_no, symbol_mod;
+extern struct symbol *modules_sym;
+extern struct symbol *sym_defconfig_list;
+extern int cdebug;
+struct expr *expr_alloc_symbol(struct symbol *sym);
+struct expr *expr_alloc_one(enum expr_type type, struct expr *ce);
+struct expr *expr_alloc_two(enum expr_type type, struct expr *e1, struct expr *e2);
+struct expr *expr_alloc_comp(enum expr_type type, struct symbol *s1, struct symbol *s2);
+struct expr *expr_alloc_and(struct expr *e1, struct expr *e2);
+struct expr *expr_alloc_or(struct expr *e1, struct expr *e2);
+struct expr *expr_copy(const struct expr *org);
+void expr_free(struct expr *e);
+int expr_eq(struct expr *e1, struct expr *e2);
+void expr_eliminate_eq(struct expr **ep1, struct expr **ep2);
+tristate expr_calc_value(struct expr *e);
+struct expr *expr_eliminate_yn(struct expr *e);
+struct expr *expr_trans_bool(struct expr *e);
+struct expr *expr_eliminate_dups(struct expr *e);
+struct expr *expr_transform(struct expr *e);
+int expr_contains_symbol(struct expr *dep, struct symbol *sym);
+bool expr_depends_symbol(struct expr *dep, struct symbol *sym);
+struct expr *expr_extract_eq_and(struct expr **ep1, struct expr **ep2);
+struct expr *expr_extract_eq_or(struct expr **ep1, struct expr **ep2);
+void expr_extract_eq(enum expr_type type, struct expr **ep, struct expr **ep1, struct expr **ep2);
+struct expr *expr_trans_compare(struct expr *e, enum expr_type type, struct symbol *sym);
+struct expr *expr_simplify_unmet_dep(struct expr *e1, struct expr *e2);
+
+void expr_fprint(struct expr *e, FILE *out);
+struct gstr; /* forward */
+void expr_gstr_print(struct expr *e, struct gstr *gs);
+
+static inline int expr_is_yes(struct expr *e)
+{
+	return !e || (e->type == E_SYMBOL && e->left.sym == &symbol_yes);
+}
+
+static inline int expr_is_no(struct expr *e)
+{
+	return e && (e->type == E_SYMBOL && e->left.sym == &symbol_no);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* EXPR_H */
diff --git a/carl9170fw/config/lkc.h b/carl9170fw/config/lkc.h
new file mode 100644
index 0000000..c18f2bd
--- /dev/null
+++ b/carl9170fw/config/lkc.h
@@ -0,0 +1,190 @@
+/*
+ * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
+ * Released under the terms of the GNU GPL v2.0.
+ */
+
+#ifndef LKC_H
+#define LKC_H
+
+#include "expr.h"
+
+#ifndef KBUILD_NO_NLS
+# include <libintl.h>
+#else
+static inline const char *gettext(const char *txt) { return txt; }
+static inline void textdomain(const char *domainname) {}
+static inline void bindtextdomain(const char *name, const char *dir) {}
+static inline char *bind_textdomain_codeset(const char *dn, char *c) { return c; }
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define P(name,type,arg)	extern type name arg
+#include "lkc_proto.h"
+#undef P
+
+#define SRCTREE "srctree"
+
+#ifndef PACKAGE
+#define PACKAGE "linux"
+#endif
+
+#define LOCALEDIR "/usr/share/locale"
+
+#define _(text) gettext(text)
+#define N_(text) (text)
+
+#ifndef CONFIG_
+#define CONFIG_ "CONFIG_"
+#endif
+
+#define TF_COMMAND	0x0001
+#define TF_PARAM	0x0002
+#define TF_OPTION	0x0004
+
+enum conf_def_mode {
+	def_default,
+	def_yes,
+	def_mod,
+	def_no,
+	def_random
+};
+
+#define T_OPT_MODULES		1
+#define T_OPT_DEFCONFIG_LIST	2
+#define T_OPT_ENV		3
+
+struct kconf_id {
+	int name;
+	int token;
+	unsigned int flags;
+	enum symbol_type stype;
+};
+
+extern int zconfdebug;
+
+int zconfparse(void);
+void zconfdump(FILE *out);
+void zconf_starthelp(void);
+FILE *zconf_fopen(const char *name);
+void zconf_initscan(const char *name);
+void zconf_nextfile(const char *name);
+int zconf_lineno(void);
+const char *zconf_curname(void);
+
+/* confdata.c */
+const char *conf_get_configname(void);
+const char *conf_get_autoconfig_name(void);
+char *conf_get_default_confname(void);
+void sym_set_change_count(int count);
+void sym_add_change_count(int count);
+void conf_set_all_new_symbols(enum conf_def_mode mode);
+
+struct conf_printer {
+	void (*print_symbol)(FILE *, struct symbol *, const char *, void *);
+	void (*print_comment)(FILE *, const char *, void *);
+};
+
+/* confdata.c and expr.c */
+static inline void xfwrite(const void *str, size_t len, size_t count, FILE *out)
+{
+	assert(len != 0);
+
+	if (fwrite(str, len, count, out) != count)
+		fprintf(stderr, "Error in writing or end of file.\n");
+}
+
+/* menu.c */
+void _menu_init(void);
+void menu_warn(struct menu *menu, const char *fmt, ...);
+struct menu *menu_add_menu(void);
+void menu_end_menu(void);
+void menu_add_entry(struct symbol *sym);
+void menu_end_entry(void);
+void menu_add_dep(struct expr *dep);
+void menu_add_visibility(struct expr *dep);
+struct property *menu_add_prop(enum prop_type type, char *prompt, struct expr *expr, struct expr *dep);
+struct property *menu_add_prompt(enum prop_type type, char *prompt, struct expr *dep);
+void menu_add_expr(enum prop_type type, struct expr *expr, struct expr *dep);
+void menu_add_symbol(enum prop_type type, struct symbol *sym, struct expr *dep);
+void menu_add_option(int token, char *arg);
+void menu_finalize(struct menu *parent);
+void menu_set_type(int type);
+
+/* util.c */
+struct file *file_lookup(const char *name);
+int file_write_dep(const char *name);
+
+struct gstr {
+	size_t len;
+	char  *s;
+	/*
+	* when max_width is not zero long lines in string s (if any) get
+	* wrapped not to exceed the max_width value
+	*/
+	int max_width;
+};
+struct gstr str_new(void);
+struct gstr str_assign(const char *s);
+void str_free(struct gstr *gs);
+void str_append(struct gstr *gs, const char *s);
+void str_printf(struct gstr *gs, const char *fmt, ...);
+const char *str_get(struct gstr *gs);
+
+/* symbol.c */
+extern struct expr *sym_env_list;
+
+void sym_init(void);
+void sym_clear_all_valid(void);
+void sym_set_all_changed(void);
+void sym_set_changed(struct symbol *sym);
+struct symbol *sym_choice_default(struct symbol *sym);
+const char *sym_get_string_default(struct symbol *sym);
+struct symbol *sym_check_deps(struct symbol *sym);
+struct property *prop_alloc(enum prop_type type, struct symbol *sym);
+struct symbol *prop_get_symbol(struct property *prop);
+struct property *sym_get_env_prop(struct symbol *sym);
+
+static inline tristate sym_get_tristate_value(struct symbol *sym)
+{
+	return sym->curr.tri;
+}
+
+
+static inline struct symbol *sym_get_choice_value(struct symbol *sym)
+{
+	return (struct symbol *)sym->curr.val;
+}
+
+static inline bool sym_set_choice_value(struct symbol *ch, struct symbol *chval)
+{
+	return sym_set_tristate_value(chval, yes);
+}
+
+static inline bool sym_is_choice(struct symbol *sym)
+{
+	return sym->flags & SYMBOL_CHOICE ? true : false;
+}
+
+static inline bool sym_is_choice_value(struct symbol *sym)
+{
+	return sym->flags & SYMBOL_CHOICEVAL ? true : false;
+}
+
+static inline bool sym_is_optional(struct symbol *sym)
+{
+	return sym->flags & SYMBOL_OPTIONAL ? true : false;
+}
+
+static inline bool sym_has_value(struct symbol *sym)
+{
+	return sym->flags & SYMBOL_DEF_USER ? true : false;
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LKC_H */
diff --git a/carl9170fw/config/lkc_proto.h b/carl9170fw/config/lkc_proto.h
new file mode 100644
index 0000000..47fe9c3
--- /dev/null
+++ b/carl9170fw/config/lkc_proto.h
@@ -0,0 +1,54 @@
+#include <stdarg.h>
+
+/* confdata.c */
+P(conf_parse,void,(const char *name));
+P(conf_read,int,(const char *name));
+P(conf_read_simple,int,(const char *name, int));
+P(conf_write_defconfig,int,(const char *name));
+P(conf_write,int,(const char *name));
+P(conf_write_autoconf,int,(void));
+P(conf_get_changed,bool,(void));
+P(conf_set_changed_callback, void,(void (*fn)(void)));
+P(conf_set_message_callback, void,(void (*fn)(const char *fmt, va_list ap)));
+
+/* menu.c */
+P(rootmenu,struct menu,);
+
+P(menu_is_visible, bool, (struct menu *menu));
+P(menu_has_prompt, bool, (struct menu *menu));
+P(menu_get_prompt,const char *,(struct menu *menu));
+P(menu_get_root_menu,struct menu *,(struct menu *menu));
+P(menu_get_parent_menu,struct menu *,(struct menu *menu));
+P(menu_has_help,bool,(struct menu *menu));
+P(menu_get_help,const char *,(struct menu *menu));
+P(get_symbol_str, void, (struct gstr *r, struct symbol *sym));
+P(get_relations_str, struct gstr, (struct symbol **sym_arr));
+P(menu_get_ext_help,void,(struct menu *menu, struct gstr *help));
+
+/* symbol.c */
+P(symbol_hash,struct symbol *,[SYMBOL_HASHSIZE]);
+
+P(sym_lookup,struct symbol *,(const char *name, int flags));
+P(sym_find,struct symbol *,(const char *name));
+P(sym_expand_string_value,const char *,(const char *in));
+P(sym_escape_string_value, const char *,(const char *in));
+P(sym_re_search,struct symbol **,(const char *pattern));
+P(sym_type_name,const char *,(enum symbol_type type));
+P(sym_calc_value,void,(struct symbol *sym));
+P(sym_get_type,enum symbol_type,(struct symbol *sym));
+P(sym_tristate_within_range,bool,(struct symbol *sym,tristate tri));
+P(sym_set_tristate_value,bool,(struct symbol *sym,tristate tri));
+P(sym_toggle_tristate_value,tristate,(struct symbol *sym));
+P(sym_string_valid,bool,(struct symbol *sym, const char *newval));
+P(sym_string_within_range,bool,(struct symbol *sym, const char *str));
+P(sym_set_string_value,bool,(struct symbol *sym, const char *newval));
+P(sym_is_changable,bool,(struct symbol *sym));
+P(sym_get_choice_prop,struct property *,(struct symbol *sym));
+P(sym_get_default_prop,struct property *,(struct symbol *sym));
+P(sym_get_string_value,const char *,(struct symbol *sym));
+
+P(prop_get_type_name,const char *,(enum prop_type type));
+
+/* expr.c */
+P(expr_compare_type,int,(enum expr_type t1, enum expr_type t2));
+P(expr_print,void,(struct expr *e, void (*fn)(void *, struct symbol *, const char *), void *data, int prevtoken));
diff --git a/carl9170fw/config/menu.c b/carl9170fw/config/menu.c
new file mode 100644
index 0000000..8c2a97e
--- /dev/null
+++ b/carl9170fw/config/menu.c
@@ -0,0 +1,607 @@
+/*
+ * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
+ * Released under the terms of the GNU GPL v2.0.
+ */
+
+#include <ctype.h>
+#include <stdarg.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "lkc.h"
+
+static const char nohelp_text[] = "There is no help available for this option.";
+
+struct menu rootmenu;
+static struct menu **last_entry_ptr;
+
+struct file *file_list;
+struct file *current_file;
+
+void menu_warn(struct menu *menu, const char *fmt, ...)
+{
+	va_list ap;
+	va_start(ap, fmt);
+	fprintf(stderr, "%s:%d:warning: ", menu->file->name, menu->lineno);
+	vfprintf(stderr, fmt, ap);
+	fprintf(stderr, "\n");
+	va_end(ap);
+}
+
+static void prop_warn(struct property *prop, const char *fmt, ...)
+{
+	va_list ap;
+	va_start(ap, fmt);
+	fprintf(stderr, "%s:%d:warning: ", prop->file->name, prop->lineno);
+	vfprintf(stderr, fmt, ap);
+	fprintf(stderr, "\n");
+	va_end(ap);
+}
+
+void _menu_init(void)
+{
+	current_entry = current_menu = &rootmenu;
+	last_entry_ptr = &rootmenu.list;
+}
+
+void menu_add_entry(struct symbol *sym)
+{
+	struct menu *menu;
+
+	menu = malloc(sizeof(*menu));
+	memset(menu, 0, sizeof(*menu));
+	menu->sym = sym;
+	menu->parent = current_menu;
+	menu->file = current_file;
+	menu->lineno = zconf_lineno();
+
+	*last_entry_ptr = menu;
+	last_entry_ptr = &menu->next;
+	current_entry = menu;
+	if (sym)
+		menu_add_symbol(P_SYMBOL, sym, NULL);
+}
+
+void menu_end_entry(void)
+{
+}
+
+struct menu *menu_add_menu(void)
+{
+	menu_end_entry();
+	last_entry_ptr = &current_entry->list;
+	return current_menu = current_entry;
+}
+
+void menu_end_menu(void)
+{
+	last_entry_ptr = &current_menu->next;
+	current_menu = current_menu->parent;
+}
+
+static struct expr *menu_check_dep(struct expr *e)
+{
+	if (!e)
+		return e;
+
+	switch (e->type) {
+	case E_NOT:
+		e->left.expr = menu_check_dep(e->left.expr);
+		break;
+	case E_OR:
+	case E_AND:
+		e->left.expr = menu_check_dep(e->left.expr);
+		e->right.expr = menu_check_dep(e->right.expr);
+		break;
+	case E_SYMBOL:
+		/* change 'm' into 'm' && MODULES */
+		if (e->left.sym == &symbol_mod)
+			return expr_alloc_and(e, expr_alloc_symbol(modules_sym));
+		break;
+	default:
+		break;
+	}
+	return e;
+}
+
+void menu_add_dep(struct expr *dep)
+{
+	current_entry->dep = expr_alloc_and(current_entry->dep, menu_check_dep(dep));
+}
+
+void menu_set_type(int type)
+{
+	struct symbol *sym = current_entry->sym;
+
+	if (sym->type == type)
+		return;
+	if (sym->type == S_UNKNOWN) {
+		sym->type = type;
+		return;
+	}
+	menu_warn(current_entry, "type of '%s' redefined from '%s' to '%s'",
+	    sym->name ? sym->name : "<choice>",
+	    sym_type_name(sym->type), sym_type_name(type));
+}
+
+struct property *menu_add_prop(enum prop_type type, char *prompt, struct expr *expr, struct expr *dep)
+{
+	struct property *prop = prop_alloc(type, current_entry->sym);
+
+	prop->menu = current_entry;
+	prop->expr = expr;
+	prop->visible.expr = menu_check_dep(dep);
+
+	if (prompt) {
+		if (isspace(*prompt)) {
+			prop_warn(prop, "leading whitespace ignored");
+			while (isspace(*prompt))
+				prompt++;
+		}
+		if (current_entry->prompt && current_entry != &rootmenu)
+			prop_warn(prop, "prompt redefined");
+
+		/* Apply all upper menus' visibilities to actual prompts. */
+		if(type == P_PROMPT) {
+			struct menu *menu = current_entry;
+
+			while ((menu = menu->parent) != NULL) {
+				if (!menu->visibility)
+					continue;
+				prop->visible.expr
+					= expr_alloc_and(prop->visible.expr,
+							 menu->visibility);
+			}
+		}
+
+		current_entry->prompt = prop;
+	}
+	prop->text = prompt;
+
+	return prop;
+}
+
+struct property *menu_add_prompt(enum prop_type type, char *prompt, struct expr *dep)
+{
+	return menu_add_prop(type, prompt, NULL, dep);
+}
+
+void menu_add_visibility(struct expr *expr)
+{
+	current_entry->visibility = expr_alloc_and(current_entry->visibility,
+	    expr);
+}
+
+void menu_add_expr(enum prop_type type, struct expr *expr, struct expr *dep)
+{
+	menu_add_prop(type, NULL, expr, dep);
+}
+
+void menu_add_symbol(enum prop_type type, struct symbol *sym, struct expr *dep)
+{
+	menu_add_prop(type, NULL, expr_alloc_symbol(sym), dep);
+}
+
+void menu_add_option(int token, char *arg)
+{
+	struct property *prop;
+
+	switch (token) {
+	case T_OPT_MODULES:
+		prop = prop_alloc(P_DEFAULT, modules_sym);
+		prop->expr = expr_alloc_symbol(current_entry->sym);
+		break;
+	case T_OPT_DEFCONFIG_LIST:
+		if (!sym_defconfig_list)
+			sym_defconfig_list = current_entry->sym;
+		else if (sym_defconfig_list != current_entry->sym)
+			zconf_error("trying to redefine defconfig symbol");
+		break;
+	case T_OPT_ENV:
+		prop_add_env(arg);
+		break;
+	}
+}
+
+static int menu_validate_number(struct symbol *sym, struct symbol *sym2)
+{
+	return sym2->type == S_INT || sym2->type == S_HEX ||
+	       (sym2->type == S_UNKNOWN && sym_string_valid(sym, sym2->name));
+}
+
+static void sym_check_prop(struct symbol *sym)
+{
+	struct property *prop;
+	struct symbol *sym2;
+	for (prop = sym->prop; prop; prop = prop->next) {
+		switch (prop->type) {
+		case P_DEFAULT:
+			if ((sym->type == S_STRING || sym->type == S_INT || sym->type == S_HEX) &&
+			    prop->expr->type != E_SYMBOL)
+				prop_warn(prop,
+				    "default for config symbol '%s'"
+				    " must be a single symbol", sym->name);
+			if (prop->expr->type != E_SYMBOL)
+				break;
+			sym2 = prop_get_symbol(prop);
+			if (sym->type == S_HEX || sym->type == S_INT) {
+				if (!menu_validate_number(sym, sym2))
+					prop_warn(prop,
+					    "'%s': number is invalid",
+					    sym->name);
+			}
+			break;
+		case P_SELECT:
+			sym2 = prop_get_symbol(prop);
+			if (sym->type != S_BOOLEAN && sym->type != S_TRISTATE)
+				prop_warn(prop,
+				    "config symbol '%s' uses select, but is "
+				    "not boolean or tristate", sym->name);
+			else if (sym2->type != S_UNKNOWN &&
+			         sym2->type != S_BOOLEAN &&
+			         sym2->type != S_TRISTATE)
+				prop_warn(prop,
+				    "'%s' has wrong type. 'select' only "
+				    "accept arguments of boolean and "
+				    "tristate type", sym2->name);
+			break;
+		case P_RANGE:
+			if (sym->type != S_INT && sym->type != S_HEX)
+				prop_warn(prop, "range is only allowed "
+				                "for int or hex symbols");
+			if (!menu_validate_number(sym, prop->expr->left.sym) ||
+			    !menu_validate_number(sym, prop->expr->right.sym))
+				prop_warn(prop, "range is invalid");
+			break;
+		default:
+			;
+		}
+	}
+}
+
+void menu_finalize(struct menu *parent)
+{
+	struct menu *menu, *last_menu;
+	struct symbol *sym;
+	struct property *prop;
+	struct expr *parentdep, *basedep, *dep, *dep2, **ep;
+
+	sym = parent->sym;
+	if (parent->list) {
+		if (sym && sym_is_choice(sym)) {
+			if (sym->type == S_UNKNOWN) {
+				/* find the first choice value to find out choice type */
+				current_entry = parent;
+				for (menu = parent->list; menu; menu = menu->next) {
+					if (menu->sym && menu->sym->type != S_UNKNOWN) {
+						menu_set_type(menu->sym->type);
+						break;
+					}
+				}
+			}
+			/* set the type of the remaining choice values */
+			for (menu = parent->list; menu; menu = menu->next) {
+				current_entry = menu;
+				if (menu->sym && menu->sym->type == S_UNKNOWN)
+					menu_set_type(sym->type);
+			}
+			parentdep = expr_alloc_symbol(sym);
+		} else if (parent->prompt)
+			parentdep = parent->prompt->visible.expr;
+		else
+			parentdep = parent->dep;
+
+		for (menu = parent->list; menu; menu = menu->next) {
+			basedep = expr_transform(menu->dep);
+			basedep = expr_alloc_and(expr_copy(parentdep), basedep);
+			basedep = expr_eliminate_dups(basedep);
+			menu->dep = basedep;
+			if (menu->sym)
+				prop = menu->sym->prop;
+			else
+				prop = menu->prompt;
+			for (; prop; prop = prop->next) {
+				if (prop->menu != menu)
+					continue;
+				dep = expr_transform(prop->visible.expr);
+				dep = expr_alloc_and(expr_copy(basedep), dep);
+				dep = expr_eliminate_dups(dep);
+				if (menu->sym && menu->sym->type != S_TRISTATE)
+					dep = expr_trans_bool(dep);
+				prop->visible.expr = dep;
+				if (prop->type == P_SELECT) {
+					struct symbol *es = prop_get_symbol(prop);
+					es->rev_dep.expr = expr_alloc_or(es->rev_dep.expr,
+							expr_alloc_and(expr_alloc_symbol(menu->sym), expr_copy(dep)));
+				}
+			}
+		}
+		for (menu = parent->list; menu; menu = menu->next)
+			menu_finalize(menu);
+	} else if (sym) {
+		basedep = parent->prompt ? parent->prompt->visible.expr : NULL;
+		basedep = expr_trans_compare(basedep, E_UNEQUAL, &symbol_no);
+		basedep = expr_eliminate_dups(expr_transform(basedep));
+		last_menu = NULL;
+		for (menu = parent->next; menu; menu = menu->next) {
+			dep = menu->prompt ? menu->prompt->visible.expr : menu->dep;
+			if (!expr_contains_symbol(dep, sym))
+				break;
+			if (expr_depends_symbol(dep, sym))
+				goto next;
+			dep = expr_trans_compare(dep, E_UNEQUAL, &symbol_no);
+			dep = expr_eliminate_dups(expr_transform(dep));
+			dep2 = expr_copy(basedep);
+			expr_eliminate_eq(&dep, &dep2);
+			expr_free(dep);
+			if (!expr_is_yes(dep2)) {
+				expr_free(dep2);
+				break;
+			}
+			expr_free(dep2);
+		next:
+			menu_finalize(menu);
+			menu->parent = parent;
+			last_menu = menu;
+		}
+		if (last_menu) {
+			parent->list = parent->next;
+			parent->next = last_menu->next;
+			last_menu->next = NULL;
+		}
+
+		sym->dir_dep.expr = expr_alloc_or(sym->dir_dep.expr, parent->dep);
+	}
+	for (menu = parent->list; menu; menu = menu->next) {
+		if (sym && sym_is_choice(sym) &&
+		    menu->sym && !sym_is_choice_value(menu->sym)) {
+			current_entry = menu;
+			menu->sym->flags |= SYMBOL_CHOICEVAL;
+			if (!menu->prompt)
+				menu_warn(menu, "choice value must have a prompt");
+			for (prop = menu->sym->prop; prop; prop = prop->next) {
+				if (prop->type == P_DEFAULT)
+					prop_warn(prop, "defaults for choice "
+						  "values not supported");
+				if (prop->menu == menu)
+					continue;
+				if (prop->type == P_PROMPT &&
+				    prop->menu->parent->sym != sym)
+					prop_warn(prop, "choice value used outside its choice group");
+			}
+			/* Non-tristate choice values of tristate choices must
+			 * depend on the choice being set to Y. The choice
+			 * values' dependencies were propagated to their
+			 * properties above, so the change here must be re-
+			 * propagated.
+			 */
+			if (sym->type == S_TRISTATE && menu->sym->type != S_TRISTATE) {
+				basedep = expr_alloc_comp(E_EQUAL, sym, &symbol_yes);
+				menu->dep = expr_alloc_and(basedep, menu->dep);
+				for (prop = menu->sym->prop; prop; prop = prop->next) {
+					if (prop->menu != menu)
+						continue;
+					prop->visible.expr = expr_alloc_and(expr_copy(basedep),
+									    prop->visible.expr);
+				}
+			}
+			menu_add_symbol(P_CHOICE, sym, NULL);
+			prop = sym_get_choice_prop(sym);
+			for (ep = &prop->expr; *ep; ep = &(*ep)->left.expr)
+				;
+			*ep = expr_alloc_one(E_LIST, NULL);
+			(*ep)->right.sym = menu->sym;
+		}
+		if (menu->list && (!menu->prompt || !menu->prompt->text)) {
+			for (last_menu = menu->list; ; last_menu = last_menu->next) {
+				last_menu->parent = parent;
+				if (!last_menu->next)
+					break;
+			}
+			last_menu->next = menu->next;
+			menu->next = menu->list;
+			menu->list = NULL;
+		}
+	}
+
+	if (sym && !(sym->flags & SYMBOL_WARNED)) {
+		if (sym->type == S_UNKNOWN)
+			menu_warn(parent, "config symbol defined without type");
+
+		if (sym_is_choice(sym) && !parent->prompt)
+			menu_warn(parent, "choice must have a prompt");
+
+		/* Check properties connected to this symbol */
+		sym_check_prop(sym);
+		sym->flags |= SYMBOL_WARNED;
+	}
+
+	if (sym && !sym_is_optional(sym) && parent->prompt) {
+		sym->rev_dep.expr = expr_alloc_or(sym->rev_dep.expr,
+				expr_alloc_and(parent->prompt->visible.expr,
+					expr_alloc_symbol(&symbol_mod)));
+	}
+}
+
+bool menu_has_prompt(struct menu *menu)
+{
+	if (!menu->prompt)
+		return false;
+	return true;
+}
+
+bool menu_is_visible(struct menu *menu)
+{
+	struct menu *child;
+	struct symbol *sym;
+	tristate visible;
+
+	if (!menu->prompt)
+		return false;
+
+	if (menu->visibility) {
+		if (expr_calc_value(menu->visibility) == no)
+			return no;
+	}
+
+	sym = menu->sym;
+	if (sym) {
+		sym_calc_value(sym);
+		visible = menu->prompt->visible.tri;
+	} else
+		visible = menu->prompt->visible.tri = expr_calc_value(menu->prompt->visible.expr);
+
+	if (visible != no)
+		return true;
+
+	if (!sym || sym_get_tristate_value(menu->sym) == no)
+		return false;
+
+	for (child = menu->list; child; child = child->next) {
+		if (menu_is_visible(child)) {
+			if (sym)
+				sym->flags |= SYMBOL_DEF_USER;
+			return true;
+		}
+	}
+
+	return false;
+}
+
+const char *menu_get_prompt(struct menu *menu)
+{
+	if (menu->prompt)
+		return menu->prompt->text;
+	else if (menu->sym)
+		return menu->sym->name;
+	return NULL;
+}
+
+struct menu *menu_get_root_menu(struct menu *menu)
+{
+	return &rootmenu;
+}
+
+struct menu *menu_get_parent_menu(struct menu *menu)
+{
+	enum prop_type type;
+
+	for (; menu != &rootmenu; menu = menu->parent) {
+		type = menu->prompt ? menu->prompt->type : 0;
+		if (type == P_MENU)
+			break;
+	}
+	return menu;
+}
+
+bool menu_has_help(struct menu *menu)
+{
+	return menu->help != NULL;
+}
+
+const char *menu_get_help(struct menu *menu)
+{
+	if (menu->help)
+		return menu->help;
+	else
+		return "";
+}
+
+static void get_prompt_str(struct gstr *r, struct property *prop)
+{
+	int i, j;
+	struct menu *submenu[8], *menu;
+
+	str_printf(r, _("Prompt: %s\n"), _(prop->text));
+	str_printf(r, _("  Defined at %s:%d\n"), prop->menu->file->name,
+		prop->menu->lineno);
+	if (!expr_is_yes(prop->visible.expr)) {
+		str_append(r, _("  Depends on: "));
+		expr_gstr_print(prop->visible.expr, r);
+		str_append(r, "\n");
+	}
+	menu = prop->menu->parent;
+	for (i = 0; menu != &rootmenu && i < 8; menu = menu->parent)
+		submenu[i++] = menu;
+	if (i > 0) {
+		str_printf(r, _("  Location:\n"));
+		for (j = 4; --i >= 0; j += 2) {
+			menu = submenu[i];
+			str_printf(r, "%*c-> %s", j, ' ', _(menu_get_prompt(menu)));
+			if (menu->sym) {
+				str_printf(r, " (%s [=%s])", menu->sym->name ?
+					menu->sym->name : _("<choice>"),
+					sym_get_string_value(menu->sym));
+			}
+			str_append(r, "\n");
+		}
+	}
+}
+
+void get_symbol_str(struct gstr *r, struct symbol *sym)
+{
+	bool hit;
+	struct property *prop;
+
+	if (sym && sym->name) {
+		str_printf(r, "Symbol: %s [=%s]\n", sym->name,
+			   sym_get_string_value(sym));
+		str_printf(r, "Type  : %s\n", sym_type_name(sym->type));
+		if (sym->type == S_INT || sym->type == S_HEX) {
+			prop = sym_get_range_prop(sym);
+			if (prop) {
+				str_printf(r, "Range : ");
+				expr_gstr_print(prop->expr, r);
+				str_append(r, "\n");
+			}
+		}
+	}
+	for_all_prompts(sym, prop)
+		get_prompt_str(r, prop);
+	hit = false;
+	for_all_properties(sym, prop, P_SELECT) {
+		if (!hit) {
+			str_append(r, "  Selects: ");
+			hit = true;
+		} else
+			str_printf(r, " && ");
+		expr_gstr_print(prop->expr, r);
+	}
+	if (hit)
+		str_append(r, "\n");
+	if (sym->rev_dep.expr) {
+		str_append(r, _("  Selected by: "));
+		expr_gstr_print(sym->rev_dep.expr, r);
+		str_append(r, "\n");
+	}
+	str_append(r, "\n\n");
+}
+
+struct gstr get_relations_str(struct symbol **sym_arr)
+{
+	struct symbol *sym;
+	struct gstr res = str_new();
+	int i;
+
+	for (i = 0; sym_arr && (sym = sym_arr[i]); i++)
+		get_symbol_str(&res, sym);
+	if (!i)
+		str_append(&res, _("No matches found.\n"));
+	return res;
+}
+
+
+void menu_get_ext_help(struct menu *menu, struct gstr *help)
+{
+	struct symbol *sym = menu->sym;
+	const char *help_text = nohelp_text;
+
+	if (menu_has_help(menu)) {
+		if (sym->name)
+			str_printf(help, "%s%s:\n\n", CONFIG_, sym->name);
+		help_text = menu_get_help(menu);
+	}
+	str_printf(help, "%s\n", _(help_text));
+	if (sym)
+		get_symbol_str(help, sym);
+}
diff --git a/carl9170fw/config/symbol.c b/carl9170fw/config/symbol.c
new file mode 100644
index 0000000..22a3c40
--- /dev/null
+++ b/carl9170fw/config/symbol.c
@@ -0,0 +1,1310 @@
+/*
+ * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
+ * Released under the terms of the GNU GPL v2.0.
+ */
+
+#include <ctype.h>
+#include <stdlib.h>
+#include <string.h>
+#include <regex.h>
+#include <sys/utsname.h>
+
+#include "lkc.h"
+
+struct symbol symbol_yes = {
+	.name = "y",
+	.curr = { "y", yes },
+	.flags = SYMBOL_CONST|SYMBOL_VALID,
+}, symbol_mod = {
+	.name = "m",
+	.curr = { "m", mod },
+	.flags = SYMBOL_CONST|SYMBOL_VALID,
+}, symbol_no = {
+	.name = "n",
+	.curr = { "n", no },
+	.flags = SYMBOL_CONST|SYMBOL_VALID,
+}, symbol_empty = {
+	.name = "",
+	.curr = { "", no },
+	.flags = SYMBOL_VALID,
+};
+
+struct symbol *sym_defconfig_list;
+struct symbol *modules_sym;
+tristate modules_val;
+
+struct expr *sym_env_list;
+
+static void sym_add_default(struct symbol *sym, const char *def)
+{
+	struct property *prop = prop_alloc(P_DEFAULT, sym);
+
+	prop->expr = expr_alloc_symbol(sym_lookup(def, SYMBOL_CONST));
+}
+
+void sym_init(void)
+{
+	struct symbol *sym;
+	struct utsname uts;
+	static bool inited = false;
+
+	if (inited)
+		return;
+	inited = true;
+
+	uname(&uts);
+
+	sym = sym_lookup("UNAME_RELEASE", 0);
+	sym->type = S_STRING;
+	sym->flags |= SYMBOL_AUTO;
+	sym_add_default(sym, uts.release);
+}
+
+enum symbol_type sym_get_type(struct symbol *sym)
+{
+	enum symbol_type type = sym->type;
+
+	if (type == S_TRISTATE) {
+		if (sym_is_choice_value(sym) && sym->visible == yes)
+			type = S_BOOLEAN;
+		else if (modules_val == no)
+			type = S_BOOLEAN;
+	}
+	return type;
+}
+
+const char *sym_type_name(enum symbol_type type)
+{
+	switch (type) {
+	case S_BOOLEAN:
+		return "boolean";
+	case S_TRISTATE:
+		return "tristate";
+	case S_INT:
+		return "integer";
+	case S_HEX:
+		return "hex";
+	case S_STRING:
+		return "string";
+	case S_UNKNOWN:
+		return "unknown";
+	case S_OTHER:
+		break;
+	}
+	return "???";
+}
+
+struct property *sym_get_choice_prop(struct symbol *sym)
+{
+	struct property *prop;
+
+	for_all_choices(sym, prop)
+		return prop;
+	return NULL;
+}
+
+struct property *sym_get_env_prop(struct symbol *sym)
+{
+	struct property *prop;
+
+	for_all_properties(sym, prop, P_ENV)
+		return prop;
+	return NULL;
+}
+
+struct property *sym_get_default_prop(struct symbol *sym)
+{
+	struct property *prop;
+
+	for_all_defaults(sym, prop) {
+		prop->visible.tri = expr_calc_value(prop->visible.expr);
+		if (prop->visible.tri != no)
+			return prop;
+	}
+	return NULL;
+}
+
+static struct property *sym_get_range_prop(struct symbol *sym)
+{
+	struct property *prop;
+
+	for_all_properties(sym, prop, P_RANGE) {
+		prop->visible.tri = expr_calc_value(prop->visible.expr);
+		if (prop->visible.tri != no)
+			return prop;
+	}
+	return NULL;
+}
+
+static int sym_get_range_val(struct symbol *sym, int base)
+{
+	sym_calc_value(sym);
+	switch (sym->type) {
+	case S_INT:
+		base = 10;
+		break;
+	case S_HEX:
+		base = 16;
+		break;
+	default:
+		break;
+	}
+	return strtol(sym->curr.val, NULL, base);
+}
+
+static void sym_validate_range(struct symbol *sym)
+{
+	struct property *prop;
+	int base, val, val2;
+	char str[64];
+
+	switch (sym->type) {
+	case S_INT:
+		base = 10;
+		break;
+	case S_HEX:
+		base = 16;
+		break;
+	default:
+		return;
+	}
+	prop = sym_get_range_prop(sym);
+	if (!prop)
+		return;
+	val = strtol(sym->curr.val, NULL, base);
+	val2 = sym_get_range_val(prop->expr->left.sym, base);
+	if (val >= val2) {
+		val2 = sym_get_range_val(prop->expr->right.sym, base);
+		if (val <= val2)
+			return;
+	}
+	if (sym->type == S_INT)
+		sprintf(str, "%d", val2);
+	else
+		sprintf(str, "0x%x", val2);
+	sym->curr.val = strdup(str);
+}
+
+static void sym_calc_visibility(struct symbol *sym)
+{
+	struct property *prop;
+	tristate tri;
+
+	/* any prompt visible? */
+	tri = no;
+	for_all_prompts(sym, prop) {
+		prop->visible.tri = expr_calc_value(prop->visible.expr);
+		tri = EXPR_OR(tri, prop->visible.tri);
+	}
+	if (tri == mod && (sym->type != S_TRISTATE || modules_val == no))
+		tri = yes;
+	if (sym->visible != tri) {
+		sym->visible = tri;
+		sym_set_changed(sym);
+	}
+	if (sym_is_choice_value(sym))
+		return;
+	/* defaulting to "yes" if no explicit "depends on" are given */
+	tri = yes;
+	if (sym->dir_dep.expr)
+		tri = expr_calc_value(sym->dir_dep.expr);
+	if (tri == mod)
+		tri = yes;
+	if (sym->dir_dep.tri != tri) {
+		sym->dir_dep.tri = tri;
+		sym_set_changed(sym);
+	}
+	tri = no;
+	if (sym->rev_dep.expr)
+		tri = expr_calc_value(sym->rev_dep.expr);
+	if (tri == mod && sym_get_type(sym) == S_BOOLEAN)
+		tri = yes;
+	if (sym->rev_dep.tri != tri) {
+		sym->rev_dep.tri = tri;
+		sym_set_changed(sym);
+	}
+}
+
+/*
+ * Find the default symbol for a choice.
+ * First try the default values for the choice symbol
+ * Next locate the first visible choice value
+ * Return NULL if none was found
+ */
+struct symbol *sym_choice_default(struct symbol *sym)
+{
+	struct symbol *def_sym;
+	struct property *prop;
+	struct expr *e;
+
+	/* any of the defaults visible? */
+	for_all_defaults(sym, prop) {
+		prop->visible.tri = expr_calc_value(prop->visible.expr);
+		if (prop->visible.tri == no)
+			continue;
+		def_sym = prop_get_symbol(prop);
+		if (def_sym->visible != no)
+			return def_sym;
+	}
+
+	/* just get the first visible value */
+	prop = sym_get_choice_prop(sym);
+	expr_list_for_each_sym(prop->expr, e, def_sym)
+		if (def_sym->visible != no)
+			return def_sym;
+
+	/* failed to locate any defaults */
+	return NULL;
+}
+
+static struct symbol *sym_calc_choice(struct symbol *sym)
+{
+	struct symbol *def_sym;
+	struct property *prop;
+	struct expr *e;
+	int flags;
+
+	/* first calculate all choice values' visibilities */
+	flags = sym->flags;
+	prop = sym_get_choice_prop(sym);
+	expr_list_for_each_sym(prop->expr, e, def_sym) {
+		sym_calc_visibility(def_sym);
+		if (def_sym->visible != no)
+			flags &= def_sym->flags;
+	}
+
+	sym->flags &= flags | ~SYMBOL_DEF_USER;
+
+	/* is the user choice visible? */
+	def_sym = sym->def[S_DEF_USER].val;
+	if (def_sym && def_sym->visible != no)
+		return def_sym;
+
+	def_sym = sym_choice_default(sym);
+
+	if (def_sym == NULL)
+		/* no choice? reset tristate value */
+		sym->curr.tri = no;
+
+	return def_sym;
+}
+
+void sym_calc_value(struct symbol *sym)
+{
+	struct symbol_value newval, oldval;
+	struct property *prop;
+	struct expr *e;
+
+	if (!sym)
+		return;
+
+	if (sym->flags & SYMBOL_VALID)
+		return;
+	sym->flags |= SYMBOL_VALID;
+
+	oldval = sym->curr;
+
+	switch (sym->type) {
+	case S_INT:
+	case S_HEX:
+	case S_STRING:
+		newval = symbol_empty.curr;
+		break;
+	case S_BOOLEAN:
+	case S_TRISTATE:
+		newval = symbol_no.curr;
+		break;
+	default:
+		sym->curr.val = sym->name;
+		sym->curr.tri = no;
+		return;
+	}
+	if (!sym_is_choice_value(sym))
+		sym->flags &= ~SYMBOL_WRITE;
+
+	sym_calc_visibility(sym);
+
+	/* set default if recursively called */
+	sym->curr = newval;
+
+	switch (sym_get_type(sym)) {
+	case S_BOOLEAN:
+	case S_TRISTATE:
+		if (sym_is_choice_value(sym) && sym->visible == yes) {
+			prop = sym_get_choice_prop(sym);
+			newval.tri = (prop_get_symbol(prop)->curr.val == sym) ? yes : no;
+		} else {
+			if (sym->visible != no) {
+				/* if the symbol is visible use the user value
+				 * if available, otherwise try the default value
+				 */
+				sym->flags |= SYMBOL_WRITE;
+				if (sym_has_value(sym)) {
+					newval.tri = EXPR_AND(sym->def[S_DEF_USER].tri,
+							      sym->visible);
+					goto calc_newval;
+				}
+			}
+			if (sym->rev_dep.tri != no)
+				sym->flags |= SYMBOL_WRITE;
+			if (!sym_is_choice(sym)) {
+				prop = sym_get_default_prop(sym);
+				if (prop) {
+					sym->flags |= SYMBOL_WRITE;
+					newval.tri = EXPR_AND(expr_calc_value(prop->expr),
+							      prop->visible.tri);
+				}
+			}
+		calc_newval:
+			if (sym->dir_dep.tri == no && sym->rev_dep.tri != no) {
+				struct expr *e;
+				e = expr_simplify_unmet_dep(sym->rev_dep.expr,
+				    sym->dir_dep.expr);
+				fprintf(stderr, "warning: (");
+				expr_fprint(e, stderr);
+				fprintf(stderr, ") selects %s which has unmet direct dependencies (",
+					sym->name);
+				expr_fprint(sym->dir_dep.expr, stderr);
+				fprintf(stderr, ")\n");
+				expr_free(e);
+			}
+			newval.tri = EXPR_OR(newval.tri, sym->rev_dep.tri);
+		}
+		if (newval.tri == mod && sym_get_type(sym) == S_BOOLEAN)
+			newval.tri = yes;
+		break;
+	case S_STRING:
+	case S_HEX:
+	case S_INT:
+		if (sym->visible != no) {
+			sym->flags |= SYMBOL_WRITE;
+			if (sym_has_value(sym)) {
+				newval.val = sym->def[S_DEF_USER].val;
+				break;
+			}
+		}
+		prop = sym_get_default_prop(sym);
+		if (prop) {
+			struct symbol *ds = prop_get_symbol(prop);
+			if (ds) {
+				sym->flags |= SYMBOL_WRITE;
+				sym_calc_value(ds);
+				newval.val = ds->curr.val;
+			}
+		}
+		break;
+	default:
+		;
+	}
+
+	sym->curr = newval;
+	if (sym_is_choice(sym) && newval.tri == yes)
+		sym->curr.val = sym_calc_choice(sym);
+	sym_validate_range(sym);
+
+	if (memcmp(&oldval, &sym->curr, sizeof(oldval))) {
+		sym_set_changed(sym);
+		if (modules_sym == sym) {
+			sym_set_all_changed();
+			modules_val = modules_sym->curr.tri;
+		}
+	}
+
+	if (sym_is_choice(sym)) {
+		struct symbol *choice_sym;
+
+		prop = sym_get_choice_prop(sym);
+		expr_list_for_each_sym(prop->expr, e, choice_sym) {
+			if ((sym->flags & SYMBOL_WRITE) &&
+			    choice_sym->visible != no)
+				choice_sym->flags |= SYMBOL_WRITE;
+			if (sym->flags & SYMBOL_CHANGED)
+				sym_set_changed(choice_sym);
+		}
+	}
+
+	if (sym->flags & SYMBOL_AUTO)
+		sym->flags &= ~SYMBOL_WRITE;
+}
+
+void sym_clear_all_valid(void)
+{
+	struct symbol *sym;
+	int i;
+
+	for_all_symbols(i, sym)
+		sym->flags &= ~SYMBOL_VALID;
+	sym_add_change_count(1);
+	if (modules_sym)
+		sym_calc_value(modules_sym);
+}
+
+void sym_set_changed(struct symbol *sym)
+{
+	struct property *prop;
+
+	sym->flags |= SYMBOL_CHANGED;
+	for (prop = sym->prop; prop; prop = prop->next) {
+		if (prop->menu)
+			prop->menu->flags |= MENU_CHANGED;
+	}
+}
+
+void sym_set_all_changed(void)
+{
+	struct symbol *sym;
+	int i;
+
+	for_all_symbols(i, sym)
+		sym_set_changed(sym);
+}
+
+bool sym_tristate_within_range(struct symbol *sym, tristate val)
+{
+	int type = sym_get_type(sym);
+
+	if (sym->visible == no)
+		return false;
+
+	if (type != S_BOOLEAN && type != S_TRISTATE)
+		return false;
+
+	if (type == S_BOOLEAN && val == mod)
+		return false;
+	if (sym->visible <= sym->rev_dep.tri)
+		return false;
+	if (sym_is_choice_value(sym) && sym->visible == yes)
+		return val == yes;
+	return val >= sym->rev_dep.tri && val <= sym->visible;
+}
+
+bool sym_set_tristate_value(struct symbol *sym, tristate val)
+{
+	tristate oldval = sym_get_tristate_value(sym);
+
+	if (oldval != val && !sym_tristate_within_range(sym, val))
+		return false;
+
+	if (!(sym->flags & SYMBOL_DEF_USER)) {
+		sym->flags |= SYMBOL_DEF_USER;
+		sym_set_changed(sym);
+	}
+	/*
+	 * setting a choice value also resets the new flag of the choice
+	 * symbol and all other choice values.
+	 */
+	if (sym_is_choice_value(sym) && val == yes) {
+		struct symbol *cs = prop_get_symbol(sym_get_choice_prop(sym));
+		struct property *prop;
+		struct expr *e;
+
+		cs->def[S_DEF_USER].val = sym;
+		cs->flags |= SYMBOL_DEF_USER;
+		prop = sym_get_choice_prop(cs);
+		for (e = prop->expr; e; e = e->left.expr) {
+			if (e->right.sym->visible != no)
+				e->right.sym->flags |= SYMBOL_DEF_USER;
+		}
+	}
+
+	sym->def[S_DEF_USER].tri = val;
+	if (oldval != val)
+		sym_clear_all_valid();
+
+	return true;
+}
+
+tristate sym_toggle_tristate_value(struct symbol *sym)
+{
+	tristate oldval, newval;
+
+	oldval = newval = sym_get_tristate_value(sym);
+	do {
+		switch (newval) {
+		case no:
+			newval = mod;
+			break;
+		case mod:
+			newval = yes;
+			break;
+		case yes:
+			newval = no;
+			break;
+		}
+		if (sym_set_tristate_value(sym, newval))
+			break;
+	} while (oldval != newval);
+	return newval;
+}
+
+bool sym_string_valid(struct symbol *sym, const char *str)
+{
+	signed char ch;
+
+	switch (sym->type) {
+	case S_STRING:
+		return true;
+	case S_INT:
+		ch = *str++;
+		if (ch == '-')
+			ch = *str++;
+		if (!isdigit(ch))
+			return false;
+		if (ch == '0' && *str != 0)
+			return false;
+		while ((ch = *str++)) {
+			if (!isdigit(ch))
+				return false;
+		}
+		return true;
+	case S_HEX:
+		if (str[0] == '0' && (str[1] == 'x' || str[1] == 'X'))
+			str += 2;
+		ch = *str++;
+		do {
+			if (!isxdigit(ch))
+				return false;
+		} while ((ch = *str++));
+		return true;
+	case S_BOOLEAN:
+	case S_TRISTATE:
+		switch (str[0]) {
+		case 'y': case 'Y':
+		case 'm': case 'M':
+		case 'n': case 'N':
+			return true;
+		}
+		return false;
+	default:
+		return false;
+	}
+}
+
+bool sym_string_within_range(struct symbol *sym, const char *str)
+{
+	struct property *prop;
+	int val;
+
+	switch (sym->type) {
+	case S_STRING:
+		return sym_string_valid(sym, str);
+	case S_INT:
+		if (!sym_string_valid(sym, str))
+			return false;
+		prop = sym_get_range_prop(sym);
+		if (!prop)
+			return true;
+		val = strtol(str, NULL, 10);
+		return val >= sym_get_range_val(prop->expr->left.sym, 10) &&
+		       val <= sym_get_range_val(prop->expr->right.sym, 10);
+	case S_HEX:
+		if (!sym_string_valid(sym, str))
+			return false;
+		prop = sym_get_range_prop(sym);
+		if (!prop)
+			return true;
+		val = strtol(str, NULL, 16);
+		return val >= sym_get_range_val(prop->expr->left.sym, 16) &&
+		       val <= sym_get_range_val(prop->expr->right.sym, 16);
+	case S_BOOLEAN:
+	case S_TRISTATE:
+		switch (str[0]) {
+		case 'y': case 'Y':
+			return sym_tristate_within_range(sym, yes);
+		case 'm': case 'M':
+			return sym_tristate_within_range(sym, mod);
+		case 'n': case 'N':
+			return sym_tristate_within_range(sym, no);
+		}
+		return false;
+	default:
+		return false;
+	}
+}
+
+bool sym_set_string_value(struct symbol *sym, const char *newval)
+{
+	const char *oldval;
+	char *val;
+	int size;
+
+	switch (sym->type) {
+	case S_BOOLEAN:
+	case S_TRISTATE:
+		switch (newval[0]) {
+		case 'y': case 'Y':
+			return sym_set_tristate_value(sym, yes);
+		case 'm': case 'M':
+			return sym_set_tristate_value(sym, mod);
+		case 'n': case 'N':
+			return sym_set_tristate_value(sym, no);
+		}
+		return false;
+	default:
+		;
+	}
+
+	if (!sym_string_within_range(sym, newval))
+		return false;
+
+	if (!(sym->flags & SYMBOL_DEF_USER)) {
+		sym->flags |= SYMBOL_DEF_USER;
+		sym_set_changed(sym);
+	}
+
+	oldval = sym->def[S_DEF_USER].val;
+	size = strlen(newval) + 1;
+	if (sym->type == S_HEX && (newval[0] != '0' || (newval[1] != 'x' && newval[1] != 'X'))) {
+		size += 2;
+		sym->def[S_DEF_USER].val = val = malloc(size);
+		*val++ = '0';
+		*val++ = 'x';
+	} else if (!oldval || strcmp(oldval, newval))
+		sym->def[S_DEF_USER].val = val = malloc(size);
+	else
+		return true;
+
+	strcpy(val, newval);
+	free((void *)oldval);
+	sym_clear_all_valid();
+
+	return true;
+}
+
+/*
+ * Find the default value associated to a symbol.
+ * For tristate symbol handle the modules=n case
+ * in which case "m" becomes "y".
+ * If the symbol does not have any default then fallback
+ * to the fixed default values.
+ */
+const char *sym_get_string_default(struct symbol *sym)
+{
+	struct property *prop;
+	struct symbol *ds;
+	const char *str;
+	tristate val;
+
+	sym_calc_visibility(sym);
+	sym_calc_value(modules_sym);
+	val = symbol_no.curr.tri;
+	str = symbol_empty.curr.val;
+
+	/* If symbol has a default value look it up */
+	prop = sym_get_default_prop(sym);
+	if (prop != NULL) {
+		switch (sym->type) {
+		case S_BOOLEAN:
+		case S_TRISTATE:
+			/* The visibility may limit the value from yes => mod */
+			val = EXPR_AND(expr_calc_value(prop->expr), prop->visible.tri);
+			break;
+		default:
+			/*
+			 * The following fails to handle the situation
+			 * where a default value is further limited by
+			 * the valid range.
+			 */
+			ds = prop_get_symbol(prop);
+			if (ds != NULL) {
+				sym_calc_value(ds);
+				str = (const char *)ds->curr.val;
+			}
+		}
+	}
+
+	/* Handle select statements */
+	val = EXPR_OR(val, sym->rev_dep.tri);
+
+	/* transpose mod to yes if modules are not enabled */
+	if (val == mod)
+		if (!sym_is_choice_value(sym) && modules_sym->curr.tri == no)
+			val = yes;
+
+	/* transpose mod to yes if type is bool */
+	if (sym->type == S_BOOLEAN && val == mod)
+		val = yes;
+
+	switch (sym->type) {
+	case S_BOOLEAN:
+	case S_TRISTATE:
+		switch (val) {
+		case no: return "n";
+		case mod: return "m";
+		case yes: return "y";
+		}
+	case S_INT:
+	case S_HEX:
+		return str;
+	case S_STRING:
+		return str;
+	case S_OTHER:
+	case S_UNKNOWN:
+		break;
+	}
+	return "";
+}
+
+const char *sym_get_string_value(struct symbol *sym)
+{
+	tristate val;
+
+	switch (sym->type) {
+	case S_BOOLEAN:
+	case S_TRISTATE:
+		val = sym_get_tristate_value(sym);
+		switch (val) {
+		case no:
+			return "n";
+		case mod:
+			sym_calc_value(modules_sym);
+			return (modules_sym->curr.tri == no) ? "n" : "m";
+		case yes:
+			return "y";
+		}
+		break;
+	default:
+		;
+	}
+	return (const char *)sym->curr.val;
+}
+
+bool sym_is_changable(struct symbol *sym)
+{
+	return sym->visible > sym->rev_dep.tri;
+}
+
+static unsigned strhash(const char *s)
+{
+	/* fnv32 hash */
+	unsigned hash = 2166136261U;
+	for (; *s; s++)
+		hash = (hash ^ *s) * 0x01000193;
+	return hash;
+}
+
+struct symbol *sym_lookup(const char *name, int flags)
+{
+	struct symbol *symbol;
+	char *new_name;
+	int hash;
+
+	if (name) {
+		if (name[0] && !name[1]) {
+			switch (name[0]) {
+			case 'y': return &symbol_yes;
+			case 'm': return &symbol_mod;
+			case 'n': return &symbol_no;
+			}
+		}
+		hash = strhash(name) % SYMBOL_HASHSIZE;
+
+		for (symbol = symbol_hash[hash]; symbol; symbol = symbol->next) {
+			if (symbol->name &&
+			    !strcmp(symbol->name, name) &&
+			    (flags ? symbol->flags & flags
+				   : !(symbol->flags & (SYMBOL_CONST|SYMBOL_CHOICE))))
+				return symbol;
+		}
+		new_name = strdup(name);
+	} else {
+		new_name = NULL;
+		hash = 0;
+	}
+
+	symbol = malloc(sizeof(*symbol));
+	memset(symbol, 0, sizeof(*symbol));
+	symbol->name = new_name;
+	symbol->type = S_UNKNOWN;
+	symbol->flags |= flags;
+
+	symbol->next = symbol_hash[hash];
+	symbol_hash[hash] = symbol;
+
+	return symbol;
+}
+
+struct symbol *sym_find(const char *name)
+{
+	struct symbol *symbol = NULL;
+	int hash = 0;
+
+	if (!name)
+		return NULL;
+
+	if (name[0] && !name[1]) {
+		switch (name[0]) {
+		case 'y': return &symbol_yes;
+		case 'm': return &symbol_mod;
+		case 'n': return &symbol_no;
+		}
+	}
+	hash = strhash(name) % SYMBOL_HASHSIZE;
+
+	for (symbol = symbol_hash[hash]; symbol; symbol = symbol->next) {
+		if (symbol->name &&
+		    !strcmp(symbol->name, name) &&
+		    !(symbol->flags & SYMBOL_CONST))
+				break;
+	}
+
+	return symbol;
+}
+
+/*
+ * Expand symbol's names embedded in the string given in argument. Symbols'
+ * name to be expanded shall be prefixed by a '$'. Unknown symbol expands to
+ * the empty string.
+ */
+const char *sym_expand_string_value(const char *in)
+{
+	const char *src;
+	char *res;
+	size_t reslen;
+
+	reslen = strlen(in) + 1;
+	res = malloc(reslen);
+	res[0] = '\0';
+
+	while ((src = strchr(in, '$'))) {
+		char *p, name[SYMBOL_MAXLENGTH];
+		const char *symval = "";
+		struct symbol *sym;
+		size_t newlen;
+
+		strncat(res, in, src - in);
+		src++;
+
+		p = name;
+		while (isalnum(*src) || *src == '_')
+			*p++ = *src++;
+		*p = '\0';
+
+		sym = sym_find(name);
+		if (sym != NULL) {
+			sym_calc_value(sym);
+			symval = sym_get_string_value(sym);
+		}
+
+		newlen = strlen(res) + strlen(symval) + strlen(src) + 1;
+		if (newlen > reslen) {
+			reslen = newlen;
+			res = realloc(res, reslen);
+		}
+
+		strcat(res, symval);
+		in = src;
+	}
+	strcat(res, in);
+
+	return res;
+}
+
+const char *sym_escape_string_value(const char *in)
+{
+	const char *p;
+	size_t reslen;
+	char *res;
+	size_t l;
+
+	reslen = strlen(in) + strlen("\"\"") + 1;
+
+	p = in;
+	for (;;) {
+		l = strcspn(p, "\"\\");
+		p += l;
+
+		if (p[0] == '\0')
+			break;
+
+		reslen++;
+		p++;
+	}
+
+	res = malloc(reslen);
+	res[0] = '\0';
+
+	strcat(res, "\"");
+
+	p = in;
+	for (;;) {
+		l = strcspn(p, "\"\\");
+		strncat(res, p, l);
+		p += l;
+
+		if (p[0] == '\0')
+			break;
+
+		strcat(res, "\\");
+		strncat(res, p++, 1);
+	}
+
+	strcat(res, "\"");
+	return res;
+}
+
+struct symbol **sym_re_search(const char *pattern)
+{
+	struct symbol *sym, **sym_arr = NULL;
+	int i, cnt, size;
+	regex_t re;
+
+	cnt = size = 0;
+	/* Skip if empty */
+	if (strlen(pattern) == 0)
+		return NULL;
+	if (regcomp(&re, pattern, REG_EXTENDED|REG_NOSUB|REG_ICASE))
+		return NULL;
+
+	for_all_symbols(i, sym) {
+		if (sym->flags & SYMBOL_CONST || !sym->name)
+			continue;
+		if (regexec(&re, sym->name, 0, NULL, 0))
+			continue;
+		if (cnt + 1 >= size) {
+			void *tmp = sym_arr;
+			size += 16;
+			sym_arr = realloc(sym_arr, size * sizeof(struct symbol *));
+			if (!sym_arr) {
+				free(tmp);
+				return NULL;
+			}
+		}
+		sym_calc_value(sym);
+		sym_arr[cnt++] = sym;
+	}
+	if (sym_arr)
+		sym_arr[cnt] = NULL;
+	regfree(&re);
+
+	return sym_arr;
+}
+
+/*
+ * When we check for recursive dependencies we use a stack to save
+ * current state so we can print out relevant info to user.
+ * The entries are located on the call stack so no need to free memory.
+ * Note inser() remove() must always match to properly clear the stack.
+ */
+static struct dep_stack {
+	struct dep_stack *prev, *next;
+	struct symbol *sym;
+	struct property *prop;
+	struct expr *expr;
+} *check_top;
+
+static void dep_stack_insert(struct dep_stack *stack, struct symbol *sym)
+{
+	memset(stack, 0, sizeof(*stack));
+	if (check_top)
+		check_top->next = stack;
+	stack->prev = check_top;
+	stack->sym = sym;
+	check_top = stack;
+}
+
+static void dep_stack_remove(void)
+{
+	check_top = check_top->prev;
+	if (check_top)
+		check_top->next = NULL;
+}
+
+/*
+ * Called when we have detected a recursive dependency.
+ * check_top point to the top of the stact so we use
+ * the ->prev pointer to locate the bottom of the stack.
+ */
+static void sym_check_print_recursive(struct symbol *last_sym)
+{
+	struct dep_stack *stack;
+	struct symbol *sym, *next_sym;
+	struct menu *menu = NULL;
+	struct property *prop;
+	struct dep_stack cv_stack;
+
+	if (sym_is_choice_value(last_sym)) {
+		dep_stack_insert(&cv_stack, last_sym);
+		last_sym = prop_get_symbol(sym_get_choice_prop(last_sym));
+	}
+
+	for (stack = check_top; stack != NULL; stack = stack->prev)
+		if (stack->sym == last_sym)
+			break;
+	if (!stack) {
+		fprintf(stderr, "unexpected recursive dependency error\n");
+		return;
+	}
+
+	for (; stack; stack = stack->next) {
+		sym = stack->sym;
+		next_sym = stack->next ? stack->next->sym : last_sym;
+		prop = stack->prop;
+		if (prop == NULL)
+			prop = stack->sym->prop;
+
+		/* for choice values find the menu entry (used below) */
+		if (sym_is_choice(sym) || sym_is_choice_value(sym)) {
+			for (prop = sym->prop; prop; prop = prop->next) {
+				menu = prop->menu;
+				if (prop->menu)
+					break;
+			}
+		}
+		if (stack->sym == last_sym)
+			fprintf(stderr, "%s:%d:error: recursive dependency detected!\n",
+				prop->file->name, prop->lineno);
+		if (stack->expr) {
+			fprintf(stderr, "%s:%d:\tsymbol %s %s value contains %s\n",
+				prop->file->name, prop->lineno,
+				sym->name ? sym->name : "<choice>",
+				prop_get_type_name(prop->type),
+				next_sym->name ? next_sym->name : "<choice>");
+		} else if (stack->prop) {
+			fprintf(stderr, "%s:%d:\tsymbol %s depends on %s\n",
+				prop->file->name, prop->lineno,
+				sym->name ? sym->name : "<choice>",
+				next_sym->name ? next_sym->name : "<choice>");
+		} else if (sym_is_choice(sym)) {
+			fprintf(stderr, "%s:%d:\tchoice %s contains symbol %s\n",
+				menu->file->name, menu->lineno,
+				sym->name ? sym->name : "<choice>",
+				next_sym->name ? next_sym->name : "<choice>");
+		} else if (sym_is_choice_value(sym)) {
+			fprintf(stderr, "%s:%d:\tsymbol %s is part of choice %s\n",
+				menu->file->name, menu->lineno,
+				sym->name ? sym->name : "<choice>",
+				next_sym->name ? next_sym->name : "<choice>");
+		} else {
+			fprintf(stderr, "%s:%d:\tsymbol %s is selected by %s\n",
+				prop->file->name, prop->lineno,
+				sym->name ? sym->name : "<choice>",
+				next_sym->name ? next_sym->name : "<choice>");
+		}
+	}
+
+	if (check_top == &cv_stack)
+		dep_stack_remove();
+}
+
+static struct symbol *sym_check_expr_deps(struct expr *e)
+{
+	struct symbol *sym;
+
+	if (!e)
+		return NULL;
+	switch (e->type) {
+	case E_OR:
+	case E_AND:
+		sym = sym_check_expr_deps(e->left.expr);
+		if (sym)
+			return sym;
+		return sym_check_expr_deps(e->right.expr);
+	case E_NOT:
+		return sym_check_expr_deps(e->left.expr);
+	case E_EQUAL:
+	case E_UNEQUAL:
+		sym = sym_check_deps(e->left.sym);
+		if (sym)
+			return sym;
+		return sym_check_deps(e->right.sym);
+	case E_SYMBOL:
+		return sym_check_deps(e->left.sym);
+	default:
+		break;
+	}
+	printf("Oops! How to check %d?\n", e->type);
+	return NULL;
+}
+
+/* return NULL when dependencies are OK */
+static struct symbol *sym_check_sym_deps(struct symbol *sym)
+{
+	struct symbol *sym2;
+	struct property *prop;
+	struct dep_stack stack;
+
+	dep_stack_insert(&stack, sym);
+
+	sym2 = sym_check_expr_deps(sym->rev_dep.expr);
+	if (sym2)
+		goto out;
+
+	for (prop = sym->prop; prop; prop = prop->next) {
+		if (prop->type == P_CHOICE || prop->type == P_SELECT)
+			continue;
+		stack.prop = prop;
+		sym2 = sym_check_expr_deps(prop->visible.expr);
+		if (sym2)
+			break;
+		if (prop->type != P_DEFAULT || sym_is_choice(sym))
+			continue;
+		stack.expr = prop->expr;
+		sym2 = sym_check_expr_deps(prop->expr);
+		if (sym2)
+			break;
+		stack.expr = NULL;
+	}
+
+out:
+	dep_stack_remove();
+
+	return sym2;
+}
+
+static struct symbol *sym_check_choice_deps(struct symbol *choice)
+{
+	struct symbol *sym, *sym2;
+	struct property *prop;
+	struct expr *e;
+	struct dep_stack stack;
+
+	dep_stack_insert(&stack, choice);
+
+	prop = sym_get_choice_prop(choice);
+	expr_list_for_each_sym(prop->expr, e, sym)
+		sym->flags |= (SYMBOL_CHECK | SYMBOL_CHECKED);
+
+	choice->flags |= (SYMBOL_CHECK | SYMBOL_CHECKED);
+	sym2 = sym_check_sym_deps(choice);
+	choice->flags &= ~SYMBOL_CHECK;
+	if (sym2)
+		goto out;
+
+	expr_list_for_each_sym(prop->expr, e, sym) {
+		sym2 = sym_check_sym_deps(sym);
+		if (sym2)
+			break;
+	}
+out:
+	expr_list_for_each_sym(prop->expr, e, sym)
+		sym->flags &= ~SYMBOL_CHECK;
+
+	if (sym2 && sym_is_choice_value(sym2) &&
+	    prop_get_symbol(sym_get_choice_prop(sym2)) == choice)
+		sym2 = choice;
+
+	dep_stack_remove();
+
+	return sym2;
+}
+
+struct symbol *sym_check_deps(struct symbol *sym)
+{
+	struct symbol *sym2;
+	struct property *prop;
+
+	if (sym->flags & SYMBOL_CHECK) {
+		sym_check_print_recursive(sym);
+		return sym;
+	}
+	if (sym->flags & SYMBOL_CHECKED)
+		return NULL;
+
+	if (sym_is_choice_value(sym)) {
+		struct dep_stack stack;
+
+		/* for choice groups start the check with main choice symbol */
+		dep_stack_insert(&stack, sym);
+		prop = sym_get_choice_prop(sym);
+		sym2 = sym_check_deps(prop_get_symbol(prop));
+		dep_stack_remove();
+	} else if (sym_is_choice(sym)) {
+		sym2 = sym_check_choice_deps(sym);
+	} else {
+		sym->flags |= (SYMBOL_CHECK | SYMBOL_CHECKED);
+		sym2 = sym_check_sym_deps(sym);
+		sym->flags &= ~SYMBOL_CHECK;
+	}
+
+	if (sym2 && sym2 == sym)
+		sym2 = NULL;
+
+	return sym2;
+}
+
+struct property *prop_alloc(enum prop_type type, struct symbol *sym)
+{
+	struct property *prop;
+	struct property **propp;
+
+	prop = malloc(sizeof(*prop));
+	memset(prop, 0, sizeof(*prop));
+	prop->type = type;
+	prop->sym = sym;
+	prop->file = current_file;
+	prop->lineno = zconf_lineno();
+
+	/* append property to the prop list of symbol */
+	if (sym) {
+		for (propp = &sym->prop; *propp; propp = &(*propp)->next)
+			;
+		*propp = prop;
+	}
+
+	return prop;
+}
+
+struct symbol *prop_get_symbol(struct property *prop)
+{
+	if (prop->expr && (prop->expr->type == E_SYMBOL ||
+			   prop->expr->type == E_LIST))
+		return prop->expr->left.sym;
+	return NULL;
+}
+
+const char *prop_get_type_name(enum prop_type type)
+{
+	switch (type) {
+	case P_PROMPT:
+		return "prompt";
+	case P_ENV:
+		return "env";
+	case P_COMMENT:
+		return "comment";
+	case P_MENU:
+		return "menu";
+	case P_DEFAULT:
+		return "default";
+	case P_CHOICE:
+		return "choice";
+	case P_SELECT:
+		return "select";
+	case P_RANGE:
+		return "range";
+	case P_SYMBOL:
+		return "symbol";
+	case P_UNKNOWN:
+		break;
+	}
+	return "unknown";
+}
+
+static void prop_add_env(const char *env)
+{
+	struct symbol *sym, *sym2;
+	struct property *prop;
+	char *p;
+
+	sym = current_entry->sym;
+	sym->flags |= SYMBOL_AUTO;
+	for_all_properties(sym, prop, P_ENV) {
+		sym2 = prop_get_symbol(prop);
+		if (strcmp(sym2->name, env))
+			menu_warn(current_entry, "redefining environment symbol from %s",
+				  sym2->name);
+		return;
+	}
+
+	prop = prop_alloc(P_ENV, sym);
+	prop->expr = expr_alloc_symbol(sym_lookup(env, SYMBOL_CONST));
+
+	sym_env_list = expr_alloc_one(E_LIST, sym_env_list);
+	sym_env_list->right.sym = sym;
+
+	p = getenv(env);
+	if (p)
+		sym_add_default(sym, p);
+	else
+		menu_warn(current_entry, "environment variable %s undefined", env);
+}
diff --git a/carl9170fw/config/util.c b/carl9170fw/config/util.c
new file mode 100644
index 0000000..d0b8b23
--- /dev/null
+++ b/carl9170fw/config/util.c
@@ -0,0 +1,140 @@
+/*
+ * Copyright (C) 2002-2005 Roman Zippel <zippel@linux-m68k.org>
+ * Copyright (C) 2002-2005 Sam Ravnborg <sam@ravnborg.org>
+ *
+ * Released under the terms of the GNU GPL v2.0.
+ */
+
+#include <stdarg.h>
+#include <stdlib.h>
+#include <string.h>
+#include "lkc.h"
+
+/* file already present in list? If not add it */
+struct file *file_lookup(const char *name)
+{
+	struct file *file;
+	const char *file_name = sym_expand_string_value(name);
+
+	for (file = file_list; file; file = file->next) {
+		if (!strcmp(name, file->name)) {
+			free((void *)file_name);
+			return file;
+		}
+	}
+
+	file = malloc(sizeof(*file));
+	memset(file, 0, sizeof(*file));
+	file->name = file_name;
+	file->next = file_list;
+	file_list = file;
+	return file;
+}
+
+/* write a dependency file as used by kbuild to track dependencies */
+int file_write_dep(const char *name)
+{
+	struct symbol *sym, *env_sym;
+	struct expr *e;
+	struct file *file;
+	FILE *out;
+
+	if (!name)
+		name = ".kconfig.d";
+	out = fopen("..config.tmp", "w");
+	if (!out)
+		return 1;
+	fprintf(out, "deps_config := \\\n");
+	for (file = file_list; file; file = file->next) {
+		if (file->next)
+			fprintf(out, "\t%s \\\n", file->name);
+		else
+			fprintf(out, "\t%s\n", file->name);
+	}
+	fprintf(out, "\n%s: \\\n"
+		     "\t$(deps_config)\n\n", conf_get_autoconfig_name());
+
+	expr_list_for_each_sym(sym_env_list, e, sym) {
+		struct property *prop;
+		const char *value;
+
+		prop = sym_get_env_prop(sym);
+		env_sym = prop_get_symbol(prop);
+		if (!env_sym)
+			continue;
+		value = getenv(env_sym->name);
+		if (!value)
+			value = "";
+		fprintf(out, "ifneq \"$(%s)\" \"%s\"\n", env_sym->name, value);
+		fprintf(out, "%s: FORCE\n", conf_get_autoconfig_name());
+		fprintf(out, "endif\n");
+	}
+
+	fprintf(out, "\n$(deps_config): ;\n");
+	fclose(out);
+	rename("..config.tmp", name);
+	return 0;
+}
+
+
+/* Allocate initial growable string */
+struct gstr str_new(void)
+{
+	struct gstr gs;
+	gs.s = malloc(sizeof(char) * 64);
+	gs.len = 64;
+	gs.max_width = 0;
+	strcpy(gs.s, "\0");
+	return gs;
+}
+
+/* Allocate and assign growable string */
+struct gstr str_assign(const char *s)
+{
+	struct gstr gs;
+	gs.s = strdup(s);
+	gs.len = strlen(s) + 1;
+	gs.max_width = 0;
+	return gs;
+}
+
+/* Free storage for growable string */
+void str_free(struct gstr *gs)
+{
+	if (gs->s)
+		free(gs->s);
+	gs->s = NULL;
+	gs->len = 0;
+}
+
+/* Append to growable string */
+void str_append(struct gstr *gs, const char *s)
+{
+	size_t l;
+	if (s) {
+		l = strlen(gs->s) + strlen(s) + 1;
+		if (l > gs->len) {
+			gs->s   = realloc(gs->s, l);
+			gs->len = l;
+		}
+		strcat(gs->s, s);
+	}
+}
+
+/* Append printf formatted string to growable string */
+void str_printf(struct gstr *gs, const char *fmt, ...)
+{
+	va_list ap;
+	char s[10000]; /* big enough... */
+	va_start(ap, fmt);
+	vsnprintf(s, sizeof(s), fmt, ap);
+	str_append(gs, s);
+	va_end(ap);
+}
+
+/* Retrieve value of growable string */
+const char *str_get(struct gstr *gs)
+{
+	return gs->s;
+}
+
diff --git a/carl9170fw/config/zconf.gperf b/carl9170fw/config/zconf.gperf
new file mode 100644
index 0000000..dd8ec26
--- /dev/null
+++ b/carl9170fw/config/zconf.gperf
@@ -0,0 +1,47 @@
+%language=ANSI-C
+%define hash-function-name kconf_id_hash
+%define lookup-function-name kconf_id_lookup
+%define string-pool-name kconf_id_strings
+%compare-strncmp
+%enum
+%pic
+%struct-type
+
+struct kconf_id;
+
+struct kconf_id *kconf_id_lookup(register const char *str, register unsigned int len);
+
+%%
+mainmenu,	T_MAINMENU,	TF_COMMAND
+menu,		T_MENU,		TF_COMMAND
+endmenu,	T_ENDMENU,	TF_COMMAND
+source,		T_SOURCE,	TF_COMMAND
+choice,		T_CHOICE,	TF_COMMAND
+endchoice,	T_ENDCHOICE,	TF_COMMAND
+comment,	T_COMMENT,	TF_COMMAND
+config,		T_CONFIG,	TF_COMMAND
+menuconfig,	T_MENUCONFIG,	TF_COMMAND
+help,		T_HELP,		TF_COMMAND
+if,		T_IF,		TF_COMMAND|TF_PARAM
+endif,		T_ENDIF,	TF_COMMAND
+depends,	T_DEPENDS,	TF_COMMAND
+optional,	T_OPTIONAL,	TF_COMMAND
+default,	T_DEFAULT,	TF_COMMAND, S_UNKNOWN
+prompt,		T_PROMPT,	TF_COMMAND
+tristate,	T_TYPE,		TF_COMMAND, S_TRISTATE
+def_tristate,	T_DEFAULT,	TF_COMMAND, S_TRISTATE
+bool,		T_TYPE,		TF_COMMAND, S_BOOLEAN
+boolean,	T_TYPE,		TF_COMMAND, S_BOOLEAN
+def_bool,	T_DEFAULT,	TF_COMMAND, S_BOOLEAN
+int,		T_TYPE,		TF_COMMAND, S_INT
+hex,		T_TYPE,		TF_COMMAND, S_HEX
+string,		T_TYPE,		TF_COMMAND, S_STRING
+select,		T_SELECT,	TF_COMMAND
+range,		T_RANGE,	TF_COMMAND
+visible,	T_VISIBLE,	TF_COMMAND
+option,		T_OPTION,	TF_COMMAND
+on,		T_ON,		TF_PARAM
+modules,	T_OPT_MODULES,	TF_OPTION
+defconfig_list,	T_OPT_DEFCONFIG_LIST,TF_OPTION
+env,		T_OPT_ENV,	TF_OPTION
+%%
diff --git a/carl9170fw/config/zconf.l b/carl9170fw/config/zconf.l
new file mode 100644
index 0000000..a2b2895
--- /dev/null
+++ b/carl9170fw/config/zconf.l
@@ -0,0 +1,364 @@
+%option nostdinit noyywrap never-interactive full ecs
+%option 8bit nodefault perf-report perf-report
+%option noinput
+%x COMMAND HELP STRING PARAM
+%{
+/*
+ * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
+ * Released under the terms of the GNU GPL v2.0.
+ */
+
+#include <limits.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "lkc.h"
+
+#define START_STRSIZE	16
+
+static struct {
+	struct file *file;
+	int lineno;
+} current_pos;
+
+static char *text;
+static int text_size, text_asize;
+
+struct buffer {
+        struct buffer *parent;
+        YY_BUFFER_STATE state;
+};
+
+struct buffer *current_buf;
+
+static int last_ts, first_ts;
+
+static void zconf_endhelp(void);
+static void zconf_endfile(void);
+
+static void new_string(void)
+{
+	text = malloc(START_STRSIZE);
+	text_asize = START_STRSIZE;
+	text_size = 0;
+	*text = 0;
+}
+
+static void append_string(const char *str, int size)
+{
+	int new_size = text_size + size + 1;
+	if (new_size > text_asize) {
+		new_size += START_STRSIZE - 1;
+		new_size &= -START_STRSIZE;
+		text = realloc(text, new_size);
+		text_asize = new_size;
+	}
+	memcpy(text + text_size, str, size);
+	text_size += size;
+	text[text_size] = 0;
+}
+
+static void alloc_string(const char *str, int size)
+{
+	text = malloc(size + 1);
+	memcpy(text, str, size);
+	text[size] = 0;
+}
+%}
+
+ws	[ \n\t]
+n	[A-Za-z0-9_]
+
+%%
+	int str = 0;
+	int ts, i;
+
+[ \t]*#.*\n	|
+[ \t]*\n	{
+	current_file->lineno++;
+	return T_EOL;
+}
+[ \t]*#.*
+
+
+[ \t]+	{
+	BEGIN(COMMAND);
+}
+
+.	{
+	unput(yytext[0]);
+	BEGIN(COMMAND);
+}
+
+
+<COMMAND>{
+	{n}+	{
+		const struct kconf_id *id = kconf_id_lookup(yytext, yyleng);
+		BEGIN(PARAM);
+		current_pos.file = current_file;
+		current_pos.lineno = current_file->lineno;
+		if (id && id->flags & TF_COMMAND) {
+			zconflval.id = id;
+			return id->token;
+		}
+		alloc_string(yytext, yyleng);
+		zconflval.string = text;
+		return T_WORD;
+	}
+	.
+	\n	{
+		BEGIN(INITIAL);
+		current_file->lineno++;
+		return T_EOL;
+	}
+}
+
+<PARAM>{
+	"&&"	return T_AND;
+	"||"	return T_OR;
+	"("	return T_OPEN_PAREN;
+	")"	return T_CLOSE_PAREN;
+	"!"	return T_NOT;
+	"="	return T_EQUAL;
+	"!="	return T_UNEQUAL;
+	\"|\'	{
+		str = yytext[0];
+		new_string();
+		BEGIN(STRING);
+	}
+	\n	BEGIN(INITIAL); current_file->lineno++; return T_EOL;
+	---	/* ignore */
+	({n}|[-/.])+	{
+		const struct kconf_id *id = kconf_id_lookup(yytext, yyleng);
+		if (id && id->flags & TF_PARAM) {
+			zconflval.id = id;
+			return id->token;
+		}
+		alloc_string(yytext, yyleng);
+		zconflval.string = text;
+		return T_WORD;
+	}
+	#.*	/* comment */
+	\\\n	current_file->lineno++;
+	.
+	<<EOF>> {
+		BEGIN(INITIAL);
+	}
+}
+
+<STRING>{
+	[^'"\\\n]+/\n	{
+		append_string(yytext, yyleng);
+		zconflval.string = text;
+		return T_WORD_QUOTE;
+	}
+	[^'"\\\n]+	{
+		append_string(yytext, yyleng);
+	}
+	\\.?/\n	{
+		append_string(yytext + 1, yyleng - 1);
+		zconflval.string = text;
+		return T_WORD_QUOTE;
+	}
+	\\.?	{
+		append_string(yytext + 1, yyleng - 1);
+	}
+	\'|\"	{
+		if (str == yytext[0]) {
+			BEGIN(PARAM);
+			zconflval.string = text;
+			return T_WORD_QUOTE;
+		} else
+			append_string(yytext, 1);
+	}
+	\n	{
+		printf("%s:%d:warning: multi-line strings not supported\n", zconf_curname(), zconf_lineno());
+		current_file->lineno++;
+		BEGIN(INITIAL);
+		return T_EOL;
+	}
+	<<EOF>>	{
+		BEGIN(INITIAL);
+	}
+}
+
+<HELP>{
+	[ \t]+	{
+		ts = 0;
+		for (i = 0; i < yyleng; i++) {
+			if (yytext[i] == '\t')
+				ts = (ts & ~7) + 8;
+			else
+				ts++;
+		}
+		last_ts = ts;
+		if (first_ts) {
+			if (ts < first_ts) {
+				zconf_endhelp();
+				return T_HELPTEXT;
+			}
+			ts -= first_ts;
+			while (ts > 8) {
+				append_string("        ", 8);
+				ts -= 8;
+			}
+			append_string("        ", ts);
+		}
+	}
+	[ \t]*\n/[^ \t\n] {
+		current_file->lineno++;
+		zconf_endhelp();
+		return T_HELPTEXT;
+	}
+	[ \t]*\n	{
+		current_file->lineno++;
+		append_string("\n", 1);
+	}
+	[^ \t\n].* {
+		while (yyleng) {
+			if ((yytext[yyleng-1] != ' ') && (yytext[yyleng-1] != '\t'))
+				break;
+			yyleng--;
+		}
+		append_string(yytext, yyleng);
+		if (!first_ts)
+			first_ts = last_ts;
+	}
+	<<EOF>>	{
+		zconf_endhelp();
+		return T_HELPTEXT;
+	}
+}
+
+<<EOF>>	{
+	if (current_file) {
+		zconf_endfile();
+		return T_EOL;
+	}
+	fclose(yyin);
+	yyterminate();
+}
+
+%%
+void zconf_starthelp(void)
+{
+	new_string();
+	last_ts = first_ts = 0;
+	BEGIN(HELP);
+}
+
+static void zconf_endhelp(void)
+{
+	zconflval.string = text;
+	BEGIN(INITIAL);
+}
+
+
+/*
+ * Try to open specified file with following names:
+ * ./name
+ * $(srctree)/name
+ * The latter is used when srctree is separate from objtree
+ * when compiling the firmware.
+ * Return NULL if file is not found.
+ */
+FILE *zconf_fopen(const char *name)
+{
+	char *env, fullname[PATH_MAX+1];
+	FILE *f;
+
+	f = fopen(name, "r");
+	if (!f && name != NULL && name[0] != '/') {
+		env = getenv(SRCTREE);
+		if (env) {
+			sprintf(fullname, "%s/%s", env, name);
+			f = fopen(fullname, "r");
+		}
+	}
+	return f;
+}
+
+void zconf_initscan(const char *name)
+{
+	yyin = zconf_fopen(name);
+	if (!yyin) {
+		printf("can't find file %s\n", name);
+		exit(1);
+	}
+
+	current_buf = malloc(sizeof(*current_buf));
+	memset(current_buf, 0, sizeof(*current_buf));
+
+	current_file = file_lookup(name);
+	current_file->lineno = 1;
+}
+
+void zconf_nextfile(const char *name)
+{
+	struct file *iter;
+	struct file *file = file_lookup(name);
+	struct buffer *buf = malloc(sizeof(*buf));
+	memset(buf, 0, sizeof(*buf));
+
+	current_buf->state = YY_CURRENT_BUFFER;
+	yyin = zconf_fopen(file->name);
+	if (!yyin) {
+		printf("%s:%d: can't open file \"%s\"\n",
+		    zconf_curname(), zconf_lineno(), file->name);
+		exit(1);
+	}
+	yy_switch_to_buffer(yy_create_buffer(yyin, YY_BUF_SIZE));
+	buf->parent = current_buf;
+	current_buf = buf;
+
+	for (iter = current_file->parent; iter; iter = iter->parent ) {
+		if (!strcmp(current_file->name,iter->name) ) {
+			printf("%s:%d: recursive inclusion detected. "
+			       "Inclusion path:\n  current file : '%s'\n",
+			       zconf_curname(), zconf_lineno(),
+			       zconf_curname());
+			iter = current_file->parent;
+			while (iter && \
+			       strcmp(iter->name,current_file->name)) {
+				printf("  included from: '%s:%d'\n",
+				       iter->name, iter->lineno-1);
+				iter = iter->parent;
+			}
+			if (iter)
+				printf("  included from: '%s:%d'\n",
+				       iter->name, iter->lineno+1);
+			exit(1);
+		}
+	}
+	file->lineno = 1;
+	file->parent = current_file;
+	current_file = file;
+}
+
+static void zconf_endfile(void)
+{
+	struct buffer *parent;
+
+	current_file = current_file->parent;
+
+	parent = current_buf->parent;
+	if (parent) {
+		fclose(yyin);
+		yy_delete_buffer(YY_CURRENT_BUFFER);
+		yy_switch_to_buffer(parent->state);
+	}
+	free(current_buf);
+	current_buf = parent;
+}
+
+int zconf_lineno(void)
+{
+	return current_pos.lineno;
+}
+
+const char *zconf_curname(void)
+{
+	return current_pos.file ? current_pos.file->name : "<none>";
+}
diff --git a/carl9170fw/config/zconf.y b/carl9170fw/config/zconf.y
new file mode 100644
index 0000000..b957a7c
--- /dev/null
+++ b/carl9170fw/config/zconf.y
@@ -0,0 +1,740 @@
+%{
+/*
+ * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
+ * Released under the terms of the GNU GPL v2.0.
+ */
+
+#include <ctype.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdbool.h>
+
+#include "lkc.h"
+
+#define printd(mask, fmt...) if (cdebug & (mask)) printf(fmt)
+
+#define PRINTD		0x0001
+#define DEBUG_PARSE	0x0002
+
+int cdebug = PRINTD;
+
+extern int zconflex(void);
+static void zconfprint(const char *err, ...);
+static void zconf_error(const char *err, ...);
+static void zconferror(const char *err);
+static bool zconf_endtoken(const struct kconf_id *id, int starttoken, int endtoken);
+
+struct symbol *symbol_hash[SYMBOL_HASHSIZE];
+
+static struct menu *current_menu, *current_entry;
+
+%}
+%expect 30
+
+%union
+{
+	char *string;
+	struct file *file;
+	struct symbol *symbol;
+	struct expr *expr;
+	struct menu *menu;
+	const struct kconf_id *id;
+}
+
+%token <id>T_MAINMENU
+%token <id>T_MENU
+%token <id>T_ENDMENU
+%token <id>T_SOURCE
+%token <id>T_CHOICE
+%token <id>T_ENDCHOICE
+%token <id>T_COMMENT
+%token <id>T_CONFIG
+%token <id>T_MENUCONFIG
+%token <id>T_HELP
+%token <string> T_HELPTEXT
+%token <id>T_IF
+%token <id>T_ENDIF
+%token <id>T_DEPENDS
+%token <id>T_OPTIONAL
+%token <id>T_PROMPT
+%token <id>T_TYPE
+%token <id>T_DEFAULT
+%token <id>T_SELECT
+%token <id>T_RANGE
+%token <id>T_VISIBLE
+%token <id>T_OPTION
+%token <id>T_ON
+%token <string> T_WORD
+%token <string> T_WORD_QUOTE
+%token T_UNEQUAL
+%token T_CLOSE_PAREN
+%token T_OPEN_PAREN
+%token T_EOL
+
+%left T_OR
+%left T_AND
+%left T_EQUAL T_UNEQUAL
+%nonassoc T_NOT
+
+%type <string> prompt
+%type <symbol> symbol
+%type <expr> expr
+%type <expr> if_expr
+%type <id> end
+%type <id> option_name
+%type <menu> if_entry menu_entry choice_entry
+%type <string> symbol_option_arg word_opt
+
+%destructor {
+	fprintf(stderr, "%s:%d: missing end statement for this entry\n",
+		$$->file->name, $$->lineno);
+	if (current_menu == $$)
+		menu_end_menu();
+} if_entry menu_entry choice_entry
+
+%{
+/* Include zconf.hash.c here so it can see the token constants. */
+#include "zconf.hash.c"
+%}
+
+%%
+input: nl start | start;
+
+start: mainmenu_stmt stmt_list | stmt_list;
+
+stmt_list:
+	  /* empty */
+	| stmt_list common_stmt
+	| stmt_list choice_stmt
+	| stmt_list menu_stmt
+	| stmt_list end			{ zconf_error("unexpected end statement"); }
+	| stmt_list T_WORD error T_EOL	{ zconf_error("unknown statement \"%s\"", $2); }
+	| stmt_list option_name error T_EOL
+{
+	zconf_error("unexpected option \"%s\"", kconf_id_strings + $2->name);
+}
+	| stmt_list error T_EOL		{ zconf_error("invalid statement"); }
+;
+
+option_name:
+	T_DEPENDS | T_PROMPT | T_TYPE | T_SELECT | T_OPTIONAL | T_RANGE | T_DEFAULT | T_VISIBLE
+;
+
+common_stmt:
+	  T_EOL
+	| if_stmt
+	| comment_stmt
+	| config_stmt
+	| menuconfig_stmt
+	| source_stmt
+;
+
+option_error:
+	  T_WORD error T_EOL		{ zconf_error("unknown option \"%s\"", $1); }
+	| error T_EOL			{ zconf_error("invalid option"); }
+;
+
+
+/* config/menuconfig entry */
+
+config_entry_start: T_CONFIG T_WORD T_EOL
+{
+	struct symbol *sym = sym_lookup($2, 0);
+	sym->flags |= SYMBOL_OPTIONAL;
+	menu_add_entry(sym);
+	printd(DEBUG_PARSE, "%s:%d:config %s\n", zconf_curname(), zconf_lineno(), $2);
+};
+
+config_stmt: config_entry_start config_option_list
+{
+	menu_end_entry();
+	printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno());
+};
+
+menuconfig_entry_start: T_MENUCONFIG T_WORD T_EOL
+{
+	struct symbol *sym = sym_lookup($2, 0);
+	sym->flags |= SYMBOL_OPTIONAL;
+	menu_add_entry(sym);
+	printd(DEBUG_PARSE, "%s:%d:menuconfig %s\n", zconf_curname(), zconf_lineno(), $2);
+};
+
+menuconfig_stmt: menuconfig_entry_start config_option_list
+{
+	if (current_entry->prompt)
+		current_entry->prompt->type = P_MENU;
+	else
+		zconfprint("warning: menuconfig statement without prompt");
+	menu_end_entry();
+	printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno());
+};
+
+config_option_list:
+	  /* empty */
+	| config_option_list config_option
+	| config_option_list symbol_option
+	| config_option_list depends
+	| config_option_list help
+	| config_option_list option_error
+	| config_option_list T_EOL
+;
+
+config_option: T_TYPE prompt_stmt_opt T_EOL
+{
+	menu_set_type($1->stype);
+	printd(DEBUG_PARSE, "%s:%d:type(%u)\n",
+		zconf_curname(), zconf_lineno(),
+		$1->stype);
+};
+
+config_option: T_PROMPT prompt if_expr T_EOL
+{
+	menu_add_prompt(P_PROMPT, $2, $3);
+	printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno());
+};
+
+config_option: T_DEFAULT expr if_expr T_EOL
+{
+	menu_add_expr(P_DEFAULT, $2, $3);
+	if ($1->stype != S_UNKNOWN)
+		menu_set_type($1->stype);
+	printd(DEBUG_PARSE, "%s:%d:default(%u)\n",
+		zconf_curname(), zconf_lineno(),
+		$1->stype);
+};
+
+config_option: T_SELECT T_WORD if_expr T_EOL
+{
+	menu_add_symbol(P_SELECT, sym_lookup($2, 0), $3);
+	printd(DEBUG_PARSE, "%s:%d:select\n", zconf_curname(), zconf_lineno());
+};
+
+config_option: T_RANGE symbol symbol if_expr T_EOL
+{
+	menu_add_expr(P_RANGE, expr_alloc_comp(E_RANGE,$2, $3), $4);
+	printd(DEBUG_PARSE, "%s:%d:range\n", zconf_curname(), zconf_lineno());
+};
+
+symbol_option: T_OPTION symbol_option_list T_EOL
+;
+
+symbol_option_list:
+	  /* empty */
+	| symbol_option_list T_WORD symbol_option_arg
+{
+	const struct kconf_id *id = kconf_id_lookup($2, strlen($2));
+	if (id && id->flags & TF_OPTION)
+		menu_add_option(id->token, $3);
+	else
+		zconfprint("warning: ignoring unknown option %s", $2);
+	free($2);
+};
+
+symbol_option_arg:
+	  /* empty */		{ $$ = NULL; }
+	| T_EQUAL prompt	{ $$ = $2; }
+;
+
+/* choice entry */
+
+choice: T_CHOICE word_opt T_EOL
+{
+	struct symbol *sym = sym_lookup($2, SYMBOL_CHOICE);
+	sym->flags |= SYMBOL_AUTO;
+	menu_add_entry(sym);
+	menu_add_expr(P_CHOICE, NULL, NULL);
+	printd(DEBUG_PARSE, "%s:%d:choice\n", zconf_curname(), zconf_lineno());
+};
+
+choice_entry: choice choice_option_list
+{
+	$$ = menu_add_menu();
+};
+
+choice_end: end
+{
+	if (zconf_endtoken($1, T_CHOICE, T_ENDCHOICE)) {
+		menu_end_menu();
+		printd(DEBUG_PARSE, "%s:%d:endchoice\n", zconf_curname(), zconf_lineno());
+	}
+};
+
+choice_stmt: choice_entry choice_block choice_end
+;
+
+choice_option_list:
+	  /* empty */
+	| choice_option_list choice_option
+	| choice_option_list depends
+	| choice_option_list help
+	| choice_option_list T_EOL
+	| choice_option_list option_error
+;
+
+choice_option: T_PROMPT prompt if_expr T_EOL
+{
+	menu_add_prompt(P_PROMPT, $2, $3);
+	printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno());
+};
+
+choice_option: T_TYPE prompt_stmt_opt T_EOL
+{
+	if ($1->stype == S_BOOLEAN || $1->stype == S_TRISTATE) {
+		menu_set_type($1->stype);
+		printd(DEBUG_PARSE, "%s:%d:type(%u)\n",
+			zconf_curname(), zconf_lineno(),
+			$1->stype);
+	} else
+		YYERROR;
+};
+
+choice_option: T_OPTIONAL T_EOL
+{
+	current_entry->sym->flags |= SYMBOL_OPTIONAL;
+	printd(DEBUG_PARSE, "%s:%d:optional\n", zconf_curname(), zconf_lineno());
+};
+
+choice_option: T_DEFAULT T_WORD if_expr T_EOL
+{
+	if ($1->stype == S_UNKNOWN) {
+		menu_add_symbol(P_DEFAULT, sym_lookup($2, 0), $3);
+		printd(DEBUG_PARSE, "%s:%d:default\n",
+			zconf_curname(), zconf_lineno());
+	} else
+		YYERROR;
+};
+
+choice_block:
+	  /* empty */
+	| choice_block common_stmt
+;
+
+/* if entry */
+
+if_entry: T_IF expr nl
+{
+	printd(DEBUG_PARSE, "%s:%d:if\n", zconf_curname(), zconf_lineno());
+	menu_add_entry(NULL);
+	menu_add_dep($2);
+	$$ = menu_add_menu();
+};
+
+if_end: end
+{
+	if (zconf_endtoken($1, T_IF, T_ENDIF)) {
+		menu_end_menu();
+		printd(DEBUG_PARSE, "%s:%d:endif\n", zconf_curname(), zconf_lineno());
+	}
+};
+
+if_stmt: if_entry if_block if_end
+;
+
+if_block:
+	  /* empty */
+	| if_block common_stmt
+	| if_block menu_stmt
+	| if_block choice_stmt
+;
+
+/* mainmenu entry */
+
+mainmenu_stmt: T_MAINMENU prompt nl
+{
+	menu_add_prompt(P_MENU, $2, NULL);
+};
+
+/* menu entry */
+
+menu: T_MENU prompt T_EOL
+{
+	menu_add_entry(NULL);
+	menu_add_prompt(P_MENU, $2, NULL);
+	printd(DEBUG_PARSE, "%s:%d:menu\n", zconf_curname(), zconf_lineno());
+};
+
+menu_entry: menu visibility_list depends_list
+{
+	$$ = menu_add_menu();
+};
+
+menu_end: end
+{
+	if (zconf_endtoken($1, T_MENU, T_ENDMENU)) {
+		menu_end_menu();
+		printd(DEBUG_PARSE, "%s:%d:endmenu\n", zconf_curname(), zconf_lineno());
+	}
+};
+
+menu_stmt: menu_entry menu_block menu_end
+;
+
+menu_block:
+	  /* empty */
+	| menu_block common_stmt
+	| menu_block menu_stmt
+	| menu_block choice_stmt
+;
+
+source_stmt: T_SOURCE prompt T_EOL
+{
+	printd(DEBUG_PARSE, "%s:%d:source %s\n", zconf_curname(), zconf_lineno(), $2);
+	zconf_nextfile($2);
+};
+
+/* comment entry */
+
+comment: T_COMMENT prompt T_EOL
+{
+	menu_add_entry(NULL);
+	menu_add_prompt(P_COMMENT, $2, NULL);
+	printd(DEBUG_PARSE, "%s:%d:comment\n", zconf_curname(), zconf_lineno());
+};
+
+comment_stmt: comment depends_list
+{
+	menu_end_entry();
+};
+
+/* help option */
+
+help_start: T_HELP T_EOL
+{
+	printd(DEBUG_PARSE, "%s:%d:help\n", zconf_curname(), zconf_lineno());
+	zconf_starthelp();
+};
+
+help: help_start T_HELPTEXT
+{
+	current_entry->help = $2;
+};
+
+/* depends option */
+
+depends_list:
+	  /* empty */
+	| depends_list depends
+	| depends_list T_EOL
+	| depends_list option_error
+;
+
+depends: T_DEPENDS T_ON expr T_EOL
+{
+	menu_add_dep($3);
+	printd(DEBUG_PARSE, "%s:%d:depends on\n", zconf_curname(), zconf_lineno());
+};
+
+/* visibility option */
+
+visibility_list:
+	  /* empty */
+	| visibility_list visible
+	| visibility_list T_EOL
+;
+
+visible: T_VISIBLE if_expr
+{
+	menu_add_visibility($2);
+};
+
+/* prompt statement */
+
+prompt_stmt_opt:
+	  /* empty */
+	| prompt if_expr
+{
+	menu_add_prompt(P_PROMPT, $1, $2);
+};
+
+prompt:	  T_WORD
+	| T_WORD_QUOTE
+;
+
+end:	  T_ENDMENU T_EOL	{ $$ = $1; }
+	| T_ENDCHOICE T_EOL	{ $$ = $1; }
+	| T_ENDIF T_EOL		{ $$ = $1; }
+;
+
+nl:
+	  T_EOL
+	| nl T_EOL
+;
+
+if_expr:  /* empty */			{ $$ = NULL; }
+	| T_IF expr			{ $$ = $2; }
+;
+
+expr:	  symbol				{ $$ = expr_alloc_symbol($1); }
+	| symbol T_EQUAL symbol			{ $$ = expr_alloc_comp(E_EQUAL, $1, $3); }
+	| symbol T_UNEQUAL symbol		{ $$ = expr_alloc_comp(E_UNEQUAL, $1, $3); }
+	| T_OPEN_PAREN expr T_CLOSE_PAREN	{ $$ = $2; }
+	| T_NOT expr				{ $$ = expr_alloc_one(E_NOT, $2); }
+	| expr T_OR expr			{ $$ = expr_alloc_two(E_OR, $1, $3); }
+	| expr T_AND expr			{ $$ = expr_alloc_two(E_AND, $1, $3); }
+;
+
+symbol:	  T_WORD	{ $$ = sym_lookup($1, 0); free($1); }
+	| T_WORD_QUOTE	{ $$ = sym_lookup($1, SYMBOL_CONST); free($1); }
+;
+
+word_opt: /* empty */			{ $$ = NULL; }
+	| T_WORD
+
+%%
+
+void conf_parse(const char *name)
+{
+	struct symbol *sym;
+	int i;
+
+	zconf_initscan(name);
+
+	sym_init();
+	_menu_init();
+	modules_sym = sym_lookup(NULL, 0);
+	modules_sym->type = S_BOOLEAN;
+	modules_sym->flags |= SYMBOL_AUTO;
+	rootmenu.prompt = menu_add_prompt(P_MENU, "CARL9170 Firmware Configuration", NULL);
+
+	if (getenv("ZCONF_DEBUG"))
+		zconfdebug = 1;
+	zconfparse();
+	if (zconfnerrs)
+		exit(1);
+	if (!modules_sym->prop) {
+		struct property *prop;
+
+		prop = prop_alloc(P_DEFAULT, modules_sym);
+		prop->expr = expr_alloc_symbol(sym_lookup("MODULES", 0));
+	}
+
+	rootmenu.prompt->text = _(rootmenu.prompt->text);
+	rootmenu.prompt->text = sym_expand_string_value(rootmenu.prompt->text);
+
+	menu_finalize(&rootmenu);
+	for_all_symbols(i, sym) {
+		if (sym_check_deps(sym))
+			zconfnerrs++;
+        }
+	if (zconfnerrs)
+		exit(1);
+	sym_set_change_count(1);
+}
+
+static const char *zconf_tokenname(int token)
+{
+	switch (token) {
+	case T_MENU:		return "menu";
+	case T_ENDMENU:		return "endmenu";
+	case T_CHOICE:		return "choice";
+	case T_ENDCHOICE:	return "endchoice";
+	case T_IF:		return "if";
+	case T_ENDIF:		return "endif";
+	case T_DEPENDS:		return "depends";
+	case T_VISIBLE:		return "visible";
+	}
+	return "<token>";
+}
+
+static bool zconf_endtoken(const struct kconf_id *id, int starttoken, int endtoken)
+{
+	if (id->token != endtoken) {
+		zconf_error("unexpected '%s' within %s block",
+			kconf_id_strings + id->name, zconf_tokenname(starttoken));
+		zconfnerrs++;
+		return false;
+	}
+	if (current_menu->file != current_file) {
+		zconf_error("'%s' in different file than '%s'",
+			kconf_id_strings + id->name, zconf_tokenname(starttoken));
+		fprintf(stderr, "%s:%d: location of the '%s'\n",
+			current_menu->file->name, current_menu->lineno,
+			zconf_tokenname(starttoken));
+		zconfnerrs++;
+		return false;
+	}
+	return true;
+}
+
+static void zconfprint(const char *err, ...)
+{
+	va_list ap;
+
+	fprintf(stderr, "%s:%d: ", zconf_curname(), zconf_lineno());
+	va_start(ap, err);
+	vfprintf(stderr, err, ap);
+	va_end(ap);
+	fprintf(stderr, "\n");
+}
+
+static void zconf_error(const char *err, ...)
+{
+	va_list ap;
+
+	zconfnerrs++;
+	fprintf(stderr, "%s:%d: ", zconf_curname(), zconf_lineno());
+	va_start(ap, err);
+	vfprintf(stderr, err, ap);
+	va_end(ap);
+	fprintf(stderr, "\n");
+}
+
+static void zconferror(const char *err)
+{
+	fprintf(stderr, "%s:%d: %s\n", zconf_curname(), zconf_lineno() + 1, err);
+}
+
+static void print_quoted_string(FILE *out, const char *str)
+{
+	const char *p;
+	int len;
+
+	putc('"', out);
+	while ((p = strchr(str, '"'))) {
+		len = p - str;
+		if (len)
+			fprintf(out, "%.*s", len, str);
+		fputs("\\\"", out);
+		str = p + 1;
+	}
+	fputs(str, out);
+	putc('"', out);
+}
+
+static void print_symbol(FILE *out, struct menu *menu)
+{
+	struct symbol *sym = menu->sym;
+	struct property *prop;
+
+	if (sym_is_choice(sym))
+		fprintf(out, "\nchoice\n");
+	else
+		fprintf(out, "\nconfig %s\n", sym->name);
+	switch (sym->type) {
+	case S_BOOLEAN:
+		fputs("  boolean\n", out);
+		break;
+	case S_TRISTATE:
+		fputs("  tristate\n", out);
+		break;
+	case S_STRING:
+		fputs("  string\n", out);
+		break;
+	case S_INT:
+		fputs("  integer\n", out);
+		break;
+	case S_HEX:
+		fputs("  hex\n", out);
+		break;
+	default:
+		fputs("  ???\n", out);
+		break;
+	}
+	for (prop = sym->prop; prop; prop = prop->next) {
+		if (prop->menu != menu)
+			continue;
+		switch (prop->type) {
+		case P_PROMPT:
+			fputs("  prompt ", out);
+			print_quoted_string(out, prop->text);
+			if (!expr_is_yes(prop->visible.expr)) {
+				fputs(" if ", out);
+				expr_fprint(prop->visible.expr, out);
+			}
+			fputc('\n', out);
+			break;
+		case P_DEFAULT:
+			fputs( "  default ", out);
+			expr_fprint(prop->expr, out);
+			if (!expr_is_yes(prop->visible.expr)) {
+				fputs(" if ", out);
+				expr_fprint(prop->visible.expr, out);
+			}
+			fputc('\n', out);
+			break;
+		case P_CHOICE:
+			fputs("  #choice value\n", out);
+			break;
+		case P_SELECT:
+			fputs( "  select ", out);
+			expr_fprint(prop->expr, out);
+			fputc('\n', out);
+			break;
+		case P_RANGE:
+			fputs( "  range ", out);
+			expr_fprint(prop->expr, out);
+			fputc('\n', out);
+			break;
+		case P_MENU:
+			fputs( "  menu ", out);
+			print_quoted_string(out, prop->text);
+			fputc('\n', out);
+			break;
+		default:
+			fprintf(out, "  unknown prop %d!\n", prop->type);
+			break;
+		}
+	}
+	if (menu->help) {
+		int len = strlen(menu->help);
+		while (menu->help[--len] == '\n')
+			menu->help[len] = 0;
+		fprintf(out, "  help\n%s\n", menu->help);
+	}
+}
+
+void zconfdump(FILE *out)
+{
+	struct property *prop;
+	struct symbol *sym;
+	struct menu *menu;
+
+	menu = rootmenu.list;
+	while (menu) {
+		if ((sym = menu->sym))
+			print_symbol(out, menu);
+		else if ((prop = menu->prompt)) {
+			switch (prop->type) {
+			case P_COMMENT:
+				fputs("\ncomment ", out);
+				print_quoted_string(out, prop->text);
+				fputs("\n", out);
+				break;
+			case P_MENU:
+				fputs("\nmenu ", out);
+				print_quoted_string(out, prop->text);
+				fputs("\n", out);
+				break;
+			default:
+				;
+			}
+			if (!expr_is_yes(prop->visible.expr)) {
+				fputs("  depends ", out);
+				expr_fprint(prop->visible.expr, out);
+				fputc('\n', out);
+			}
+		}
+
+		if (menu->list)
+			menu = menu->list;
+		else if (menu->next)
+			menu = menu->next;
+		else while ((menu = menu->parent)) {
+			if (menu->prompt && menu->prompt->type == P_MENU)
+				fputs("\nendmenu\n", out);
+			if (menu->next) {
+				menu = menu->next;
+				break;
+			}
+		}
+	}
+}
+
+#include "zconf.lex.c"
+#include "util.c"
+#include "confdata.c"
+#include "expr.c"
+#include "symbol.c"
+#include "menu.c"
diff --git a/carl9170fw/extra/FindGPERF.cmake b/carl9170fw/extra/FindGPERF.cmake
new file mode 100644
index 0000000..baf8749
--- /dev/null
+++ b/carl9170fw/extra/FindGPERF.cmake
@@ -0,0 +1,160 @@
+# - Find gperf executable and provides a macro to generate custom build rules
+#
+# The module defines the following variables:
+#  GPERF_FOUND - true is gperf executable is found
+#  GPERF_EXECUTABLE - the path to the gperf executable
+#  GPERF_VERSION - the version of gperf
+#  GPERF_LIBRARIES - The gperf libraries
+#
+# The minimum required version of gperf can be specified using the
+# standard syntax, e.g. FIND_PACKAGE(GPERF 2.5.13)
+#
+#
+# If gperf is found on the system, the module provides the macro:
+#  GPERF_TARGET(Name GperfInput GperfOutput [COMPILE_FLAGS <string>])
+# which creates a custom command  to generate the <GperfOutput> file from
+# the <GperfInput> file.  If  COMPILE_FLAGS option is specified, the next
+# parameter is added to the gperf  command line. Name is an alias used to
+# get  details of  this custom  command.  Indeed the  macro defines  the
+# following variables:
+#  GPERF_${Name}_DEFINED - true is the macro ran successfully
+#  GPERF_${Name}_OUTPUTS - the source file generated by the custom rule, an
+#  alias for GperfOutput
+#  GPERF_${Name}_INPUT - the gperf source file, an alias for ${GperfInput}
+#
+# Gperf scanners oftenly use tokens  defined by Bison: the code generated
+# by Gperf  depends of the header  generated by Bison.   This module also
+# defines a macro:
+#  ADD_GPERF_BISON_DEPENDENCY(GperfTarget BisonTarget)
+# which  adds the  required dependency  between a  scanner and  a parser
+# where  <GperfTarget>  and <BisonTarget>  are  the  first parameters  of
+# respectively GPERF_TARGET and BISON_TARGET macros.
+#
+#  ====================================================================
+#  Example:
+#
+#   find_package(GPERF)
+#
+#   GPERF_TARGET(MyHash hash.gperf  ${CMAKE_CURRENT_BINARY_DIR}/hash.c)
+#
+#  ====================================================================
+
+#=============================================================================
+# Copyright 2009 Kitware, Inc.
+# Copyright 2006 Tristan Carel
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+#   notice, this list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in the
+#   documentation and/or other materials provided with the distribution.
+#
+# * Neither the names of Kitware, Inc., the Insight Software Consortium,
+#   nor the names of their contributors may be used to endorse or promote
+#   products derived from this software without specific prior written
+#   permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+cmake_minimum_required(VERSION 2.8.4)
+
+FIND_PROGRAM(GPERF_EXECUTABLE gperf DOC "path to the gperf executable")
+MARK_AS_ADVANCED(GPERF_EXECUTABLE)
+
+FIND_LIBRARY(FL_LIBRARY NAMES fl
+  DOC "path to the fl library")
+MARK_AS_ADVANCED(FL_LIBRARY)
+SET(GPERF_LIBRARIES ${FL_LIBRARY})
+
+IF(GPERF_EXECUTABLE)
+
+  EXECUTE_PROCESS(COMMAND ${GPERF_EXECUTABLE} --version
+    OUTPUT_VARIABLE GPERF_version_output
+    ERROR_VARIABLE GPERF_version_error
+    RESULT_VARIABLE GPERF_version_result
+    OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+  SET(ENV{LC_ALL} ${_Bison_SAVED_LC_ALL})
+
+  IF(NOT ${GPERF_version_result} EQUAL 0)
+    MESSAGE(SEND_ERROR "Command \"${GPERF_EXECUTABLE} --version\" failed with output:\n${GPERF_version_error}")
+  ELSE() 
+    STRING(REGEX REPLACE "^GNU gperf ([^\n]+)\n.*" "\\1"
+      GPERF_VERSION "${GPERF_version_output}")
+  ENDIF()
+
+  #============================================================
+  # GPERF_TARGET (public macro)
+  #============================================================
+  #
+  MACRO(GPERF_TARGET Name Input Output)
+    SET(GPERF_TARGET_usage "GPERF_TARGET(<Name> <Input> <Output> [COMPILE_FLAGS <string>]")
+    IF(${ARGC} GREATER 3)
+      IF(${ARGC} EQUAL 5)
+        IF("${ARGV3}" STREQUAL "COMPILE_FLAGS")
+          SET(GPERF_EXECUTABLE_opts  "${ARGV4}")
+          SEPARATE_ARGUMENTS(GPERF_EXECUTABLE_opts)
+        ELSE()
+          MESSAGE(SEND_ERROR ${GPERF_TARGET_usage})
+        ENDIF()
+      ELSE()
+        MESSAGE(SEND_ERROR ${GPERF_TARGET_usage})
+      ENDIF()
+    ENDIF()
+
+    ADD_CUSTOM_COMMAND(OUTPUT ${Output}
+      COMMAND ${GPERF_EXECUTABLE}
+      ARGS ${GPERF_EXECUTABLE_opts} < ${Input} > ${Output}
+      DEPENDS ${Input}
+      COMMENT "[GPERF][${Name}] Building hash with gperf ${GPERF_VERSION}"
+      WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
+
+    SET(GPERF_${Name}_DEFINED TRUE)
+    SET(GPERF_${Name}_OUTPUTS ${Output})
+    SET(GPERF_${Name}_INPUT ${Input})
+    SET(GPERF_${Name}_COMPILE_FLAGS ${GPERF_EXECUTABLE_opts})
+  ENDMACRO(GPERF_TARGET)
+  #============================================================
+
+
+  #============================================================
+  # ADD_GPERF_BISON_DEPENDENCY (public macro)
+  #============================================================
+  #
+  MACRO(ADD_GPERF_BISON_DEPENDENCY GperfTarget BisonTarget)
+
+    IF(NOT GPERF_${GperfTarget}_OUTPUTS)
+      MESSAGE(SEND_ERROR "Gperf target `${GperfTarget}' does not exists.")
+    ENDIF()
+
+    IF(NOT BISON_${BisonTarget}_OUTPUT_HEADER)
+      MESSAGE(SEND_ERROR "Bison target `${BisonTarget}' does not exists.")
+    ENDIF()
+
+    SET_SOURCE_FILES_PROPERTIES(${GPERF_${GperfTarget}_OUTPUTS}
+      PROPERTIES OBJECT_DEPENDS ${BISON_${BisonTarget}_OUTPUT_HEADER})
+  ENDMACRO(ADD_GPERF_BISON_DEPENDENCY)
+  #============================================================
+
+ENDIF(GPERF_EXECUTABLE)
+
+INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(GPERF REQUIRED_VARS GPERF_EXECUTABLE
+                                       VERSION_VAR GPERF_VERSION)
+
+# FindGPERF.cmake ends here
diff --git a/carl9170fw/extra/FindPackageHandleStandardArgs.cmake b/carl9170fw/extra/FindPackageHandleStandardArgs.cmake
new file mode 100644
index 0000000..ec3440c
--- /dev/null
+++ b/carl9170fw/extra/FindPackageHandleStandardArgs.cmake
@@ -0,0 +1,278 @@
+# FIND_PACKAGE_HANDLE_STANDARD_ARGS(<name> ... )
+#
+# This function is intended to be used in FindXXX.cmake modules files.
+# It handles the REQUIRED, QUIET and version-related arguments to FIND_PACKAGE().
+# It also sets the <UPPERCASED_NAME>_FOUND variable.
+# The package is considered found if all variables <var1>... listed contain
+# valid results, e.g. valid filepaths.
+#
+# There are two modes of this function. The first argument in both modes is
+# the name of the Find-module where it is called (in original casing).
+#
+# The first simple mode looks like this:
+#    FIND_PACKAGE_HANDLE_STANDARD_ARGS(<name> (DEFAULT_MSG|"Custom failure message") <var1>...<varN> )
+# If the variables <var1> to <varN> are all valid, then <UPPERCASED_NAME>_FOUND
+# will be set to TRUE.
+# If DEFAULT_MSG is given as second argument, then the function will generate
+# itself useful success and error messages. You can also supply a custom error message
+# for the failure case. This is not recommended.
+#
+# The second mode is more powerful and also supports version checking:
+#    FIND_PACKAGE_HANDLE_STANDARD_ARGS(NAME [REQUIRED_VARS <var1>...<varN>]
+#                                           [VERSION_VAR   <versionvar>
+#                                           [CONFIG_MODE]
+#                                           [FAIL_MESSAGE "Custom failure message"] )
+#
+# As above, if <var1> through <varN> are all valid, <UPPERCASED_NAME>_FOUND
+# will be set to TRUE.
+# After REQUIRED_VARS the variables which are required for this package are listed.
+# Following VERSION_VAR the name of the variable can be specified which holds
+# the version of the package which has been found. If this is done, this version
+# will be checked against the (potentially) specified required version used
+# in the find_package() call. The EXACT keyword is also handled. The default
+# messages include information about the required version and the version
+# which has been actually found, both if the version is ok or not.
+# Use the option CONFIG_MODE if your FindXXX.cmake module is a wrapper for
+# a find_package(... NO_MODULE) call, in this case all the information
+# provided by the config-mode of find_package() will be evaluated
+# automatically.
+# Via FAIL_MESSAGE a custom failure message can be specified, if this is not
+# used, the default message will be displayed.
+#
+# Example for mode 1:
+#
+#    FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibXml2  DEFAULT_MSG  LIBXML2_LIBRARY LIBXML2_INCLUDE_DIR)
+#
+# LibXml2 is considered to be found, if both LIBXML2_LIBRARY and
+# LIBXML2_INCLUDE_DIR are valid. Then also LIBXML2_FOUND is set to TRUE.
+# If it is not found and REQUIRED was used, it fails with FATAL_ERROR,
+# independent whether QUIET was used or not.
+# If it is found, success will be reported, including the content of <var1>.
+# On repeated Cmake runs, the same message won't be printed again.
+#
+# Example for mode 2:
+#
+#    FIND_PACKAGE_HANDLE_STANDARD_ARGS(BISON  REQUIRED_VARS BISON_EXECUTABLE
+#                                             VERSION_VAR BISON_VERSION)
+# In this case, BISON is considered to be found if the variable(s) listed
+# after REQUIRED_VAR are all valid, i.e. BISON_EXECUTABLE in this case.
+# Also the version of BISON will be checked by using the version contained
+# in BISON_VERSION.
+# Since no FAIL_MESSAGE is given, the default messages will be printed.
+#
+# Another example for mode 2:
+#
+#    FIND_PACKAGE(Automoc4 QUIET NO_MODULE HINTS /opt/automoc4)
+#    FIND_PACKAGE_HANDLE_STANDARD_ARGS(Automoc4  CONFIG_MODE)
+# In this case, FindAutmoc4.cmake wraps a call to FIND_PACKAGE(Automoc4 NO_MODULE)
+# and adds an additional search directory for automoc4.
+# The following FIND_PACKAGE_HANDLE_STANDARD_ARGS() call produces a proper
+# success/error message.
+
+#=============================================================================
+# Copyright 2007-2009 Kitware, Inc.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+#   notice, this list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in the
+#   documentation and/or other materials provided with the distribution.
+#
+# * Neither the names of Kitware, Inc., the Insight Software Consortium,
+#   nor the names of their contributors may be used to endorse or promote
+#   products derived from this software without specific prior written
+#   permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+INCLUDE(FindPackageMessage)
+INCLUDE(CMakeParseArguments)
+
+# internal helper macro
+MACRO(_FPHSA_FAILURE_MESSAGE _msg)
+  IF (${_NAME}_FIND_REQUIRED)
+    MESSAGE(FATAL_ERROR "${_msg}")
+  ELSE (${_NAME}_FIND_REQUIRED)
+    IF (NOT ${_NAME}_FIND_QUIETLY)
+      MESSAGE(STATUS "${_msg}")
+    ENDIF (NOT ${_NAME}_FIND_QUIETLY)
+  ENDIF (${_NAME}_FIND_REQUIRED)
+ENDMACRO(_FPHSA_FAILURE_MESSAGE _msg)
+
+
+# internal helper macro to generate the failure message when used in CONFIG_MODE:
+MACRO(_FPHSA_HANDLE_FAILURE_CONFIG_MODE)
+  # <name>_CONFIG is set, but FOUND is false, this means that some other of the REQUIRED_VARS was not found:
+  IF(${_NAME}_CONFIG)
+    _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: missing: ${MISSING_VARS} (found ${${_NAME}_CONFIG} ${VERSION_MSG})")
+  ELSE(${_NAME}_CONFIG)
+    # If _CONSIDERED_CONFIGS is set, the config-file has been found, but no suitable version.
+    # List them all in the error message:
+    IF(${_NAME}_CONSIDERED_CONFIGS)
+      SET(configsText "")
+      LIST(LENGTH ${_NAME}_CONSIDERED_CONFIGS configsCount)
+      MATH(EXPR configsCount "${configsCount} - 1")
+      FOREACH(currentConfigIndex RANGE ${configsCount})
+        LIST(GET ${_NAME}_CONSIDERED_CONFIGS ${currentConfigIndex} filename)
+        LIST(GET ${_NAME}_CONSIDERED_VERSIONS ${currentConfigIndex} version)
+        SET(configsText "${configsText}    ${filename} (version ${version})\n")
+      ENDFOREACH(currentConfigIndex)
+      _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE} ${VERSION_MSG}, checked the following files:\n${configsText}")
+
+    ELSE(${_NAME}_CONSIDERED_CONFIGS)
+      # Simple case: No Config-file was found at all:
+      _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: found neither ${_NAME}Config.cmake nor ${_NAME_LOWER}-config.cmake ${VERSION_MSG}")
+    ENDIF(${_NAME}_CONSIDERED_CONFIGS)
+  ENDIF(${_NAME}_CONFIG)
+ENDMACRO(_FPHSA_HANDLE_FAILURE_CONFIG_MODE)
+
+
+FUNCTION(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG)
+
+# set up the arguments for CMAKE_PARSE_ARGUMENTS and check whether we are in
+# new extended or in the "old" mode:
+  SET(options CONFIG_MODE)
+  SET(oneValueArgs FAIL_MESSAGE VERSION_VAR)
+  SET(multiValueArgs REQUIRED_VARS)
+  SET(_KEYWORDS_FOR_EXTENDED_MODE  ${options} ${oneValueArgs} ${multiValueArgs} )
+  LIST(FIND _KEYWORDS_FOR_EXTENDED_MODE "${_FIRST_ARG}" INDEX)
+
+  IF(${INDEX} EQUAL -1)
+    SET(FPHSA_FAIL_MESSAGE ${_FIRST_ARG})
+    SET(FPHSA_REQUIRED_VARS ${ARGN})
+    SET(FPHSA_VERSION_VAR)
+  ELSE(${INDEX} EQUAL -1)
+
+    CMAKE_PARSE_ARGUMENTS(FPHSA "${options}" "${oneValueArgs}" "${multiValueArgs}"  ${_FIRST_ARG} ${ARGN})
+
+    IF(FPHSA_UNPARSED_ARGUMENTS)
+      MESSAGE(FATAL_ERROR "Unknown keywords given to FIND_PACKAGE_HANDLE_STANDARD_ARGS(): \"${FPHSA_UNPARSED_ARGUMENTS}\"")
+    ENDIF(FPHSA_UNPARSED_ARGUMENTS)
+
+    IF(NOT FPHSA_FAIL_MESSAGE)
+      SET(FPHSA_FAIL_MESSAGE  "DEFAULT_MSG")
+    ENDIF(NOT FPHSA_FAIL_MESSAGE)
+  ENDIF(${INDEX} EQUAL -1)
+
+# now that we collected all arguments, process them
+
+  IF("${FPHSA_FAIL_MESSAGE}" STREQUAL "DEFAULT_MSG")
+    SET(FPHSA_FAIL_MESSAGE "Could NOT find ${_NAME}")
+  ENDIF("${FPHSA_FAIL_MESSAGE}" STREQUAL "DEFAULT_MSG")
+
+  # In config-mode, we rely on the variable <package>_CONFIG, which is set by find_package()
+  # when it successfully found the config-file, including version checking:
+  IF(FPHSA_CONFIG_MODE)
+    LIST(INSERT FPHSA_REQUIRED_VARS 0 ${_NAME}_CONFIG)
+    LIST(REMOVE_DUPLICATES FPHSA_REQUIRED_VARS)
+    SET(FPHSA_VERSION_VAR ${_NAME}_VERSION)
+  ENDIF(FPHSA_CONFIG_MODE)
+
+  IF(NOT FPHSA_REQUIRED_VARS)
+    MESSAGE(FATAL_ERROR "No REQUIRED_VARS specified for FIND_PACKAGE_HANDLE_STANDARD_ARGS()")
+  ENDIF(NOT FPHSA_REQUIRED_VARS)
+
+  LIST(GET FPHSA_REQUIRED_VARS 0 _FIRST_REQUIRED_VAR)
+
+  STRING(TOUPPER ${_NAME} _NAME_UPPER)
+  STRING(TOLOWER ${_NAME} _NAME_LOWER)
+
+  # collect all variables which were not found, so they can be printed, so the
+  # user knows better what went wrong (#6375)
+  SET(MISSING_VARS "")
+  SET(DETAILS "")
+  SET(${_NAME_UPPER}_FOUND TRUE)
+  # check if all passed variables are valid
+  FOREACH(_CURRENT_VAR ${FPHSA_REQUIRED_VARS})
+    IF(NOT ${_CURRENT_VAR})
+      SET(${_NAME_UPPER}_FOUND FALSE)
+      SET(MISSING_VARS "${MISSING_VARS} ${_CURRENT_VAR}")
+    ELSE(NOT ${_CURRENT_VAR})
+      SET(DETAILS "${DETAILS}[${${_CURRENT_VAR}}]")
+    ENDIF(NOT ${_CURRENT_VAR})
+  ENDFOREACH(_CURRENT_VAR)
+
+
+  # version handling:
+  SET(VERSION_MSG "")
+  SET(VERSION_OK TRUE)
+  SET(VERSION ${${FPHSA_VERSION_VAR}} )
+  IF (${_NAME}_FIND_VERSION)
+
+    IF(VERSION)
+
+      IF(${_NAME}_FIND_VERSION_EXACT)       # exact version required
+        IF (NOT "${${_NAME}_FIND_VERSION}" VERSION_EQUAL "${VERSION}")
+          SET(VERSION_MSG "Found unsuitable version \"${VERSION}\", but required is exact version \"${${_NAME}_FIND_VERSION}\"")
+          SET(VERSION_OK FALSE)
+        ELSE (NOT "${${_NAME}_FIND_VERSION}" VERSION_EQUAL "${VERSION}")
+          SET(VERSION_MSG "(found suitable exact version \"${VERSION}\")")
+        ENDIF (NOT "${${_NAME}_FIND_VERSION}" VERSION_EQUAL "${VERSION}")
+
+      ELSE(${_NAME}_FIND_VERSION_EXACT)     # minimum version specified:
+        IF ("${${_NAME}_FIND_VERSION}" VERSION_GREATER "${VERSION}")
+          SET(VERSION_MSG "Found unsuitable version \"${VERSION}\", but required is at least \"${${_NAME}_FIND_VERSION}\"")
+          SET(VERSION_OK FALSE)
+        ELSE ("${${_NAME}_FIND_VERSION}" VERSION_GREATER "${VERSION}")
+          SET(VERSION_MSG "(found suitable version \"${VERSION}\", required is \"${${_NAME}_FIND_VERSION}\")")
+        ENDIF ("${${_NAME}_FIND_VERSION}" VERSION_GREATER "${VERSION}")
+      ENDIF(${_NAME}_FIND_VERSION_EXACT)
+
+    ELSE(VERSION)
+
+      # if the package was not found, but a version was given, add that to the output:
+      IF(${_NAME}_FIND_VERSION_EXACT)
+         SET(VERSION_MSG "(Required is exact version \"${${_NAME}_FIND_VERSION}\")")
+      ELSE(${_NAME}_FIND_VERSION_EXACT)
+         SET(VERSION_MSG "(Required is at least version \"${${_NAME}_FIND_VERSION}\")")
+      ENDIF(${_NAME}_FIND_VERSION_EXACT)
+
+    ENDIF(VERSION)
+  ELSE (${_NAME}_FIND_VERSION)
+    IF(VERSION)
+      SET(VERSION_MSG "(found version \"${VERSION}\")")
+    ENDIF(VERSION)
+  ENDIF (${_NAME}_FIND_VERSION)
+
+  IF(VERSION_OK)
+    SET(DETAILS "${DETAILS}[v${VERSION}(${${_NAME}_FIND_VERSION})]")
+  ELSE(VERSION_OK)
+    SET(${_NAME_UPPER}_FOUND FALSE)
+  ENDIF(VERSION_OK)
+
+
+  # print the result:
+  IF (${_NAME_UPPER}_FOUND)
+    FIND_PACKAGE_MESSAGE(${_NAME} "Found ${_NAME}: ${${_FIRST_REQUIRED_VAR}} ${VERSION_MSG}" "${DETAILS}")
+  ELSE (${_NAME_UPPER}_FOUND)
+
+    IF(FPHSA_CONFIG_MODE)
+      _FPHSA_HANDLE_FAILURE_CONFIG_MODE()
+    ELSE(FPHSA_CONFIG_MODE)
+      IF(NOT VERSION_OK)
+        _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: ${VERSION_MSG} (found ${${_FIRST_REQUIRED_VAR}})")
+      ELSE(NOT VERSION_OK)
+        _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE} (missing: ${MISSING_VARS}) ${VERSION_MSG}")
+      ENDIF(NOT VERSION_OK)
+    ENDIF(FPHSA_CONFIG_MODE)
+
+  ENDIF (${_NAME_UPPER}_FOUND)
+
+  SET(${_NAME_UPPER}_FOUND ${${_NAME_UPPER}_FOUND} PARENT_SCOPE)
+
+ENDFUNCTION(FIND_PACKAGE_HANDLE_STANDARD_ARGS _FIRST_ARG)
diff --git a/carl9170fw/extra/FindUSB-1.0.cmake b/carl9170fw/extra/FindUSB-1.0.cmake
new file mode 100644
index 0000000..83df063
--- /dev/null
+++ b/carl9170fw/extra/FindUSB-1.0.cmake
@@ -0,0 +1,112 @@
+# - Try to find USB-1.0
+# Once done this will define
+#
+#  USB-1.0_FOUND - system has USB-1.0
+#  USB-1.0_INCLUDE_DIRS - the USB-1.0 include directory
+#  USB-1.0_LIBRARIES - Link these to use USB-1.0
+#  USB-1.0_DEFINITIONS - Compiler switches required for using USB-1.0
+#
+#  Copyright (c) 2009 Andreas Schneider <mail@cynapses.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+# 3. The name of the author may not be used to endorse or promote products
+#    derived from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+
+if (USB-1.0_LIBRARIES AND USB-1.0_INCLUDE_DIRS)
+  # in cache already
+  set(USB-1.0_FOUND TRUE)
+else (USB-1.0_LIBRARIES AND USB-1.0_INCLUDE_DIRS)
+  # use pkg-config to get the directories and then use these values
+  # in the FIND_PATH() and FIND_LIBRARY() calls
+  if (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4)
+    include(UsePkgConfig)
+    pkgconfig(libusb-1.0 _USB-1.0_INCLUDEDIR _USB-1.0_LIBDIR _USB-1.0_LDFLAGS _USB-1.0_CFLAGS)
+  else (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4)
+    find_package(PkgConfig)
+    if (PKG_CONFIG_FOUND)
+      pkg_check_modules(_USB-1.0 libusb-1.0)
+    endif (PKG_CONFIG_FOUND)
+  endif (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4)
+
+  find_path(USB-1.0_INCLUDE_DIR
+    NAMES
+      libusb.h
+    PATHS
+      ${_USB-1.0_INCLUDEDIR}
+      /usr/include
+      /usr/local/include
+      /opt/local/include
+      /sw/include
+    PATH_SUFFIXES
+      libusb-1.0
+  )
+  mark_as_advanced(USB-1.0_INCLUDE_DIR)
+
+  find_library(USB-1.0_LIBRARY
+    NAMES
+      usb-1.0
+    PATHS
+      ${_USB-1.0_LIBDIR}
+      /usr/lib
+      /usr/local/lib
+      /opt/local/lib
+      /sw/lib
+  )
+  mark_as_advanced(USB-1.0_LIBRARY)
+
+  if (USB-1.0_LIBRARY)
+    set(USB-1.0_FOUND TRUE)
+    mark_as_advanced(USB-1.0_FOUND)
+  endif (USB-1.0_LIBRARY)
+
+  set(USB-1.0_INCLUDE_DIRS
+    ${USB-1.0_INCLUDE_DIR}
+  )
+
+  if (USB-1.0_FOUND)
+    set(USB-1.0_LIBRARIES
+      ${USB-1.0_LIBRARIES}
+      ${USB-1.0_LIBRARY}
+    )
+  endif (USB-1.0_FOUND)
+
+  if (USB-1.0_INCLUDE_DIRS AND USB-1.0_LIBRARIES)
+     set(USB-1.0_FOUND TRUE)
+  endif (USB-1.0_INCLUDE_DIRS AND USB-1.0_LIBRARIES)
+
+  if (USB-1.0_FOUND)
+    if (NOT USB-1.0_FIND_QUIETLY)
+      message(STATUS "Found USB-1.0: ${USB-1.0_LIBRARIES}")
+    endif (NOT USB-1.0_FIND_QUIETLY)
+  else (USB-1.0_FOUND)
+    if (USB-1.0_FIND_REQUIRED)
+      message(FATAL_ERROR "Could not find USB-1.0")
+    endif (USB-1.0_FIND_REQUIRED)
+  endif (USB-1.0_FOUND)
+
+  # show the USB-1.0_INCLUDE_DIRS and USB-1.0_LIBRARIES variables only in the advanced view
+  mark_as_advanced(USB-1.0_INCLUDE_DIRS USB-1.0_LIBRARIES)
+
+endif (USB-1.0_LIBRARIES AND USB-1.0_INCLUDE_DIRS)
+
diff --git a/carl9170fw/extra/GCCVersion.cmake b/carl9170fw/extra/GCCVersion.cmake
new file mode 100644
index 0000000..bb5fef3
--- /dev/null
+++ b/carl9170fw/extra/GCCVersion.cmake
@@ -0,0 +1,60 @@
+#=============================================================================
+# Copyright 2006-2009 Kitware, Inc.
+# Copyright 2006-2008 Andreas Schneider <mail@cynapses.org>
+# Copyright 2007      Wengo
+# Copyright 2007      Mike Jackson
+# Copyright 2008      Andreas Pakulat <apaku@gmx.de>
+# Copyright 2008-2009 Philip Lowman <philip@yhbt.com>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+#   notice, this list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in the
+#   documentation and/or other materials provided with the distribution.
+#
+# * Neither the names of Kitware, Inc., the Insight Software Consortium,
+#   nor the names of their contributors may be used to endorse or promote
+#   products derived from this software without specific prior written
+#   permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#-------------------------------------------------------------------------------
+
+#
+# Runs compiler with "-dumpversion" and parses major/minor
+# version with a regex.
+#
+FUNCTION(_COMPILER_DUMPVERSION _OUTPUT_VERSION)
+
+  EXEC_PROGRAM(${CMAKE_C_COMPILER}
+    ARGS ${CMAKE_C_COMPILER_ARG1} -dumpversion
+    OUTPUT_VARIABLE _COMPILER_VERSION
+  )
+  STRING(REGEX REPLACE "([0-9])\\.([0-9])(\\.[0-9])?" "\\1\\2"
+    _COMPILER_VERSION ${_COMPILER_VERSION})
+
+  SET(${_OUTPUT_VERSION} ${_COMPILER_VERSION} PARENT_SCOPE)
+ENDFUNCTION()
+
+#
+# End functions/macros
+#
+#-------------------------------------------------------------------------------
+
+
diff --git a/carl9170fw/extra/libusb-zeropacket.diff b/carl9170fw/extra/libusb-zeropacket.diff
new file mode 100644
index 0000000..9aa73de
--- /dev/null
+++ b/carl9170fw/extra/libusb-zeropacket.diff
@@ -0,0 +1,38 @@
+diff -Nurp libusb-1.0-1.0.2/libusb/libusb.h libusb-1.0-1.0.2-orig/libusb/libusb.h
+--- libusb-1.0-1.0.2/libusb/libusb.h	2009-06-07 23:18:19.000000000 +0200
++++ libusb-1.0-1.0.2-orig/libusb/libusb.h	2009-08-10 22:07:41.000000000 +0200
+@@ -673,6 +673,9 @@ enum libusb_transfer_flags {
+ 	 * from your transfer callback, as this will result in a double-free
+ 	 * when this flag is acted upon. */
+ 	LIBUSB_TRANSFER_FREE_TRANSFER = 1<<2,
++
++	/** Send an extra termination packet, when needed */
++	LIBUSB_TRANSFER_ZERO_PACKET = 1<<3,
+ };
+ 
+ /** \ingroup asyncio
+diff -Nurp libusb-1.0-1.0.2/libusb/os/linux_usbfs.c libusb-1.0-1.0.2-orig/libusb/os/linux_usbfs.c
+--- libusb-1.0-1.0.2/libusb/os/linux_usbfs.c	2009-06-10 22:41:26.000000000 +0200
++++ libusb-1.0-1.0.2-orig/libusb/os/linux_usbfs.c	2009-08-10 22:10:14.000000000 +0200
+@@ -1298,6 +1298,8 @@ static int submit_bulk_transfer(struct u
+ 		urb->type = urb_type;
+ 		urb->endpoint = transfer->endpoint;
+ 		urb->buffer = transfer->buffer + (i * MAX_BULK_BUFFER_LENGTH);
++		if (transfer->flags & LIBUSB_TRANSFER_ZERO_PACKET)
++			urb->flags = USBFS_URB_ZERO_PACKET;
+ 		if (i == num_urbs - 1 && last_urb_partial)
+ 			urb->buffer_length = transfer->length % MAX_BULK_BUFFER_LENGTH;
+ 		else
+diff -Nurp libusb-1.0-1.0.2/libusb/os/linux_usbfs.h libusb-1.0-1.0.2-orig/libusb/os/linux_usbfs.h
+--- libusb-1.0-1.0.2/libusb/os/linux_usbfs.h	2008-07-16 16:17:57.000000000 +0200
++++ libusb-1.0-1.0.2-orig/libusb/os/linux_usbfs.h	2009-08-10 22:13:15.000000000 +0200
+@@ -63,6 +63,9 @@ struct usbfs_getdriver {
+ #define USBFS_URB_DISABLE_SPD	1
+ #define USBFS_URB_ISO_ASAP	2
+ #define USBFS_URB_QUEUE_BULK	0x10
++#define USBFS_URB_NO_FSBR	0x20
++#define USBFS_URB_ZERO_PACKET	0x40
++#define USBFS_URB_NO_INTERRUPT	0x80
+ 
+ enum usbfs_urb_type {
+ 	USBFS_URB_TYPE_ISO = 0,
diff --git a/carl9170fw/extra/sh-elf-linux.cmake b/carl9170fw/extra/sh-elf-linux.cmake
new file mode 100644
index 0000000..8be6d36
--- /dev/null
+++ b/carl9170fw/extra/sh-elf-linux.cmake
@@ -0,0 +1,21 @@
+set(CMAKE_SYSTEM_NAME "Generic")
+set(CMAKE_SYSTEM_PROCESSOR "sh2")
+
+set_property(DIRECTORY PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE)
+
+set(CMAKE_FIND_ROOT_PATH ${CMAKE_SOURCE_DIR}/toolchain/inst/)
+
+set(CMAKE_C_FLAGS "-m2 -ml -Os -ffreestanding -nostartfiles")
+set(CMAKE_C_LINK_FLAGS "-static -EL -x --gc-sections")
+
+set(OBJCOPY ${CMAKE_SOURCE_DIR}/toolchain/inst/bin/sh-elf-objcopy)
+set(CMAKE_C_COMPILER "${CMAKE_SOURCE_DIR}/toolchain/inst/bin/sh-elf-gcc")
+set(CMAKE_AR ${CMAKE_SOURCE_DIR}/toolchain/inst/bin/sh-elf-ar)
+set(CMAKE_ASM_COMPILER ${CMAKE_SOURCE_DIR}/toolchain/inst/bin/sh-elf-as)
+set(CMAKE_ASM-ATT_COMPILER ${CMAKE_SOURCE_DIR}/toolchain/inst/bin/sh-elf-as)
+set(CMAKE_LINKER ${CMAKE_SOURCE_DIR}/toolchain/inst/bin/sh-elf-ld)
+set(CMAKE_C_LINK_EXECUTABLE "${CMAKE_SOURCE_DIR}/toolchain/inst/bin/sh-elf-ld <OBJECTS> <CMAKE_C_LINK_FLAGS> <LINK_FLAGS> -o <TARGET>")
+
+set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
+set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
+set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
diff --git a/carl9170fw/genapi.sh b/carl9170fw/genapi.sh
new file mode 100755
index 0000000..8912cc6
--- /dev/null
+++ b/carl9170fw/genapi.sh
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+cat <<EOF > include/shared/version.h
+#ifndef __CARL9170_SHARED_VERSION_H
+#define __CARL9170_SHARED_VERSION_H
+#define CARL9170FW_VERSION_YEAR $((100`date +%Y`%100))
+#define CARL9170FW_VERSION_MONTH $((100`date +%m`%100))
+#define CARL9170FW_VERSION_DAY $((100`date +%d`%100))
+#define CARL9170FW_VERSION_GIT "`git describe 2>/dev/null`"
+#endif /* __CARL9170_SHARED_VERSION_H */
+EOF
diff --git a/carl9170fw/include/linux/ch9.h b/carl9170fw/include/linux/ch9.h
new file mode 100644
index 0000000..94e01bb
--- /dev/null
+++ b/carl9170fw/include/linux/ch9.h
@@ -0,0 +1,803 @@
+/*
+ * This file holds USB constants and structures that are needed for
+ * USB device APIs.  These are used by the USB device model, which is
+ * defined in chapter 9 of the USB 2.0 specification and in the
+ * Wireless USB 1.0 (spread around).  Linux has several APIs in C that
+ * need these:
+ *
+ * - the master/host side Linux-USB kernel driver API;
+ * - the "usbfs" user space API; and
+ * - the Linux "gadget" slave/device/peripheral side driver API.
+ *
+ * USB 2.0 adds an additional "On The Go" (OTG) mode, which lets systems
+ * act either as a USB master/host or as a USB slave/device.  That means
+ * the master and slave side APIs benefit from working well together.
+ *
+ * There's also "Wireless USB", using low power short range radios for
+ * peripheral interconnection but otherwise building on the USB framework.
+ *
+ * Note all descriptors are declared '__attribute__((packed))' so that:
+ *
+ * [a] they never get padded, either internally (USB spec writers
+ *     probably handled that) or externally;
+ *
+ * [b] so that accessing bigger-than-a-bytes fields will never
+ *     generate bus errors on any platform, even when the location of
+ *     its descriptor inside a bundle isn't "naturally aligned", and
+ *
+ * [c] for consistency, removing all doubt even when it appears to
+ *     someone that the two other points are non-issues for that
+ *     particular descriptor type.
+ */
+
+#ifndef __LINUX_USB_CH9_H
+#define __LINUX_USB_CH9_H
+
+#include <linux/types.h>	/* __u8 etc */
+
+/*-------------------------------------------------------------------------*/
+
+/* CONTROL REQUEST SUPPORT */
+
+/*
+ * USB directions
+ *
+ * This bit flag is used in endpoint descriptors' bEndpointAddress field.
+ * It's also one of three fields in control requests bRequestType.
+ */
+#define USB_DIR_MASK			0x80
+#define USB_DIR_OUT			0		/* to device */
+#define USB_DIR_IN			0x80		/* to host */
+
+/*
+ * USB types, the second of three bRequestType fields
+ */
+#define USB_TYPE_MASK			(0x03 << 5)
+#define USB_TYPE_STANDARD		(0x00 << 5)
+#define USB_TYPE_CLASS			(0x01 << 5)
+#define USB_TYPE_VENDOR			(0x02 << 5)
+#define USB_TYPE_RESERVED		(0x03 << 5)
+
+/*
+ * USB recipients, the third of three bRequestType fields
+ */
+#define USB_RECIP_MASK			0x1f
+#define USB_RECIP_DEVICE		0x00
+#define USB_RECIP_INTERFACE		0x01
+#define USB_RECIP_ENDPOINT		0x02
+#define USB_RECIP_OTHER			0x03
+/* From Wireless USB 1.0 */
+#define USB_RECIP_PORT			0x04
+#define USB_RECIP_RPIPE		0x05
+
+/*
+ * Standard requests, for the bRequest field of a SETUP packet.
+ *
+ * These are qualified by the bRequestType field, so that for example
+ * TYPE_CLASS or TYPE_VENDOR specific feature flags could be retrieved
+ * by a GET_STATUS request.
+ */
+#define USB_REQ_GET_STATUS		0x00
+#define USB_REQ_CLEAR_FEATURE		0x01
+#define USB_REQ_SET_FEATURE		0x03
+#define USB_REQ_SET_ADDRESS		0x05
+#define USB_REQ_GET_DESCRIPTOR		0x06
+#define USB_REQ_SET_DESCRIPTOR		0x07
+#define USB_REQ_GET_CONFIGURATION	0x08
+#define USB_REQ_SET_CONFIGURATION	0x09
+#define USB_REQ_GET_INTERFACE		0x0A
+#define USB_REQ_SET_INTERFACE		0x0B
+#define USB_REQ_SYNCH_FRAME		0x0C
+
+#define USB_REQ_SET_ENCRYPTION		0x0D	/* Wireless USB */
+#define USB_REQ_GET_ENCRYPTION		0x0E
+#define USB_REQ_RPIPE_ABORT		0x0E
+#define USB_REQ_SET_HANDSHAKE		0x0F
+#define USB_REQ_RPIPE_RESET		0x0F
+#define USB_REQ_GET_HANDSHAKE		0x10
+#define USB_REQ_SET_CONNECTION		0x11
+#define USB_REQ_SET_SECURITY_DATA	0x12
+#define USB_REQ_GET_SECURITY_DATA	0x13
+#define USB_REQ_SET_WUSB_DATA		0x14
+#define USB_REQ_LOOPBACK_DATA_WRITE	0x15
+#define USB_REQ_LOOPBACK_DATA_READ	0x16
+#define USB_REQ_SET_INTERFACE_DS	0x17
+
+/* The Link Power Management (LPM) ECN defines USB_REQ_TEST_AND_SET command,
+ * used by hubs to put ports into a new L1 suspend state, except that it
+ * forgot to define its number ...
+ */
+
+/*
+ * USB feature flags are written using USB_REQ_{CLEAR,SET}_FEATURE, and
+ * are read as a bit array returned by USB_REQ_GET_STATUS.  (So there
+ * are at most sixteen features of each type.)  Hubs may also support a
+ * new USB_REQ_TEST_AND_SET_FEATURE to put ports into L1 suspend.
+ */
+#define USB_DEVICE_SELF_POWERED		0	/* (read only) */
+#define USB_DEVICE_REMOTE_WAKEUP	1	/* dev may initiate wakeup */
+#define USB_DEVICE_TEST_MODE		2	/* (wired high speed only) */
+#define USB_DEVICE_BATTERY		2	/* (wireless) */
+#define USB_DEVICE_B_HNP_ENABLE		3	/* (otg) dev may initiate HNP */
+#define USB_DEVICE_WUSB_DEVICE		3	/* (wireless)*/
+#define USB_DEVICE_A_HNP_SUPPORT	4	/* (otg) RH port supports HNP */
+#define USB_DEVICE_A_ALT_HNP_SUPPORT	5	/* (otg) other RH port does */
+#define USB_DEVICE_DEBUG_MODE		6	/* (special devices only) */
+
+#define USB_ENDPOINT_HALT		0	/* IN/OUT will STALL */
+
+
+/**
+ * struct usb_ctrlrequest - SETUP data for a USB device control request
+ * @bRequestType: matches the USB bmRequestType field
+ * @bRequest: matches the USB bRequest field
+ * @wValue: matches the USB wValue field (le16 byte order)
+ * @wIndex: matches the USB wIndex field (le16 byte order)
+ * @wLength: matches the USB wLength field (le16 byte order)
+ *
+ * This structure is used to send control requests to a USB device.  It matches
+ * the different fields of the USB 2.0 Spec section 9.3, table 9-2.  See the
+ * USB spec for a fuller description of the different fields, and what they are
+ * used for.
+ *
+ * Note that the driver for any interface can issue control requests.
+ * For most devices, interfaces don't coordinate with each other, so
+ * such requests may be made at any time.
+ */
+struct usb_ctrlrequest {
+	__u8 bRequestType;
+	__u8 bRequest;
+	__le16 wValue;
+	__le16 wIndex;
+	__le16 wLength;
+} __attribute__ ((packed));
+
+/*-------------------------------------------------------------------------*/
+
+/*
+ * STANDARD DESCRIPTORS ... as returned by GET_DESCRIPTOR, or
+ * (rarely) accepted by SET_DESCRIPTOR.
+ *
+ * Note that all multi-byte values here are encoded in little endian
+ * byte order "on the wire".  Within the kernel and when exposed
+ * through the Linux-USB APIs, they are not converted to cpu byte
+ * order; it is the responsibility of the client code to do this.
+ * The single exception is when device and configuration descriptors (but
+ * not other descriptors) are read from usbfs (i.e. /proc/bus/usb/BBB/DDD);
+ * in this case the fields are converted to host endianness by the kernel.
+ */
+
+/*
+ * Descriptor types ... USB 2.0 spec table 9.5
+ */
+#define USB_DT_DEVICE			0x01
+#define USB_DT_CONFIG			0x02
+#define USB_DT_STRING			0x03
+#define USB_DT_INTERFACE		0x04
+#define USB_DT_ENDPOINT			0x05
+#define USB_DT_DEVICE_QUALIFIER		0x06
+#define USB_DT_OTHER_SPEED_CONFIG	0x07
+#define USB_DT_INTERFACE_POWER		0x08
+/* these are from a minor usb 2.0 revision (ECN) */
+#define USB_DT_OTG			0x09
+#define USB_DT_DEBUG			0x0a
+#define USB_DT_INTERFACE_ASSOCIATION	0x0b
+/* these are from the Wireless USB spec */
+#define USB_DT_SECURITY			0x0c
+#define USB_DT_KEY			0x0d
+#define USB_DT_ENCRYPTION_TYPE		0x0e
+#define USB_DT_BOS			0x0f
+#define USB_DT_DEVICE_CAPABILITY	0x10
+#define USB_DT_WIRELESS_ENDPOINT_COMP	0x11
+#define USB_DT_WIRE_ADAPTER		0x21
+#define USB_DT_RPIPE			0x22
+#define USB_DT_CS_RADIO_CONTROL		0x23
+/* From the USB 3.0 spec */
+#define	USB_DT_SS_ENDPOINT_COMP		0x30
+
+/* Conventional codes for class-specific descriptors.  The convention is
+ * defined in the USB "Common Class" Spec (3.11).  Individual class specs
+ * are authoritative for their usage, not the "common class" writeup.
+ */
+#define USB_DT_CS_DEVICE		(USB_TYPE_CLASS | USB_DT_DEVICE)
+#define USB_DT_CS_CONFIG		(USB_TYPE_CLASS | USB_DT_CONFIG)
+#define USB_DT_CS_STRING		(USB_TYPE_CLASS | USB_DT_STRING)
+#define USB_DT_CS_INTERFACE		(USB_TYPE_CLASS | USB_DT_INTERFACE)
+#define USB_DT_CS_ENDPOINT		(USB_TYPE_CLASS | USB_DT_ENDPOINT)
+
+/* All standard descriptors have these 2 fields at the beginning */
+struct usb_descriptor_header {
+	__u8  bLength;
+	__u8  bDescriptorType;
+} __attribute__ ((packed));
+
+
+/*-------------------------------------------------------------------------*/
+
+/* USB_DT_DEVICE: Device descriptor */
+struct usb_device_descriptor {
+	__u8  bLength;
+	__u8  bDescriptorType;
+
+	__le16 bcdUSB;
+	__u8  bDeviceClass;
+	__u8  bDeviceSubClass;
+	__u8  bDeviceProtocol;
+	__u8  bMaxPacketSize0;
+	__le16 idVendor;
+	__le16 idProduct;
+	__le16 bcdDevice;
+	__u8  iManufacturer;
+	__u8  iProduct;
+	__u8  iSerialNumber;
+	__u8  bNumConfigurations;
+} __attribute__ ((packed));
+
+#define USB_DT_DEVICE_SIZE		18
+
+
+/*
+ * Device and/or Interface Class codes
+ * as found in bDeviceClass or bInterfaceClass
+ * and defined by www.usb.org documents
+ */
+#define USB_CLASS_PER_INTERFACE		0	/* for DeviceClass */
+#define USB_CLASS_AUDIO			1
+#define USB_CLASS_COMM			2
+#define USB_CLASS_HID			3
+#define USB_CLASS_PHYSICAL		5
+#define USB_CLASS_STILL_IMAGE		6
+#define USB_CLASS_PRINTER		7
+#define USB_CLASS_MASS_STORAGE		8
+#define USB_CLASS_HUB			9
+#define USB_CLASS_CDC_DATA		0x0a
+#define USB_CLASS_CSCID			0x0b	/* chip+ smart card */
+#define USB_CLASS_CONTENT_SEC		0x0d	/* content security */
+#define USB_CLASS_VIDEO			0x0e
+#define USB_CLASS_WIRELESS_CONTROLLER	0xe0
+#define USB_CLASS_MISC			0xef
+#define USB_CLASS_APP_SPEC		0xfe
+#define USB_CLASS_VENDOR_SPEC		0xff
+
+#define USB_SUBCLASS_VENDOR_SPEC	0xff
+
+/*-------------------------------------------------------------------------*/
+
+/* USB_DT_CONFIG: Configuration descriptor information.
+ *
+ * USB_DT_OTHER_SPEED_CONFIG is the same descriptor, except that the
+ * descriptor type is different.  Highspeed-capable devices can look
+ * different depending on what speed they're currently running.  Only
+ * devices with a USB_DT_DEVICE_QUALIFIER have any OTHER_SPEED_CONFIG
+ * descriptors.
+ */
+struct usb_config_descriptor {
+	__u8  bLength;
+	__u8  bDescriptorType;
+
+	__le16 wTotalLength;
+	__u8  bNumInterfaces;
+	__u8  bConfigurationValue;
+	__u8  iConfiguration;
+	__u8  bmAttributes;
+	__u8  bMaxPower;
+} __attribute__ ((packed));
+
+#define USB_DT_CONFIG_SIZE		9
+
+/* from config descriptor bmAttributes */
+#define USB_CONFIG_ATT_ONE		(1 << 7)	/* must be set */
+#define USB_CONFIG_ATT_SELFPOWER	(1 << 6)	/* self powered */
+#define USB_CONFIG_ATT_WAKEUP		(1 << 5)	/* can wakeup */
+#define USB_CONFIG_ATT_BATTERY		(1 << 4)	/* battery powered */
+
+/*-------------------------------------------------------------------------*/
+
+/* USB_DT_STRING: String descriptor */
+struct usb_string_descriptor {
+	__u8  bLength;
+	__u8  bDescriptorType;
+
+	__le16 wData[1];		/* UTF-16LE encoded */
+} __attribute__ ((packed));
+
+/* note that "string" zero is special, it holds language codes that
+ * the device supports, not Unicode characters.
+ */
+
+/*-------------------------------------------------------------------------*/
+
+/* USB_DT_INTERFACE: Interface descriptor */
+struct usb_interface_descriptor {
+	__u8  bLength;
+	__u8  bDescriptorType;
+
+	__u8  bInterfaceNumber;
+	__u8  bAlternateSetting;
+	__u8  bNumEndpoints;
+	__u8  bInterfaceClass;
+	__u8  bInterfaceSubClass;
+	__u8  bInterfaceProtocol;
+	__u8  iInterface;
+} __attribute__ ((packed));
+
+#define USB_DT_INTERFACE_SIZE		9
+
+/*-------------------------------------------------------------------------*/
+
+/* USB_DT_ENDPOINT: Endpoint descriptor */
+struct usb_endpoint_descriptor {
+	__u8  bLength;
+	__u8  bDescriptorType;
+
+	__u8  bEndpointAddress;
+	__u8  bmAttributes;
+	__le16 wMaxPacketSize;
+	__u8  bInterval;
+} __attribute__ ((packed));
+
+#define USB_DT_ENDPOINT_SIZE		7
+#define USB_DT_ENDPOINT_AUDIO_SIZE	9	/* Audio extension */
+
+
+/*
+ * Endpoints
+ */
+#define USB_ENDPOINT_NUMBER_MASK	0x0f	/* in bEndpointAddress */
+#define USB_ENDPOINT_DIR_MASK		0x80
+
+#define USB_ENDPOINT_SYNCTYPE		0x0c
+#define USB_ENDPOINT_SYNC_NONE		(0 << 2)
+#define USB_ENDPOINT_SYNC_ASYNC		(1 << 2)
+#define USB_ENDPOINT_SYNC_ADAPTIVE	(2 << 2)
+#define USB_ENDPOINT_SYNC_SYNC		(3 << 2)
+
+#define USB_ENDPOINT_XFERTYPE_MASK	0x03	/* in bmAttributes */
+#define USB_ENDPOINT_XFER_CONTROL	0
+#define USB_ENDPOINT_XFER_ISOC		1
+#define USB_ENDPOINT_XFER_BULK		2
+#define USB_ENDPOINT_XFER_INT		3
+#define USB_ENDPOINT_MAX_ADJUSTABLE	0x80
+
+/*-------------------------------------------------------------------------*/
+
+/**
+ * usb_endpoint_num - get the endpoint's number
+ * @epd: endpoint to be checked
+ *
+ * Returns @epd's number: 0 to 15.
+ */
+static inline int usb_endpoint_num(const struct usb_endpoint_descriptor *epd)
+{
+	return epd->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK;
+}
+
+/**
+ * usb_endpoint_type - get the endpoint's transfer type
+ * @epd: endpoint to be checked
+ *
+ * Returns one of USB_ENDPOINT_XFER_{CONTROL, ISOC, BULK, INT} according
+ * to @epd's transfer type.
+ */
+static inline int usb_endpoint_type(const struct usb_endpoint_descriptor *epd)
+{
+	return epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK;
+}
+
+/**
+ * usb_endpoint_dir_in - check if the endpoint has IN direction
+ * @epd: endpoint to be checked
+ *
+ * Returns true if the endpoint is of type IN, otherwise it returns false.
+ */
+static inline int usb_endpoint_dir_in(const struct usb_endpoint_descriptor *epd)
+{
+	return ((epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_IN);
+}
+
+/**
+ * usb_endpoint_dir_out - check if the endpoint has OUT direction
+ * @epd: endpoint to be checked
+ *
+ * Returns true if the endpoint is of type OUT, otherwise it returns false.
+ */
+static inline int usb_endpoint_dir_out(
+				const struct usb_endpoint_descriptor *epd)
+{
+	return ((epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT);
+}
+
+/**
+ * usb_endpoint_xfer_bulk - check if the endpoint has bulk transfer type
+ * @epd: endpoint to be checked
+ *
+ * Returns true if the endpoint is of type bulk, otherwise it returns false.
+ */
+static inline int usb_endpoint_xfer_bulk(
+				const struct usb_endpoint_descriptor *epd)
+{
+	return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
+		USB_ENDPOINT_XFER_BULK);
+}
+
+/**
+ * usb_endpoint_xfer_control - check if the endpoint has control transfer type
+ * @epd: endpoint to be checked
+ *
+ * Returns true if the endpoint is of type control, otherwise it returns false.
+ */
+static inline int usb_endpoint_xfer_control(
+				const struct usb_endpoint_descriptor *epd)
+{
+	return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
+		USB_ENDPOINT_XFER_CONTROL);
+}
+
+/**
+ * usb_endpoint_xfer_int - check if the endpoint has interrupt transfer type
+ * @epd: endpoint to be checked
+ *
+ * Returns true if the endpoint is of type interrupt, otherwise it returns
+ * false.
+ */
+static inline int usb_endpoint_xfer_int(
+				const struct usb_endpoint_descriptor *epd)
+{
+	return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
+		USB_ENDPOINT_XFER_INT);
+}
+
+/**
+ * usb_endpoint_xfer_isoc - check if the endpoint has isochronous transfer type
+ * @epd: endpoint to be checked
+ *
+ * Returns true if the endpoint is of type isochronous, otherwise it returns
+ * false.
+ */
+static inline int usb_endpoint_xfer_isoc(
+				const struct usb_endpoint_descriptor *epd)
+{
+	return (epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
+		USB_ENDPOINT_XFER_ISOC;
+}
+
+/**
+ * usb_endpoint_is_bulk_in - check if the endpoint is bulk IN
+ * @epd: endpoint to be checked
+ *
+ * Returns true if the endpoint has bulk transfer type and IN direction,
+ * otherwise it returns false.
+ */
+static inline int usb_endpoint_is_bulk_in(
+				const struct usb_endpoint_descriptor *epd)
+{
+	return usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_in(epd);
+}
+
+/**
+ * usb_endpoint_is_bulk_out - check if the endpoint is bulk OUT
+ * @epd: endpoint to be checked
+ *
+ * Returns true if the endpoint has bulk transfer type and OUT direction,
+ * otherwise it returns false.
+ */
+static inline int usb_endpoint_is_bulk_out(
+				const struct usb_endpoint_descriptor *epd)
+{
+	return usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_out(epd);
+}
+
+/**
+ * usb_endpoint_is_int_in - check if the endpoint is interrupt IN
+ * @epd: endpoint to be checked
+ *
+ * Returns true if the endpoint has interrupt transfer type and IN direction,
+ * otherwise it returns false.
+ */
+static inline int usb_endpoint_is_int_in(
+				const struct usb_endpoint_descriptor *epd)
+{
+	return usb_endpoint_xfer_int(epd) && usb_endpoint_dir_in(epd);
+}
+
+/**
+ * usb_endpoint_is_int_out - check if the endpoint is interrupt OUT
+ * @epd: endpoint to be checked
+ *
+ * Returns true if the endpoint has interrupt transfer type and OUT direction,
+ * otherwise it returns false.
+ */
+static inline int usb_endpoint_is_int_out(
+				const struct usb_endpoint_descriptor *epd)
+{
+	return usb_endpoint_xfer_int(epd) && usb_endpoint_dir_out(epd);
+}
+
+/**
+ * usb_endpoint_is_isoc_in - check if the endpoint is isochronous IN
+ * @epd: endpoint to be checked
+ *
+ * Returns true if the endpoint has isochronous transfer type and IN direction,
+ * otherwise it returns false.
+ */
+static inline int usb_endpoint_is_isoc_in(
+				const struct usb_endpoint_descriptor *epd)
+{
+	return usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_in(epd);
+}
+
+/**
+ * usb_endpoint_is_isoc_out - check if the endpoint is isochronous OUT
+ * @epd: endpoint to be checked
+ *
+ * Returns true if the endpoint has isochronous transfer type and OUT direction,
+ * otherwise it returns false.
+ */
+static inline int usb_endpoint_is_isoc_out(
+				const struct usb_endpoint_descriptor *epd)
+{
+	return usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_out(epd);
+}
+
+/*-------------------------------------------------------------------------*/
+
+/* USB_DT_SS_ENDPOINT_COMP: SuperSpeed Endpoint Companion descriptor */
+struct usb_ss_ep_comp_descriptor {
+	__u8  bLength;
+	__u8  bDescriptorType;
+
+	__u8  bMaxBurst;
+	__u8  bmAttributes;
+	__le16 wBytesPerInterval;
+} __attribute__ ((packed));
+
+#define USB_DT_SS_EP_COMP_SIZE		6
+
+/*-------------------------------------------------------------------------*/
+
+/* USB_DT_DEVICE_QUALIFIER: Device Qualifier descriptor */
+struct usb_qualifier_descriptor {
+	__u8  bLength;
+	__u8  bDescriptorType;
+
+	__le16 bcdUSB;
+	__u8  bDeviceClass;
+	__u8  bDeviceSubClass;
+	__u8  bDeviceProtocol;
+	__u8  bMaxPacketSize0;
+	__u8  bNumConfigurations;
+	__u8  bRESERVED;
+} __attribute__ ((packed));
+
+
+/*-------------------------------------------------------------------------*/
+
+/* USB_DT_OTG (from OTG 1.0a supplement) */
+struct usb_otg_descriptor {
+	__u8  bLength;
+	__u8  bDescriptorType;
+
+	__u8  bmAttributes;	/* support for HNP, SRP, etc */
+} __attribute__ ((packed));
+
+/* from usb_otg_descriptor.bmAttributes */
+#define USB_OTG_SRP		(1 << 0)
+#define USB_OTG_HNP		(1 << 1)	/* swap host/device roles */
+
+/*-------------------------------------------------------------------------*/
+
+/* USB_DT_DEBUG:  for special highspeed devices, replacing serial console */
+struct usb_debug_descriptor {
+	__u8  bLength;
+	__u8  bDescriptorType;
+
+	/* bulk endpoints with 8 byte maxpacket */
+	__u8  bDebugInEndpoint;
+	__u8  bDebugOutEndpoint;
+} __attribute__((packed));
+
+/*-------------------------------------------------------------------------*/
+
+/* USB_DT_INTERFACE_ASSOCIATION: groups interfaces */
+struct usb_interface_assoc_descriptor {
+	__u8  bLength;
+	__u8  bDescriptorType;
+
+	__u8  bFirstInterface;
+	__u8  bInterfaceCount;
+	__u8  bFunctionClass;
+	__u8  bFunctionSubClass;
+	__u8  bFunctionProtocol;
+	__u8  iFunction;
+} __attribute__ ((packed));
+
+
+/*-------------------------------------------------------------------------*/
+
+/* USB_DT_SECURITY:  group of wireless security descriptors, including
+ * encryption types available for setting up a CC/association.
+ */
+struct usb_security_descriptor {
+	__u8  bLength;
+	__u8  bDescriptorType;
+
+	__le16 wTotalLength;
+	__u8  bNumEncryptionTypes;
+} __attribute__((packed));
+
+/*-------------------------------------------------------------------------*/
+
+/* USB_DT_KEY:  used with {GET,SET}_SECURITY_DATA; only public keys
+ * may be retrieved.
+ */
+struct usb_key_descriptor {
+	__u8  bLength;
+	__u8  bDescriptorType;
+
+	__u8  tTKID[3];
+	__u8  bReserved;
+	__u8  bKeyData[0];
+} __attribute__((packed));
+
+/*-------------------------------------------------------------------------*/
+
+/* USB_DT_ENCRYPTION_TYPE:  bundled in DT_SECURITY groups */
+struct usb_encryption_descriptor {
+	__u8  bLength;
+	__u8  bDescriptorType;
+
+	__u8  bEncryptionType;
+#define	USB_ENC_TYPE_UNSECURE		0
+#define	USB_ENC_TYPE_WIRED		1	/* non-wireless mode */
+#define	USB_ENC_TYPE_CCM_1		2	/* aes128/cbc session */
+#define	USB_ENC_TYPE_RSA_1		3	/* rsa3072/sha1 auth */
+	__u8  bEncryptionValue;		/* use in SET_ENCRYPTION */
+	__u8  bAuthKeyIndex;
+} __attribute__((packed));
+
+
+/*-------------------------------------------------------------------------*/
+
+/* USB_DT_BOS:  group of device-level capabilities */
+struct usb_bos_descriptor {
+	__u8  bLength;
+	__u8  bDescriptorType;
+
+	__le16 wTotalLength;
+	__u8  bNumDeviceCaps;
+} __attribute__((packed));
+
+/*-------------------------------------------------------------------------*/
+
+/* USB_DT_DEVICE_CAPABILITY:  grouped with BOS */
+struct usb_dev_cap_header {
+	__u8  bLength;
+	__u8  bDescriptorType;
+	__u8  bDevCapabilityType;
+} __attribute__((packed));
+
+#define	USB_CAP_TYPE_WIRELESS_USB	1
+
+struct usb_wireless_cap_descriptor {	/* Ultra Wide Band */
+	__u8  bLength;
+	__u8  bDescriptorType;
+	__u8  bDevCapabilityType;
+
+	__u8  bmAttributes;
+#define	USB_WIRELESS_P2P_DRD		(1 << 1)
+#define	USB_WIRELESS_BEACON_MASK	(3 << 2)
+#define	USB_WIRELESS_BEACON_SELF	(1 << 2)
+#define	USB_WIRELESS_BEACON_DIRECTED	(2 << 2)
+#define	USB_WIRELESS_BEACON_NONE	(3 << 2)
+	__le16 wPHYRates;	/* bit rates, Mbps */
+#define	USB_WIRELESS_PHY_53		(1 << 0)	/* always set */
+#define	USB_WIRELESS_PHY_80		(1 << 1)
+#define	USB_WIRELESS_PHY_107		(1 << 2)	/* always set */
+#define	USB_WIRELESS_PHY_160		(1 << 3)
+#define	USB_WIRELESS_PHY_200		(1 << 4)	/* always set */
+#define	USB_WIRELESS_PHY_320		(1 << 5)
+#define	USB_WIRELESS_PHY_400		(1 << 6)
+#define	USB_WIRELESS_PHY_480		(1 << 7)
+	__u8  bmTFITXPowerInfo;	/* TFI power levels */
+	__u8  bmFFITXPowerInfo;	/* FFI power levels */
+	__le16 bmBandGroup;
+	__u8  bReserved;
+} __attribute__((packed));
+
+#define	USB_CAP_TYPE_EXT		2
+
+struct usb_ext_cap_descriptor {		/* Link Power Management */
+	__u8  bLength;
+	__u8  bDescriptorType;
+	__u8  bDevCapabilityType;
+	__u8  bmAttributes;
+#define USB_LPM_SUPPORT			(1 << 1)	/* supports LPM */
+} __attribute__((packed));
+
+/*-------------------------------------------------------------------------*/
+
+/* USB_DT_WIRELESS_ENDPOINT_COMP:  companion descriptor associated with
+ * each endpoint descriptor for a wireless device
+ */
+struct usb_wireless_ep_comp_descriptor {
+	__u8  bLength;
+	__u8  bDescriptorType;
+
+	__u8  bMaxBurst;
+	__u8  bMaxSequence;
+	__le16 wMaxStreamDelay;
+	__le16 wOverTheAirPacketSize;
+	__u8  bOverTheAirInterval;
+	__u8  bmCompAttributes;
+#define USB_ENDPOINT_SWITCH_MASK	0x03	/* in bmCompAttributes */
+#define USB_ENDPOINT_SWITCH_NO		0
+#define USB_ENDPOINT_SWITCH_SWITCH	1
+#define USB_ENDPOINT_SWITCH_SCALE	2
+} __attribute__((packed));
+
+/*-------------------------------------------------------------------------*/
+
+/* USB_REQ_SET_HANDSHAKE is a four-way handshake used between a wireless
+ * host and a device for connection set up, mutual authentication, and
+ * exchanging short lived session keys.  The handshake depends on a CC.
+ */
+struct usb_handshake {
+	__u8 bMessageNumber;
+	__u8 bStatus;
+	__u8 tTKID[3];
+	__u8 bReserved;
+	__u8 CDID[16];
+	__u8 nonce[16];
+	__u8 MIC[8];
+} __attribute__((packed));
+
+/*-------------------------------------------------------------------------*/
+
+/* USB_REQ_SET_CONNECTION modifies or revokes a connection context (CC).
+ * A CC may also be set up using non-wireless secure channels (including
+ * wired USB!), and some devices may support CCs with multiple hosts.
+ */
+struct usb_connection_context {
+	__u8 CHID[16];		/* persistent host id */
+	__u8 CDID[16];		/* device id (unique w/in host context) */
+	__u8 CK[16];		/* connection key */
+} __attribute__((packed));
+
+/*-------------------------------------------------------------------------*/
+
+/* USB 2.0 defines three speeds, here's how Linux identifies them */
+
+enum usb_device_speed {
+	USB_SPEED_UNKNOWN = 0,			/* enumerating */
+	USB_SPEED_LOW, USB_SPEED_FULL,		/* usb 1.1 */
+	USB_SPEED_HIGH,				/* usb 2.0 */
+	USB_SPEED_WIRELESS,			/* wireless (usb 2.5) */
+	USB_SPEED_SUPER,			/* usb 3.0 */
+};
+
+enum usb_device_state {
+	/* NOTATTACHED isn't in the USB spec, and this state acts
+	 * the same as ATTACHED ... but it's clearer this way.
+	 */
+	USB_STATE_NOTATTACHED = 0,
+
+	/* chapter 9 and authentication (wireless) device states */
+	USB_STATE_ATTACHED,
+	USB_STATE_POWERED,			/* wired */
+	USB_STATE_RECONNECTING,			/* auth */
+	USB_STATE_UNAUTHENTICATED,		/* auth */
+	USB_STATE_DEFAULT,			/* limited function */
+	USB_STATE_ADDRESS,
+	USB_STATE_CONFIGURED,			/* most functions */
+
+	USB_STATE_SUSPENDED
+
+	/* NOTE:  there are actually four different SUSPENDED
+	 * states, returning to POWERED, DEFAULT, ADDRESS, or
+	 * CONFIGURED respectively when SOF tokens flow again.
+	 * At this level there's no difference between L1 and L2
+	 * suspend states.  (L2 being original USB 1.1 suspend.)
+	 */
+};
+
+#endif /* __LINUX_USB_CH9_H */
diff --git a/carl9170fw/include/linux/compiler.h b/carl9170fw/include/linux/compiler.h
new file mode 100644
index 0000000..d331f3c
--- /dev/null
+++ b/carl9170fw/include/linux/compiler.h
@@ -0,0 +1,107 @@
+/*
+ * 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; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef __SHARED_COMPILER_H
+#define __SHARED_COMPILER_H
+
+#define __noinline	__attribute__((noinline))
+#define __noreturn	__attribute__((noreturn))
+#define __inline	__attribute__((always_inline))
+#define __hot		__attribute__((hot))
+#define __cold		__attribute__((cold))
+#define __unused	__attribute__((unused))
+#define __force		__attribute__((force))
+#define __section(s)	__attribute__((section("." # s)))
+#define __aligned(a)	__attribute__((aligned(a)))
+#define __packed	__attribute__((packed))
+
+#define BUILD_BUG_ON(condition)	((void)sizeof(char[1 - 2*!!(condition)]))
+#define BUILD_BUG_ON_ZERO(e) (sizeof(char[1 - 2 * !!(e)]) - 1)
+
+#define ALIGN(x, a)		__ALIGN_MASK(x, (typeof(x))(a) - 1)
+#define __ALIGN_MASK(x, mask)	(((x) + (mask)) & ~(mask))
+
+#define __roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y))
+
+#define __must_be_array(a) \
+  BUILD_BUG_ON_ZERO(__builtin_types_compatible_p(typeof(a), typeof(&a[0])))
+#define ARRAY_SIZE(arr) (sizeof((arr)) / sizeof((arr)[0]) + __must_be_array(arr))
+
+#define BIT(b)			(1 << (b))
+#define MASK(w)			(BIT(w) - 1)
+
+#undef offsetof
+#ifdef __compiler_offsetof
+# define offsetof(TYPE, MEMBER) __compiler_offsetof(TYPE, MEMBER)
+#else
+# define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
+#endif
+
+#define likely(x)	__builtin_expect(!!(x), 1)
+#define unlikely(x)	__builtin_expect(!!(x), 0)
+
+#define min(x, y) ({				\
+	typeof(x) _min1 = (x);			\
+	typeof(y) _min2 = (y);			\
+	(void) (&_min1 == &_min2);		\
+	_min1 < _min2 ? _min1 : _min2; })
+
+#define max(x, y) ({				\
+	typeof(x) _max1 = (x);			\
+	typeof(y) _max2 = (y);			\
+	(void) (&_max1 == &_max2);		\
+	_max1 > _max2 ? _max1 : _max2; })
+
+#define min_t(type, x, y) ({			\
+	type __min1 = (x);			\
+	type __min2 = (y);			\
+	__min1 < __min2 ? __min1 : __min2; })
+
+#define max_t(type, x, y) ({			\
+	type __max1 = (x);			\
+	type __max2 = (y);			\
+	__max1 > __max2 ? __max1 : __max2; })
+
+
+#define container_of(ptr, type, member) ({			\
+	const typeof(((type *)0)->member) * __mptr = (ptr);	\
+	(type *)(((unsigned long)__mptr - offsetof(type, member))); })
+
+#define MAX_ERRNO	4095
+
+#define IS_ERR_VALUE(x) unlikely((x) >= (unsigned long)-MAX_ERRNO)
+
+static inline void *ERR_PTR(long errornr)
+{
+	return (void *) errornr;
+}
+
+static inline long PTR_ERR(const void *ptr)
+{
+	return (long) ptr;
+}
+
+static inline long IS_ERR(const void *ptr)
+{
+	return IS_ERR_VALUE((unsigned long)ptr);
+}
+
+static inline long IS_ERR_OR_NULL(const void *ptr)
+{
+	return !ptr || IS_ERR_VALUE((unsigned long)ptr);
+}
+
+#endif /* __SHARED_COMPILER_H */
diff --git a/carl9170fw/include/linux/ieee80211.h b/carl9170fw/include/linux/ieee80211.h
new file mode 100644
index 0000000..e4448ca
--- /dev/null
+++ b/carl9170fw/include/linux/ieee80211.h
@@ -0,0 +1,1918 @@
+/*
+ * IEEE 802.11 defines
+ *
+ * Copyright (c) 2001-2002, SSH Communications Security Corp and Jouni Malinen
+ * <jkmaline@cc.hut.fi>
+ * Copyright (c) 2002-2003, Jouni Malinen <jkmaline@cc.hut.fi>
+ * Copyright (c) 2005, Devicescape Software, Inc.
+ * Copyright (c) 2006, Michael Wu <flamingice@sourmilk.net>
+ *
+ * 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.
+ */
+
+#ifndef __LINUX_IEEE80211_H
+#define __LINUX_IEEE80211_H
+
+/*
+ * DS bit usage
+ *
+ * TA = transmitter address
+ * RA = receiver address
+ * DA = destination address
+ * SA = source address
+ *
+ * ToDS    FromDS  A1(RA)  A2(TA)  A3      A4      Use
+ * -----------------------------------------------------------------
+ *  0       0       DA      SA      BSSID   -       IBSS/DLS
+ *  0       1       DA      BSSID   SA      -       AP -> STA
+ *  1       0       BSSID   SA      DA      -       AP <- STA
+ *  1       1       RA      TA      DA      SA      unspecified (WDS)
+ */
+
+#define FCS_LEN 4
+
+#define IEEE80211_FCTL_VERS		0x0003
+#define IEEE80211_FCTL_FTYPE		0x000c
+#define IEEE80211_FCTL_STYPE		0x00f0
+#define IEEE80211_FCTL_TODS		0x0100
+#define IEEE80211_FCTL_FROMDS		0x0200
+#define IEEE80211_FCTL_MOREFRAGS	0x0400
+#define IEEE80211_FCTL_RETRY		0x0800
+#define IEEE80211_FCTL_PM		0x1000
+#define IEEE80211_FCTL_MOREDATA		0x2000
+#define IEEE80211_FCTL_PROTECTED	0x4000
+#define IEEE80211_FCTL_ORDER		0x8000
+
+#define IEEE80211_SCTL_FRAG		0x000F
+#define IEEE80211_SCTL_SEQ		0xFFF0
+
+#define IEEE80211_FTYPE_MGMT		0x0000
+#define IEEE80211_FTYPE_CTL		0x0004
+#define IEEE80211_FTYPE_DATA		0x0008
+
+/* management */
+#define IEEE80211_STYPE_ASSOC_REQ	0x0000
+#define IEEE80211_STYPE_ASSOC_RESP	0x0010
+#define IEEE80211_STYPE_REASSOC_REQ	0x0020
+#define IEEE80211_STYPE_REASSOC_RESP	0x0030
+#define IEEE80211_STYPE_PROBE_REQ	0x0040
+#define IEEE80211_STYPE_PROBE_RESP	0x0050
+#define IEEE80211_STYPE_BEACON		0x0080
+#define IEEE80211_STYPE_ATIM		0x0090
+#define IEEE80211_STYPE_DISASSOC	0x00A0
+#define IEEE80211_STYPE_AUTH		0x00B0
+#define IEEE80211_STYPE_DEAUTH		0x00C0
+#define IEEE80211_STYPE_ACTION		0x00D0
+
+/* control */
+#define IEEE80211_STYPE_BACK_REQ	0x0080
+#define IEEE80211_STYPE_BACK		0x0090
+#define IEEE80211_STYPE_PSPOLL		0x00A0
+#define IEEE80211_STYPE_RTS		0x00B0
+#define IEEE80211_STYPE_CTS		0x00C0
+#define IEEE80211_STYPE_ACK		0x00D0
+#define IEEE80211_STYPE_CFEND		0x00E0
+#define IEEE80211_STYPE_CFENDACK	0x00F0
+
+/* data */
+#define IEEE80211_STYPE_DATA			0x0000
+#define IEEE80211_STYPE_DATA_CFACK		0x0010
+#define IEEE80211_STYPE_DATA_CFPOLL		0x0020
+#define IEEE80211_STYPE_DATA_CFACKPOLL		0x0030
+#define IEEE80211_STYPE_NULLFUNC		0x0040
+#define IEEE80211_STYPE_CFACK			0x0050
+#define IEEE80211_STYPE_CFPOLL			0x0060
+#define IEEE80211_STYPE_CFACKPOLL		0x0070
+#define IEEE80211_STYPE_QOS_DATA		0x0080
+#define IEEE80211_STYPE_QOS_DATA_CFACK		0x0090
+#define IEEE80211_STYPE_QOS_DATA_CFPOLL		0x00A0
+#define IEEE80211_STYPE_QOS_DATA_CFACKPOLL	0x00B0
+#define IEEE80211_STYPE_QOS_NULLFUNC		0x00C0
+#define IEEE80211_STYPE_QOS_CFACK		0x00D0
+#define IEEE80211_STYPE_QOS_CFPOLL		0x00E0
+#define IEEE80211_STYPE_QOS_CFACKPOLL		0x00F0
+
+
+/* miscellaneous IEEE 802.11 constants */
+#define IEEE80211_MAX_FRAG_THRESHOLD	2352
+#define IEEE80211_MAX_RTS_THRESHOLD	2353
+#define IEEE80211_MAX_AID		2007
+#define IEEE80211_MAX_TIM_LEN		251
+/* Maximum size for the MA-UNITDATA primitive, 802.11 standard section
+   6.2.1.1.2.
+
+   802.11e clarifies the figure in section 7.1.2. The frame body is
+   up to 2304 octets long (maximum MSDU size) plus any crypt overhead. */
+#define IEEE80211_MAX_DATA_LEN		2304
+/* 30 byte 4 addr hdr, 2 byte QoS, 2304 byte MSDU, 12 byte crypt, 4 byte FCS */
+#define IEEE80211_MAX_FRAME_LEN		2352
+
+#define IEEE80211_MAX_SSID_LEN		32
+
+#define IEEE80211_MAX_MESH_ID_LEN	32
+
+#define IEEE80211_QOS_CTL_LEN		2
+/* 1d tag mask */
+#define IEEE80211_QOS_CTL_TAG1D_MASK		0x0007
+/* TID mask */
+#define IEEE80211_QOS_CTL_TID_MASK		0x000f
+/* EOSP */
+#define IEEE80211_QOS_CTL_EOSP			0x0010
+/* ACK policy */
+#define IEEE80211_QOS_CTL_ACK_POLICY_NORMAL	0x0000
+#define IEEE80211_QOS_CTL_ACK_POLICY_NOACK	0x0020
+#define IEEE80211_QOS_CTL_ACK_POLICY_NO_EXPL	0x0040
+#define IEEE80211_QOS_CTL_ACK_POLICY_BLOCKACK	0x0060
+#define IEEE80211_QOS_CTL_ACK_POLICY_MASK	0x0060
+/* A-MSDU 802.11n */
+#define IEEE80211_QOS_CTL_A_MSDU_PRESENT	0x0080
+/* Mesh Control 802.11s */
+#define IEEE80211_QOS_CTL_MESH_CONTROL_PRESENT  0x0100
+
+/* U-APSD queue for WMM IEs sent by AP */
+#define IEEE80211_WMM_IE_AP_QOSINFO_UAPSD	(1<<7)
+#define IEEE80211_WMM_IE_AP_QOSINFO_PARAM_SET_CNT_MASK	0x0f
+
+/* U-APSD queues for WMM IEs sent by STA */
+#define IEEE80211_WMM_IE_STA_QOSINFO_AC_VO	(1<<0)
+#define IEEE80211_WMM_IE_STA_QOSINFO_AC_VI	(1<<1)
+#define IEEE80211_WMM_IE_STA_QOSINFO_AC_BK	(1<<2)
+#define IEEE80211_WMM_IE_STA_QOSINFO_AC_BE	(1<<3)
+#define IEEE80211_WMM_IE_STA_QOSINFO_AC_MASK	0x0f
+
+/* U-APSD max SP length for WMM IEs sent by STA */
+#define IEEE80211_WMM_IE_STA_QOSINFO_SP_ALL	0x00
+#define IEEE80211_WMM_IE_STA_QOSINFO_SP_2	0x01
+#define IEEE80211_WMM_IE_STA_QOSINFO_SP_4	0x02
+#define IEEE80211_WMM_IE_STA_QOSINFO_SP_6	0x03
+#define IEEE80211_WMM_IE_STA_QOSINFO_SP_MASK	0x03
+#define IEEE80211_WMM_IE_STA_QOSINFO_SP_SHIFT	5
+
+#define IEEE80211_HT_CTL_LEN		4
+
+struct ieee80211_hdr {
+	__le16 frame_control;
+	__le16 duration_id;
+	u8 addr1[6];
+	u8 addr2[6];
+	u8 addr3[6];
+	__le16 seq_ctrl;
+	u8 addr4[6];
+} __attribute__ ((packed));
+
+struct ieee80211_hdr_3addr {
+	__le16 frame_control;
+	__le16 duration_id;
+	u8 addr1[6];
+	u8 addr2[6];
+	u8 addr3[6];
+	__le16 seq_ctrl;
+} __attribute__ ((packed));
+
+struct ieee80211_qos_hdr {
+	__le16 frame_control;
+	__le16 duration_id;
+	u8 addr1[6];
+	u8 addr2[6];
+	u8 addr3[6];
+	__le16 seq_ctrl;
+	__le16 qos_ctrl;
+} __attribute__ ((packed));
+
+/**
+ * ieee80211_has_tods - check if IEEE80211_FCTL_TODS is set
+ * @fc: frame control bytes in little-endian byteorder
+ */
+static inline int ieee80211_has_tods(__le16 fc)
+{
+	return (fc & cpu_to_le16(IEEE80211_FCTL_TODS)) != 0;
+}
+
+/**
+ * ieee80211_has_fromds - check if IEEE80211_FCTL_FROMDS is set
+ * @fc: frame control bytes in little-endian byteorder
+ */
+static inline int ieee80211_has_fromds(__le16 fc)
+{
+	return (fc & cpu_to_le16(IEEE80211_FCTL_FROMDS)) != 0;
+}
+
+/**
+ * ieee80211_has_a4 - check if IEEE80211_FCTL_TODS and IEEE80211_FCTL_FROMDS are set
+ * @fc: frame control bytes in little-endian byteorder
+ */
+static inline int ieee80211_has_a4(__le16 fc)
+{
+	__le16 tmp = cpu_to_le16(IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS);
+	return (fc & tmp) == tmp;
+}
+
+/**
+ * ieee80211_has_morefrags - check if IEEE80211_FCTL_MOREFRAGS is set
+ * @fc: frame control bytes in little-endian byteorder
+ */
+static inline int ieee80211_has_morefrags(__le16 fc)
+{
+	return (fc & cpu_to_le16(IEEE80211_FCTL_MOREFRAGS)) != 0;
+}
+
+/**
+ * ieee80211_has_retry - check if IEEE80211_FCTL_RETRY is set
+ * @fc: frame control bytes in little-endian byteorder
+ */
+static inline int ieee80211_has_retry(__le16 fc)
+{
+	return (fc & cpu_to_le16(IEEE80211_FCTL_RETRY)) != 0;
+}
+
+/**
+ * ieee80211_has_pm - check if IEEE80211_FCTL_PM is set
+ * @fc: frame control bytes in little-endian byteorder
+ */
+static inline int ieee80211_has_pm(__le16 fc)
+{
+	return (fc & cpu_to_le16(IEEE80211_FCTL_PM)) != 0;
+}
+
+/**
+ * ieee80211_has_moredata - check if IEEE80211_FCTL_MOREDATA is set
+ * @fc: frame control bytes in little-endian byteorder
+ */
+static inline int ieee80211_has_moredata(__le16 fc)
+{
+	return (fc & cpu_to_le16(IEEE80211_FCTL_MOREDATA)) != 0;
+}
+
+/**
+ * ieee80211_has_protected - check if IEEE80211_FCTL_PROTECTED is set
+ * @fc: frame control bytes in little-endian byteorder
+ */
+static inline int ieee80211_has_protected(__le16 fc)
+{
+	return (fc & cpu_to_le16(IEEE80211_FCTL_PROTECTED)) != 0;
+}
+
+/**
+ * ieee80211_has_order - check if IEEE80211_FCTL_ORDER is set
+ * @fc: frame control bytes in little-endian byteorder
+ */
+static inline int ieee80211_has_order(__le16 fc)
+{
+	return (fc & cpu_to_le16(IEEE80211_FCTL_ORDER)) != 0;
+}
+
+/**
+ * ieee80211_is_mgmt - check if type is IEEE80211_FTYPE_MGMT
+ * @fc: frame control bytes in little-endian byteorder
+ */
+static inline int ieee80211_is_mgmt(__le16 fc)
+{
+	return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE)) ==
+	       cpu_to_le16(IEEE80211_FTYPE_MGMT);
+}
+
+/**
+ * ieee80211_is_ctl - check if type is IEEE80211_FTYPE_CTL
+ * @fc: frame control bytes in little-endian byteorder
+ */
+static inline int ieee80211_is_ctl(__le16 fc)
+{
+	return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE)) ==
+	       cpu_to_le16(IEEE80211_FTYPE_CTL);
+}
+
+/**
+ * ieee80211_is_data - check if type is IEEE80211_FTYPE_DATA
+ * @fc: frame control bytes in little-endian byteorder
+ */
+static inline int ieee80211_is_data(__le16 fc)
+{
+	return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE)) ==
+	       cpu_to_le16(IEEE80211_FTYPE_DATA);
+}
+
+/**
+ * ieee80211_is_data_qos - check if type is IEEE80211_FTYPE_DATA and IEEE80211_STYPE_QOS_DATA is set
+ * @fc: frame control bytes in little-endian byteorder
+ */
+static inline int ieee80211_is_data_qos(__le16 fc)
+{
+	/*
+	 * mask with QOS_DATA rather than IEEE80211_FCTL_STYPE as we just need
+	 * to check the one bit
+	 */
+	return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_STYPE_QOS_DATA)) ==
+	       cpu_to_le16(IEEE80211_FTYPE_DATA | IEEE80211_STYPE_QOS_DATA);
+}
+
+/**
+ * ieee80211_is_data_present - check if type is IEEE80211_FTYPE_DATA and has data
+ * @fc: frame control bytes in little-endian byteorder
+ */
+static inline int ieee80211_is_data_present(__le16 fc)
+{
+	/*
+	 * mask with 0x40 and test that that bit is clear to only return true
+	 * for the data-containing substypes.
+	 */
+	return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | 0x40)) ==
+	       cpu_to_le16(IEEE80211_FTYPE_DATA);
+}
+
+/**
+ * ieee80211_is_assoc_req - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_ASSOC_REQ
+ * @fc: frame control bytes in little-endian byteorder
+ */
+static inline int ieee80211_is_assoc_req(__le16 fc)
+{
+	return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
+	       cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_ASSOC_REQ);
+}
+
+/**
+ * ieee80211_is_assoc_resp - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_ASSOC_RESP
+ * @fc: frame control bytes in little-endian byteorder
+ */
+static inline int ieee80211_is_assoc_resp(__le16 fc)
+{
+	return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
+	       cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_ASSOC_RESP);
+}
+
+/**
+ * ieee80211_is_reassoc_req - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_REASSOC_REQ
+ * @fc: frame control bytes in little-endian byteorder
+ */
+static inline int ieee80211_is_reassoc_req(__le16 fc)
+{
+	return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
+	       cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_REASSOC_REQ);
+}
+
+/**
+ * ieee80211_is_reassoc_resp - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_REASSOC_RESP
+ * @fc: frame control bytes in little-endian byteorder
+ */
+static inline int ieee80211_is_reassoc_resp(__le16 fc)
+{
+	return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
+	       cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_REASSOC_RESP);
+}
+
+/**
+ * ieee80211_is_probe_req - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_PROBE_REQ
+ * @fc: frame control bytes in little-endian byteorder
+ */
+static inline int ieee80211_is_probe_req(__le16 fc)
+{
+	return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
+	       cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_PROBE_REQ);
+}
+
+/**
+ * ieee80211_is_probe_resp - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_PROBE_RESP
+ * @fc: frame control bytes in little-endian byteorder
+ */
+static inline int ieee80211_is_probe_resp(__le16 fc)
+{
+	return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
+	       cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_PROBE_RESP);
+}
+
+/**
+ * ieee80211_is_beacon - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_BEACON
+ * @fc: frame control bytes in little-endian byteorder
+ */
+static inline int ieee80211_is_beacon(__le16 fc)
+{
+	return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
+	       cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_BEACON);
+}
+
+/**
+ * ieee80211_is_atim - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_ATIM
+ * @fc: frame control bytes in little-endian byteorder
+ */
+static inline int ieee80211_is_atim(__le16 fc)
+{
+	return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
+	       cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_ATIM);
+}
+
+/**
+ * ieee80211_is_disassoc - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_DISASSOC
+ * @fc: frame control bytes in little-endian byteorder
+ */
+static inline int ieee80211_is_disassoc(__le16 fc)
+{
+	return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
+	       cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_DISASSOC);
+}
+
+/**
+ * ieee80211_is_auth - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_AUTH
+ * @fc: frame control bytes in little-endian byteorder
+ */
+static inline int ieee80211_is_auth(__le16 fc)
+{
+	return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
+	       cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_AUTH);
+}
+
+/**
+ * ieee80211_is_deauth - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_DEAUTH
+ * @fc: frame control bytes in little-endian byteorder
+ */
+static inline int ieee80211_is_deauth(__le16 fc)
+{
+	return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
+	       cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_DEAUTH);
+}
+
+/**
+ * ieee80211_is_action - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_ACTION
+ * @fc: frame control bytes in little-endian byteorder
+ */
+static inline int ieee80211_is_action(__le16 fc)
+{
+	return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
+	       cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_ACTION);
+}
+
+/**
+ * ieee80211_is_back_req - check if IEEE80211_FTYPE_CTL && IEEE80211_STYPE_BACK_REQ
+ * @fc: frame control bytes in little-endian byteorder
+ */
+static inline int ieee80211_is_back_req(__le16 fc)
+{
+	return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
+	       cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_BACK_REQ);
+}
+
+/**
+ * ieee80211_is_back - check if IEEE80211_FTYPE_CTL && IEEE80211_STYPE_BACK
+ * @fc: frame control bytes in little-endian byteorder
+ */
+static inline int ieee80211_is_back(__le16 fc)
+{
+	return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
+	       cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_BACK);
+}
+
+/**
+ * ieee80211_is_pspoll - check if IEEE80211_FTYPE_CTL && IEEE80211_STYPE_PSPOLL
+ * @fc: frame control bytes in little-endian byteorder
+ */
+static inline int ieee80211_is_pspoll(__le16 fc)
+{
+	return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
+	       cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_PSPOLL);
+}
+
+/**
+ * ieee80211_is_rts - check if IEEE80211_FTYPE_CTL && IEEE80211_STYPE_RTS
+ * @fc: frame control bytes in little-endian byteorder
+ */
+static inline int ieee80211_is_rts(__le16 fc)
+{
+	return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
+	       cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_RTS);
+}
+
+/**
+ * ieee80211_is_cts - check if IEEE80211_FTYPE_CTL && IEEE80211_STYPE_CTS
+ * @fc: frame control bytes in little-endian byteorder
+ */
+static inline int ieee80211_is_cts(__le16 fc)
+{
+	return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
+	       cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_CTS);
+}
+
+/**
+ * ieee80211_is_ack - check if IEEE80211_FTYPE_CTL && IEEE80211_STYPE_ACK
+ * @fc: frame control bytes in little-endian byteorder
+ */
+static inline int ieee80211_is_ack(__le16 fc)
+{
+	return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
+	       cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_ACK);
+}
+
+/**
+ * ieee80211_is_cfend - check if IEEE80211_FTYPE_CTL && IEEE80211_STYPE_CFEND
+ * @fc: frame control bytes in little-endian byteorder
+ */
+static inline int ieee80211_is_cfend(__le16 fc)
+{
+	return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
+	       cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_CFEND);
+}
+
+/**
+ * ieee80211_is_cfendack - check if IEEE80211_FTYPE_CTL && IEEE80211_STYPE_CFENDACK
+ * @fc: frame control bytes in little-endian byteorder
+ */
+static inline int ieee80211_is_cfendack(__le16 fc)
+{
+	return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
+	       cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_CFENDACK);
+}
+
+/**
+ * ieee80211_is_nullfunc - check if frame is a regular (non-QoS) nullfunc frame
+ * @fc: frame control bytes in little-endian byteorder
+ */
+static inline int ieee80211_is_nullfunc(__le16 fc)
+{
+	return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
+	       cpu_to_le16(IEEE80211_FTYPE_DATA | IEEE80211_STYPE_NULLFUNC);
+}
+
+/**
+ * ieee80211_is_qos_nullfunc - check if frame is a QoS nullfunc frame
+ * @fc: frame control bytes in little-endian byteorder
+ */
+static inline int ieee80211_is_qos_nullfunc(__le16 fc)
+{
+	return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
+	       cpu_to_le16(IEEE80211_FTYPE_DATA | IEEE80211_STYPE_QOS_NULLFUNC);
+}
+
+static inline unsigned int ieee80211_hdrlen(__le16 fc)
+{
+	unsigned int hdrlen = 24;
+
+	if (ieee80211_has_a4(fc))
+		hdrlen = 30;
+
+	if (ieee80211_is_data_qos(fc)) {
+		hdrlen += IEEE80211_QOS_CTL_LEN;
+		if (ieee80211_has_order(fc))
+			hdrlen += IEEE80211_HT_CTL_LEN;
+	}
+
+        return hdrlen;
+}
+
+/**
+ * ieee80211_is_first_frag - check if IEEE80211_SCTL_FRAG is not set
+ * @seq_ctrl: frame sequence control bytes in little-endian byteorder
+ */
+static inline int ieee80211_is_first_frag(__le16 seq_ctrl)
+{
+	return (seq_ctrl & cpu_to_le16(IEEE80211_SCTL_FRAG)) == 0;
+}
+
+struct ieee80211s_hdr {
+	u8 flags;
+	u8 ttl;
+	__le32 seqnum;
+	u8 eaddr1[6];
+	u8 eaddr2[6];
+} __attribute__ ((packed));
+
+/* Mesh flags */
+#define MESH_FLAGS_AE_A4	0x1
+#define MESH_FLAGS_AE_A5_A6	0x2
+#define MESH_FLAGS_AE		0x3
+#define MESH_FLAGS_PS_DEEP	0x4
+
+/**
+ * struct ieee80211_quiet_ie
+ *
+ * This structure refers to "Quiet information element"
+ */
+struct ieee80211_quiet_ie {
+	u8 count;
+	u8 period;
+	__le16 duration;
+	__le16 offset;
+} __attribute__ ((packed));
+
+/**
+ * struct ieee80211_msrment_ie
+ *
+ * This structure refers to "Measurement Request/Report information element"
+ */
+struct ieee80211_msrment_ie {
+	u8 token;
+	u8 mode;
+	u8 type;
+	u8 request[0];
+} __attribute__ ((packed));
+
+/**
+ * struct ieee80211_channel_sw_ie
+ *
+ * This structure refers to "Channel Switch Announcement information element"
+ */
+struct ieee80211_channel_sw_ie {
+	u8 mode;
+	u8 new_ch_num;
+	u8 count;
+} __attribute__ ((packed));
+
+/**
+ * struct ieee80211_tim
+ *
+ * This structure refers to "Traffic Indication Map information element"
+ */
+struct ieee80211_tim_ie {
+	u8 dtim_count;
+	u8 dtim_period;
+	u8 bitmap_ctrl;
+	/* variable size: 1 - 251 bytes */
+	u8 virtual_map[1];
+} __attribute__ ((packed));
+
+/**
+ * struct ieee80211_meshconf_ie
+ *
+ * This structure refers to "Mesh Configuration information element"
+ */
+struct ieee80211_meshconf_ie {
+	u8 meshconf_psel;
+	u8 meshconf_pmetric;
+	u8 meshconf_congest;
+	u8 meshconf_synch;
+	u8 meshconf_auth;
+	u8 meshconf_form;
+	u8 meshconf_cap;
+} __attribute__ ((packed));
+
+/**
+ * struct ieee80211_rann_ie
+ *
+ * This structure refers to "Root Announcement information element"
+ */
+struct ieee80211_rann_ie {
+	u8 rann_flags;
+	u8 rann_hopcount;
+	u8 rann_ttl;
+	u8 rann_addr[6];
+	__le32 rann_seq;
+	__le32 rann_interval;
+	__le32 rann_metric;
+} __attribute__ ((packed));
+
+enum ieee80211_rann_flags {
+	RANN_FLAG_IS_GATE = 1 << 0,
+};
+
+#define WLAN_SA_QUERY_TR_ID_LEN 2
+
+struct ieee80211_mgmt {
+	__le16 frame_control;
+	__le16 duration;
+	u8 da[6];
+	u8 sa[6];
+	u8 bssid[6];
+	__le16 seq_ctrl;
+	union {
+		struct {
+			__le16 auth_alg;
+			__le16 auth_transaction;
+			__le16 status_code;
+			/* possibly followed by Challenge text */
+			u8 variable[0];
+		} __attribute__ ((packed)) auth;
+		struct {
+			__le16 reason_code;
+		} __attribute__ ((packed)) deauth;
+		struct {
+			__le16 capab_info;
+			__le16 listen_interval;
+			/* followed by SSID and Supported rates */
+			u8 variable[0];
+		} __attribute__ ((packed)) assoc_req;
+		struct {
+			__le16 capab_info;
+			__le16 status_code;
+			__le16 aid;
+			/* followed by Supported rates */
+			u8 variable[0];
+		} __attribute__ ((packed)) assoc_resp, reassoc_resp;
+		struct {
+			__le16 capab_info;
+			__le16 listen_interval;
+			u8 current_ap[6];
+			/* followed by SSID and Supported rates */
+			u8 variable[0];
+		} __attribute__ ((packed)) reassoc_req;
+		struct {
+			__le16 reason_code;
+		} __attribute__ ((packed)) disassoc;
+		struct {
+			__le64 timestamp;
+			__le16 beacon_int;
+			__le16 capab_info;
+			/* followed by some of SSID, Supported rates,
+			 * FH Params, DS Params, CF Params, IBSS Params, TIM */
+			u8 variable[0];
+		} __attribute__ ((packed)) beacon;
+		struct {
+			/* only variable items: SSID, Supported rates */
+			u8 variable[0];
+		} __attribute__ ((packed)) probe_req;
+		struct {
+			__le64 timestamp;
+			__le16 beacon_int;
+			__le16 capab_info;
+			/* followed by some of SSID, Supported rates,
+			 * FH Params, DS Params, CF Params, IBSS Params */
+			u8 variable[0];
+		} __attribute__ ((packed)) probe_resp;
+		struct {
+			u8 category;
+			union {
+				struct {
+					u8 action_code;
+					u8 dialog_token;
+					u8 status_code;
+					u8 variable[0];
+				} __attribute__ ((packed)) wme_action;
+				struct{
+					u8 action_code;
+					u8 element_id;
+					u8 length;
+					struct ieee80211_channel_sw_ie sw_elem;
+				} __attribute__((packed)) chan_switch;
+				struct{
+					u8 action_code;
+					u8 dialog_token;
+					u8 element_id;
+					u8 length;
+					struct ieee80211_msrment_ie msr_elem;
+				} __attribute__((packed)) measurement;
+				struct{
+					u8 action_code;
+					u8 dialog_token;
+					__le16 capab;
+					__le16 timeout;
+					__le16 start_seq_num;
+				} __attribute__((packed)) addba_req;
+				struct{
+					u8 action_code;
+					u8 dialog_token;
+					__le16 status;
+					__le16 capab;
+					__le16 timeout;
+				} __attribute__((packed)) addba_resp;
+				struct{
+					u8 action_code;
+					__le16 params;
+					__le16 reason_code;
+				} __attribute__((packed)) delba;
+				struct {
+					u8 action_code;
+					u8 variable[0];
+				} __attribute__((packed)) self_prot;
+				struct{
+					u8 action_code;
+					u8 variable[0];
+				} __attribute__((packed)) mesh_action;
+				struct {
+					u8 action;
+					u8 trans_id[WLAN_SA_QUERY_TR_ID_LEN];
+				} __attribute__ ((packed)) sa_query;
+				struct {
+					u8 action;
+					u8 smps_control;
+				} __attribute__ ((packed)) ht_smps;
+				struct {
+					u8 action_code;
+					u8 dialog_token;
+					__le16 capability;
+					u8 variable[0];
+				} __packed tdls_discover_resp;
+			} u;
+		} __attribute__ ((packed)) action;
+	} u;
+} __attribute__ ((packed));
+
+/* Supported Rates value encodings in 802.11n-2009 7.3.2.2 */
+#define BSS_MEMBERSHIP_SELECTOR_HT_PHY	127
+
+/* mgmt header + 1 byte category code */
+#define IEEE80211_MIN_ACTION_SIZE offsetof(struct ieee80211_mgmt, u.action.u)
+
+
+/* Management MIC information element (IEEE 802.11w) */
+struct ieee80211_mmie {
+	u8 element_id;
+	u8 length;
+	__le16 key_id;
+	u8 sequence_number[6];
+	u8 mic[8];
+} __attribute__ ((packed));
+
+struct ieee80211_vendor_ie {
+	u8 element_id;
+	u8 len;
+	u8 oui[3];
+	u8 oui_type;
+} __packed;
+
+/* Control frames */
+struct ieee80211_rts {
+	__le16 frame_control;
+	__le16 duration;
+	u8 ra[6];
+	u8 ta[6];
+} __attribute__ ((packed));
+
+struct ieee80211_cts {
+	__le16 frame_control;
+	__le16 duration;
+	u8 ra[6];
+} __attribute__ ((packed));
+
+struct ieee80211_pspoll {
+	__le16 frame_control;
+	__le16 aid;
+	u8 bssid[6];
+	u8 ta[6];
+} __attribute__ ((packed));
+
+/* TDLS */
+
+/* Link-id information element */
+struct ieee80211_tdls_lnkie {
+	u8 ie_type; /* Link Identifier IE */
+	u8 ie_len;
+	u8 bssid[6];
+	u8 init_sta[6];
+	u8 resp_sta[6];
+} __packed;
+
+struct ieee80211_tdls_data {
+	u8 da[6];
+	u8 sa[6];
+	__be16 ether_type;
+	u8 payload_type;
+	u8 category;
+	u8 action_code;
+	union {
+		struct {
+			u8 dialog_token;
+			__le16 capability;
+			u8 variable[0];
+		} __packed setup_req;
+		struct {
+			__le16 status_code;
+			u8 dialog_token;
+			__le16 capability;
+			u8 variable[0];
+		} __packed setup_resp;
+		struct {
+			__le16 status_code;
+			u8 dialog_token;
+			u8 variable[0];
+		} __packed setup_cfm;
+		struct {
+			__le16 reason_code;
+			u8 variable[0];
+		} __packed teardown;
+		struct {
+			u8 dialog_token;
+			u8 variable[0];
+		} __packed discover_req;
+	} u;
+} __packed;
+
+/**
+ * struct ieee80211_bar - HT Block Ack Request
+ *
+ * This structure refers to "HT BlockAckReq" as
+ * described in 802.11n draft section 7.2.1.7.1
+ */
+struct ieee80211_bar {
+	__le16 frame_control;
+	__le16 duration;
+	__u8 ra[6];
+	__u8 ta[6];
+	__le16 control;
+	__le16 start_seq_num;
+} __attribute__((packed)) __aligned(4);
+
+/* 802.11 BA(R) control masks */
+#define IEEE80211_BAR_CTRL_ACK_POLICY_NORMAL	0x0000
+#define IEEE80211_BAR_CTRL_MULTI_TID		0x0002
+#define IEEE80211_BAR_CTRL_CBMTID_COMPRESSED_BA	0x0004
+#define IEEE80211_BAR_CTRL_TID_INFO_MASK	0xf000
+#define IEEE80211_BAR_CTRL_TID_INFO_SHIFT	12
+
+/**
+ * struct ieee80211_ba - HT Block Ack
+ *
+ * This structure refers to "HT BlockAck" as
+ * described in 802.11n draft section 7.2.1.8.1
+ */
+struct ieee80211_ba {
+	__le16 frame_control;
+	__le16 duration;
+	u8 ra[6];
+	u8 ta[6];
+	__le16 control;
+
+	__le16 start_seq_num;
+	u8 bitmap[8];
+} __attribute__((packed));
+
+#define IEEE80211_HT_MCS_MASK_LEN		10
+
+/**
+ * struct ieee80211_mcs_info - MCS information
+ * @rx_mask: RX mask
+ * @rx_highest: highest supported RX rate. If set represents
+ *	the highest supported RX data rate in units of 1 Mbps.
+ *	If this field is 0 this value should not be used to
+ *	consider the highest RX data rate supported.
+ * @tx_params: TX parameters
+ */
+struct ieee80211_mcs_info {
+	u8 rx_mask[IEEE80211_HT_MCS_MASK_LEN];
+	__le16 rx_highest;
+	u8 tx_params;
+	u8 reserved[3];
+} __attribute__((packed));
+
+/* 802.11n HT capability MSC set */
+#define IEEE80211_HT_MCS_RX_HIGHEST_MASK	0x3ff
+#define IEEE80211_HT_MCS_TX_DEFINED		0x01
+#define IEEE80211_HT_MCS_TX_RX_DIFF		0x02
+/* value 0 == 1 stream etc */
+#define IEEE80211_HT_MCS_TX_MAX_STREAMS_MASK	0x0C
+#define IEEE80211_HT_MCS_TX_MAX_STREAMS_SHIFT	2
+#define		IEEE80211_HT_MCS_TX_MAX_STREAMS	4
+#define IEEE80211_HT_MCS_TX_UNEQUAL_MODULATION	0x10
+
+/*
+ * 802.11n D5.0 20.3.5 / 20.6 says:
+ * - indices 0 to 7 and 32 are single spatial stream
+ * - 8 to 31 are multiple spatial streams using equal modulation
+ *   [8..15 for two streams, 16..23 for three and 24..31 for four]
+ * - remainder are multiple spatial streams using unequal modulation
+ */
+#define IEEE80211_HT_MCS_UNEQUAL_MODULATION_START 33
+#define IEEE80211_HT_MCS_UNEQUAL_MODULATION_START_BYTE \
+	(IEEE80211_HT_MCS_UNEQUAL_MODULATION_START / 8)
+
+/**
+ * struct ieee80211_ht_cap - HT capabilities
+ *
+ * This structure is the "HT capabilities element" as
+ * described in 802.11n D5.0 7.3.2.57
+ */
+struct ieee80211_ht_cap {
+	__le16 cap_info;
+	u8 ampdu_params_info;
+
+	/* 16 bytes MCS information */
+	struct ieee80211_mcs_info mcs;
+
+	__le16 extended_ht_cap_info;
+	__le32 tx_BF_cap_info;
+	u8 antenna_selection_info;
+} __attribute__ ((packed));
+
+/* 802.11n HT capabilities masks (for cap_info) */
+#define IEEE80211_HT_CAP_LDPC_CODING		0x0001
+#define IEEE80211_HT_CAP_SUP_WIDTH_20_40	0x0002
+#define IEEE80211_HT_CAP_SM_PS			0x000C
+#define		IEEE80211_HT_CAP_SM_PS_SHIFT	2
+#define IEEE80211_HT_CAP_GRN_FLD		0x0010
+#define IEEE80211_HT_CAP_SGI_20			0x0020
+#define IEEE80211_HT_CAP_SGI_40			0x0040
+#define IEEE80211_HT_CAP_TX_STBC		0x0080
+#define IEEE80211_HT_CAP_RX_STBC		0x0300
+#define		IEEE80211_HT_CAP_RX_STBC_SHIFT	8
+#define IEEE80211_HT_CAP_DELAY_BA		0x0400
+#define IEEE80211_HT_CAP_MAX_AMSDU		0x0800
+#define IEEE80211_HT_CAP_DSSSCCK40		0x1000
+#define IEEE80211_HT_CAP_RESERVED		0x2000
+#define IEEE80211_HT_CAP_40MHZ_INTOLERANT	0x4000
+#define IEEE80211_HT_CAP_LSIG_TXOP_PROT		0x8000
+
+/* 802.11n HT extended capabilities masks (for extended_ht_cap_info) */
+#define IEEE80211_HT_EXT_CAP_PCO		0x0001
+#define IEEE80211_HT_EXT_CAP_PCO_TIME		0x0006
+#define		IEEE80211_HT_EXT_CAP_PCO_TIME_SHIFT	1
+#define IEEE80211_HT_EXT_CAP_MCS_FB		0x0300
+#define		IEEE80211_HT_EXT_CAP_MCS_FB_SHIFT	8
+#define IEEE80211_HT_EXT_CAP_HTC_SUP		0x0400
+#define IEEE80211_HT_EXT_CAP_RD_RESPONDER	0x0800
+
+/* 802.11n HT capability AMPDU settings (for ampdu_params_info) */
+#define IEEE80211_HT_AMPDU_PARM_FACTOR		0x03
+#define IEEE80211_HT_AMPDU_PARM_DENSITY		0x1C
+#define		IEEE80211_HT_AMPDU_PARM_DENSITY_SHIFT	2
+
+/*
+ * Maximum length of AMPDU that the STA can receive.
+ * Length = 2 ^ (13 + max_ampdu_length_exp) - 1 (octets)
+ */
+enum ieee80211_max_ampdu_length_exp {
+	IEEE80211_HT_MAX_AMPDU_8K = 0,
+	IEEE80211_HT_MAX_AMPDU_16K = 1,
+	IEEE80211_HT_MAX_AMPDU_32K = 2,
+	IEEE80211_HT_MAX_AMPDU_64K = 3
+};
+
+#define IEEE80211_HT_MAX_AMPDU_FACTOR 13
+
+/* Minimum MPDU start spacing */
+enum ieee80211_min_mpdu_spacing {
+	IEEE80211_HT_MPDU_DENSITY_NONE = 0,	/* No restriction */
+	IEEE80211_HT_MPDU_DENSITY_0_25 = 1,	/* 1/4 usec */
+	IEEE80211_HT_MPDU_DENSITY_0_5 = 2,	/* 1/2 usec */
+	IEEE80211_HT_MPDU_DENSITY_1 = 3,	/* 1 usec */
+	IEEE80211_HT_MPDU_DENSITY_2 = 4,	/* 2 usec */
+	IEEE80211_HT_MPDU_DENSITY_4 = 5,	/* 4 usec */
+	IEEE80211_HT_MPDU_DENSITY_8 = 6,	/* 8 usec */
+	IEEE80211_HT_MPDU_DENSITY_16 = 7	/* 16 usec */
+};
+
+/**
+ * struct ieee80211_ht_operation - HT operation IE
+ *
+ * This structure is the "HT operation element" as
+ * described in 802.11n-2009 7.3.2.57
+ */
+struct ieee80211_ht_operation {
+	u8 primary_chan;
+	u8 ht_param;
+	__le16 operation_mode;
+	__le16 stbc_param;
+	u8 basic_set[16];
+} __attribute__ ((packed));
+
+/* for ht_param */
+#define IEEE80211_HT_PARAM_CHA_SEC_OFFSET		0x03
+#define		IEEE80211_HT_PARAM_CHA_SEC_NONE		0x00
+#define		IEEE80211_HT_PARAM_CHA_SEC_ABOVE	0x01
+#define		IEEE80211_HT_PARAM_CHA_SEC_BELOW	0x03
+#define IEEE80211_HT_PARAM_CHAN_WIDTH_ANY		0x04
+#define IEEE80211_HT_PARAM_RIFS_MODE			0x08
+
+/* for operation_mode */
+#define IEEE80211_HT_OP_MODE_PROTECTION			0x0003
+#define		IEEE80211_HT_OP_MODE_PROTECTION_NONE		0
+#define		IEEE80211_HT_OP_MODE_PROTECTION_NONMEMBER	1
+#define		IEEE80211_HT_OP_MODE_PROTECTION_20MHZ		2
+#define		IEEE80211_HT_OP_MODE_PROTECTION_NONHT_MIXED	3
+#define IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT		0x0004
+#define IEEE80211_HT_OP_MODE_NON_HT_STA_PRSNT		0x0010
+
+/* for stbc_param */
+#define IEEE80211_HT_STBC_PARAM_DUAL_BEACON		0x0040
+#define IEEE80211_HT_STBC_PARAM_DUAL_CTS_PROT		0x0080
+#define IEEE80211_HT_STBC_PARAM_STBC_BEACON		0x0100
+#define IEEE80211_HT_STBC_PARAM_LSIG_TXOP_FULLPROT	0x0200
+#define IEEE80211_HT_STBC_PARAM_PCO_ACTIVE		0x0400
+#define IEEE80211_HT_STBC_PARAM_PCO_PHASE		0x0800
+
+
+/* block-ack parameters */
+#define IEEE80211_ADDBA_PARAM_POLICY_MASK 0x0002
+#define IEEE80211_ADDBA_PARAM_TID_MASK 0x003C
+#define IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK 0xFFC0
+#define IEEE80211_DELBA_PARAM_TID_MASK 0xF000
+#define IEEE80211_DELBA_PARAM_INITIATOR_MASK 0x0800
+
+/*
+ * A-PMDU buffer sizes
+ * According to IEEE802.11n spec size varies from 8K to 64K (in powers of 2)
+ */
+#define IEEE80211_MIN_AMPDU_BUF 0x8
+#define IEEE80211_MAX_AMPDU_BUF 0x40
+
+
+/* Spatial Multiplexing Power Save Modes (for capability) */
+#define WLAN_HT_CAP_SM_PS_STATIC	0
+#define WLAN_HT_CAP_SM_PS_DYNAMIC	1
+#define WLAN_HT_CAP_SM_PS_INVALID	2
+#define WLAN_HT_CAP_SM_PS_DISABLED	3
+
+/* for SM power control field lower two bits */
+#define WLAN_HT_SMPS_CONTROL_DISABLED	0
+#define WLAN_HT_SMPS_CONTROL_STATIC	1
+#define WLAN_HT_SMPS_CONTROL_DYNAMIC	3
+
+/* Authentication algorithms */
+#define WLAN_AUTH_OPEN 0
+#define WLAN_AUTH_SHARED_KEY 1
+#define WLAN_AUTH_FT 2
+#define WLAN_AUTH_SAE 3
+#define WLAN_AUTH_LEAP 128
+
+#define WLAN_AUTH_CHALLENGE_LEN 128
+
+#define WLAN_CAPABILITY_ESS		(1<<0)
+#define WLAN_CAPABILITY_IBSS		(1<<1)
+
+/*
+ * A mesh STA sets the ESS and IBSS capability bits to zero.
+ * however, this holds true for p2p probe responses (in the p2p_find
+ * phase) as well.
+ */
+#define WLAN_CAPABILITY_IS_STA_BSS(cap)	\
+	(!((cap) & (WLAN_CAPABILITY_ESS | WLAN_CAPABILITY_IBSS)))
+
+#define WLAN_CAPABILITY_CF_POLLABLE	(1<<2)
+#define WLAN_CAPABILITY_CF_POLL_REQUEST	(1<<3)
+#define WLAN_CAPABILITY_PRIVACY		(1<<4)
+#define WLAN_CAPABILITY_SHORT_PREAMBLE	(1<<5)
+#define WLAN_CAPABILITY_PBCC		(1<<6)
+#define WLAN_CAPABILITY_CHANNEL_AGILITY	(1<<7)
+
+/* 802.11h */
+#define WLAN_CAPABILITY_SPECTRUM_MGMT	(1<<8)
+#define WLAN_CAPABILITY_QOS		(1<<9)
+#define WLAN_CAPABILITY_SHORT_SLOT_TIME	(1<<10)
+#define WLAN_CAPABILITY_DSSS_OFDM	(1<<13)
+/* measurement */
+#define IEEE80211_SPCT_MSR_RPRT_MODE_LATE	(1<<0)
+#define IEEE80211_SPCT_MSR_RPRT_MODE_INCAPABLE	(1<<1)
+#define IEEE80211_SPCT_MSR_RPRT_MODE_REFUSED	(1<<2)
+
+#define IEEE80211_SPCT_MSR_RPRT_TYPE_BASIC	0
+#define IEEE80211_SPCT_MSR_RPRT_TYPE_CCA	1
+#define IEEE80211_SPCT_MSR_RPRT_TYPE_RPI	2
+
+
+/* 802.11g ERP information element */
+#define WLAN_ERP_NON_ERP_PRESENT (1<<0)
+#define WLAN_ERP_USE_PROTECTION (1<<1)
+#define WLAN_ERP_BARKER_PREAMBLE (1<<2)
+
+/* WLAN_ERP_BARKER_PREAMBLE values */
+enum {
+	WLAN_ERP_PREAMBLE_SHORT = 0,
+	WLAN_ERP_PREAMBLE_LONG = 1,
+};
+
+/* Status codes */
+enum ieee80211_statuscode {
+	WLAN_STATUS_SUCCESS = 0,
+	WLAN_STATUS_UNSPECIFIED_FAILURE = 1,
+	WLAN_STATUS_CAPS_UNSUPPORTED = 10,
+	WLAN_STATUS_REASSOC_NO_ASSOC = 11,
+	WLAN_STATUS_ASSOC_DENIED_UNSPEC = 12,
+	WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG = 13,
+	WLAN_STATUS_UNKNOWN_AUTH_TRANSACTION = 14,
+	WLAN_STATUS_CHALLENGE_FAIL = 15,
+	WLAN_STATUS_AUTH_TIMEOUT = 16,
+	WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA = 17,
+	WLAN_STATUS_ASSOC_DENIED_RATES = 18,
+	/* 802.11b */
+	WLAN_STATUS_ASSOC_DENIED_NOSHORTPREAMBLE = 19,
+	WLAN_STATUS_ASSOC_DENIED_NOPBCC = 20,
+	WLAN_STATUS_ASSOC_DENIED_NOAGILITY = 21,
+	/* 802.11h */
+	WLAN_STATUS_ASSOC_DENIED_NOSPECTRUM = 22,
+	WLAN_STATUS_ASSOC_REJECTED_BAD_POWER = 23,
+	WLAN_STATUS_ASSOC_REJECTED_BAD_SUPP_CHAN = 24,
+	/* 802.11g */
+	WLAN_STATUS_ASSOC_DENIED_NOSHORTTIME = 25,
+	WLAN_STATUS_ASSOC_DENIED_NODSSSOFDM = 26,
+	/* 802.11w */
+	WLAN_STATUS_ASSOC_REJECTED_TEMPORARILY = 30,
+	WLAN_STATUS_ROBUST_MGMT_FRAME_POLICY_VIOLATION = 31,
+	/* 802.11i */
+	WLAN_STATUS_INVALID_IE = 40,
+	WLAN_STATUS_INVALID_GROUP_CIPHER = 41,
+	WLAN_STATUS_INVALID_PAIRWISE_CIPHER = 42,
+	WLAN_STATUS_INVALID_AKMP = 43,
+	WLAN_STATUS_UNSUPP_RSN_VERSION = 44,
+	WLAN_STATUS_INVALID_RSN_IE_CAP = 45,
+	WLAN_STATUS_CIPHER_SUITE_REJECTED = 46,
+	/* 802.11e */
+	WLAN_STATUS_UNSPECIFIED_QOS = 32,
+	WLAN_STATUS_ASSOC_DENIED_NOBANDWIDTH = 33,
+	WLAN_STATUS_ASSOC_DENIED_LOWACK = 34,
+	WLAN_STATUS_ASSOC_DENIED_UNSUPP_QOS = 35,
+	WLAN_STATUS_REQUEST_DECLINED = 37,
+	WLAN_STATUS_INVALID_QOS_PARAM = 38,
+	WLAN_STATUS_CHANGE_TSPEC = 39,
+	WLAN_STATUS_WAIT_TS_DELAY = 47,
+	WLAN_STATUS_NO_DIRECT_LINK = 48,
+	WLAN_STATUS_STA_NOT_PRESENT = 49,
+	WLAN_STATUS_STA_NOT_QSTA = 50,
+	/* 802.11s */
+	WLAN_STATUS_ANTI_CLOG_REQUIRED = 76,
+	WLAN_STATUS_FCG_NOT_SUPP = 78,
+	WLAN_STATUS_STA_NO_TBTT = 78,
+};
+
+
+/* Reason codes */
+enum ieee80211_reasoncode {
+	WLAN_REASON_UNSPECIFIED = 1,
+	WLAN_REASON_PREV_AUTH_NOT_VALID = 2,
+	WLAN_REASON_DEAUTH_LEAVING = 3,
+	WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY = 4,
+	WLAN_REASON_DISASSOC_AP_BUSY = 5,
+	WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA = 6,
+	WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA = 7,
+	WLAN_REASON_DISASSOC_STA_HAS_LEFT = 8,
+	WLAN_REASON_STA_REQ_ASSOC_WITHOUT_AUTH = 9,
+	/* 802.11h */
+	WLAN_REASON_DISASSOC_BAD_POWER = 10,
+	WLAN_REASON_DISASSOC_BAD_SUPP_CHAN = 11,
+	/* 802.11i */
+	WLAN_REASON_INVALID_IE = 13,
+	WLAN_REASON_MIC_FAILURE = 14,
+	WLAN_REASON_4WAY_HANDSHAKE_TIMEOUT = 15,
+	WLAN_REASON_GROUP_KEY_HANDSHAKE_TIMEOUT = 16,
+	WLAN_REASON_IE_DIFFERENT = 17,
+	WLAN_REASON_INVALID_GROUP_CIPHER = 18,
+	WLAN_REASON_INVALID_PAIRWISE_CIPHER = 19,
+	WLAN_REASON_INVALID_AKMP = 20,
+	WLAN_REASON_UNSUPP_RSN_VERSION = 21,
+	WLAN_REASON_INVALID_RSN_IE_CAP = 22,
+	WLAN_REASON_IEEE8021X_FAILED = 23,
+	WLAN_REASON_CIPHER_SUITE_REJECTED = 24,
+	/* 802.11e */
+	WLAN_REASON_DISASSOC_UNSPECIFIED_QOS = 32,
+	WLAN_REASON_DISASSOC_QAP_NO_BANDWIDTH = 33,
+	WLAN_REASON_DISASSOC_LOW_ACK = 34,
+	WLAN_REASON_DISASSOC_QAP_EXCEED_TXOP = 35,
+	WLAN_REASON_QSTA_LEAVE_QBSS = 36,
+	WLAN_REASON_QSTA_NOT_USE = 37,
+	WLAN_REASON_QSTA_REQUIRE_SETUP = 38,
+	WLAN_REASON_QSTA_TIMEOUT = 39,
+	WLAN_REASON_QSTA_CIPHER_NOT_SUPP = 45,
+	/* 802.11s */
+	WLAN_REASON_MESH_PEER_CANCELED = 52,
+	WLAN_REASON_MESH_MAX_PEERS = 53,
+	WLAN_REASON_MESH_CONFIG = 54,
+	WLAN_REASON_MESH_CLOSE = 55,
+	WLAN_REASON_MESH_MAX_RETRIES = 56,
+	WLAN_REASON_MESH_CONFIRM_TIMEOUT = 57,
+	WLAN_REASON_MESH_INVALID_GTK = 58,
+	WLAN_REASON_MESH_INCONSISTENT_PARAM = 59,
+	WLAN_REASON_MESH_INVALID_SECURITY = 60,
+	WLAN_REASON_MESH_PATH_ERROR = 61,
+	WLAN_REASON_MESH_PATH_NOFORWARD = 62,
+	WLAN_REASON_MESH_PATH_DEST_UNREACHABLE = 63,
+	WLAN_REASON_MAC_EXISTS_IN_MBSS = 64,
+	WLAN_REASON_MESH_CHAN_REGULATORY = 65,
+	WLAN_REASON_MESH_CHAN = 66,
+};
+
+
+/* Information Element IDs */
+enum ieee80211_eid {
+	WLAN_EID_SSID = 0,
+	WLAN_EID_SUPP_RATES = 1,
+	WLAN_EID_FH_PARAMS = 2,
+	WLAN_EID_DS_PARAMS = 3,
+	WLAN_EID_CF_PARAMS = 4,
+	WLAN_EID_TIM = 5,
+	WLAN_EID_IBSS_PARAMS = 6,
+	WLAN_EID_CHALLENGE = 16,
+
+	WLAN_EID_COUNTRY = 7,
+	WLAN_EID_HP_PARAMS = 8,
+	WLAN_EID_HP_TABLE = 9,
+	WLAN_EID_REQUEST = 10,
+
+	WLAN_EID_QBSS_LOAD = 11,
+	WLAN_EID_EDCA_PARAM_SET = 12,
+	WLAN_EID_TSPEC = 13,
+	WLAN_EID_TCLAS = 14,
+	WLAN_EID_SCHEDULE = 15,
+	WLAN_EID_TS_DELAY = 43,
+	WLAN_EID_TCLAS_PROCESSING = 44,
+	WLAN_EID_QOS_CAPA = 46,
+	/* 802.11z */
+	WLAN_EID_LINK_ID = 101,
+	/* 802.11s */
+	WLAN_EID_MESH_CONFIG = 113,
+	WLAN_EID_MESH_ID = 114,
+	WLAN_EID_LINK_METRIC_REPORT = 115,
+	WLAN_EID_CONGESTION_NOTIFICATION = 116,
+	WLAN_EID_PEER_MGMT = 117,
+	WLAN_EID_CHAN_SWITCH_PARAM = 118,
+	WLAN_EID_MESH_AWAKE_WINDOW = 119,
+	WLAN_EID_BEACON_TIMING = 120,
+	WLAN_EID_MCCAOP_SETUP_REQ = 121,
+	WLAN_EID_MCCAOP_SETUP_RESP = 122,
+	WLAN_EID_MCCAOP_ADVERT = 123,
+	WLAN_EID_MCCAOP_TEARDOWN = 124,
+	WLAN_EID_GANN = 125,
+	WLAN_EID_RANN = 126,
+	WLAN_EID_PREQ = 130,
+	WLAN_EID_PREP = 131,
+	WLAN_EID_PERR = 132,
+	WLAN_EID_PXU = 137,
+	WLAN_EID_PXUC = 138,
+	WLAN_EID_AUTH_MESH_PEER_EXCH = 139,
+	WLAN_EID_MIC = 140,
+
+	WLAN_EID_PWR_CONSTRAINT = 32,
+	WLAN_EID_PWR_CAPABILITY = 33,
+	WLAN_EID_TPC_REQUEST = 34,
+	WLAN_EID_TPC_REPORT = 35,
+	WLAN_EID_SUPPORTED_CHANNELS = 36,
+	WLAN_EID_CHANNEL_SWITCH = 37,
+	WLAN_EID_MEASURE_REQUEST = 38,
+	WLAN_EID_MEASURE_REPORT = 39,
+	WLAN_EID_QUIET = 40,
+	WLAN_EID_IBSS_DFS = 41,
+
+	WLAN_EID_ERP_INFO = 42,
+	WLAN_EID_EXT_SUPP_RATES = 50,
+
+	WLAN_EID_HT_CAPABILITY = 45,
+	WLAN_EID_HT_OPERATION = 61,
+
+	WLAN_EID_RSN = 48,
+	WLAN_EID_MMIE = 76,
+	WLAN_EID_WPA = 221,
+	WLAN_EID_GENERIC = 221,
+	WLAN_EID_VENDOR_SPECIFIC = 221,
+	WLAN_EID_QOS_PARAMETER = 222,
+
+	WLAN_EID_AP_CHAN_REPORT = 51,
+	WLAN_EID_NEIGHBOR_REPORT = 52,
+	WLAN_EID_RCPI = 53,
+	WLAN_EID_BSS_AVG_ACCESS_DELAY = 63,
+	WLAN_EID_ANTENNA_INFO = 64,
+	WLAN_EID_RSNI = 65,
+	WLAN_EID_MEASUREMENT_PILOT_TX_INFO = 66,
+	WLAN_EID_BSS_AVAILABLE_CAPACITY = 67,
+	WLAN_EID_BSS_AC_ACCESS_DELAY = 68,
+	WLAN_EID_RRM_ENABLED_CAPABILITIES = 70,
+	WLAN_EID_MULTIPLE_BSSID = 71,
+	WLAN_EID_BSS_COEX_2040 = 72,
+	WLAN_EID_OVERLAP_BSS_SCAN_PARAM = 74,
+	WLAN_EID_EXT_CAPABILITY = 127,
+
+	WLAN_EID_MOBILITY_DOMAIN = 54,
+	WLAN_EID_FAST_BSS_TRANSITION = 55,
+	WLAN_EID_TIMEOUT_INTERVAL = 56,
+	WLAN_EID_RIC_DATA = 57,
+	WLAN_EID_RIC_DESCRIPTOR = 75,
+
+	WLAN_EID_DSE_REGISTERED_LOCATION = 58,
+	WLAN_EID_SUPPORTED_REGULATORY_CLASSES = 59,
+	WLAN_EID_EXT_CHANSWITCH_ANN = 60,
+};
+
+/* Action category code */
+enum ieee80211_category {
+	WLAN_CATEGORY_SPECTRUM_MGMT = 0,
+	WLAN_CATEGORY_QOS = 1,
+	WLAN_CATEGORY_DLS = 2,
+	WLAN_CATEGORY_BACK = 3,
+	WLAN_CATEGORY_PUBLIC = 4,
+	WLAN_CATEGORY_HT = 7,
+	WLAN_CATEGORY_SA_QUERY = 8,
+	WLAN_CATEGORY_PROTECTED_DUAL_OF_ACTION = 9,
+	WLAN_CATEGORY_TDLS = 12,
+	WLAN_CATEGORY_MESH_ACTION = 13,
+	WLAN_CATEGORY_MULTIHOP_ACTION = 14,
+	WLAN_CATEGORY_SELF_PROTECTED = 15,
+	WLAN_CATEGORY_WMM = 17,
+	WLAN_CATEGORY_VENDOR_SPECIFIC_PROTECTED = 126,
+	WLAN_CATEGORY_VENDOR_SPECIFIC = 127,
+};
+
+/* SPECTRUM_MGMT action code */
+enum ieee80211_spectrum_mgmt_actioncode {
+	WLAN_ACTION_SPCT_MSR_REQ = 0,
+	WLAN_ACTION_SPCT_MSR_RPRT = 1,
+	WLAN_ACTION_SPCT_TPC_REQ = 2,
+	WLAN_ACTION_SPCT_TPC_RPRT = 3,
+	WLAN_ACTION_SPCT_CHL_SWITCH = 4,
+};
+
+/* HT action codes */
+enum ieee80211_ht_actioncode {
+	WLAN_HT_ACTION_NOTIFY_CHANWIDTH = 0,
+	WLAN_HT_ACTION_SMPS = 1,
+	WLAN_HT_ACTION_PSMP = 2,
+	WLAN_HT_ACTION_PCO_PHASE = 3,
+	WLAN_HT_ACTION_CSI = 4,
+	WLAN_HT_ACTION_NONCOMPRESSED_BF = 5,
+	WLAN_HT_ACTION_COMPRESSED_BF = 6,
+	WLAN_HT_ACTION_ASEL_IDX_FEEDBACK = 7,
+};
+
+/* Self Protected Action codes */
+enum ieee80211_self_protected_actioncode {
+	WLAN_SP_RESERVED = 0,
+	WLAN_SP_MESH_PEERING_OPEN = 1,
+	WLAN_SP_MESH_PEERING_CONFIRM = 2,
+	WLAN_SP_MESH_PEERING_CLOSE = 3,
+	WLAN_SP_MGK_INFORM = 4,
+	WLAN_SP_MGK_ACK = 5,
+};
+
+/* Mesh action codes */
+enum ieee80211_mesh_actioncode {
+	WLAN_MESH_ACTION_LINK_METRIC_REPORT,
+	WLAN_MESH_ACTION_HWMP_PATH_SELECTION,
+	WLAN_MESH_ACTION_GATE_ANNOUNCEMENT,
+	WLAN_MESH_ACTION_CONGESTION_CONTROL_NOTIFICATION,
+	WLAN_MESH_ACTION_MCCA_SETUP_REQUEST,
+	WLAN_MESH_ACTION_MCCA_SETUP_REPLY,
+	WLAN_MESH_ACTION_MCCA_ADVERTISEMENT_REQUEST,
+	WLAN_MESH_ACTION_MCCA_ADVERTISEMENT,
+	WLAN_MESH_ACTION_MCCA_TEARDOWN,
+	WLAN_MESH_ACTION_TBTT_ADJUSTMENT_REQUEST,
+	WLAN_MESH_ACTION_TBTT_ADJUSTMENT_RESPONSE,
+};
+
+/* Security key length */
+enum ieee80211_key_len {
+	WLAN_KEY_LEN_WEP40 = 5,
+	WLAN_KEY_LEN_WEP104 = 13,
+	WLAN_KEY_LEN_CCMP = 16,
+	WLAN_KEY_LEN_TKIP = 32,
+	WLAN_KEY_LEN_AES_CMAC = 16,
+};
+
+/* Public action codes */
+enum ieee80211_pub_actioncode {
+	WLAN_PUB_ACTION_TDLS_DISCOVER_RES = 14,
+};
+
+/* TDLS action codes */
+enum ieee80211_tdls_actioncode {
+	WLAN_TDLS_SETUP_REQUEST = 0,
+	WLAN_TDLS_SETUP_RESPONSE = 1,
+	WLAN_TDLS_SETUP_CONFIRM = 2,
+	WLAN_TDLS_TEARDOWN = 3,
+	WLAN_TDLS_PEER_TRAFFIC_INDICATION = 4,
+	WLAN_TDLS_CHANNEL_SWITCH_REQUEST = 5,
+	WLAN_TDLS_CHANNEL_SWITCH_RESPONSE = 6,
+	WLAN_TDLS_PEER_PSM_REQUEST = 7,
+	WLAN_TDLS_PEER_PSM_RESPONSE = 8,
+	WLAN_TDLS_PEER_TRAFFIC_RESPONSE = 9,
+	WLAN_TDLS_DISCOVERY_REQUEST = 10,
+};
+
+/*
+ * TDLS capabililites to be enabled in the 5th byte of the
+ * @WLAN_EID_EXT_CAPABILITY information element
+ */
+#define WLAN_EXT_CAPA5_TDLS_ENABLED	BIT(5)
+#define WLAN_EXT_CAPA5_TDLS_PROHIBITED	BIT(6)
+
+/* TDLS specific payload type in the LLC/SNAP header */
+#define WLAN_TDLS_SNAP_RFTYPE	0x2
+
+/**
+ * enum - mesh synchronization method identifier
+ *
+ * @IEEE80211_SYNC_METHOD_NEIGHBOR_OFFSET: the default synchronization method
+ * @IEEE80211_SYNC_METHOD_VENDOR: a vendor specific synchronization method
+ * that will be specified in a vendor specific information element
+ */
+enum {
+	IEEE80211_SYNC_METHOD_NEIGHBOR_OFFSET = 1,
+	IEEE80211_SYNC_METHOD_VENDOR = 255,
+};
+
+/**
+ * enum - mesh path selection protocol identifier
+ *
+ * @IEEE80211_PATH_PROTOCOL_HWMP: the default path selection protocol
+ * @IEEE80211_PATH_PROTOCOL_VENDOR: a vendor specific protocol that will
+ * be specified in a vendor specific information element
+ */
+enum {
+	IEEE80211_PATH_PROTOCOL_HWMP = 1,
+	IEEE80211_PATH_PROTOCOL_VENDOR = 255,
+};
+
+/**
+ * enum - mesh path selection metric identifier
+ *
+ * @IEEE80211_PATH_METRIC_AIRTIME: the default path selection metric
+ * @IEEE80211_PATH_METRIC_VENDOR: a vendor specific metric that will be
+ * specified in a vendor specific information element
+ */
+enum {
+	IEEE80211_PATH_METRIC_AIRTIME = 1,
+	IEEE80211_PATH_METRIC_VENDOR = 255,
+};
+
+
+/*
+ * IEEE 802.11-2007 7.3.2.9 Country information element
+ *
+ * Minimum length is 8 octets, ie len must be evenly
+ * divisible by 2
+ */
+
+/* Although the spec says 8 I'm seeing 6 in practice */
+#define IEEE80211_COUNTRY_IE_MIN_LEN	6
+
+/* The Country String field of the element shall be 3 octets in length */
+#define IEEE80211_COUNTRY_STRING_LEN	3
+
+/*
+ * For regulatory extension stuff see IEEE 802.11-2007
+ * Annex I (page 1141) and Annex J (page 1147). Also
+ * review 7.3.2.9.
+ *
+ * When dot11RegulatoryClassesRequired is true and the
+ * first_channel/reg_extension_id is >= 201 then the IE
+ * compromises of the 'ext' struct represented below:
+ *
+ *  - Regulatory extension ID - when generating IE this just needs
+ *    to be monotonically increasing for each triplet passed in
+ *    the IE
+ *  - Regulatory class - index into set of rules
+ *  - Coverage class - index into air propagation time (Table 7-27),
+ *    in microseconds, you can compute the air propagation time from
+ *    the index by multiplying by 3, so index 10 yields a propagation
+ *    of 10 us. Valid values are 0-31, values 32-255 are not defined
+ *    yet. A value of 0 inicates air propagation of <= 1 us.
+ *
+ *  See also Table I.2 for Emission limit sets and table
+ *  I.3 for Behavior limit sets. Table J.1 indicates how to map
+ *  a reg_class to an emission limit set and behavior limit set.
+ */
+#define IEEE80211_COUNTRY_EXTENSION_ID 201
+
+/*
+ *  Channels numbers in the IE must be monotonically increasing
+ *  if dot11RegulatoryClassesRequired is not true.
+ *
+ *  If dot11RegulatoryClassesRequired is true consecutive
+ *  subband triplets following a regulatory triplet shall
+ *  have monotonically increasing first_channel number fields.
+ *
+ *  Channel numbers shall not overlap.
+ *
+ *  Note that max_power is signed.
+ */
+struct ieee80211_country_ie_triplet {
+	union {
+		struct {
+			u8 first_channel;
+			u8 num_channels;
+			s8 max_power;
+		} __attribute__ ((packed)) chans;
+		struct {
+			u8 reg_extension_id;
+			u8 reg_class;
+			u8 coverage_class;
+		} __attribute__ ((packed)) ext;
+	};
+} __attribute__ ((packed));
+
+enum ieee80211_timeout_interval_type {
+	WLAN_TIMEOUT_REASSOC_DEADLINE = 1 /* 802.11r */,
+	WLAN_TIMEOUT_KEY_LIFETIME = 2 /* 802.11r */,
+	WLAN_TIMEOUT_ASSOC_COMEBACK = 3 /* 802.11w */,
+};
+
+/* BACK action code */
+enum ieee80211_back_actioncode {
+	WLAN_ACTION_ADDBA_REQ = 0,
+	WLAN_ACTION_ADDBA_RESP = 1,
+	WLAN_ACTION_DELBA = 2,
+};
+
+/* BACK (block-ack) parties */
+enum ieee80211_back_parties {
+	WLAN_BACK_RECIPIENT = 0,
+	WLAN_BACK_INITIATOR = 1,
+};
+
+/* SA Query action */
+enum ieee80211_sa_query_action {
+	WLAN_ACTION_SA_QUERY_REQUEST = 0,
+	WLAN_ACTION_SA_QUERY_RESPONSE = 1,
+};
+
+
+/* cipher suite selectors */
+#define WLAN_CIPHER_SUITE_USE_GROUP	0x000FAC00
+#define WLAN_CIPHER_SUITE_WEP40		0x000FAC01
+#define WLAN_CIPHER_SUITE_TKIP		0x000FAC02
+/* reserved:				0x000FAC03 */
+#define WLAN_CIPHER_SUITE_CCMP		0x000FAC04
+#define WLAN_CIPHER_SUITE_WEP104	0x000FAC05
+#define WLAN_CIPHER_SUITE_AES_CMAC	0x000FAC06
+
+#define WLAN_CIPHER_SUITE_SMS4		0x00147201
+
+/* AKM suite selectors */
+#define WLAN_AKM_SUITE_8021X		0x000FAC01
+#define WLAN_AKM_SUITE_PSK		0x000FAC02
+#define WLAN_AKM_SUITE_SAE			0x000FAC08
+#define WLAN_AKM_SUITE_FT_OVER_SAE	0x000FAC09
+
+#define WLAN_MAX_KEY_LEN		32
+
+#define WLAN_PMKID_LEN			16
+
+#define WLAN_OUI_WFA			0x506f9a
+#define WLAN_OUI_TYPE_WFA_P2P		9
+
+/*
+ * WMM/802.11e Tspec Element
+ */
+#define IEEE80211_WMM_IE_TSPEC_TID_MASK		0x0F
+#define IEEE80211_WMM_IE_TSPEC_TID_SHIFT	1
+
+enum ieee80211_tspec_status_code {
+	IEEE80211_TSPEC_STATUS_ADMISS_ACCEPTED = 0,
+	IEEE80211_TSPEC_STATUS_ADDTS_INVAL_PARAMS = 0x1,
+};
+
+struct ieee80211_tspec_ie {
+	u8 element_id;
+	u8 len;
+	u8 oui[3];
+	u8 oui_type;
+	u8 oui_subtype;
+	u8 version;
+	__le16 tsinfo;
+	u8 tsinfo_resvd;
+	__le16 nominal_msdu;
+	__le16 max_msdu;
+	__le32 min_service_int;
+	__le32 max_service_int;
+	__le32 inactivity_int;
+	__le32 suspension_int;
+	__le32 service_start_time;
+	__le32 min_data_rate;
+	__le32 mean_data_rate;
+	__le32 peak_data_rate;
+	__le32 max_burst_size;
+	__le32 delay_bound;
+	__le32 min_phy_rate;
+	__le16 sba;
+	__le16 medium_time;
+} __packed;
+
+/**
+ * ieee80211_get_qos_ctl - get pointer to qos control bytes
+ * @hdr: the frame
+ *
+ * The qos ctrl bytes come after the frame_control, duration, seq_num
+ * and 3 or 4 addresses of length ETH_ALEN.
+ * 3 addr: 2 + 2 + 2 + 3*6 = 24
+ * 4 addr: 2 + 2 + 2 + 4*6 = 30
+ */
+static inline u8 *ieee80211_get_qos_ctl(struct ieee80211_hdr *hdr)
+{
+	if (ieee80211_has_a4(hdr->frame_control))
+		return (u8 *)hdr + 30;
+	else
+		return (u8 *)hdr + 24;
+}
+
+/**
+ * ieee80211_get_SA - get pointer to SA
+ * @hdr: the frame
+ *
+ * Given an 802.11 frame, this function returns the offset
+ * to the source address (SA). It does not verify that the
+ * header is long enough to contain the address, and the
+ * header must be long enough to contain the frame control
+ * field.
+ */
+static inline u8 *ieee80211_get_SA(struct ieee80211_hdr *hdr)
+{
+	if (ieee80211_has_a4(hdr->frame_control))
+		return hdr->addr4;
+	if (ieee80211_has_fromds(hdr->frame_control))
+		return hdr->addr3;
+	return hdr->addr2;
+}
+
+/**
+ * ieee80211_get_DA - get pointer to DA
+ * @hdr: the frame
+ *
+ * Given an 802.11 frame, this function returns the offset
+ * to the destination address (DA). It does not verify that
+ * the header is long enough to contain the address, and the
+ * header must be long enough to contain the frame control
+ * field.
+ */
+static inline u8 *ieee80211_get_DA(struct ieee80211_hdr *hdr)
+{
+	if (ieee80211_has_tods(hdr->frame_control))
+		return hdr->addr3;
+	else
+		return hdr->addr1;
+}
+
+/**
+ * ieee80211_is_robust_mgmt_frame - check if frame is a robust management frame
+ * @hdr: the frame (buffer must include at least the first octet of payload)
+ */
+static inline bool ieee80211_is_robust_mgmt_frame(struct ieee80211_hdr *hdr)
+{
+	if (ieee80211_is_disassoc(hdr->frame_control) ||
+	    ieee80211_is_deauth(hdr->frame_control))
+		return true;
+
+	if (ieee80211_is_action(hdr->frame_control)) {
+		u8 *category;
+
+		/*
+		 * Action frames, excluding Public Action frames, are Robust
+		 * Management Frames. However, if we are looking at a Protected
+		 * frame, skip the check since the data may be encrypted and
+		 * the frame has already been found to be a Robust Management
+		 * Frame (by the other end).
+		 */
+		if (ieee80211_has_protected(hdr->frame_control))
+			return true;
+		category = ((u8 *) hdr) + 24;
+		return *category != WLAN_CATEGORY_PUBLIC &&
+			*category != WLAN_CATEGORY_HT &&
+			*category != WLAN_CATEGORY_SELF_PROTECTED &&
+			*category != WLAN_CATEGORY_VENDOR_SPECIFIC;
+	}
+
+	return false;
+}
+
+/**
+ * ieee80211_is_public_action - check if frame is a public action frame
+ * @hdr: the frame
+ * @len: length of the frame
+ */
+static inline bool ieee80211_is_public_action(struct ieee80211_hdr *hdr,
+					      size_t len)
+{
+	struct ieee80211_mgmt *mgmt = (void *)hdr;
+
+	if (len < IEEE80211_MIN_ACTION_SIZE)
+		return false;
+	if (!ieee80211_is_action(hdr->frame_control))
+		return false;
+	return mgmt->u.action.category == WLAN_CATEGORY_PUBLIC;
+}
+
+/**
+ * ieee80211_fhss_chan_to_freq - get channel frequency
+ * @channel: the FHSS channel
+ *
+ * Convert IEEE802.11 FHSS channel to frequency (MHz)
+ * Ref IEEE 802.11-2007 section 14.6
+ */
+static inline int ieee80211_fhss_chan_to_freq(int channel)
+{
+	if ((channel > 1) && (channel < 96))
+		return channel + 2400;
+	else
+		return -1;
+}
+
+/**
+ * ieee80211_freq_to_fhss_chan - get channel
+ * @freq: the channels frequency
+ *
+ * Convert frequency (MHz) to IEEE802.11 FHSS channel
+ * Ref IEEE 802.11-2007 section 14.6
+ */
+static inline int ieee80211_freq_to_fhss_chan(int freq)
+{
+	if ((freq > 2401) && (freq < 2496))
+		return freq - 2400;
+	else
+		return -1;
+}
+
+/**
+ * ieee80211_dsss_chan_to_freq - get channel center frequency
+ * @channel: the DSSS channel
+ *
+ * Convert IEEE802.11 DSSS channel to the center frequency (MHz).
+ * Ref IEEE 802.11-2007 section 15.6
+ */
+static inline int ieee80211_dsss_chan_to_freq(int channel)
+{
+	if ((channel > 0) && (channel < 14))
+		return 2407 + (channel * 5);
+	else if (channel == 14)
+		return 2484;
+	else
+		return -1;
+}
+
+/**
+ * ieee80211_freq_to_dsss_chan - get channel
+ * @freq: the frequency
+ *
+ * Convert frequency (MHz) to IEEE802.11 DSSS channel
+ * Ref IEEE 802.11-2007 section 15.6
+ *
+ * This routine selects the channel with the closest center frequency.
+ */
+static inline int ieee80211_freq_to_dsss_chan(int freq)
+{
+	if ((freq >= 2410) && (freq < 2475))
+		return (freq - 2405) / 5;
+	else if ((freq >= 2482) && (freq < 2487))
+		return 14;
+	else
+		return -1;
+}
+
+/* Convert IEEE802.11 HR DSSS channel to frequency (MHz) and back
+ * Ref IEEE 802.11-2007 section 18.4.6.2
+ *
+ * The channels and frequencies are the same as those defined for DSSS
+ */
+#define ieee80211_hr_chan_to_freq(chan) ieee80211_dsss_chan_to_freq(chan)
+#define ieee80211_freq_to_hr_chan(freq) ieee80211_freq_to_dsss_chan(freq)
+
+/* Convert IEEE802.11 ERP channel to frequency (MHz) and back
+ * Ref IEEE 802.11-2007 section 19.4.2
+ */
+#define ieee80211_erp_chan_to_freq(chan) ieee80211_hr_chan_to_freq(chan)
+#define ieee80211_freq_to_erp_chan(freq) ieee80211_freq_to_hr_chan(freq)
+
+/**
+ * ieee80211_ofdm_chan_to_freq - get channel center frequency
+ * @s_freq: starting frequency == (dotChannelStartingFactor/2) MHz
+ * @channel: the OFDM channel
+ *
+ * Convert IEEE802.11 OFDM channel to center frequency (MHz)
+ * Ref IEEE 802.11-2007 section 17.3.8.3.2
+ */
+static inline int ieee80211_ofdm_chan_to_freq(int s_freq, int channel)
+{
+	if ((channel > 0) && (channel <= 200) &&
+	    (s_freq >= 4000))
+		return s_freq + (channel * 5);
+	else
+		return -1;
+}
+
+/**
+ * ieee80211_freq_to_ofdm_channel - get channel
+ * @s_freq: starting frequency == (dotChannelStartingFactor/2) MHz
+ * @freq: the frequency
+ *
+ * Convert frequency (MHz) to IEEE802.11 OFDM channel
+ * Ref IEEE 802.11-2007 section 17.3.8.3.2
+ *
+ * This routine selects the channel with the closest center frequency.
+ */
+static inline int ieee80211_freq_to_ofdm_chan(int s_freq, int freq)
+{
+	if ((freq > (s_freq + 2)) && (freq <= (s_freq + 1202)) &&
+	    (s_freq >= 4000))
+		return (freq + 2 - s_freq) / 5;
+	else
+		return -1;
+}
+
+/**
+ * ieee80211_tu_to_usec - convert time units (TU) to microseconds
+ * @tu: the TUs
+ */
+static inline unsigned long ieee80211_tu_to_usec(unsigned long tu)
+{
+	return 1024 * tu;
+}
+
+/**
+ * ieee80211_check_tim - check if AID bit is set in TIM
+ * @tim: the TIM IE
+ * @tim_len: length of the TIM IE
+ * @aid: the AID to look for
+ */
+static inline bool ieee80211_check_tim(struct ieee80211_tim_ie *tim,
+				       u8 tim_len, u16 aid)
+{
+	u8 mask;
+	u8 indexn0, indexn1, indexn2;
+
+	if (unlikely(!tim || tim_len < sizeof(*tim)))
+		return false;
+
+	aid &= 0x3fff;
+	indexn0 = aid / 8;
+	mask  = 1 << (aid & 7);
+
+	indexn1 = tim->bitmap_ctrl & 0xfe;
+	indexn2 = tim_len + indexn1 - 4;
+
+	if (indexn0 < indexn1 || indexn0 > indexn2)
+		return false;
+
+	indexn0 -= indexn1;
+
+	return !!(tim->virtual_map[indexn0] & mask);
+}
+
+#endif /* __LINUX_IEEE80211_H */
diff --git a/carl9170fw/include/linux/types.h b/carl9170fw/include/linux/types.h
new file mode 100644
index 0000000..3f45f0f
--- /dev/null
+++ b/carl9170fw/include/linux/types.h
@@ -0,0 +1,61 @@
+/*
+ * 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; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef __LINUX_TYPES_H
+#define __LINUX_TYPES_H
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <stdlib.h>
+#include <sys/param.h>
+
+#if BYTE_ORDER == BIG_ENDIAN
+#error	"big endian is not supported by target"
+#endif
+
+typedef uint16_t	__le16;
+typedef uint32_t	__le32;
+typedef uint64_t	__le64;
+
+typedef uint8_t		u8;
+typedef uint8_t		__u8;
+typedef uint16_t	u16;
+typedef uint16_t	__u16;
+typedef uint32_t	u32;
+typedef uint32_t	__u32;
+typedef uint64_t	u64;
+typedef uint64_t	__u64;
+typedef int8_t		s8;
+typedef int8_t		__s8;
+typedef int16_t		s16;
+typedef int16_t		__s16;
+typedef int32_t		s32;
+typedef int32_t		__s32;
+typedef int64_t		s64;
+typedef int64_t		__s64;
+
+#define cpu_to_le16(x) ((__le16)(uint16_t)(x))
+#define le16_to_cpu(x) ((uint16_t)(__le16)(x))
+#define cpu_to_le32(x) ((__le32)(uint32_t)(x))
+#define le32_to_cpu(x) ((uint32_t)(__le32)(x))
+#define cpu_to_le64(x) ((__le64)(uint64_t)(x))
+#define le64_to_cpu(x) ((uint64_t)(__le64)(x))
+
+typedef uint16_t	__be16;
+typedef uint32_t	__be32;
+typedef uint64_t	__be64;
+
+#endif /* __LINUX_TYPES_H */
diff --git a/carl9170fw/include/shared/eeprom.h b/carl9170fw/include/shared/eeprom.h
new file mode 100644
index 0000000..7cff40a
--- /dev/null
+++ b/carl9170fw/include/shared/eeprom.h
@@ -0,0 +1,216 @@
+/*
+ * Shared Atheros AR9170 Header
+ *
+ * EEPROM layout
+ *
+ * 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.
+ */
+#ifndef __CARL9170_SHARED_EEPROM_H
+#define __CARL9170_SHARED_EEPROM_H
+
+#define AR9170_EEPROM_START		0x1600
+
+#define AR5416_MAX_CHAINS		2
+#define AR5416_MODAL_SPURS		5
+
+struct ar9170_eeprom_modal {
+	__le32	antCtrlChain[AR5416_MAX_CHAINS];
+	__le32	antCtrlCommon;
+	s8	antennaGainCh[AR5416_MAX_CHAINS];
+	u8	switchSettling;
+	u8	txRxAttenCh[AR5416_MAX_CHAINS];
+	u8	rxTxMarginCh[AR5416_MAX_CHAINS];
+	s8	adcDesiredSize;
+	s8	pgaDesiredSize;
+	u8	xlnaGainCh[AR5416_MAX_CHAINS];
+	u8	txEndToXpaOff;
+	u8	txEndToRxOn;
+	u8	txFrameToXpaOn;
+	u8	thresh62;
+	s8	noiseFloorThreshCh[AR5416_MAX_CHAINS];
+	u8	xpdGain;
+	u8	xpd;
+	s8	iqCalICh[AR5416_MAX_CHAINS];
+	s8	iqCalQCh[AR5416_MAX_CHAINS];
+	u8	pdGainOverlap;
+	u8	ob;
+	u8	db;
+	u8	xpaBiasLvl;
+	u8	pwrDecreaseFor2Chain;
+	u8	pwrDecreaseFor3Chain;
+	u8	txFrameToDataStart;
+	u8	txFrameToPaOn;
+	u8	ht40PowerIncForPdadc;
+	u8	bswAtten[AR5416_MAX_CHAINS];
+	u8	bswMargin[AR5416_MAX_CHAINS];
+	u8	swSettleHt40;
+	u8	reserved[22];
+	struct spur_channel {
+		__le16 spurChan;
+		u8	spurRangeLow;
+		u8	spurRangeHigh;
+	} __packed spur_channels[AR5416_MODAL_SPURS];
+} __packed;
+
+#define AR5416_NUM_PD_GAINS		4
+#define AR5416_PD_GAIN_ICEPTS		5
+
+struct ar9170_calibration_data_per_freq {
+	u8	pwr_pdg[AR5416_NUM_PD_GAINS][AR5416_PD_GAIN_ICEPTS];
+	u8	vpd_pdg[AR5416_NUM_PD_GAINS][AR5416_PD_GAIN_ICEPTS];
+} __packed;
+
+#define AR5416_NUM_5G_CAL_PIERS		8
+#define AR5416_NUM_2G_CAL_PIERS		4
+
+#define AR5416_NUM_5G_TARGET_PWRS	8
+#define AR5416_NUM_2G_CCK_TARGET_PWRS	3
+#define AR5416_NUM_2G_OFDM_TARGET_PWRS	4
+#define AR5416_MAX_NUM_TGT_PWRS		8
+
+struct ar9170_calibration_target_power_legacy {
+	u8	freq;
+	u8	power[4];
+} __packed;
+
+struct ar9170_calibration_target_power_ht {
+	u8	freq;
+	u8	power[8];
+} __packed;
+
+#define AR5416_NUM_CTLS			24
+
+struct ar9170_calctl_edges {
+	u8	channel;
+#define AR9170_CALCTL_EDGE_FLAGS	0xC0
+	u8	power_flags;
+} __packed;
+
+#define AR5416_NUM_BAND_EDGES		8
+
+struct ar9170_calctl_data {
+	struct ar9170_calctl_edges
+		control_edges[AR5416_MAX_CHAINS][AR5416_NUM_BAND_EDGES];
+} __packed;
+
+struct ar9170_eeprom {
+	__le16	length;
+	__le16	checksum;
+	__le16	version;
+	u8	operating_flags;
+#define AR9170_OPFLAG_5GHZ		1
+#define AR9170_OPFLAG_2GHZ		2
+	u8	misc;
+	__le16	reg_domain[2];
+	u8	mac_address[6];
+	u8	rx_mask;
+	u8	tx_mask;
+	__le16	rf_silent;
+	__le16	bluetooth_options;
+	__le16	device_capabilities;
+	__le32	build_number;
+	u8	deviceType;
+	u8	reserved[33];
+
+	u8	customer_data[64];
+
+	struct ar9170_eeprom_modal
+		modal_header[2];
+
+	u8	cal_freq_pier_5G[AR5416_NUM_5G_CAL_PIERS];
+	u8	cal_freq_pier_2G[AR5416_NUM_2G_CAL_PIERS];
+
+	struct ar9170_calibration_data_per_freq
+		cal_pier_data_5G[AR5416_MAX_CHAINS][AR5416_NUM_5G_CAL_PIERS],
+		cal_pier_data_2G[AR5416_MAX_CHAINS][AR5416_NUM_2G_CAL_PIERS];
+
+	/* power calibration data */
+	struct ar9170_calibration_target_power_legacy
+		cal_tgt_pwr_5G[AR5416_NUM_5G_TARGET_PWRS];
+	struct ar9170_calibration_target_power_ht
+		cal_tgt_pwr_5G_ht20[AR5416_NUM_5G_TARGET_PWRS],
+		cal_tgt_pwr_5G_ht40[AR5416_NUM_5G_TARGET_PWRS];
+
+	struct ar9170_calibration_target_power_legacy
+		cal_tgt_pwr_2G_cck[AR5416_NUM_2G_CCK_TARGET_PWRS],
+		cal_tgt_pwr_2G_ofdm[AR5416_NUM_2G_OFDM_TARGET_PWRS];
+	struct ar9170_calibration_target_power_ht
+		cal_tgt_pwr_2G_ht20[AR5416_NUM_2G_OFDM_TARGET_PWRS],
+		cal_tgt_pwr_2G_ht40[AR5416_NUM_2G_OFDM_TARGET_PWRS];
+
+	/* conformance testing limits */
+	u8	ctl_index[AR5416_NUM_CTLS];
+	struct ar9170_calctl_data
+		ctl_data[AR5416_NUM_CTLS];
+
+	u8	pad;
+	__le16	subsystem_id;
+} __packed;
+
+#define AR9170_LED_MODE_POWER_ON		0x0001
+#define AR9170_LED_MODE_RESERVED		0x0002
+#define AR9170_LED_MODE_DISABLE_STATE		0x0004
+#define AR9170_LED_MODE_OFF_IN_PSM		0x0008
+
+/* AR9170_LED_MODE BIT is set */
+#define AR9170_LED_MODE_FREQUENCY_S		4
+#define AR9170_LED_MODE_FREQUENCY		0x0030
+#define AR9170_LED_MODE_FREQUENCY_1HZ		0x0000
+#define AR9170_LED_MODE_FREQUENCY_0_5HZ		0x0010
+#define AR9170_LED_MODE_FREQUENCY_0_25HZ	0x0020
+#define AR9170_LED_MODE_FREQUENCY_0_125HZ	0x0030
+
+/* AR9170_LED_MODE BIT is not set */
+#define AR9170_LED_MODE_CONN_STATE_S		4
+#define AR9170_LED_MODE_CONN_STATE		0x0030
+#define AR9170_LED_MODE_CONN_STATE_FORCE_OFF	0x0000
+#define AR9170_LED_MODE_CONN_STATE_FORCE_ON	0x0010
+/* Idle off / Active on */
+#define AR9170_LED_MODE_CONN_STATE_IOFF_AON	0x0020
+/* Idle on / Active off */
+#define AR9170_LED_MODE_CONN_STATE_ION_AOFF	0x0010
+
+#define AR9170_LED_MODE_MODE			0x0040
+#define AR9170_LED_MODE_RESERVED2		0x0080
+
+#define AR9170_LED_MODE_TON_SCAN_S		8
+#define AR9170_LED_MODE_TON_SCAN		0x0f00
+
+#define AR9170_LED_MODE_TOFF_SCAN_S		12
+#define AR9170_LED_MODE_TOFF_SCAN		0xf000
+
+struct ar9170_led_mode {
+	__le16 led;
+};
+
+#endif /* __CARL9170_SHARED_EEPROM_H */
diff --git a/carl9170fw/include/shared/fwcmd.h b/carl9170fw/include/shared/fwcmd.h
new file mode 100644
index 0000000..9443c80
--- /dev/null
+++ b/carl9170fw/include/shared/fwcmd.h
@@ -0,0 +1,318 @@
+/*
+ * Shared Atheros AR9170 Header
+ *
+ * Firmware command interface definitions
+ *
+ * Copyright 2008, Johannes Berg <johannes@sipsolutions.net>
+ * Copyright 2009-2011 Christian Lamparter <chunkeey@googlemail.com>
+ *
+ * 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.
+ *
+ * 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.
+ */
+
+#ifndef __CARL9170_SHARED_FWCMD_H
+#define __CARL9170_SHARED_FWCMD_H
+
+#define	CARL9170_MAX_CMD_LEN		64
+#define	CARL9170_MAX_CMD_PAYLOAD_LEN	60
+
+#define CARL9170FW_API_MIN_VER		1
+#define CARL9170FW_API_MAX_VER		1
+
+enum carl9170_cmd_oids {
+	CARL9170_CMD_RREG		= 0x00,
+	CARL9170_CMD_WREG		= 0x01,
+	CARL9170_CMD_ECHO		= 0x02,
+	CARL9170_CMD_SWRST		= 0x03,
+	CARL9170_CMD_REBOOT		= 0x04,
+	CARL9170_CMD_BCN_CTRL		= 0x05,
+	CARL9170_CMD_READ_TSF		= 0x06,
+	CARL9170_CMD_RX_FILTER		= 0x07,
+	CARL9170_CMD_WOL		= 0x08,
+	CARL9170_CMD_TALLY		= 0x09,
+
+	/* CAM */
+	CARL9170_CMD_EKEY		= 0x10,
+	CARL9170_CMD_DKEY		= 0x11,
+
+	/* RF / PHY */
+	CARL9170_CMD_FREQUENCY		= 0x20,
+	CARL9170_CMD_RF_INIT		= 0x21,
+	CARL9170_CMD_SYNTH		= 0x22,
+	CARL9170_CMD_FREQ_START		= 0x23,
+	CARL9170_CMD_PSM		= 0x24,
+
+	/* Asychronous command flag */
+	CARL9170_CMD_ASYNC_FLAG		= 0x40,
+	CARL9170_CMD_WREG_ASYNC		= (CARL9170_CMD_WREG |
+					   CARL9170_CMD_ASYNC_FLAG),
+	CARL9170_CMD_REBOOT_ASYNC	= (CARL9170_CMD_REBOOT |
+					   CARL9170_CMD_ASYNC_FLAG),
+	CARL9170_CMD_BCN_CTRL_ASYNC	= (CARL9170_CMD_BCN_CTRL |
+					   CARL9170_CMD_ASYNC_FLAG),
+	CARL9170_CMD_PSM_ASYNC		= (CARL9170_CMD_PSM |
+					   CARL9170_CMD_ASYNC_FLAG),
+
+	/* responses and traps */
+	CARL9170_RSP_FLAG		= 0xc0,
+	CARL9170_RSP_PRETBTT		= 0xc0,
+	CARL9170_RSP_TXCOMP		= 0xc1,
+	CARL9170_RSP_BEACON_CONFIG	= 0xc2,
+	CARL9170_RSP_ATIM		= 0xc3,
+	CARL9170_RSP_WATCHDOG		= 0xc6,
+	CARL9170_RSP_TEXT		= 0xca,
+	CARL9170_RSP_HEXDUMP		= 0xcc,
+	CARL9170_RSP_RADAR		= 0xcd,
+	CARL9170_RSP_GPIO		= 0xce,
+	CARL9170_RSP_BOOT		= 0xcf,
+};
+
+struct carl9170_set_key_cmd {
+	__le16		user;
+	__le16		keyId;
+	__le16		type;
+	u8		macAddr[6];
+	u32		key[4];
+} __packed __aligned(4);
+#define CARL9170_SET_KEY_CMD_SIZE		28
+
+struct carl9170_disable_key_cmd {
+	__le16		user;
+	__le16		padding;
+} __packed __aligned(4);
+#define CARL9170_DISABLE_KEY_CMD_SIZE		4
+
+struct carl9170_u32_list {
+	u32	vals[0];
+} __packed;
+
+struct carl9170_reg_list {
+	__le32		regs[0];
+} __packed;
+
+struct carl9170_write_reg {
+	struct {
+		__le32		addr;
+		__le32		val;
+	} regs[0] __packed;
+} __packed;
+
+#define	CARL9170FW_PHY_HT_ENABLE		0x4
+#define	CARL9170FW_PHY_HT_DYN2040		0x8
+#define	CARL9170FW_PHY_HT_EXT_CHAN_OFF		0x3
+#define	CARL9170FW_PHY_HT_EXT_CHAN_OFF_S	2
+
+struct carl9170_rf_init {
+	__le32		freq;
+	u8		ht_settings;
+	u8		padding2[3];
+	__le32		delta_slope_coeff_exp;
+	__le32		delta_slope_coeff_man;
+	__le32		delta_slope_coeff_exp_shgi;
+	__le32		delta_slope_coeff_man_shgi;
+	__le32		finiteLoopCount;
+} __packed;
+#define CARL9170_RF_INIT_SIZE		28
+
+struct carl9170_rf_init_result {
+	__le32		ret;		/* AR9170_PHY_REG_AGC_CONTROL */
+} __packed;
+#define	CARL9170_RF_INIT_RESULT_SIZE	4
+
+#define	CARL9170_PSM_SLEEP		0x1000
+#define	CARL9170_PSM_SOFTWARE		0
+#define	CARL9170_PSM_WAKE		0 /* internally used. */
+#define	CARL9170_PSM_COUNTER		0xfff
+#define	CARL9170_PSM_COUNTER_S		0
+
+struct carl9170_psm {
+	__le32		state;
+} __packed;
+#define CARL9170_PSM_SIZE		4
+
+struct carl9170_rx_filter_cmd {
+	__le32		rx_filter;
+} __packed;
+#define CARL9170_RX_FILTER_CMD_SIZE	4
+
+#define CARL9170_RX_FILTER_BAD		0x01
+#define CARL9170_RX_FILTER_OTHER_RA	0x02
+#define CARL9170_RX_FILTER_DECRY_FAIL	0x04
+#define CARL9170_RX_FILTER_CTL_OTHER	0x08
+#define CARL9170_RX_FILTER_CTL_PSPOLL	0x10
+#define CARL9170_RX_FILTER_CTL_BACKR	0x20
+#define CARL9170_RX_FILTER_MGMT		0x40
+#define CARL9170_RX_FILTER_DATA		0x80
+#define CARL9170_RX_FILTER_EVERYTHING	(~0)
+
+struct carl9170_bcn_ctrl_cmd {
+	__le32		vif_id;
+	__le32		mode;
+	__le32		bcn_addr;
+	__le32		bcn_len;
+} __packed;
+#define CARL9170_BCN_CTRL_CMD_SIZE	16
+
+#define CARL9170_BCN_CTRL_DRAIN	0
+#define CARL9170_BCN_CTRL_CAB_TRIGGER	1
+
+struct carl9170_wol_cmd {
+	__le32		flags;
+	u8		mac[6];
+	u8		bssid[6];
+	__le32		null_interval;
+	__le32		free_for_use2;
+	__le32		mask;
+	u8		pattern[32];
+} __packed;
+
+#define CARL9170_WOL_CMD_SIZE		60
+
+#define CARL9170_WOL_DISCONNECT		1
+#define CARL9170_WOL_MAGIC_PKT		2
+
+struct carl9170_cmd_head {
+	union {
+		struct {
+			u8	len;
+			u8	cmd;
+			u8	seq;
+			u8	ext;
+		} __packed;
+
+		u32 hdr_data;
+	} __packed;
+} __packed;
+
+struct carl9170_cmd {
+	struct carl9170_cmd_head hdr;
+	union {
+		struct carl9170_set_key_cmd	setkey;
+		struct carl9170_disable_key_cmd	disablekey;
+		struct carl9170_u32_list	echo;
+		struct carl9170_reg_list	rreg;
+		struct carl9170_write_reg	wreg;
+		struct carl9170_rf_init		rf_init;
+		struct carl9170_psm		psm;
+		struct carl9170_wol_cmd		wol;
+		struct carl9170_bcn_ctrl_cmd	bcn_ctrl;
+		struct carl9170_rx_filter_cmd	rx_filter;
+		u8 data[CARL9170_MAX_CMD_PAYLOAD_LEN];
+	} __packed;
+} __packed __aligned(4);
+
+#define	CARL9170_TX_STATUS_QUEUE	3
+#define	CARL9170_TX_STATUS_QUEUE_S	0
+#define	CARL9170_TX_STATUS_RIX_S	2
+#define	CARL9170_TX_STATUS_RIX		(3 << CARL9170_TX_STATUS_RIX_S)
+#define	CARL9170_TX_STATUS_TRIES_S	4
+#define	CARL9170_TX_STATUS_TRIES	(7 << CARL9170_TX_STATUS_TRIES_S)
+#define	CARL9170_TX_STATUS_SUCCESS	0x80
+
+#ifdef __CARL9170FW__
+/*
+ * NOTE:
+ * Both structs [carl9170_tx_status and _carl9170_tx_status]
+ * need to be "bit for bit" in sync.
+ */
+struct carl9170_tx_status {
+	/*
+	 * Beware of compiler bugs in all gcc pre 4.4!
+	 */
+
+	u8 cookie;
+	u8 queue:2;
+	u8 rix:2;
+	u8 tries:3;
+	u8 success:1;
+} __packed;
+#endif /* __CARL9170FW__ */
+
+struct _carl9170_tx_status {
+	/*
+	 * This version should be immune to all alignment bugs.
+	 */
+
+	u8 cookie;
+	u8 info;
+} __packed;
+#define CARL9170_TX_STATUS_SIZE		2
+
+#define	CARL9170_RSP_TX_STATUS_NUM	(CARL9170_MAX_CMD_PAYLOAD_LEN /	\
+					 sizeof(struct _carl9170_tx_status))
+
+#define	CARL9170_TX_MAX_RATE_TRIES	7
+
+#define	CARL9170_TX_MAX_RATES		4
+#define	CARL9170_TX_MAX_RETRY_RATES	(CARL9170_TX_MAX_RATES - 1)
+#define	CARL9170_ERR_MAGIC		"ERR:"
+#define	CARL9170_BUG_MAGIC		"BUG:"
+
+struct carl9170_gpio {
+	__le32 gpio;
+} __packed;
+#define CARL9170_GPIO_SIZE		4
+
+struct carl9170_tsf_rsp {
+	union {
+		__le32 tsf[2];
+		__le64 tsf_64;
+	} __packed;
+} __packed;
+#define CARL9170_TSF_RSP_SIZE		8
+
+struct carl9170_tally_rsp {
+	__le32 active;
+	__le32 cca;
+	__le32 tx_time;
+	__le32 rx_total;
+	__le32 rx_overrun;
+	__le32 tick;
+} __packed;
+
+struct carl9170_rsp {
+	struct carl9170_cmd_head hdr;
+
+	union {
+		struct carl9170_rf_init_result	rf_init_res;
+		struct carl9170_u32_list	rreg_res;
+		struct carl9170_u32_list	echo;
+#ifdef __CARL9170FW__
+		struct carl9170_tx_status	tx_status[0];
+#endif /* __CARL9170FW__ */
+		struct _carl9170_tx_status	_tx_status[0];
+		struct carl9170_gpio		gpio;
+		struct carl9170_tsf_rsp		tsf;
+		struct carl9170_psm		psm;
+		struct carl9170_tally_rsp	tally;
+		u8 data[CARL9170_MAX_CMD_PAYLOAD_LEN];
+	} __packed;
+} __packed __aligned(4);
+
+#endif /* __CARL9170_SHARED_FWCMD_H */
diff --git a/carl9170fw/include/shared/fwdesc.h b/carl9170fw/include/shared/fwdesc.h
new file mode 100644
index 0000000..66848d4
--- /dev/null
+++ b/carl9170fw/include/shared/fwdesc.h
@@ -0,0 +1,277 @@
+/*
+ * Shared CARL9170 Header
+ *
+ * Firmware descriptor format
+ *
+ * Copyright 2009-2011 Christian Lamparter <chunkeey@googlemail.com>
+ *
+ * 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.
+ *
+ * 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/.
+ */
+
+#ifndef __CARL9170_SHARED_FWDESC_H
+#define __CARL9170_SHARED_FWDESC_H
+
+/* NOTE: Don't mess with the order of the flags! */
+enum carl9170fw_feature_list {
+	/* Always set */
+	CARL9170FW_DUMMY_FEATURE,
+
+	/*
+	 * Indicates that this image has special boot block which prevents
+	 * legacy drivers to drive the firmware.
+	 */
+	CARL9170FW_MINIBOOT,
+
+	/* usb registers are initialized by the firmware */
+	CARL9170FW_USB_INIT_FIRMWARE,
+
+	/* command traps & notifications are send through EP2 */
+	CARL9170FW_USB_RESP_EP2,
+
+	/* usb download (app -> fw) stream */
+	CARL9170FW_USB_DOWN_STREAM,
+
+	/* usb upload (fw -> app) stream */
+	CARL9170FW_USB_UP_STREAM,
+
+	/* unusable - reserved to flag non-functional debug firmwares */
+	CARL9170FW_UNUSABLE,
+
+	/* AR9170_CMD_RF_INIT, AR9170_CMD_FREQ_START, AR9170_CMD_FREQUENCY */
+	CARL9170FW_COMMAND_PHY,
+
+	/* AR9170_CMD_EKEY, AR9170_CMD_DKEY */
+	CARL9170FW_COMMAND_CAM,
+
+	/* Firmware has a software Content After Beacon Queueing mechanism */
+	CARL9170FW_WLANTX_CAB,
+
+	/* The firmware is capable of responding to incoming BAR frames */
+	CARL9170FW_HANDLE_BACK_REQ,
+
+	/* GPIO Interrupt | CARL9170_RSP_GPIO */
+	CARL9170FW_GPIO_INTERRUPT,
+
+	/* Firmware PSM support | CARL9170_CMD_PSM */
+	CARL9170FW_PSM,
+
+	/* Firmware RX filter | CARL9170_CMD_RX_FILTER */
+	CARL9170FW_RX_FILTER,
+
+	/* Wake up on WLAN */
+	CARL9170FW_WOL,
+
+	/* Firmware supports PSM in the 5GHZ Band */
+	CARL9170FW_FIXED_5GHZ_PSM,
+
+	/* HW (ANI, CCA, MIB) tally counters */
+	CARL9170FW_HW_COUNTERS,
+
+	/* Firmware will pass BA when BARs are queued */
+	CARL9170FW_RX_BA_FILTER,
+
+	/* KEEP LAST */
+	__CARL9170FW_FEATURE_NUM
+};
+
+#define OTUS_MAGIC	"OTAR"
+#define MOTD_MAGIC	"MOTD"
+#define FIX_MAGIC	"FIX\0"
+#define DBG_MAGIC	"DBG\0"
+#define CHK_MAGIC	"CHK\0"
+#define TXSQ_MAGIC	"TXSQ"
+#define WOL_MAGIC	"WOL\0"
+#define LAST_MAGIC	"LAST"
+
+#define CARL9170FW_SET_DAY(d) (((d) - 1) % 31)
+#define CARL9170FW_SET_MONTH(m) ((((m) - 1) % 12) * 31)
+#define CARL9170FW_SET_YEAR(y) (((y) - 10) * 372)
+
+#define CARL9170FW_GET_DAY(d) (((d) % 31) + 1)
+#define CARL9170FW_GET_MONTH(m) ((((m) / 31) % 12) + 1)
+#define CARL9170FW_GET_YEAR(y) ((y) / 372 + 10)
+
+#define CARL9170FW_MAGIC_SIZE			4
+
+struct carl9170fw_desc_head {
+	u8	magic[CARL9170FW_MAGIC_SIZE];
+	__le16 length;
+	u8 min_ver;
+	u8 cur_ver;
+} __packed;
+#define CARL9170FW_DESC_HEAD_SIZE			\
+	(sizeof(struct carl9170fw_desc_head))
+
+#define CARL9170FW_OTUS_DESC_MIN_VER		6
+#define CARL9170FW_OTUS_DESC_CUR_VER		7
+struct carl9170fw_otus_desc {
+	struct carl9170fw_desc_head head;
+	__le32 feature_set;
+	__le32 fw_address;
+	__le32 bcn_addr;
+	__le16 bcn_len;
+	__le16 miniboot_size;
+	__le16 tx_frag_len;
+	__le16 rx_max_frame_len;
+	u8 tx_descs;
+	u8 cmd_bufs;
+	u8 api_ver;
+	u8 vif_num;
+} __packed;
+#define CARL9170FW_OTUS_DESC_SIZE			\
+	(sizeof(struct carl9170fw_otus_desc))
+
+#define CARL9170FW_MOTD_STRING_LEN			24
+#define CARL9170FW_MOTD_RELEASE_LEN			20
+#define CARL9170FW_MOTD_DESC_MIN_VER			1
+#define CARL9170FW_MOTD_DESC_CUR_VER			2
+struct carl9170fw_motd_desc {
+	struct carl9170fw_desc_head head;
+	__le32 fw_year_month_day;
+	char desc[CARL9170FW_MOTD_STRING_LEN];
+	char release[CARL9170FW_MOTD_RELEASE_LEN];
+} __packed;
+#define CARL9170FW_MOTD_DESC_SIZE			\
+	(sizeof(struct carl9170fw_motd_desc))
+
+#define CARL9170FW_FIX_DESC_MIN_VER			1
+#define CARL9170FW_FIX_DESC_CUR_VER			2
+struct carl9170fw_fix_entry {
+	__le32 address;
+	__le32 mask;
+	__le32 value;
+} __packed;
+
+struct carl9170fw_fix_desc {
+	struct carl9170fw_desc_head head;
+	struct carl9170fw_fix_entry data[0];
+} __packed;
+#define CARL9170FW_FIX_DESC_SIZE			\
+	(sizeof(struct carl9170fw_fix_desc))
+
+#define CARL9170FW_DBG_DESC_MIN_VER			1
+#define CARL9170FW_DBG_DESC_CUR_VER			3
+struct carl9170fw_dbg_desc {
+	struct carl9170fw_desc_head head;
+
+	__le32 bogoclock_addr;
+	__le32 counter_addr;
+	__le32 rx_total_addr;
+	__le32 rx_overrun_addr;
+	__le32 rx_filter;
+
+	/* Put your debugging definitions here */
+} __packed;
+#define CARL9170FW_DBG_DESC_SIZE			\
+	(sizeof(struct carl9170fw_dbg_desc))
+
+#define CARL9170FW_CHK_DESC_MIN_VER			1
+#define CARL9170FW_CHK_DESC_CUR_VER			2
+struct carl9170fw_chk_desc {
+	struct carl9170fw_desc_head head;
+	__le32 fw_crc32;
+	__le32 hdr_crc32;
+} __packed;
+#define CARL9170FW_CHK_DESC_SIZE			\
+	(sizeof(struct carl9170fw_chk_desc))
+
+#define CARL9170FW_TXSQ_DESC_MIN_VER			1
+#define CARL9170FW_TXSQ_DESC_CUR_VER			1
+struct carl9170fw_txsq_desc {
+	struct carl9170fw_desc_head head;
+
+	__le32 seq_table_addr;
+} __packed;
+#define CARL9170FW_TXSQ_DESC_SIZE			\
+	(sizeof(struct carl9170fw_txsq_desc))
+
+#define CARL9170FW_WOL_DESC_MIN_VER			1
+#define CARL9170FW_WOL_DESC_CUR_VER			1
+struct carl9170fw_wol_desc {
+	struct carl9170fw_desc_head head;
+
+	__le32 supported_triggers;	/* CARL9170_WOL_ */
+} __packed;
+#define CARL9170FW_WOL_DESC_SIZE			\
+	(sizeof(struct carl9170fw_wol_desc))
+
+#define CARL9170FW_LAST_DESC_MIN_VER			1
+#define CARL9170FW_LAST_DESC_CUR_VER			2
+struct carl9170fw_last_desc {
+	struct carl9170fw_desc_head head;
+} __packed;
+#define CARL9170FW_LAST_DESC_SIZE			\
+	(sizeof(struct carl9170fw_fix_desc))
+
+#define CARL9170FW_DESC_MAX_LENGTH			8192
+
+#define CARL9170FW_FILL_DESC(_magic, _length, _min_ver, _cur_ver)	\
+	.head = {							\
+		.magic = _magic,					\
+		.length = cpu_to_le16(_length),				\
+		.min_ver = _min_ver,					\
+		.cur_ver = _cur_ver,					\
+	}
+
+static inline void carl9170fw_fill_desc(struct carl9170fw_desc_head *head,
+					 u8 magic[CARL9170FW_MAGIC_SIZE],
+					 __le16 length, u8 min_ver, u8 cur_ver)
+{
+	head->magic[0] = magic[0];
+	head->magic[1] = magic[1];
+	head->magic[2] = magic[2];
+	head->magic[3] = magic[3];
+
+	head->length = length;
+	head->min_ver = min_ver;
+	head->cur_ver = cur_ver;
+}
+
+#define carl9170fw_for_each_hdr(desc, fw_desc)				\
+	for (desc = fw_desc;						\
+	     memcmp(desc->magic, LAST_MAGIC, CARL9170FW_MAGIC_SIZE) &&	\
+	     le16_to_cpu(desc->length) >= CARL9170FW_DESC_HEAD_SIZE &&	\
+	     le16_to_cpu(desc->length) < CARL9170FW_DESC_MAX_LENGTH;	\
+	     desc = (void *)((unsigned long)desc + le16_to_cpu(desc->length)))
+
+#define CHECK_HDR_VERSION(head, _min_ver)				\
+	(((head)->cur_ver < _min_ver) || ((head)->min_ver > _min_ver))	\
+
+static inline bool carl9170fw_supports(__le32 list, u8 feature)
+{
+	return le32_to_cpu(list) & BIT(feature);
+}
+
+static inline bool carl9170fw_desc_cmp(const struct carl9170fw_desc_head *head,
+				       const u8 descid[CARL9170FW_MAGIC_SIZE],
+				       u16 min_len, u8 compatible_revision)
+{
+	if (descid[0] == head->magic[0] && descid[1] == head->magic[1] &&
+	    descid[2] == head->magic[2] && descid[3] == head->magic[3] &&
+	    !CHECK_HDR_VERSION(head, compatible_revision) &&
+	    (le16_to_cpu(head->length) >= min_len))
+		return true;
+
+	return false;
+}
+
+#define CARL9170FW_MIN_SIZE	32
+#define CARL9170FW_MAX_SIZE	16384
+
+static inline bool carl9170fw_size_check(unsigned int len)
+{
+	return (len <= CARL9170FW_MAX_SIZE && len >= CARL9170FW_MIN_SIZE);
+}
+
+#endif /* __CARL9170_SHARED_FWDESC_H */
diff --git a/carl9170fw/include/shared/hw.h b/carl9170fw/include/shared/hw.h
new file mode 100644
index 0000000..fa834c1
--- /dev/null
+++ b/carl9170fw/include/shared/hw.h
@@ -0,0 +1,817 @@
+/*
+ * Shared Atheros AR9170 Header
+ *
+ * Register map, hardware-specific definitions
+ *
+ * Copyright 2008, Johannes Berg <johannes@sipsolutions.net>
+ * Copyright 2009-2011 Christian Lamparter <chunkeey@googlemail.com>
+ *
+ * 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.
+ *
+ * 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.
+ */
+
+#ifndef __CARL9170_SHARED_HW_H
+#define __CARL9170_SHARED_HW_H
+
+/* High Speed UART */
+#define	AR9170_UART_REG_BASE			0x1c0000
+
+/* Definitions of interrupt registers */
+#define	AR9170_UART_REG_RX_BUFFER		(AR9170_UART_REG_BASE + 0x000)
+#define	AR9170_UART_REG_TX_HOLDING		(AR9170_UART_REG_BASE + 0x004)
+#define	AR9170_UART_REG_FIFO_CONTROL		(AR9170_UART_REG_BASE + 0x010)
+#define		AR9170_UART_FIFO_CTRL_RESET_RX_FIFO	0x02
+#define		AR9170_UART_FIFO_CTRL_RESET_TX_FIFO	0x04
+
+#define	AR9170_UART_REG_LINE_CONTROL		(AR9170_UART_REG_BASE + 0x014)
+#define	AR9170_UART_REG_MODEM_CONTROL		(AR9170_UART_REG_BASE + 0x018)
+#define		AR9170_UART_MODEM_CTRL_DTR_BIT		0x01
+#define		AR9170_UART_MODEM_CTRL_RTS_BIT		0x02
+#define		AR9170_UART_MODEM_CTRL_INTERNAL_LOOP_BACK	0x10
+#define		AR9170_UART_MODEM_CTRL_AUTO_RTS		0x20
+#define		AR9170_UART_MODEM_CTRL_AUTO_CTR		0x40
+
+#define	AR9170_UART_REG_LINE_STATUS		(AR9170_UART_REG_BASE + 0x01c)
+#define		AR9170_UART_LINE_STS_RX_DATA_READY	0x01
+#define		AR9170_UART_LINE_STS_RX_BUFFER_OVERRUN	0x02
+#define		AR9170_UART_LINE_STS_RX_BREAK_IND	0x10
+#define		AR9170_UART_LINE_STS_TX_FIFO_NEAR_EMPTY	0x20
+#define		AR9170_UART_LINE_STS_TRANSMITTER_EMPTY	0x40
+
+#define	AR9170_UART_REG_MODEM_STATUS		(AR9170_UART_REG_BASE + 0x020)
+#define		AR9170_UART_MODEM_STS_CTS_CHANGE	0x01
+#define		AR9170_UART_MODEM_STS_DSR_CHANGE	0x02
+#define		AR9170_UART_MODEM_STS_DCD_CHANGE	0x08
+#define		AR9170_UART_MODEM_STS_CTS_COMPL		0x10
+#define		AR9170_UART_MODEM_STS_DSR_COMPL		0x20
+#define		AR9170_UART_MODEM_STS_DCD_COMPL		0x80
+
+#define	AR9170_UART_REG_SCRATCH			(AR9170_UART_REG_BASE + 0x024)
+#define	AR9170_UART_REG_DIVISOR_LSB		(AR9170_UART_REG_BASE + 0x028)
+#define	AR9170_UART_REG_DIVISOR_MSB		(AR9170_UART_REG_BASE + 0x02c)
+#define	AR9170_UART_REG_WORD_RX_BUFFER		(AR9170_UART_REG_BASE + 0x034)
+#define	AR9170_UART_REG_WORD_TX_HOLDING		(AR9170_UART_REG_BASE + 0x038)
+#define	AR9170_UART_REG_FIFO_COUNT		(AR9170_UART_REG_BASE + 0x03c)
+#define	AR9170_UART_REG_REMAINDER		(AR9170_UART_REG_BASE + 0x04c)
+
+/* Timer */
+#define	AR9170_TIMER_REG_BASE			0x1c1000
+
+#define	AR9170_TIMER_REG_WATCH_DOG		(AR9170_TIMER_REG_BASE + 0x000)
+#define	AR9170_TIMER_REG_TIMER0			(AR9170_TIMER_REG_BASE + 0x010)
+#define	AR9170_TIMER_REG_TIMER1			(AR9170_TIMER_REG_BASE + 0x014)
+#define	AR9170_TIMER_REG_TIMER2			(AR9170_TIMER_REG_BASE + 0x018)
+#define	AR9170_TIMER_REG_TIMER3			(AR9170_TIMER_REG_BASE + 0x01c)
+#define	AR9170_TIMER_REG_TIMER4			(AR9170_TIMER_REG_BASE + 0x020)
+#define	AR9170_TIMER_REG_CONTROL		(AR9170_TIMER_REG_BASE + 0x024)
+#define		AR9170_TIMER_CTRL_DISABLE_CLOCK		0x100
+
+#define	AR9170_TIMER_REG_INTERRUPT		(AR9170_TIMER_REG_BASE + 0x028)
+#define		AR9170_TIMER_INT_TIMER0			0x001
+#define		AR9170_TIMER_INT_TIMER1			0x002
+#define		AR9170_TIMER_INT_TIMER2			0x004
+#define		AR9170_TIMER_INT_TIMER3			0x008
+#define		AR9170_TIMER_INT_TIMER4			0x010
+#define		AR9170_TIMER_INT_TICK_TIMER		0x100
+
+#define	AR9170_TIMER_REG_TICK_TIMER		(AR9170_TIMER_REG_BASE + 0x030)
+#define	AR9170_TIMER_REG_CLOCK_LOW		(AR9170_TIMER_REG_BASE + 0x040)
+#define	AR9170_TIMER_REG_CLOCK_HIGH		(AR9170_TIMER_REG_BASE + 0x044)
+
+#define	AR9170_MAC_REG_BASE			0x1c3000
+
+#define	AR9170_MAC_REG_POWER_STATE_CTRL		(AR9170_MAC_REG_BASE + 0x500)
+#define		AR9170_MAC_POWER_STATE_CTRL_RESET	0x20
+
+#define	AR9170_MAC_REG_MAC_POWER_STATE_CTRL	(AR9170_MAC_REG_BASE + 0x50c)
+
+#define	AR9170_MAC_REG_INT_CTRL			(AR9170_MAC_REG_BASE + 0x510)
+#define		AR9170_MAC_INT_TXC			BIT(0)
+#define		AR9170_MAC_INT_RXC			BIT(1)
+#define		AR9170_MAC_INT_RETRY_FAIL		BIT(2)
+#define		AR9170_MAC_INT_WAKEUP			BIT(3)
+#define		AR9170_MAC_INT_ATIM			BIT(4)
+#define		AR9170_MAC_INT_DTIM			BIT(5)
+#define		AR9170_MAC_INT_CFG_BCN			BIT(6)
+#define		AR9170_MAC_INT_ABORT			BIT(7)
+#define		AR9170_MAC_INT_QOS			BIT(8)
+#define		AR9170_MAC_INT_MIMO_PS			BIT(9)
+#define		AR9170_MAC_INT_KEY_GEN			BIT(10)
+#define		AR9170_MAC_INT_DECRY_NOUSER		BIT(11)
+#define		AR9170_MAC_INT_RADAR			BIT(12)
+#define		AR9170_MAC_INT_QUIET_FRAME		BIT(13)
+#define		AR9170_MAC_INT_PRETBTT			BIT(14)
+
+#define	AR9170_MAC_REG_TSF_L			(AR9170_MAC_REG_BASE + 0x514)
+#define	AR9170_MAC_REG_TSF_H			(AR9170_MAC_REG_BASE + 0x518)
+
+#define	AR9170_MAC_REG_ATIM_WINDOW		(AR9170_MAC_REG_BASE + 0x51c)
+#define		AR9170_MAC_ATIM_PERIOD_S		0
+#define		AR9170_MAC_ATIM_PERIOD			0x0000ffff
+
+#define	AR9170_MAC_REG_BCN_PERIOD		(AR9170_MAC_REG_BASE + 0x520)
+#define		AR9170_MAC_BCN_PERIOD_S			0
+#define		AR9170_MAC_BCN_PERIOD			0x0000ffff
+#define		AR9170_MAC_BCN_DTIM_S			16
+#define		AR9170_MAC_BCN_DTIM			0x00ff0000
+#define		AR9170_MAC_BCN_AP_MODE			BIT(24)
+#define		AR9170_MAC_BCN_IBSS_MODE		BIT(25)
+#define		AR9170_MAC_BCN_PWR_MGT			BIT(26)
+#define		AR9170_MAC_BCN_STA_PS			BIT(27)
+
+#define	AR9170_MAC_REG_PRETBTT			(AR9170_MAC_REG_BASE + 0x524)
+#define		AR9170_MAC_PRETBTT_S			0
+#define		AR9170_MAC_PRETBTT			0x0000ffff
+#define		AR9170_MAC_PRETBTT2_S			16
+#define		AR9170_MAC_PRETBTT2			0xffff0000
+
+#define	AR9170_MAC_REG_MAC_ADDR_L		(AR9170_MAC_REG_BASE + 0x610)
+#define	AR9170_MAC_REG_MAC_ADDR_H		(AR9170_MAC_REG_BASE + 0x614)
+#define	AR9170_MAC_REG_BSSID_L			(AR9170_MAC_REG_BASE + 0x618)
+#define	AR9170_MAC_REG_BSSID_H			(AR9170_MAC_REG_BASE + 0x61c)
+
+#define	AR9170_MAC_REG_GROUP_HASH_TBL_L		(AR9170_MAC_REG_BASE + 0x624)
+#define	AR9170_MAC_REG_GROUP_HASH_TBL_H		(AR9170_MAC_REG_BASE + 0x628)
+
+#define	AR9170_MAC_REG_RX_TIMEOUT		(AR9170_MAC_REG_BASE + 0x62c)
+
+#define	AR9170_MAC_REG_BASIC_RATE		(AR9170_MAC_REG_BASE + 0x630)
+#define	AR9170_MAC_REG_MANDATORY_RATE		(AR9170_MAC_REG_BASE + 0x634)
+#define	AR9170_MAC_REG_RTS_CTS_RATE		(AR9170_MAC_REG_BASE + 0x638)
+#define	AR9170_MAC_REG_BACKOFF_PROTECT		(AR9170_MAC_REG_BASE + 0x63c)
+#define	AR9170_MAC_REG_RX_THRESHOLD		(AR9170_MAC_REG_BASE + 0x640)
+#define	AR9170_MAC_REG_AFTER_PNP		(AR9170_MAC_REG_BASE + 0x648)
+#define	AR9170_MAC_REG_RX_PE_DELAY		(AR9170_MAC_REG_BASE + 0x64c)
+
+#define	AR9170_MAC_REG_DYNAMIC_SIFS_ACK		(AR9170_MAC_REG_BASE + 0x658)
+#define	AR9170_MAC_REG_SNIFFER			(AR9170_MAC_REG_BASE + 0x674)
+#define		AR9170_MAC_SNIFFER_ENABLE_PROMISC	BIT(0)
+#define		AR9170_MAC_SNIFFER_DEFAULTS		0x02000000
+#define	AR9170_MAC_REG_ENCRYPTION		(AR9170_MAC_REG_BASE + 0x678)
+#define		AR9170_MAC_ENCRYPTION_MGMT_RX_SOFTWARE	BIT(2)
+#define		AR9170_MAC_ENCRYPTION_RX_SOFTWARE	BIT(3)
+#define		AR9170_MAC_ENCRYPTION_DEFAULTS		0x70
+
+#define	AR9170_MAC_REG_MISC_680			(AR9170_MAC_REG_BASE + 0x680)
+#define	AR9170_MAC_REG_MISC_684			(AR9170_MAC_REG_BASE + 0x684)
+#define	AR9170_MAC_REG_TX_UNDERRUN		(AR9170_MAC_REG_BASE + 0x688)
+
+#define	AR9170_MAC_REG_FRAMETYPE_FILTER		(AR9170_MAC_REG_BASE + 0x68c)
+#define		AR9170_MAC_FTF_ASSOC_REQ		BIT(0)
+#define		AR9170_MAC_FTF_ASSOC_RESP		BIT(1)
+#define		AR9170_MAC_FTF_REASSOC_REQ		BIT(2)
+#define		AR9170_MAC_FTF_REASSOC_RESP		BIT(3)
+#define		AR9170_MAC_FTF_PRB_REQ			BIT(4)
+#define		AR9170_MAC_FTF_PRB_RESP			BIT(5)
+#define		AR9170_MAC_FTF_BIT6			BIT(6)
+#define		AR9170_MAC_FTF_BIT7			BIT(7)
+#define		AR9170_MAC_FTF_BEACON			BIT(8)
+#define		AR9170_MAC_FTF_ATIM			BIT(9)
+#define		AR9170_MAC_FTF_DEASSOC			BIT(10)
+#define		AR9170_MAC_FTF_AUTH			BIT(11)
+#define		AR9170_MAC_FTF_DEAUTH			BIT(12)
+#define		AR9170_MAC_FTF_BIT13			BIT(13)
+#define		AR9170_MAC_FTF_BIT14			BIT(14)
+#define		AR9170_MAC_FTF_BIT15			BIT(15)
+#define		AR9170_MAC_FTF_BAR			BIT(24)
+#define		AR9170_MAC_FTF_BA			BIT(25)
+#define		AR9170_MAC_FTF_PSPOLL			BIT(26)
+#define		AR9170_MAC_FTF_RTS			BIT(27)
+#define		AR9170_MAC_FTF_CTS			BIT(28)
+#define		AR9170_MAC_FTF_ACK			BIT(29)
+#define		AR9170_MAC_FTF_CFE			BIT(30)
+#define		AR9170_MAC_FTF_CFE_ACK			BIT(31)
+#define		AR9170_MAC_FTF_DEFAULTS			0x0500ffff
+#define		AR9170_MAC_FTF_MONITOR			0xff00ffff
+
+#define	AR9170_MAC_REG_ACK_EXTENSION		(AR9170_MAC_REG_BASE + 0x690)
+#define	AR9170_MAC_REG_ACK_TPC			(AR9170_MAC_REG_BASE + 0x694)
+#define	AR9170_MAC_REG_EIFS_AND_SIFS		(AR9170_MAC_REG_BASE + 0x698)
+#define	AR9170_MAC_REG_RX_TIMEOUT_COUNT		(AR9170_MAC_REG_BASE + 0x69c)
+#define	AR9170_MAC_REG_RX_TOTAL			(AR9170_MAC_REG_BASE + 0x6a0)
+#define	AR9170_MAC_REG_RX_CRC32			(AR9170_MAC_REG_BASE + 0x6a4)
+#define	AR9170_MAC_REG_RX_CRC16			(AR9170_MAC_REG_BASE + 0x6a8)
+#define	AR9170_MAC_REG_RX_ERR_DECRYPTION_UNI	(AR9170_MAC_REG_BASE + 0x6ac)
+#define	AR9170_MAC_REG_RX_OVERRUN		(AR9170_MAC_REG_BASE + 0x6b0)
+#define	AR9170_MAC_REG_RX_ERR_DECRYPTION_MUL	(AR9170_MAC_REG_BASE + 0x6bc)
+#define AR9170_MAC_REG_TX_BLOCKACKS		(AR9170_MAC_REG_BASE + 0x6c0)
+#define AR9170_MAC_REG_NAV_COUNT		(AR9170_MAC_REG_BASE + 0x6c4)
+#define AR9170_MAC_REG_BACKOFF_STATUS		(AR9170_MAC_REG_BASE + 0x6c8)
+#define		AR9170_MAC_BACKOFF_CCA			BIT(24)
+#define		AR9170_MAC_BACKOFF_TX_PEX		BIT(25)
+#define		AR9170_MAC_BACKOFF_RX_PE		BIT(26)
+#define		AR9170_MAC_BACKOFF_MD_READY		BIT(27)
+#define		AR9170_MAC_BACKOFF_TX_PE		BIT(28)
+
+#define	AR9170_MAC_REG_TX_RETRY			(AR9170_MAC_REG_BASE + 0x6cc)
+
+#define AR9170_MAC_REG_TX_COMPLETE		(AR9170_MAC_REG_BASE + 0x6d4)
+
+#define	AR9170_MAC_REG_CHANNEL_BUSY		(AR9170_MAC_REG_BASE + 0x6e8)
+#define	AR9170_MAC_REG_EXT_BUSY			(AR9170_MAC_REG_BASE + 0x6ec)
+
+#define	AR9170_MAC_REG_SLOT_TIME		(AR9170_MAC_REG_BASE + 0x6f0)
+#define	AR9170_MAC_REG_TX_TOTAL			(AR9170_MAC_REG_BASE + 0x6f4)
+#define AR9170_MAC_REG_ACK_FC			(AR9170_MAC_REG_BASE + 0x6f8)
+
+#define	AR9170_MAC_REG_CAM_MODE			(AR9170_MAC_REG_BASE + 0x700)
+#define		AR9170_MAC_CAM_IBSS			0xe0
+#define		AR9170_MAC_CAM_AP			0xa1
+#define		AR9170_MAC_CAM_STA			0x2
+#define		AR9170_MAC_CAM_AP_WDS			0x3
+#define		AR9170_MAC_CAM_DEFAULTS			(0xf << 24)
+#define		AR9170_MAC_CAM_HOST_PENDING		0x80000000
+
+#define	AR9170_MAC_REG_CAM_ROLL_CALL_TBL_L	(AR9170_MAC_REG_BASE + 0x704)
+#define	AR9170_MAC_REG_CAM_ROLL_CALL_TBL_H	(AR9170_MAC_REG_BASE + 0x708)
+
+#define	AR9170_MAC_REG_CAM_ADDR			(AR9170_MAC_REG_BASE + 0x70c)
+#define		AR9170_MAC_CAM_ADDR_WRITE		0x80000000
+#define	AR9170_MAC_REG_CAM_DATA0		(AR9170_MAC_REG_BASE + 0x720)
+#define	AR9170_MAC_REG_CAM_DATA1		(AR9170_MAC_REG_BASE + 0x724)
+#define	AR9170_MAC_REG_CAM_DATA2		(AR9170_MAC_REG_BASE + 0x728)
+#define	AR9170_MAC_REG_CAM_DATA3		(AR9170_MAC_REG_BASE + 0x72c)
+
+#define	AR9170_MAC_REG_CAM_DBG0			(AR9170_MAC_REG_BASE + 0x730)
+#define	AR9170_MAC_REG_CAM_DBG1			(AR9170_MAC_REG_BASE + 0x734)
+#define	AR9170_MAC_REG_CAM_DBG2			(AR9170_MAC_REG_BASE + 0x738)
+#define	AR9170_MAC_REG_CAM_STATE		(AR9170_MAC_REG_BASE + 0x73c)
+#define		AR9170_MAC_CAM_STATE_READ_PENDING	0x40000000
+#define		AR9170_MAC_CAM_STATE_WRITE_PENDING	0x80000000
+
+#define	AR9170_MAC_REG_CAM_TXKEY		(AR9170_MAC_REG_BASE + 0x740)
+#define	AR9170_MAC_REG_CAM_RXKEY		(AR9170_MAC_REG_BASE + 0x750)
+
+#define	AR9170_MAC_REG_CAM_TX_ENC_TYPE		(AR9170_MAC_REG_BASE + 0x760)
+#define	AR9170_MAC_REG_CAM_RX_ENC_TYPE		(AR9170_MAC_REG_BASE + 0x770)
+#define	AR9170_MAC_REG_CAM_TX_SERACH_HIT	(AR9170_MAC_REG_BASE + 0x780)
+#define	AR9170_MAC_REG_CAM_RX_SERACH_HIT	(AR9170_MAC_REG_BASE + 0x790)
+
+#define	AR9170_MAC_REG_AC0_CW			(AR9170_MAC_REG_BASE + 0xb00)
+#define	AR9170_MAC_REG_AC1_CW			(AR9170_MAC_REG_BASE + 0xb04)
+#define	AR9170_MAC_REG_AC2_CW			(AR9170_MAC_REG_BASE + 0xb08)
+#define	AR9170_MAC_REG_AC3_CW			(AR9170_MAC_REG_BASE + 0xb0c)
+#define	AR9170_MAC_REG_AC4_CW			(AR9170_MAC_REG_BASE + 0xb10)
+#define	AR9170_MAC_REG_AC2_AC1_AC0_AIFS		(AR9170_MAC_REG_BASE + 0xb14)
+#define	AR9170_MAC_REG_AC4_AC3_AC2_AIFS		(AR9170_MAC_REG_BASE + 0xb18)
+#define AR9170_MAC_REG_TXOP_ACK_EXTENSION	(AR9170_MAC_REG_BASE + 0xb1c)
+#define AR9170_MAC_REG_TXOP_ACK_INTERVAL	(AR9170_MAC_REG_BASE + 0xb20)
+#define AR9170_MAC_REG_CONTENTION_POINT		(AR9170_MAC_REG_BASE + 0xb24)
+#define	AR9170_MAC_REG_RETRY_MAX		(AR9170_MAC_REG_BASE + 0xb28)
+#define AR9170_MAC_REG_TID_CFACK_CFEND_RATE	(AR9170_MAC_REG_BASE + 0xb2c)
+#define	AR9170_MAC_REG_TXOP_NOT_ENOUGH_IND	(AR9170_MAC_REG_BASE + 0xb30)
+#define AR9170_MAC_REG_TKIP_TSC			(AR9170_MAC_REG_BASE + 0xb34)
+#define AR9170_MAC_REG_TXOP_DURATION		(AR9170_MAC_REG_BASE + 0xb38)
+#define AR9170_MAC_REG_TX_QOS_THRESHOLD		(AR9170_MAC_REG_BASE + 0xb3c)
+#define	AR9170_MAC_REG_QOS_PRIORITY_VIRTUAL_CCA	(AR9170_MAC_REG_BASE + 0xb40)
+#define		AR9170_MAC_VIRTUAL_CCA_Q0		BIT(15)
+#define		AR9170_MAC_VIRTUAL_CCA_Q1		BIT(16)
+#define		AR9170_MAC_VIRTUAL_CCA_Q2		BIT(17)
+#define		AR9170_MAC_VIRTUAL_CCA_Q3		BIT(18)
+#define		AR9170_MAC_VIRTUAL_CCA_Q4		BIT(19)
+#define		AR9170_MAC_VIRTUAL_CCA_ALL		(0xf8000)
+
+#define	AR9170_MAC_REG_AC1_AC0_TXOP		(AR9170_MAC_REG_BASE + 0xb44)
+#define	AR9170_MAC_REG_AC3_AC2_TXOP		(AR9170_MAC_REG_BASE + 0xb48)
+
+#define	AR9170_MAC_REG_AMPDU_COUNT		(AR9170_MAC_REG_BASE + 0xb88)
+#define	AR9170_MAC_REG_MPDU_COUNT		(AR9170_MAC_REG_BASE + 0xb8c)
+
+#define	AR9170_MAC_REG_AMPDU_FACTOR		(AR9170_MAC_REG_BASE + 0xb9c)
+#define		AR9170_MAC_AMPDU_FACTOR			0x7f0000
+#define		AR9170_MAC_AMPDU_FACTOR_S		16
+#define	AR9170_MAC_REG_AMPDU_DENSITY		(AR9170_MAC_REG_BASE + 0xba0)
+#define		AR9170_MAC_AMPDU_DENSITY		0x7
+#define		AR9170_MAC_AMPDU_DENSITY_S		0
+
+#define	AR9170_MAC_REG_FCS_SELECT		(AR9170_MAC_REG_BASE + 0xbb0)
+#define		AR9170_MAC_FCS_SWFCS			0x1
+#define		AR9170_MAC_FCS_FIFO_PROT		0x4
+
+#define	AR9170_MAC_REG_RTS_CTS_TPC		(AR9170_MAC_REG_BASE + 0xbb4)
+#define AR9170_MAC_REG_CFEND_QOSNULL_TPC	(AR9170_MAC_REG_BASE + 0xbb8)
+
+#define	AR9170_MAC_REG_ACK_TABLE		(AR9170_MAC_REG_BASE + 0xc00)
+#define AR9170_MAC_REG_RX_CONTROL		(AR9170_MAC_REG_BASE + 0xc40)
+#define		AR9170_MAC_RX_CTRL_DEAGG		0x1
+#define		AR9170_MAC_RX_CTRL_SHORT_FILTER		0x2
+#define		AR9170_MAC_RX_CTRL_SA_DA_SEARCH		0x20
+#define		AR9170_MAC_RX_CTRL_PASS_TO_HOST		BIT(28)
+#define		AR9170_MAC_RX_CTRL_ACK_IN_SNIFFER	BIT(30)
+
+#define AR9170_MAC_REG_RX_CONTROL_1		(AR9170_MAC_REG_BASE + 0xc44)
+
+#define	AR9170_MAC_REG_AMPDU_RX_THRESH		(AR9170_MAC_REG_BASE + 0xc50)
+
+#define	AR9170_MAC_REG_RX_MPDU			(AR9170_MAC_REG_BASE + 0xca0)
+#define	AR9170_MAC_REG_RX_DROPPED_MPDU		(AR9170_MAC_REG_BASE + 0xca4)
+#define	AR9170_MAC_REG_RX_DEL_MPDU		(AR9170_MAC_REG_BASE + 0xca8)
+#define	AR9170_MAC_REG_RX_PHY_MISC_ERROR	(AR9170_MAC_REG_BASE + 0xcac)
+#define	AR9170_MAC_REG_RX_PHY_XR_ERROR		(AR9170_MAC_REG_BASE + 0xcb0)
+#define	AR9170_MAC_REG_RX_PHY_OFDM_ERROR	(AR9170_MAC_REG_BASE + 0xcb4)
+#define	AR9170_MAC_REG_RX_PHY_CCK_ERROR		(AR9170_MAC_REG_BASE + 0xcb8)
+#define	AR9170_MAC_REG_RX_PHY_HT_ERROR		(AR9170_MAC_REG_BASE + 0xcbc)
+#define	AR9170_MAC_REG_RX_PHY_TOTAL		(AR9170_MAC_REG_BASE + 0xcc0)
+
+#define	AR9170_MAC_REG_DMA_TXQ_ADDR		(AR9170_MAC_REG_BASE + 0xd00)
+#define	AR9170_MAC_REG_DMA_TXQ_CURR_ADDR	(AR9170_MAC_REG_BASE + 0xd04)
+#define	AR9170_MAC_REG_DMA_TXQ0_ADDR		(AR9170_MAC_REG_BASE + 0xd00)
+#define	AR9170_MAC_REG_DMA_TXQ0_CURR_ADDR	(AR9170_MAC_REG_BASE + 0xd04)
+#define	AR9170_MAC_REG_DMA_TXQ1_ADDR		(AR9170_MAC_REG_BASE + 0xd08)
+#define	AR9170_MAC_REG_DMA_TXQ1_CURR_ADDR	(AR9170_MAC_REG_BASE + 0xd0c)
+#define	AR9170_MAC_REG_DMA_TXQ2_ADDR		(AR9170_MAC_REG_BASE + 0xd10)
+#define	AR9170_MAC_REG_DMA_TXQ2_CURR_ADDR	(AR9170_MAC_REG_BASE + 0xd14)
+#define	AR9170_MAC_REG_DMA_TXQ3_ADDR		(AR9170_MAC_REG_BASE + 0xd18)
+#define	AR9170_MAC_REG_DMA_TXQ3_CURR_ADDR	(AR9170_MAC_REG_BASE + 0xd1c)
+#define	AR9170_MAC_REG_DMA_TXQ4_ADDR		(AR9170_MAC_REG_BASE + 0xd20)
+#define	AR9170_MAC_REG_DMA_TXQ4_CURR_ADDR	(AR9170_MAC_REG_BASE + 0xd24)
+#define	AR9170_MAC_REG_DMA_RXQ_ADDR		(AR9170_MAC_REG_BASE + 0xd28)
+#define	AR9170_MAC_REG_DMA_RXQ_CURR_ADDR	(AR9170_MAC_REG_BASE + 0xd2c)
+
+#define	AR9170_MAC_REG_DMA_TRIGGER		(AR9170_MAC_REG_BASE + 0xd30)
+#define		AR9170_DMA_TRIGGER_TXQ0			BIT(0)
+#define		AR9170_DMA_TRIGGER_TXQ1			BIT(1)
+#define		AR9170_DMA_TRIGGER_TXQ2			BIT(2)
+#define		AR9170_DMA_TRIGGER_TXQ3			BIT(3)
+#define		AR9170_DMA_TRIGGER_TXQ4			BIT(4)
+#define		AR9170_DMA_TRIGGER_RXQ			BIT(8)
+
+#define AR9170_MAC_REG_DMA_WLAN_STATUS		(AR9170_MAC_REG_BASE + 0xd38)
+#define	AR9170_MAC_REG_DMA_STATUS		(AR9170_MAC_REG_BASE + 0xd3c)
+#define AR9170_MAC_REG_DMA_TXQ_LAST_ADDR	(AR9170_MAC_REG_BASE + 0xd40)
+#define	AR9170_MAC_REG_DMA_TXQ0_LAST_ADDR	(AR9170_MAC_REG_BASE + 0xd40)
+#define	AR9170_MAC_REG_DMA_TXQ1_LAST_ADDR	(AR9170_MAC_REG_BASE + 0xd44)
+#define	AR9170_MAC_REG_DMA_TXQ2_LAST_ADDR	(AR9170_MAC_REG_BASE + 0xd48)
+#define	AR9170_MAC_REG_DMA_TXQ3_LAST_ADDR	(AR9170_MAC_REG_BASE + 0xd4c)
+#define	AR9170_MAC_REG_DMA_TXQ4_LAST_ADDR	(AR9170_MAC_REG_BASE + 0xd50)
+#define	AR9170_MAC_REG_DMA_TXQ0Q1_LEN		(AR9170_MAC_REG_BASE + 0xd54)
+#define	AR9170_MAC_REG_DMA_TXQ2Q3_LEN		(AR9170_MAC_REG_BASE + 0xd58)
+#define	AR9170_MAC_REG_DMA_TXQ4_LEN		(AR9170_MAC_REG_BASE + 0xd5c)
+
+#define AR9170_MAC_REG_DMA_TXQX_LAST_ADDR	(AR9170_MAC_REG_BASE + 0xd74)
+#define AR9170_MAC_REG_DMA_TXQX_FAIL_ADDR	(AR9170_MAC_REG_BASE + 0xd78)
+#define	AR9170_MAC_REG_TXRX_MPI			(AR9170_MAC_REG_BASE + 0xd7c)
+#define		AR9170_MAC_TXRX_MPI_TX_MPI_MASK		0x0000000f
+#define		AR9170_MAC_TXRX_MPI_TX_TO_MASK		0x0000fff0
+#define		AR9170_MAC_TXRX_MPI_RX_MPI_MASK		0x000f0000
+#define		AR9170_MAC_TXRX_MPI_RX_TO_MASK		0xfff00000
+
+#define	AR9170_MAC_REG_BCN_ADDR			(AR9170_MAC_REG_BASE + 0xd84)
+#define	AR9170_MAC_REG_BCN_LENGTH		(AR9170_MAC_REG_BASE + 0xd88)
+#define		AR9170_MAC_BCN_LENGTH_MAX		256
+
+#define AR9170_MAC_REG_BCN_STATUS		(AR9170_MAC_REG_BASE + 0xd8c)
+
+#define	AR9170_MAC_REG_BCN_PLCP			(AR9170_MAC_REG_BASE + 0xd90)
+#define	AR9170_MAC_REG_BCN_CTRL			(AR9170_MAC_REG_BASE + 0xd94)
+#define		AR9170_BCN_CTRL_READY			0x01
+#define		AR9170_BCN_CTRL_LOCK			0x02
+
+#define AR9170_MAC_REG_BCN_CURR_ADDR		(AR9170_MAC_REG_BASE + 0xd98)
+#define	AR9170_MAC_REG_BCN_COUNT		(AR9170_MAC_REG_BASE + 0xd9c)
+#define	AR9170_MAC_REG_BCN_HT1			(AR9170_MAC_REG_BASE + 0xda0)
+#define		AR9170_MAC_BCN_HT1_HT_EN		BIT(0)
+#define		AR9170_MAC_BCN_HT1_GF_PMB		BIT(1)
+#define		AR9170_MAC_BCN_HT1_SP_EXP		BIT(2)
+#define		AR9170_MAC_BCN_HT1_TX_BF		BIT(3)
+#define		AR9170_MAC_BCN_HT1_PWR_CTRL_S		4
+#define		AR9170_MAC_BCN_HT1_PWR_CTRL		0x70
+#define		AR9170_MAC_BCN_HT1_TX_ANT1		BIT(7)
+#define		AR9170_MAC_BCN_HT1_TX_ANT0		BIT(8)
+#define		AR9170_MAC_BCN_HT1_NUM_LFT_S		9
+#define		AR9170_MAC_BCN_HT1_NUM_LFT		0x600
+#define		AR9170_MAC_BCN_HT1_BWC_20M_EXT		BIT(16)
+#define		AR9170_MAC_BCN_HT1_BWC_40M_SHARED	BIT(17)
+#define		AR9170_MAC_BCN_HT1_BWC_40M_DUP		(BIT(16) | BIT(17))
+#define		AR9170_MAC_BCN_HT1_BF_MCS_S		18
+#define		AR9170_MAC_BCN_HT1_BF_MCS		0x1c0000
+#define		AR9170_MAC_BCN_HT1_TPC_S		21
+#define		AR9170_MAC_BCN_HT1_TPC			0x7e00000
+#define		AR9170_MAC_BCN_HT1_CHAIN_MASK_S		27
+#define		AR9170_MAC_BCN_HT1_CHAIN_MASK		0x38000000
+
+#define	AR9170_MAC_REG_BCN_HT2			(AR9170_MAC_REG_BASE + 0xda4)
+#define		AR9170_MAC_BCN_HT2_MCS_S		0
+#define		AR9170_MAC_BCN_HT2_MCS			0x7f
+#define		AR9170_MAC_BCN_HT2_BW40			BIT(8)
+#define		AR9170_MAC_BCN_HT2_SMOOTHING		BIT(9)
+#define		AR9170_MAC_BCN_HT2_SS			BIT(10)
+#define		AR9170_MAC_BCN_HT2_NSS			BIT(11)
+#define		AR9170_MAC_BCN_HT2_STBC_S		12
+#define		AR9170_MAC_BCN_HT2_STBC			0x3000
+#define		AR9170_MAC_BCN_HT2_ADV_COD		BIT(14)
+#define		AR9170_MAC_BCN_HT2_SGI			BIT(15)
+#define		AR9170_MAC_BCN_HT2_LEN_S		16
+#define		AR9170_MAC_BCN_HT2_LEN			0xffff0000
+
+#define	AR9170_MAC_REG_DMA_TXQX_ADDR_CURR	(AR9170_MAC_REG_BASE + 0xdc0)
+
+/* Random number generator */
+#define	AR9170_RAND_REG_BASE			0x1d0000
+
+#define	AR9170_RAND_REG_NUM			(AR9170_RAND_REG_BASE + 0x000)
+#define	AR9170_RAND_REG_MODE			(AR9170_RAND_REG_BASE + 0x004)
+#define		AR9170_RAND_MODE_MANUAL			0x000
+#define		AR9170_RAND_MODE_FREE			0x001
+
+/* GPIO */
+#define	AR9170_GPIO_REG_BASE			0x1d0100
+#define	AR9170_GPIO_REG_PORT_TYPE		(AR9170_GPIO_REG_BASE + 0x000)
+#define	AR9170_GPIO_REG_PORT_DATA		(AR9170_GPIO_REG_BASE + 0x004)
+#define		AR9170_GPIO_PORT_LED_0			1
+#define		AR9170_GPIO_PORT_LED_1			2
+/* WPS Button GPIO for TP-Link TL-WN821N */
+#define		AR9170_GPIO_PORT_WPS_BUTTON_PRESSED	4
+
+/* Memory Controller */
+#define	AR9170_MC_REG_BASE			0x1d1000
+
+#define	AR9170_MC_REG_FLASH_WAIT_STATE		(AR9170_MC_REG_BASE + 0x000)
+#define	AR9170_MC_REG_SEEPROM_WP0		(AR9170_MC_REG_BASE + 0x400)
+#define	AR9170_MC_REG_SEEPROM_WP1		(AR9170_MC_REG_BASE + 0x404)
+#define	AR9170_MC_REG_SEEPROM_WP2		(AR9170_MC_REG_BASE + 0x408)
+
+/* Interrupt Controller */
+#define	AR9170_MAX_INT_SRC			9
+#define	AR9170_INT_REG_BASE			0x1d2000
+
+#define	AR9170_INT_REG_FLAG			(AR9170_INT_REG_BASE + 0x000)
+#define	AR9170_INT_REG_FIQ_MASK			(AR9170_INT_REG_BASE + 0x004)
+#define	AR9170_INT_REG_IRQ_MASK			(AR9170_INT_REG_BASE + 0x008)
+/* INT_REG_FLAG, INT_REG_FIQ_MASK and INT_REG_IRQ_MASK */
+#define		AR9170_INT_FLAG_WLAN			0x001
+#define		AR9170_INT_FLAG_PTAB_BIT		0x002
+#define		AR9170_INT_FLAG_SE_BIT			0x004
+#define		AR9170_INT_FLAG_UART_BIT		0x008
+#define		AR9170_INT_FLAG_TIMER_BIT		0x010
+#define		AR9170_INT_FLAG_EXT_BIT			0x020
+#define		AR9170_INT_FLAG_SW_BIT			0x040
+#define		AR9170_INT_FLAG_USB_BIT			0x080
+#define		AR9170_INT_FLAG_ETHERNET_BIT		0x100
+
+#define	AR9170_INT_REG_PRIORITY1		(AR9170_INT_REG_BASE + 0x00c)
+#define	AR9170_INT_REG_PRIORITY2		(AR9170_INT_REG_BASE + 0x010)
+#define	AR9170_INT_REG_PRIORITY3		(AR9170_INT_REG_BASE + 0x014)
+#define	AR9170_INT_REG_EXT_INT_CONTROL		(AR9170_INT_REG_BASE + 0x018)
+#define	AR9170_INT_REG_SW_INT_CONTROL		(AR9170_INT_REG_BASE + 0x01c)
+#define		AR9170_INT_SW_INT_ENABLE		0x1
+
+#define	AR9170_INT_REG_FIQ_ENCODE		(AR9170_INT_REG_BASE + 0x020)
+#define	AR9170_INT_INT_IRQ_ENCODE		(AR9170_INT_REG_BASE + 0x024)
+
+/* Power Management */
+#define	AR9170_PWR_REG_BASE			0x1d4000
+
+#define AR9170_PWR_REG_POWER_STATE		(AR9170_PWR_REG_BASE + 0x000)
+
+#define	AR9170_PWR_REG_RESET			(AR9170_PWR_REG_BASE + 0x004)
+#define		AR9170_PWR_RESET_COMMIT_RESET_MASK	BIT(0)
+#define		AR9170_PWR_RESET_WLAN_MASK		BIT(1)
+#define		AR9170_PWR_RESET_DMA_MASK		BIT(2)
+#define		AR9170_PWR_RESET_BRIDGE_MASK		BIT(3)
+#define		AR9170_PWR_RESET_AHB_MASK		BIT(9)
+#define		AR9170_PWR_RESET_BB_WARM_RESET		BIT(10)
+#define		AR9170_PWR_RESET_BB_COLD_RESET		BIT(11)
+#define		AR9170_PWR_RESET_ADDA_CLK_COLD_RESET	BIT(12)
+#define		AR9170_PWR_RESET_PLL			BIT(13)
+#define		AR9170_PWR_RESET_USB_PLL		BIT(14)
+
+#define	AR9170_PWR_REG_CLOCK_SEL		(AR9170_PWR_REG_BASE + 0x008)
+#define		AR9170_PWR_CLK_AHB_40MHZ		0
+#define		AR9170_PWR_CLK_AHB_20_22MHZ		1
+#define		AR9170_PWR_CLK_AHB_40_44MHZ		2
+#define		AR9170_PWR_CLK_AHB_80_88MHZ		3
+#define		AR9170_PWR_CLK_DAC_160_INV_DLY		0x70
+
+#define	AR9170_PWR_REG_CHIP_REVISION		(AR9170_PWR_REG_BASE + 0x010)
+#define AR9170_PWR_REG_PLL_ADDAC		(AR9170_PWR_REG_BASE + 0x014)
+#define		AR9170_PWR_PLL_ADDAC_DIV_S		2
+#define		AR9170_PWR_PLL_ADDAC_DIV		0xffc
+#define	AR9170_PWR_REG_WATCH_DOG_MAGIC		(AR9170_PWR_REG_BASE + 0x020)
+
+/* Faraday USB Controller */
+#define	AR9170_USB_REG_BASE			0x1e1000
+
+#define	AR9170_USB_REG_MAIN_CTRL		(AR9170_USB_REG_BASE + 0x000)
+#define		AR9170_USB_MAIN_CTRL_REMOTE_WAKEUP	BIT(0)
+#define		AR9170_USB_MAIN_CTRL_ENABLE_GLOBAL_INT	BIT(2)
+#define		AR9170_USB_MAIN_CTRL_GO_TO_SUSPEND	BIT(3)
+#define		AR9170_USB_MAIN_CTRL_RESET		BIT(4)
+#define		AR9170_USB_MAIN_CTRL_CHIP_ENABLE	BIT(5)
+#define		AR9170_USB_MAIN_CTRL_HIGHSPEED		BIT(6)
+
+#define	AR9170_USB_REG_DEVICE_ADDRESS		(AR9170_USB_REG_BASE + 0x001)
+#define		AR9170_USB_DEVICE_ADDRESS_CONFIGURE	BIT(7)
+
+#define	AR9170_USB_REG_TEST			(AR9170_USB_REG_BASE + 0x002)
+#define	AR9170_USB_REG_PHY_TEST_SELECT		(AR9170_USB_REG_BASE + 0x008)
+#define	AR9170_USB_REG_CX_CONFIG_STATUS		(AR9170_USB_REG_BASE + 0x00b)
+#define	AR9170_USB_REG_EP0_DATA			(AR9170_USB_REG_BASE + 0x00c)
+#define	AR9170_USB_REG_EP0_DATA1		(AR9170_USB_REG_BASE + 0x00c)
+#define	AR9170_USB_REG_EP0_DATA2		(AR9170_USB_REG_BASE + 0x00d)
+
+#define	AR9170_USB_REG_INTR_MASK_BYTE_0		(AR9170_USB_REG_BASE + 0x011)
+#define	AR9170_USB_REG_INTR_MASK_BYTE_1		(AR9170_USB_REG_BASE + 0x012)
+#define	AR9170_USB_REG_INTR_MASK_BYTE_2		(AR9170_USB_REG_BASE + 0x013)
+#define	AR9170_USB_REG_INTR_MASK_BYTE_3		(AR9170_USB_REG_BASE + 0x014)
+#define	AR9170_USB_REG_INTR_MASK_BYTE_4		(AR9170_USB_REG_BASE + 0x015)
+#define		AR9170_USB_INTR_DISABLE_OUT_INT		(BIT(7) | BIT(6))
+
+#define	AR9170_USB_REG_INTR_MASK_BYTE_5		(AR9170_USB_REG_BASE + 0x016)
+#define	AR9170_USB_REG_INTR_MASK_BYTE_6		(AR9170_USB_REG_BASE + 0x017)
+#define		AR9170_USB_INTR_DISABLE_IN_INT		BIT(6)
+
+#define	AR9170_USB_REG_INTR_MASK_BYTE_7		(AR9170_USB_REG_BASE + 0x018)
+
+#define	AR9170_USB_REG_INTR_GROUP		(AR9170_USB_REG_BASE + 0x020)
+
+#define	AR9170_USB_REG_INTR_SOURCE_0		(AR9170_USB_REG_BASE + 0x021)
+#define		AR9170_USB_INTR_SRC0_SETUP		BIT(0)
+#define		AR9170_USB_INTR_SRC0_IN			BIT(1)
+#define		AR9170_USB_INTR_SRC0_OUT		BIT(2)
+#define		AR9170_USB_INTR_SRC0_FAIL		BIT(3) /* ??? */
+#define		AR9170_USB_INTR_SRC0_END		BIT(4) /* ??? */
+#define		AR9170_USB_INTR_SRC0_ABORT		BIT(7)
+
+#define	AR9170_USB_REG_INTR_SOURCE_1		(AR9170_USB_REG_BASE + 0x022)
+#define	AR9170_USB_REG_INTR_SOURCE_2		(AR9170_USB_REG_BASE + 0x023)
+#define	AR9170_USB_REG_INTR_SOURCE_3		(AR9170_USB_REG_BASE + 0x024)
+#define	AR9170_USB_REG_INTR_SOURCE_4		(AR9170_USB_REG_BASE + 0x025)
+#define	AR9170_USB_REG_INTR_SOURCE_5		(AR9170_USB_REG_BASE + 0x026)
+#define	AR9170_USB_REG_INTR_SOURCE_6		(AR9170_USB_REG_BASE + 0x027)
+#define	AR9170_USB_REG_INTR_SOURCE_7		(AR9170_USB_REG_BASE + 0x028)
+#define		AR9170_USB_INTR_SRC7_USB_RESET		BIT(1)
+#define		AR9170_USB_INTR_SRC7_USB_SUSPEND	BIT(2)
+#define		AR9170_USB_INTR_SRC7_USB_RESUME		BIT(3)
+#define		AR9170_USB_INTR_SRC7_ISO_SEQ_ERR	BIT(4)
+#define		AR9170_USB_INTR_SRC7_ISO_SEQ_ABORT	BIT(5)
+#define		AR9170_USB_INTR_SRC7_TX0BYTE		BIT(6)
+#define		AR9170_USB_INTR_SRC7_RX0BYTE		BIT(7)
+
+#define	AR9170_USB_REG_IDLE_COUNT		(AR9170_USB_REG_BASE + 0x02f)
+
+#define	AR9170_USB_REG_EP_MAP			(AR9170_USB_REG_BASE + 0x030)
+#define	AR9170_USB_REG_EP1_MAP			(AR9170_USB_REG_BASE + 0x030)
+#define	AR9170_USB_REG_EP2_MAP			(AR9170_USB_REG_BASE + 0x031)
+#define	AR9170_USB_REG_EP3_MAP			(AR9170_USB_REG_BASE + 0x032)
+#define	AR9170_USB_REG_EP4_MAP			(AR9170_USB_REG_BASE + 0x033)
+#define	AR9170_USB_REG_EP5_MAP			(AR9170_USB_REG_BASE + 0x034)
+#define	AR9170_USB_REG_EP6_MAP			(AR9170_USB_REG_BASE + 0x035)
+#define	AR9170_USB_REG_EP7_MAP			(AR9170_USB_REG_BASE + 0x036)
+#define	AR9170_USB_REG_EP8_MAP			(AR9170_USB_REG_BASE + 0x037)
+#define	AR9170_USB_REG_EP9_MAP			(AR9170_USB_REG_BASE + 0x038)
+#define	AR9170_USB_REG_EP10_MAP			(AR9170_USB_REG_BASE + 0x039)
+
+#define	AR9170_USB_REG_EP_IN_MAX_SIZE_HIGH	(AR9170_USB_REG_BASE + 0x03f)
+#define		AR9170_USB_EP_IN_TOGGLE			0x10
+
+#define	AR9170_USB_REG_EP_IN_MAX_SIZE_LOW	(AR9170_USB_REG_BASE + 0x03e)
+
+#define	AR9170_USB_REG_EP_OUT_MAX_SIZE_HIGH	(AR9170_USB_REG_BASE + 0x05f)
+#define		AR9170_USB_EP_OUT_TOGGLE		0x10
+
+#define	AR9170_USB_REG_EP_OUT_MAX_SIZE_LOW	(AR9170_USB_REG_BASE + 0x05e)
+
+#define	AR9170_USB_REG_EP3_BYTE_COUNT_HIGH	(AR9170_USB_REG_BASE + 0x0ae)
+#define	AR9170_USB_REG_EP3_BYTE_COUNT_LOW	(AR9170_USB_REG_BASE + 0x0be)
+#define	AR9170_USB_REG_EP4_BYTE_COUNT_HIGH	(AR9170_USB_REG_BASE + 0x0af)
+#define	AR9170_USB_REG_EP4_BYTE_COUNT_LOW	(AR9170_USB_REG_BASE + 0x0bf)
+
+#define	AR9170_USB_REG_FIFO_MAP			(AR9170_USB_REG_BASE + 0x080)
+#define	AR9170_USB_REG_FIFO0_MAP		(AR9170_USB_REG_BASE + 0x080)
+#define	AR9170_USB_REG_FIFO1_MAP		(AR9170_USB_REG_BASE + 0x081)
+#define	AR9170_USB_REG_FIFO2_MAP		(AR9170_USB_REG_BASE + 0x082)
+#define	AR9170_USB_REG_FIFO3_MAP		(AR9170_USB_REG_BASE + 0x083)
+#define	AR9170_USB_REG_FIFO4_MAP		(AR9170_USB_REG_BASE + 0x084)
+#define	AR9170_USB_REG_FIFO5_MAP		(AR9170_USB_REG_BASE + 0x085)
+#define	AR9170_USB_REG_FIFO6_MAP		(AR9170_USB_REG_BASE + 0x086)
+#define	AR9170_USB_REG_FIFO7_MAP		(AR9170_USB_REG_BASE + 0x087)
+#define	AR9170_USB_REG_FIFO8_MAP		(AR9170_USB_REG_BASE + 0x088)
+#define	AR9170_USB_REG_FIFO9_MAP		(AR9170_USB_REG_BASE + 0x089)
+
+#define	AR9170_USB_REG_FIFO_CONFIG		(AR9170_USB_REG_BASE + 0x090)
+#define	AR9170_USB_REG_FIFO0_CONFIG		(AR9170_USB_REG_BASE + 0x090)
+#define	AR9170_USB_REG_FIFO1_CONFIG		(AR9170_USB_REG_BASE + 0x091)
+#define	AR9170_USB_REG_FIFO2_CONFIG		(AR9170_USB_REG_BASE + 0x092)
+#define	AR9170_USB_REG_FIFO3_CONFIG		(AR9170_USB_REG_BASE + 0x093)
+#define	AR9170_USB_REG_FIFO4_CONFIG		(AR9170_USB_REG_BASE + 0x094)
+#define	AR9170_USB_REG_FIFO5_CONFIG		(AR9170_USB_REG_BASE + 0x095)
+#define	AR9170_USB_REG_FIFO6_CONFIG		(AR9170_USB_REG_BASE + 0x096)
+#define	AR9170_USB_REG_FIFO7_CONFIG		(AR9170_USB_REG_BASE + 0x097)
+#define	AR9170_USB_REG_FIFO8_CONFIG		(AR9170_USB_REG_BASE + 0x098)
+#define	AR9170_USB_REG_FIFO9_CONFIG		(AR9170_USB_REG_BASE + 0x099)
+
+#define	AR9170_USB_REG_EP3_DATA			(AR9170_USB_REG_BASE + 0x0f8)
+#define	AR9170_USB_REG_EP4_DATA			(AR9170_USB_REG_BASE + 0x0fc)
+
+#define	AR9170_USB_REG_FIFO_SIZE		(AR9170_USB_REG_BASE + 0x100)
+#define	AR9170_USB_REG_DMA_CTL			(AR9170_USB_REG_BASE + 0x108)
+#define		AR9170_USB_DMA_CTL_ENABLE_TO_DEVICE	BIT(0)
+#define		AR9170_USB_DMA_CTL_ENABLE_FROM_DEVICE	BIT(1)
+#define		AR9170_USB_DMA_CTL_HIGH_SPEED		BIT(2)
+#define		AR9170_USB_DMA_CTL_UP_PACKET_MODE	BIT(3)
+#define		AR9170_USB_DMA_CTL_UP_STREAM_S		4
+#define		AR9170_USB_DMA_CTL_UP_STREAM		(BIT(4) | BIT(5))
+#define		AR9170_USB_DMA_CTL_UP_STREAM_4K		(0)
+#define		AR9170_USB_DMA_CTL_UP_STREAM_8K		BIT(4)
+#define		AR9170_USB_DMA_CTL_UP_STREAM_16K	BIT(5)
+#define		AR9170_USB_DMA_CTL_UP_STREAM_32K	(BIT(4) | BIT(5))
+#define		AR9170_USB_DMA_CTL_DOWN_STREAM		BIT(6)
+
+#define	AR9170_USB_REG_DMA_STATUS		(AR9170_USB_REG_BASE + 0x10c)
+#define		AR9170_USB_DMA_STATUS_UP_IDLE		BIT(8)
+#define		AR9170_USB_DMA_STATUS_DN_IDLE		BIT(16)
+
+#define	AR9170_USB_REG_MAX_AGG_UPLOAD		(AR9170_USB_REG_BASE + 0x110)
+#define	AR9170_USB_REG_UPLOAD_TIME_CTL		(AR9170_USB_REG_BASE + 0x114)
+
+#define AR9170_USB_REG_WAKE_UP			(AR9170_USB_REG_BASE + 0x120)
+#define		AR9170_USB_WAKE_UP_WAKE			BIT(0)
+
+#define	AR9170_USB_REG_CBUS_CTRL		(AR9170_USB_REG_BASE + 0x1f0)
+#define		AR9170_USB_CBUS_CTRL_BUFFER_END		(BIT(1))
+
+/* PCI/USB to AHB Bridge */
+#define	AR9170_PTA_REG_BASE			0x1e2000
+
+#define	AR9170_PTA_REG_CMD			(AR9170_PTA_REG_BASE + 0x000)
+#define	AR9170_PTA_REG_PARAM1			(AR9170_PTA_REG_BASE + 0x004)
+#define	AR9170_PTA_REG_PARAM2			(AR9170_PTA_REG_BASE + 0x008)
+#define	AR9170_PTA_REG_PARAM3			(AR9170_PTA_REG_BASE + 0x00c)
+#define	AR9170_PTA_REG_RSP			(AR9170_PTA_REG_BASE + 0x010)
+#define	AR9170_PTA_REG_STATUS1			(AR9170_PTA_REG_BASE + 0x014)
+#define	AR9170_PTA_REG_STATUS2			(AR9170_PTA_REG_BASE + 0x018)
+#define	AR9170_PTA_REG_STATUS3			(AR9170_PTA_REG_BASE + 0x01c)
+#define	AR9170_PTA_REG_AHB_INT_FLAG		(AR9170_PTA_REG_BASE + 0x020)
+#define	AR9170_PTA_REG_AHB_INT_MASK		(AR9170_PTA_REG_BASE + 0x024)
+#define	AR9170_PTA_REG_AHB_INT_ACK		(AR9170_PTA_REG_BASE + 0x028)
+#define	AR9170_PTA_REG_AHB_SCRATCH1		(AR9170_PTA_REG_BASE + 0x030)
+#define	AR9170_PTA_REG_AHB_SCRATCH2		(AR9170_PTA_REG_BASE + 0x034)
+#define	AR9170_PTA_REG_AHB_SCRATCH3		(AR9170_PTA_REG_BASE + 0x038)
+#define	AR9170_PTA_REG_AHB_SCRATCH4		(AR9170_PTA_REG_BASE + 0x03c)
+
+#define	AR9170_PTA_REG_SHARE_MEM_CTRL		(AR9170_PTA_REG_BASE + 0x124)
+
+/*
+ * PCI to AHB Bridge
+ */
+
+#define	AR9170_PTA_REG_INT_FLAG			(AR9170_PTA_REG_BASE + 0x100)
+#define		AR9170_PTA_INT_FLAG_DN			0x01
+#define		AR9170_PTA_INT_FLAG_UP			0x02
+#define		AR9170_PTA_INT_FLAG_CMD			0x04
+
+#define	AR9170_PTA_REG_INT_MASK			(AR9170_PTA_REG_BASE + 0x104)
+#define	AR9170_PTA_REG_DN_DMA_ADDRL		(AR9170_PTA_REG_BASE + 0x108)
+#define	AR9170_PTA_REG_DN_DMA_ADDRH		(AR9170_PTA_REG_BASE + 0x10c)
+#define	AR9170_PTA_REG_UP_DMA_ADDRL		(AR9170_PTA_REG_BASE + 0x110)
+#define	AR9170_PTA_REG_UP_DMA_ADDRH		(AR9170_PTA_REG_BASE + 0x114)
+#define	AR9170_PTA_REG_DN_PEND_TIME		(AR9170_PTA_REG_BASE + 0x118)
+#define	AR9170_PTA_REG_UP_PEND_TIME		(AR9170_PTA_REG_BASE + 0x11c)
+#define	AR9170_PTA_REG_CONTROL			(AR9170_PTA_REG_BASE + 0x120)
+#define		AR9170_PTA_CTRL_4_BEAT_BURST		0x00
+#define		AR9170_PTA_CTRL_8_BEAT_BURST		0x01
+#define		AR9170_PTA_CTRL_16_BEAT_BURST		0x02
+#define		AR9170_PTA_CTRL_LOOPBACK_MODE		0x10
+
+#define	AR9170_PTA_REG_MEM_CTRL			(AR9170_PTA_REG_BASE + 0x124)
+#define	AR9170_PTA_REG_MEM_ADDR			(AR9170_PTA_REG_BASE + 0x128)
+#define	AR9170_PTA_REG_DN_DMA_TRIGGER		(AR9170_PTA_REG_BASE + 0x12c)
+#define	AR9170_PTA_REG_UP_DMA_TRIGGER		(AR9170_PTA_REG_BASE + 0x130)
+#define	AR9170_PTA_REG_DMA_STATUS		(AR9170_PTA_REG_BASE + 0x134)
+#define	AR9170_PTA_REG_DN_CURR_ADDRL		(AR9170_PTA_REG_BASE + 0x138)
+#define	AR9170_PTA_REG_DN_CURR_ADDRH		(AR9170_PTA_REG_BASE + 0x13c)
+#define	AR9170_PTA_REG_UP_CURR_ADDRL		(AR9170_PTA_REG_BASE + 0x140)
+#define	AR9170_PTA_REG_UP_CURR_ADDRH		(AR9170_PTA_REG_BASE + 0x144)
+#define	AR9170_PTA_REG_DMA_MODE_CTRL		(AR9170_PTA_REG_BASE + 0x148)
+#define		AR9170_PTA_DMA_MODE_CTRL_RESET		BIT(0)
+#define		AR9170_PTA_DMA_MODE_CTRL_DISABLE_USB	BIT(1)
+
+/* Protocol Controller Module */
+#define	AR9170_MAC_REG_PC_REG_BASE		(AR9170_MAC_REG_BASE + 0xe00)
+
+
+#define	AR9170_NUM_LEDS				2
+
+/* CAM */
+#define	AR9170_CAM_MAX_USER			64
+#define	AR9170_CAM_MAX_KEY_LENGTH		16
+
+#define AR9170_SRAM_OFFSET		0x100000
+#define AR9170_SRAM_SIZE		0x18000
+
+#define AR9170_PRAM_OFFSET		0x200000
+#define AR9170_PRAM_SIZE		0x8000
+
+enum cpu_clock {
+	AHB_STATIC_40MHZ = 0,
+	AHB_GMODE_22MHZ = 1,
+	AHB_AMODE_20MHZ = 1,
+	AHB_GMODE_44MHZ = 2,
+	AHB_AMODE_40MHZ = 2,
+	AHB_GMODE_88MHZ = 3,
+	AHB_AMODE_80MHZ = 3
+};
+
+/* USB endpoints */
+enum ar9170_usb_ep {
+	/*
+	 * Control EP is always EP 0 (USB SPEC)
+	 *
+	 * The weird thing is: the original firmware has a few
+	 * comments that suggest that the actual EP numbers
+	 * are in the 1 to 10 range?!
+	 */
+	AR9170_USB_EP_CTRL		= 0,
+
+	AR9170_USB_EP_TX,
+	AR9170_USB_EP_RX,
+	AR9170_USB_EP_IRQ,
+	AR9170_USB_EP_CMD,
+	AR9170_USB_NUM_EXTRA_EP		= 4,
+
+	__AR9170_USB_NUM_EP,
+
+	__AR9170_USB_NUM_MAX_EP		= 10
+};
+
+enum ar9170_usb_fifo {
+	__AR9170_USB_NUM_MAX_FIFO	= 10
+};
+
+enum ar9170_tx_queues {
+	AR9170_TXQ0	= 0,
+	AR9170_TXQ1,
+	AR9170_TXQ2,
+	AR9170_TXQ3,
+	AR9170_TXQ_SPECIAL,
+
+	/* keep last */
+	__AR9170_NUM_TX_QUEUES = 5
+};
+
+#define	AR9170_TX_STREAM_TAG		0x697e
+#define	AR9170_RX_STREAM_TAG		0x4e00
+#define	AR9170_RX_STREAM_MAX_SIZE	0xffff
+
+struct ar9170_stream {
+	__le16 length;
+	__le16 tag;
+
+	u8 payload[0];
+} __packed __aligned(4);
+#define AR9170_STREAM_LEN				4
+
+#define AR9170_MAX_ACKTABLE_ENTRIES			8
+#define AR9170_MAX_VIRTUAL_MAC				7
+
+#define	AR9170_USB_EP_CTRL_MAX				64
+#define	AR9170_USB_EP_TX_MAX				512
+#define	AR9170_USB_EP_RX_MAX				512
+#define	AR9170_USB_EP_IRQ_MAX				64
+#define	AR9170_USB_EP_CMD_MAX				64
+
+/* Trigger PRETBTT interrupt 6 Kus earlier */
+#define CARL9170_PRETBTT_KUS				6
+
+#define	AR5416_MAX_RATE_POWER				63
+
+#define SET_VAL(reg, value, newvalue)					\
+	(value = ((value) & ~reg) | (((newvalue) << reg##_S) & reg))
+
+#define SET_CONSTVAL(reg, newvalue)					\
+	(((newvalue) << reg##_S) & reg)
+
+#define MOD_VAL(reg, value, newvalue)					\
+	(((value) & ~reg) | (((newvalue) << reg##_S) & reg))
+
+#define GET_VAL(reg, value)						\
+	(((value) & reg) >> reg##_S)
+
+#endif	/* __CARL9170_SHARED_HW_H */
diff --git a/carl9170fw/include/shared/phy.h b/carl9170fw/include/shared/phy.h
new file mode 100644
index 0000000..024fb42
--- /dev/null
+++ b/carl9170fw/include/shared/phy.h
@@ -0,0 +1,564 @@
+/*
+ * Shared Atheros AR9170 Header
+ *
+ * PHY register map
+ *
+ * Copyright (c) 2008-2009 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.
+ */
+
+#ifndef __CARL9170_SHARED_PHY_H
+#define __CARL9170_SHARED_PHY_H
+
+#define	AR9170_PHY_REG_BASE			(0x1bc000 + 0x9800)
+#define	AR9170_PHY_REG(_n)			(AR9170_PHY_REG_BASE + \
+						 ((_n) << 2))
+
+#define	AR9170_PHY_REG_TEST			(AR9170_PHY_REG_BASE + 0x0000)
+#define		AR9170_PHY_TEST_AGC_CLR			0x10000000
+#define		AR9170_PHY_TEST_RFSILENT_BB		0x00002000
+
+#define	AR9170_PHY_REG_TURBO			(AR9170_PHY_REG_BASE + 0x0004)
+#define		AR9170_PHY_TURBO_FC_TURBO_MODE		0x00000001
+#define		AR9170_PHY_TURBO_FC_TURBO_SHORT		0x00000002
+#define		AR9170_PHY_TURBO_FC_DYN2040_EN		0x00000004
+#define		AR9170_PHY_TURBO_FC_DYN2040_PRI_ONLY	0x00000008
+#define		AR9170_PHY_TURBO_FC_DYN2040_PRI_CH	0x00000010
+/* For 25 MHz channel spacing -- not used but supported by hw */
+#define		AR9170_PHY_TURBO_FC_DYN2040_EXT_CH	0x00000020
+#define		AR9170_PHY_TURBO_FC_HT_EN		0x00000040
+#define		AR9170_PHY_TURBO_FC_SHORT_GI_40		0x00000080
+#define		AR9170_PHY_TURBO_FC_WALSH		0x00000100
+#define		AR9170_PHY_TURBO_FC_SINGLE_HT_LTF1	0x00000200
+#define		AR9170_PHY_TURBO_FC_ENABLE_DAC_FIFO	0x00000800
+
+#define	AR9170_PHY_REG_TEST2			(AR9170_PHY_REG_BASE + 0x0008)
+
+#define	AR9170_PHY_REG_TIMING2			(AR9170_PHY_REG_BASE + 0x0010)
+#define		AR9170_PHY_TIMING2_USE_FORCE		0x00001000
+#define		AR9170_PHY_TIMING2_FORCE		0x00000fff
+#define		AR9170_PHY_TIMING2_FORCE_S			 0
+
+#define	AR9170_PHY_REG_TIMING3			(AR9170_PHY_REG_BASE + 0x0014)
+#define		AR9170_PHY_TIMING3_DSC_EXP		0x0001e000
+#define		AR9170_PHY_TIMING3_DSC_EXP_S		13
+#define		AR9170_PHY_TIMING3_DSC_MAN		0xfffe0000
+#define		AR9170_PHY_TIMING3_DSC_MAN_S		17
+
+#define	AR9170_PHY_REG_CHIP_ID			(AR9170_PHY_REG_BASE + 0x0018)
+#define		AR9170_PHY_CHIP_ID_REV_0		0x80
+#define		AR9170_PHY_CHIP_ID_REV_1		0x81
+#define		AR9170_PHY_CHIP_ID_9160_REV_0		0xb0
+
+#define	AR9170_PHY_REG_ACTIVE			(AR9170_PHY_REG_BASE + 0x001c)
+#define		AR9170_PHY_ACTIVE_EN			0x00000001
+#define		AR9170_PHY_ACTIVE_DIS			0x00000000
+
+#define	AR9170_PHY_REG_RF_CTL2			(AR9170_PHY_REG_BASE + 0x0024)
+#define		AR9170_PHY_RF_CTL2_TX_END_DATA_START	0x000000ff
+#define		AR9170_PHY_RF_CTL2_TX_END_DATA_START_S	0
+#define		AR9170_PHY_RF_CTL2_TX_END_PA_ON		0x0000ff00
+#define		AR9170_PHY_RF_CTL2_TX_END_PA_ON_S	8
+
+#define	AR9170_PHY_REG_RF_CTL3                  (AR9170_PHY_REG_BASE + 0x0028)
+#define		AR9170_PHY_RF_CTL3_TX_END_TO_A2_RX_ON	0x00ff0000
+#define		AR9170_PHY_RF_CTL3_TX_END_TO_A2_RX_ON_S	16
+
+#define	AR9170_PHY_REG_ADC_CTL			(AR9170_PHY_REG_BASE + 0x002c)
+#define		AR9170_PHY_ADC_CTL_OFF_INBUFGAIN	0x00000003
+#define		AR9170_PHY_ADC_CTL_OFF_INBUFGAIN_S	0
+#define		AR9170_PHY_ADC_CTL_OFF_PWDDAC		0x00002000
+#define		AR9170_PHY_ADC_CTL_OFF_PWDBANDGAP	0x00004000
+#define		AR9170_PHY_ADC_CTL_OFF_PWDADC		0x00008000
+#define		AR9170_PHY_ADC_CTL_ON_INBUFGAIN		0x00030000
+#define		AR9170_PHY_ADC_CTL_ON_INBUFGAIN_S	16
+
+#define	AR9170_PHY_REG_ADC_SERIAL_CTL		(AR9170_PHY_REG_BASE + 0x0030)
+#define		AR9170_PHY_ADC_SCTL_SEL_INTERNAL_ADDAC	0x00000000
+#define		AR9170_PHY_ADC_SCTL_SEL_EXTERNAL_RADIO	0x00000001
+
+#define	AR9170_PHY_REG_RF_CTL4			(AR9170_PHY_REG_BASE + 0x0034)
+#define		AR9170_PHY_RF_CTL4_TX_END_XPAB_OFF	0xff000000
+#define		AR9170_PHY_RF_CTL4_TX_END_XPAB_OFF_S	24
+#define		AR9170_PHY_RF_CTL4_TX_END_XPAA_OFF	0x00ff0000
+#define		AR9170_PHY_RF_CTL4_TX_END_XPAA_OFF_S	16
+#define		AR9170_PHY_RF_CTL4_FRAME_XPAB_ON	0x0000ff00
+#define		AR9170_PHY_RF_CTL4_FRAME_XPAB_ON_S	8
+#define		AR9170_PHY_RF_CTL4_FRAME_XPAA_ON	0x000000ff
+#define		AR9170_PHY_RF_CTL4_FRAME_XPAA_ON_S	0
+
+#define	AR9170_PHY_REG_TSTDAC_CONST		(AR9170_PHY_REG_BASE + 0x003c)
+
+#define	AR9170_PHY_REG_SETTLING			(AR9170_PHY_REG_BASE + 0x0044)
+#define		AR9170_PHY_SETTLING_SWITCH		0x00003f80
+#define		AR9170_PHY_SETTLING_SWITCH_S		7
+
+#define	AR9170_PHY_REG_RXGAIN			(AR9170_PHY_REG_BASE + 0x0048)
+#define	AR9170_PHY_REG_RXGAIN_CHAIN_2		(AR9170_PHY_REG_BASE + 0x2048)
+#define		AR9170_PHY_RXGAIN_TXRX_ATTEN		0x0003f000
+#define		AR9170_PHY_RXGAIN_TXRX_ATTEN_S		12
+#define		AR9170_PHY_RXGAIN_TXRX_RF_MAX		0x007c0000
+#define		AR9170_PHY_RXGAIN_TXRX_RF_MAX_S		18
+
+#define	AR9170_PHY_REG_DESIRED_SZ		(AR9170_PHY_REG_BASE + 0x0050)
+#define		AR9170_PHY_DESIRED_SZ_ADC		0x000000ff
+#define		AR9170_PHY_DESIRED_SZ_ADC_S		0
+#define		AR9170_PHY_DESIRED_SZ_PGA		0x0000ff00
+#define		AR9170_PHY_DESIRED_SZ_PGA_S		8
+#define		AR9170_PHY_DESIRED_SZ_TOT_DES		0x0ff00000
+#define		AR9170_PHY_DESIRED_SZ_TOT_DES_S		20
+
+#define	AR9170_PHY_REG_FIND_SIG			(AR9170_PHY_REG_BASE + 0x0058)
+#define		AR9170_PHY_FIND_SIG_FIRSTEP		0x0003f000
+#define		AR9170_PHY_FIND_SIG_FIRSTEP_S		12
+#define		AR9170_PHY_FIND_SIG_FIRPWR		0x03fc0000
+#define		AR9170_PHY_FIND_SIG_FIRPWR_S		18
+
+#define	AR9170_PHY_REG_AGC_CTL1			(AR9170_PHY_REG_BASE + 0x005c)
+#define		AR9170_PHY_AGC_CTL1_COARSE_LOW		0x00007f80
+#define		AR9170_PHY_AGC_CTL1_COARSE_LOW_S	7
+#define		AR9170_PHY_AGC_CTL1_COARSE_HIGH		0x003f8000
+#define		AR9170_PHY_AGC_CTL1_COARSE_HIGH_S	15
+
+#define	AR9170_PHY_REG_AGC_CONTROL		(AR9170_PHY_REG_BASE + 0x0060)
+#define		AR9170_PHY_AGC_CONTROL_CAL		0x00000001
+#define		AR9170_PHY_AGC_CONTROL_NF		0x00000002
+#define		AR9170_PHY_AGC_CONTROL_ENABLE_NF	0x00008000
+#define		AR9170_PHY_AGC_CONTROL_FLTR_CAL		0x00010000
+#define		AR9170_PHY_AGC_CONTROL_NO_UPDATE_NF	0x00020000
+
+#define	AR9170_PHY_REG_CCA			(AR9170_PHY_REG_BASE + 0x0064)
+#define		AR9170_PHY_CCA_MIN_PWR			0x0ff80000
+#define		AR9170_PHY_CCA_MIN_PWR_S		19
+#define		AR9170_PHY_CCA_THRESH62			0x0007f000
+#define		AR9170_PHY_CCA_THRESH62_S		12
+
+#define	AR9170_PHY_REG_SFCORR			(AR9170_PHY_REG_BASE + 0x0068)
+#define		AR9170_PHY_SFCORR_M2COUNT_THR		0x0000001f
+#define		AR9170_PHY_SFCORR_M2COUNT_THR_S		0
+#define		AR9170_PHY_SFCORR_M1_THRESH		0x00fe0000
+#define		AR9170_PHY_SFCORR_M1_THRESH_S		17
+#define		AR9170_PHY_SFCORR_M2_THRESH		0x7f000000
+#define		AR9170_PHY_SFCORR_M2_THRESH_S		24
+
+#define	AR9170_PHY_REG_SFCORR_LOW		(AR9170_PHY_REG_BASE + 0x006c)
+#define		AR9170_PHY_SFCORR_LOW_USE_SELF_CORR_LOW	0x00000001
+#define		AR9170_PHY_SFCORR_LOW_M2COUNT_THR_LOW	0x00003f00
+#define		AR9170_PHY_SFCORR_LOW_M2COUNT_THR_LOW_S	8
+#define		AR9170_PHY_SFCORR_LOW_M1_THRESH_LOW	0x001fc000
+#define		AR9170_PHY_SFCORR_LOW_M1_THRESH_LOW_S	14
+#define		AR9170_PHY_SFCORR_LOW_M2_THRESH_LOW	0x0fe00000
+#define		AR9170_PHY_SFCORR_LOW_M2_THRESH_LOW_S	21
+
+#define	AR9170_PHY_REG_SLEEP_CTR_CONTROL	(AR9170_PHY_REG_BASE + 0x0070)
+#define	AR9170_PHY_REG_SLEEP_CTR_LIMIT		(AR9170_PHY_REG_BASE + 0x0074)
+#define	AR9170_PHY_REG_SLEEP_SCAL		(AR9170_PHY_REG_BASE + 0x0078)
+
+#define	AR9170_PHY_REG_PLL_CTL			(AR9170_PHY_REG_BASE + 0x007c)
+#define		AR9170_PHY_PLL_CTL_40			0xaa
+#define		AR9170_PHY_PLL_CTL_40_5413		0x04
+#define		AR9170_PHY_PLL_CTL_44			0xab
+#define		AR9170_PHY_PLL_CTL_44_2133		0xeb
+#define		AR9170_PHY_PLL_CTL_40_2133		0xea
+
+#define	AR9170_PHY_REG_BIN_MASK_1		(AR9170_PHY_REG_BASE + 0x0100)
+#define	AR9170_PHY_REG_BIN_MASK_2		(AR9170_PHY_REG_BASE + 0x0104)
+#define	AR9170_PHY_REG_BIN_MASK_3		(AR9170_PHY_REG_BASE + 0x0108)
+#define	AR9170_PHY_REG_MASK_CTL			(AR9170_PHY_REG_BASE + 0x010c)
+
+/* analogue power on time (100ns) */
+#define	AR9170_PHY_REG_RX_DELAY			(AR9170_PHY_REG_BASE + 0x0114)
+#define	AR9170_PHY_REG_SEARCH_START_DELAY	(AR9170_PHY_REG_BASE + 0x0118)
+#define		AR9170_PHY_RX_DELAY_DELAY		0x00003fff
+
+#define	AR9170_PHY_REG_TIMING_CTRL4(_i)		(AR9170_PHY_REG_BASE + \
+						(0x0120 + ((_i) << 12)))
+#define		AR9170_PHY_TIMING_CTRL4_IQCORR_Q_Q_COFF		0x01f
+#define		AR9170_PHY_TIMING_CTRL4_IQCORR_Q_Q_COFF_S	0
+#define		AR9170_PHY_TIMING_CTRL4_IQCORR_Q_I_COFF		0x7e0
+#define		AR9170_PHY_TIMING_CTRL4_IQCORR_Q_I_COFF_S	5
+#define		AR9170_PHY_TIMING_CTRL4_IQCORR_ENABLE		0x800
+#define		AR9170_PHY_TIMING_CTRL4_IQCAL_LOG_COUNT_MAX	0xf000
+#define		AR9170_PHY_TIMING_CTRL4_IQCAL_LOG_COUNT_MAX_S	12
+#define		AR9170_PHY_TIMING_CTRL4_DO_IQCAL		0x10000
+#define		AR9170_PHY_TIMING_CTRL4_ENABLE_SPUR_RSSI	0x80000000
+#define		AR9170_PHY_TIMING_CTRL4_ENABLE_SPUR_FILTER	0x40000000
+#define		AR9170_PHY_TIMING_CTRL4_ENABLE_CHAN_MASK	0x20000000
+#define		AR9170_PHY_TIMING_CTRL4_ENABLE_PILOT_MASK	0x10000000
+
+#define	AR9170_PHY_REG_TIMING5			(AR9170_PHY_REG_BASE + 0x0124)
+#define		AR9170_PHY_TIMING5_CYCPWR_THR1		0x000000fe
+#define		AR9170_PHY_TIMING5_CYCPWR_THR1_S	1
+
+#define	AR9170_PHY_REG_POWER_TX_RATE1		(AR9170_PHY_REG_BASE + 0x0134)
+#define	AR9170_PHY_REG_POWER_TX_RATE2		(AR9170_PHY_REG_BASE + 0x0138)
+#define	AR9170_PHY_REG_POWER_TX_RATE_MAX	(AR9170_PHY_REG_BASE + 0x013c)
+#define		AR9170_PHY_POWER_TX_RATE_MAX_TPC_ENABLE	0x00000040
+
+#define	AR9170_PHY_REG_FRAME_CTL		(AR9170_PHY_REG_BASE + 0x0144)
+#define		AR9170_PHY_FRAME_CTL_TX_CLIP		0x00000038
+#define		AR9170_PHY_FRAME_CTL_TX_CLIP_S		3
+
+#define	AR9170_PHY_REG_SPUR_REG			(AR9170_PHY_REG_BASE + 0x014c)
+#define		AR9170_PHY_SPUR_REG_MASK_RATE_CNTL	(0xff << 18)
+#define		AR9170_PHY_SPUR_REG_MASK_RATE_CNTL_S	18
+#define		AR9170_PHY_SPUR_REG_ENABLE_MASK_PPM	0x20000
+#define		AR9170_PHY_SPUR_REG_MASK_RATE_SELECT	(0xff << 9)
+#define		AR9170_PHY_SPUR_REG_MASK_RATE_SELECT_S	9
+#define		AR9170_PHY_SPUR_REG_ENABLE_VIT_SPUR_RSSI	0x100
+#define		AR9170_PHY_SPUR_REG_SPUR_RSSI_THRESH	0x7f
+#define		AR9170_PHY_SPUR_REG_SPUR_RSSI_THRESH_S	0
+
+#define	AR9170_PHY_REG_RADAR_EXT		(AR9170_PHY_REG_BASE + 0x0140)
+#define		AR9170_PHY_RADAR_EXT_ENA		0x00004000
+
+#define	AR9170_PHY_REG_RADAR_0			(AR9170_PHY_REG_BASE + 0x0154)
+#define		AR9170_PHY_RADAR_0_ENA			0x00000001
+#define		AR9170_PHY_RADAR_0_FFT_ENA		0x80000000
+/* inband pulse threshold */
+#define		AR9170_PHY_RADAR_0_INBAND		0x0000003e
+#define		AR9170_PHY_RADAR_0_INBAND_S		1
+/* pulse RSSI threshold */
+#define		AR9170_PHY_RADAR_0_PRSSI		0x00000fc0
+#define		AR9170_PHY_RADAR_0_PRSSI_S		6
+/* pulse height threshold */
+#define		AR9170_PHY_RADAR_0_HEIGHT		0x0003f000
+#define		AR9170_PHY_RADAR_0_HEIGHT_S		12
+/* radar RSSI threshold */
+#define		AR9170_PHY_RADAR_0_RRSSI		0x00fc0000
+#define		AR9170_PHY_RADAR_0_RRSSI_S		18
+/* radar firepower threshold */
+#define		AR9170_PHY_RADAR_0_FIRPWR		0x7f000000
+#define		AR9170_PHY_RADAR_0_FIRPWR_S		24
+
+#define	AR9170_PHY_REG_RADAR_1			(AR9170_PHY_REG_BASE + 0x0158)
+#define		AR9170_PHY_RADAR_1_RELPWR_ENA		0x00800000
+#define		AR9170_PHY_RADAR_1_USE_FIR128		0x00400000
+#define		AR9170_PHY_RADAR_1_RELPWR_THRESH	0x003f0000
+#define		AR9170_PHY_RADAR_1_RELPWR_THRESH_S	16
+#define		AR9170_PHY_RADAR_1_BLOCK_CHECK		0x00008000
+#define		AR9170_PHY_RADAR_1_MAX_RRSSI		0x00004000
+#define		AR9170_PHY_RADAR_1_RELSTEP_CHECK	0x00002000
+#define		AR9170_PHY_RADAR_1_RELSTEP_THRESH	0x00001f00
+#define		AR9170_PHY_RADAR_1_RELSTEP_THRESH_S	8
+#define		AR9170_PHY_RADAR_1_MAXLEN		0x000000ff
+#define		AR9170_PHY_RADAR_1_MAXLEN_S		0
+
+#define	AR9170_PHY_REG_SWITCH_CHAIN_0		(AR9170_PHY_REG_BASE + 0x0160)
+#define	AR9170_PHY_REG_SWITCH_CHAIN_2		(AR9170_PHY_REG_BASE + 0x2160)
+
+#define	AR9170_PHY_REG_SWITCH_COM		(AR9170_PHY_REG_BASE + 0x0164)
+
+#define	AR9170_PHY_REG_CCA_THRESHOLD		(AR9170_PHY_REG_BASE + 0x0168)
+
+#define	AR9170_PHY_REG_SIGMA_DELTA		(AR9170_PHY_REG_BASE + 0x016c)
+#define		AR9170_PHY_SIGMA_DELTA_ADC_SEL		0x00000003
+#define		AR9170_PHY_SIGMA_DELTA_ADC_SEL_S	0
+#define		AR9170_PHY_SIGMA_DELTA_FILT2		0x000000f8
+#define		AR9170_PHY_SIGMA_DELTA_FILT2_S		3
+#define		AR9170_PHY_SIGMA_DELTA_FILT1		0x00001f00
+#define		AR9170_PHY_SIGMA_DELTA_FILT1_S		8
+#define		AR9170_PHY_SIGMA_DELTA_ADC_CLIP		0x01ffe000
+#define		AR9170_PHY_SIGMA_DELTA_ADC_CLIP_S	13
+
+#define	AR9170_PHY_REG_RESTART			(AR9170_PHY_REG_BASE + 0x0170)
+#define		AR9170_PHY_RESTART_DIV_GC		0x001c0000
+#define		AR9170_PHY_RESTART_DIV_GC_S		18
+
+#define	AR9170_PHY_REG_RFBUS_REQ		(AR9170_PHY_REG_BASE + 0x017c)
+#define		AR9170_PHY_RFBUS_REQ_EN			0x00000001
+
+#define	AR9170_PHY_REG_TIMING7			(AR9170_PHY_REG_BASE + 0x0180)
+#define	AR9170_PHY_REG_TIMING8			(AR9170_PHY_REG_BASE + 0x0184)
+#define		AR9170_PHY_TIMING8_PILOT_MASK_2		0x000fffff
+#define		AR9170_PHY_TIMING8_PILOT_MASK_2_S	0
+
+#define	AR9170_PHY_REG_BIN_MASK2_1		(AR9170_PHY_REG_BASE + 0x0188)
+#define	AR9170_PHY_REG_BIN_MASK2_2		(AR9170_PHY_REG_BASE + 0x018c)
+#define	AR9170_PHY_REG_BIN_MASK2_3		(AR9170_PHY_REG_BASE + 0x0190)
+#define	AR9170_PHY_REG_BIN_MASK2_4		(AR9170_PHY_REG_BASE + 0x0194)
+#define		AR9170_PHY_BIN_MASK2_4_MASK_4		0x00003fff
+#define		AR9170_PHY_BIN_MASK2_4_MASK_4_S		0
+
+#define	AR9170_PHY_REG_TIMING9			(AR9170_PHY_REG_BASE + 0x0198)
+#define	AR9170_PHY_REG_TIMING10			(AR9170_PHY_REG_BASE + 0x019c)
+#define		AR9170_PHY_TIMING10_PILOT_MASK_2	0x000fffff
+#define		AR9170_PHY_TIMING10_PILOT_MASK_2_S	0
+
+#define	AR9170_PHY_REG_TIMING11			(AR9170_PHY_REG_BASE + 0x01a0)
+#define		AR9170_PHY_TIMING11_SPUR_DELTA_PHASE	0x000fffff
+#define		AR9170_PHY_TIMING11_SPUR_DELTA_PHASE_S	0
+#define		AR9170_PHY_TIMING11_SPUR_FREQ_SD	0x3ff00000
+#define		AR9170_PHY_TIMING11_SPUR_FREQ_SD_S	20
+#define		AR9170_PHY_TIMING11_USE_SPUR_IN_AGC	0x40000000
+#define		AR9170_PHY_TIMING11_USE_SPUR_IN_SELFCOR	0x80000000
+
+#define	AR9170_PHY_REG_RX_CHAINMASK		(AR9170_PHY_REG_BASE + 0x01a4)
+#define	AR9170_PHY_REG_NEW_ADC_DC_GAIN_CORR(_i)	(AR9170_PHY_REG_BASE + \
+						 0x01b4 + ((_i) << 12))
+#define		AR9170_PHY_NEW_ADC_GAIN_CORR_ENABLE		0x40000000
+#define		AR9170_PHY_NEW_ADC_DC_OFFSET_CORR_ENABLE	0x80000000
+
+#define	AR9170_PHY_REG_MULTICHAIN_GAIN_CTL	(AR9170_PHY_REG_BASE + 0x01ac)
+#define		AR9170_PHY_9285_ANT_DIV_CTL_ALL		0x7f000000
+#define		AR9170_PHY_9285_ANT_DIV_CTL		0x01000000
+#define		AR9170_PHY_9285_ANT_DIV_CTL_S		24
+#define		AR9170_PHY_9285_ANT_DIV_ALT_LNACONF	0x06000000
+#define		AR9170_PHY_9285_ANT_DIV_ALT_LNACONF_S	25
+#define		AR9170_PHY_9285_ANT_DIV_MAIN_LNACONF	0x18000000
+#define		AR9170_PHY_9285_ANT_DIV_MAIN_LNACONF_S	27
+#define		AR9170_PHY_9285_ANT_DIV_ALT_GAINTB	0x20000000
+#define		AR9170_PHY_9285_ANT_DIV_ALT_GAINTB_S	29
+#define		AR9170_PHY_9285_ANT_DIV_MAIN_GAINTB	0x40000000
+#define		AR9170_PHY_9285_ANT_DIV_MAIN_GAINTB_S	30
+#define		AR9170_PHY_9285_ANT_DIV_LNA1		2
+#define		AR9170_PHY_9285_ANT_DIV_LNA2		1
+#define		AR9170_PHY_9285_ANT_DIV_LNA1_PLUS_LNA2	3
+#define		AR9170_PHY_9285_ANT_DIV_LNA1_MINUS_LNA2	0
+#define		AR9170_PHY_9285_ANT_DIV_GAINTB_0	0
+#define		AR9170_PHY_9285_ANT_DIV_GAINTB_1	1
+
+#define	AR9170_PHY_REG_EXT_CCA0			(AR9170_PHY_REG_BASE + 0x01b8)
+#define		AR9170_PHY_REG_EXT_CCA0_THRESH62	0x000000ff
+#define		AR9170_PHY_REG_EXT_CCA0_THRESH62_S	0
+
+#define	AR9170_PHY_REG_EXT_CCA			(AR9170_PHY_REG_BASE + 0x01bc)
+#define		AR9170_PHY_EXT_CCA_CYCPWR_THR1		0x0000fe00
+#define		AR9170_PHY_EXT_CCA_CYCPWR_THR1_S	9
+#define		AR9170_PHY_EXT_CCA_THRESH62		0x007f0000
+#define		AR9170_PHY_EXT_CCA_THRESH62_S		16
+#define		AR9170_PHY_EXT_CCA_MIN_PWR		0xff800000
+#define		AR9170_PHY_EXT_CCA_MIN_PWR_S		23
+
+#define	AR9170_PHY_REG_SFCORR_EXT		(AR9170_PHY_REG_BASE + 0x01c0)
+#define		AR9170_PHY_SFCORR_EXT_M1_THRESH		0x0000007f
+#define		AR9170_PHY_SFCORR_EXT_M1_THRESH_S	0
+#define		AR9170_PHY_SFCORR_EXT_M2_THRESH		0x00003f80
+#define		AR9170_PHY_SFCORR_EXT_M2_THRESH_S	7
+#define		AR9170_PHY_SFCORR_EXT_M1_THRESH_LOW	0x001fc000
+#define		AR9170_PHY_SFCORR_EXT_M1_THRESH_LOW_S	14
+#define		AR9170_PHY_SFCORR_EXT_M2_THRESH_LOW	0x0fe00000
+#define		AR9170_PHY_SFCORR_EXT_M2_THRESH_LOW_S	21
+#define		AR9170_PHY_SFCORR_SPUR_SUBCHNL_SD_S	28
+
+#define	AR9170_PHY_REG_HALFGI			(AR9170_PHY_REG_BASE + 0x01d0)
+#define		AR9170_PHY_HALFGI_DSC_MAN		0x0007fff0
+#define		AR9170_PHY_HALFGI_DSC_MAN_S		4
+#define		AR9170_PHY_HALFGI_DSC_EXP		0x0000000f
+#define		AR9170_PHY_HALFGI_DSC_EXP_S		0
+
+#define	AR9170_PHY_REG_CHANNEL_MASK_01_30	(AR9170_PHY_REG_BASE + 0x01d4)
+#define	AR9170_PHY_REG_CHANNEL_MASK_31_60	(AR9170_PHY_REG_BASE + 0x01d8)
+
+#define	AR9170_PHY_REG_CHAN_INFO_MEMORY		(AR9170_PHY_REG_BASE + 0x01dc)
+#define		AR9170_PHY_CHAN_INFO_MEMORY_CAPTURE_MASK	0x0001
+
+#define	AR9170_PHY_REG_HEAVY_CLIP_ENABLE	(AR9170_PHY_REG_BASE + 0x01e0)
+#define	AR9170_PHY_REG_HEAVY_CLIP_FACTOR_RIFS	(AR9170_PHY_REG_BASE + 0x01ec)
+#define		AR9170_PHY_RIFS_INIT_DELAY		0x03ff0000
+
+#define	AR9170_PHY_REG_CALMODE			(AR9170_PHY_REG_BASE + 0x01f0)
+#define		AR9170_PHY_CALMODE_IQ			0x00000000
+#define		AR9170_PHY_CALMODE_ADC_GAIN		0x00000001
+#define		AR9170_PHY_CALMODE_ADC_DC_PER		0x00000002
+#define		AR9170_PHY_CALMODE_ADC_DC_INIT		0x00000003
+
+#define	AR9170_PHY_REG_REFCLKDLY		(AR9170_PHY_REG_BASE + 0x01f4)
+#define	AR9170_PHY_REG_REFCLKPD			(AR9170_PHY_REG_BASE + 0x01f8)
+
+
+#define	AR9170_PHY_REG_CAL_MEAS_0(_i)		(AR9170_PHY_REG_BASE + \
+						 0x0410 + ((_i) << 12))
+#define	AR9170_PHY_REG_CAL_MEAS_1(_i)		(AR9170_PHY_REG_BASE + \
+						 0x0414 \ + ((_i) << 12))
+#define	AR9170_PHY_REG_CAL_MEAS_2(_i)		(AR9170_PHY_REG_BASE + \
+						 0x0418 + ((_i) << 12))
+#define	AR9170_PHY_REG_CAL_MEAS_3(_i)		(AR9170_PHY_REG_BASE + \
+						 0x041c + ((_i) << 12))
+
+#define	AR9170_PHY_REG_CURRENT_RSSI		(AR9170_PHY_REG_BASE + 0x041c)
+
+#define	AR9170_PHY_REG_RFBUS_GRANT		(AR9170_PHY_REG_BASE + 0x0420)
+#define		AR9170_PHY_RFBUS_GRANT_EN		0x00000001
+
+#define	AR9170_PHY_REG_CHAN_INFO_GAIN_DIFF	(AR9170_PHY_REG_BASE + 0x04f4)
+#define		AR9170_PHY_CHAN_INFO_GAIN_DIFF_UPPER_LIMIT	320
+
+#define	AR9170_PHY_REG_CHAN_INFO_GAIN		(AR9170_PHY_REG_BASE + 0x04fc)
+
+#define	AR9170_PHY_REG_MODE			(AR9170_PHY_REG_BASE + 0x0a00)
+#define		AR9170_PHY_MODE_ASYNCFIFO		0x80
+#define		AR9170_PHY_MODE_AR2133			0x08
+#define		AR9170_PHY_MODE_AR5111			0x00
+#define		AR9170_PHY_MODE_AR5112			0x08
+#define		AR9170_PHY_MODE_DYNAMIC			0x04
+#define		AR9170_PHY_MODE_RF2GHZ			0x02
+#define		AR9170_PHY_MODE_RF5GHZ			0x00
+#define		AR9170_PHY_MODE_CCK			0x01
+#define		AR9170_PHY_MODE_OFDM			0x00
+#define		AR9170_PHY_MODE_DYN_CCK_DISABLE		0x100
+
+#define	AR9170_PHY_REG_CCK_TX_CTRL		(AR9170_PHY_REG_BASE + 0x0a04)
+#define		AR9170_PHY_CCK_TX_CTRL_JAPAN			0x00000010
+#define		AR9170_PHY_CCK_TX_CTRL_TX_DAC_SCALE_CCK         0x0000000c
+#define		AR9170_PHY_CCK_TX_CTRL_TX_DAC_SCALE_CCK_S       2
+
+#define	AR9170_PHY_REG_CCK_DETECT		(AR9170_PHY_REG_BASE + 0x0a08)
+#define		AR9170_PHY_CCK_DETECT_WEAK_SIG_THR_CCK		0x0000003f
+#define		AR9170_PHY_CCK_DETECT_WEAK_SIG_THR_CCK_S	0
+/* [12:6] settling time for antenna switch */
+#define		AR9170_PHY_CCK_DETECT_ANT_SWITCH_TIME		0x00001fc0
+#define		AR9170_PHY_CCK_DETECT_ANT_SWITCH_TIME_S		6
+#define		AR9170_PHY_CCK_DETECT_BB_ENABLE_ANT_FAST_DIV	0x2000
+#define		AR9170_PHY_CCK_DETECT_BB_ENABLE_ANT_FAST_DIV_S	13
+
+#define	AR9170_PHY_REG_GAIN_2GHZ		(AR9170_PHY_REG_BASE + 0x0a0c)
+#define	AR9170_PHY_REG_GAIN_2GHZ_CHAIN_2	(AR9170_PHY_REG_BASE + 0x2a0c)
+#define		AR9170_PHY_GAIN_2GHZ_RXTX_MARGIN	0x00fc0000
+#define		AR9170_PHY_GAIN_2GHZ_RXTX_MARGIN_S	18
+#define		AR9170_PHY_GAIN_2GHZ_BSW_MARGIN		0x00003c00
+#define		AR9170_PHY_GAIN_2GHZ_BSW_MARGIN_S	10
+#define		AR9170_PHY_GAIN_2GHZ_BSW_ATTEN		0x0000001f
+#define		AR9170_PHY_GAIN_2GHZ_BSW_ATTEN_S	0
+#define		AR9170_PHY_GAIN_2GHZ_XATTEN2_MARGIN	0x003e0000
+#define		AR9170_PHY_GAIN_2GHZ_XATTEN2_MARGIN_S	17
+#define		AR9170_PHY_GAIN_2GHZ_XATTEN1_MARGIN	0x0001f000
+#define		AR9170_PHY_GAIN_2GHZ_XATTEN1_MARGIN_S	12
+#define		AR9170_PHY_GAIN_2GHZ_XATTEN2_DB		0x00000fc0
+#define		AR9170_PHY_GAIN_2GHZ_XATTEN2_DB_S	6
+#define		AR9170_PHY_GAIN_2GHZ_XATTEN1_DB		0x0000003f
+#define		AR9170_PHY_GAIN_2GHZ_XATTEN1_DB_S	0
+
+#define	AR9170_PHY_REG_CCK_RXCTRL4		(AR9170_PHY_REG_BASE + 0x0a1c)
+#define		AR9170_PHY_CCK_RXCTRL4_FREQ_EST_SHORT	0x01f80000
+#define		AR9170_PHY_CCK_RXCTRL4_FREQ_EST_SHORT_S	19
+
+#define	AR9170_PHY_REG_DAG_CTRLCCK		(AR9170_PHY_REG_BASE + 0x0a28)
+#define		AR9170_REG_DAG_CTRLCCK_EN_RSSI_THR	0x00000200
+#define		AR9170_REG_DAG_CTRLCCK_RSSI_THR		0x0001fc00
+#define		AR9170_REG_DAG_CTRLCCK_RSSI_THR_S	10
+
+#define	AR9170_PHY_REG_FORCE_CLKEN_CCK		(AR9170_PHY_REG_BASE + 0x0a2c)
+#define		AR9170_FORCE_CLKEN_CCK_MRC_MUX		0x00000040
+
+#define	AR9170_PHY_REG_POWER_TX_RATE3		(AR9170_PHY_REG_BASE + 0x0a34)
+#define	AR9170_PHY_REG_POWER_TX_RATE4		(AR9170_PHY_REG_BASE + 0x0a38)
+
+#define	AR9170_PHY_REG_SCRM_SEQ_XR		(AR9170_PHY_REG_BASE + 0x0a3c)
+#define	AR9170_PHY_REG_HEADER_DETECT_XR		(AR9170_PHY_REG_BASE + 0x0a40)
+#define	AR9170_PHY_REG_CHIRP_DETECTED_XR	(AR9170_PHY_REG_BASE + 0x0a44)
+#define	AR9170_PHY_REG_BLUETOOTH		(AR9170_PHY_REG_BASE + 0x0a54)
+
+#define	AR9170_PHY_REG_TPCRG1			(AR9170_PHY_REG_BASE + 0x0a58)
+#define		AR9170_PHY_TPCRG1_NUM_PD_GAIN		0x0000c000
+#define		AR9170_PHY_TPCRG1_NUM_PD_GAIN_S		14
+#define		AR9170_PHY_TPCRG1_PD_GAIN_1		0x00030000
+#define		AR9170_PHY_TPCRG1_PD_GAIN_1_S		16
+#define		AR9170_PHY_TPCRG1_PD_GAIN_2		0x000c0000
+#define		AR9170_PHY_TPCRG1_PD_GAIN_2_S		18
+#define		AR9170_PHY_TPCRG1_PD_GAIN_3		0x00300000
+#define		AR9170_PHY_TPCRG1_PD_GAIN_3_S		20
+#define		AR9170_PHY_TPCRG1_PD_CAL_ENABLE		0x00400000
+#define		AR9170_PHY_TPCRG1_PD_CAL_ENABLE_S	22
+
+#define	AR9170_PHY_REG_TX_PWRCTRL4		(AR9170_PHY_REG_BASE + 0x0a64)
+#define		AR9170_PHY_TX_PWRCTRL_PD_AVG_VALID	0x00000001
+#define		AR9170_PHY_TX_PWRCTRL_PD_AVG_VALID_S	0
+#define		AR9170_PHY_TX_PWRCTRL_PD_AVG_OUT	0x000001fe
+#define		AR9170_PHY_TX_PWRCTRL_PD_AVG_OUT_S	1
+
+#define	AR9170_PHY_REG_ANALOG_SWAP		(AR9170_PHY_REG_BASE + 0x0a68)
+#define		AR9170_PHY_ANALOG_SWAP_AB		0x0001
+#define		AR9170_PHY_ANALOG_SWAP_ALT_CHAIN	0x00000040
+
+#define	AR9170_PHY_REG_TPCRG5			(AR9170_PHY_REG_BASE + 0x0a6c)
+#define		AR9170_PHY_TPCRG5_PD_GAIN_OVERLAP	0x0000000f
+#define		AR9170_PHY_TPCRG5_PD_GAIN_OVERLAP_S	0
+#define		AR9170_PHY_TPCRG5_PD_GAIN_BOUNDARY_1	0x000003f0
+#define		AR9170_PHY_TPCRG5_PD_GAIN_BOUNDARY_1_S	4
+#define		AR9170_PHY_TPCRG5_PD_GAIN_BOUNDARY_2	0x0000fc00
+#define		AR9170_PHY_TPCRG5_PD_GAIN_BOUNDARY_2_S	10
+#define		AR9170_PHY_TPCRG5_PD_GAIN_BOUNDARY_3    0x003f0000
+#define		AR9170_PHY_TPCRG5_PD_GAIN_BOUNDARY_3_S  16
+#define		AR9170_PHY_TPCRG5_PD_GAIN_BOUNDARY_4    0x0fc00000
+#define		AR9170_PHY_TPCRG5_PD_GAIN_BOUNDARY_4_S  22
+
+#define	AR9170_PHY_REG_TX_PWRCTRL6_0		(AR9170_PHY_REG_BASE + 0x0a70)
+#define	AR9170_PHY_REG_TX_PWRCTRL6_1		(AR9170_PHY_REG_BASE + 0x1a70)
+#define		AR9170_PHY_TX_PWRCTRL_ERR_EST_MODE	0x03000000
+#define		AR9170_PHY_TX_PWRCTRL_ERR_EST_MODE_S	24
+
+#define	AR9170_PHY_REG_TX_PWRCTRL7		(AR9170_PHY_REG_BASE + 0x0a74)
+#define		AR9170_PHY_TX_PWRCTRL_INIT_TX_GAIN	0x01f80000
+#define		AR9170_PHY_TX_PWRCTRL_INIT_TX_GAIN_S	19
+
+#define	AR9170_PHY_REG_TX_PWRCTRL9		(AR9170_PHY_REG_BASE + 0x0a7c)
+#define		AR9170_PHY_TX_DESIRED_SCALE_CCK		0x00007c00
+#define		AR9170_PHY_TX_DESIRED_SCALE_CCK_S	10
+#define		AR9170_PHY_TX_PWRCTRL9_RES_DC_REMOVAL	0x80000000
+#define		AR9170_PHY_TX_PWRCTRL9_RES_DC_REMOVAL_S	31
+
+#define	AR9170_PHY_REG_TX_GAIN_TBL1		(AR9170_PHY_REG_BASE + 0x0b00)
+#define		AR9170_PHY_TX_GAIN			0x0007f000
+#define		AR9170_PHY_TX_GAIN_S			12
+
+/* Carrier leak calibration control, do it after AGC calibration */
+#define	AR9170_PHY_REG_CL_CAL_CTL		(AR9170_PHY_REG_BASE + 0x0b58)
+#define		AR9170_PHY_CL_CAL_ENABLE		0x00000002
+#define		AR9170_PHY_CL_CAL_PARALLEL_CAL_ENABLE	0x00000001
+
+#define	AR9170_PHY_REG_POWER_TX_RATE5		(AR9170_PHY_REG_BASE + 0x0b8c)
+#define	AR9170_PHY_REG_POWER_TX_RATE6		(AR9170_PHY_REG_BASE + 0x0b90)
+
+#define	AR9170_PHY_REG_CH0_TX_PWRCTRL11		(AR9170_PHY_REG_BASE + 0x0b98)
+#define	AR9170_PHY_REG_CH1_TX_PWRCTRL11		(AR9170_PHY_REG_BASE + 0x1b98)
+#define		AR9170_PHY_TX_CHX_PWRCTRL_OLPC_TEMP_COMP	0x0000fc00
+#define		AR9170_PHY_TX_CHX_PWRCTRL_OLPC_TEMP_COMP_S	10
+
+#define	AR9170_PHY_REG_CAL_CHAINMASK		(AR9170_PHY_REG_BASE + 0x0b9c)
+#define	AR9170_PHY_REG_VIT_MASK2_M_46_61	(AR9170_PHY_REG_BASE + 0x0ba0)
+#define	AR9170_PHY_REG_MASK2_M_31_45		(AR9170_PHY_REG_BASE + 0x0ba4)
+#define	AR9170_PHY_REG_MASK2_M_16_30		(AR9170_PHY_REG_BASE + 0x0ba8)
+#define	AR9170_PHY_REG_MASK2_M_00_15		(AR9170_PHY_REG_BASE + 0x0bac)
+#define	AR9170_PHY_REG_PILOT_MASK_01_30		(AR9170_PHY_REG_BASE + 0x0bb0)
+#define	AR9170_PHY_REG_PILOT_MASK_31_60		(AR9170_PHY_REG_BASE + 0x0bb4)
+#define	AR9170_PHY_REG_MASK2_P_15_01		(AR9170_PHY_REG_BASE + 0x0bb8)
+#define	AR9170_PHY_REG_MASK2_P_30_16		(AR9170_PHY_REG_BASE + 0x0bbc)
+#define	AR9170_PHY_REG_MASK2_P_45_31		(AR9170_PHY_REG_BASE + 0x0bc0)
+#define	AR9170_PHY_REG_MASK2_P_61_45		(AR9170_PHY_REG_BASE + 0x0bc4)
+#define	AR9170_PHY_REG_POWER_TX_SUB		(AR9170_PHY_REG_BASE + 0x0bc8)
+#define	AR9170_PHY_REG_POWER_TX_RATE7		(AR9170_PHY_REG_BASE + 0x0bcc)
+#define	AR9170_PHY_REG_POWER_TX_RATE8		(AR9170_PHY_REG_BASE + 0x0bd0)
+#define	AR9170_PHY_REG_POWER_TX_RATE9		(AR9170_PHY_REG_BASE + 0x0bd4)
+#define	AR9170_PHY_REG_XPA_CFG			(AR9170_PHY_REG_BASE + 0x0bd8)
+#define		AR9170_PHY_FORCE_XPA_CFG		0x000000001
+#define		AR9170_PHY_FORCE_XPA_CFG_S		0
+
+#define	AR9170_PHY_REG_CH1_CCA			(AR9170_PHY_REG_BASE + 0x1064)
+#define		AR9170_PHY_CH1_CCA_MIN_PWR		0x0ff80000
+#define		AR9170_PHY_CH1_CCA_MIN_PWR_S		19
+
+#define	AR9170_PHY_REG_CH2_CCA			(AR9170_PHY_REG_BASE + 0x2064)
+#define		AR9170_PHY_CH2_CCA_MIN_PWR		0x0ff80000
+#define		AR9170_PHY_CH2_CCA_MIN_PWR_S		19
+
+#define	AR9170_PHY_REG_CH1_EXT_CCA		(AR9170_PHY_REG_BASE + 0x11bc)
+#define		AR9170_PHY_CH1_EXT_CCA_MIN_PWR		0xff800000
+#define		AR9170_PHY_CH1_EXT_CCA_MIN_PWR_S	23
+
+#define	AR9170_PHY_REG_CH2_EXT_CCA		(AR9170_PHY_REG_BASE + 0x21bc)
+#define		AR9170_PHY_CH2_EXT_CCA_MIN_PWR		0xff800000
+#define		AR9170_PHY_CH2_EXT_CCA_MIN_PWR_S	23
+
+#endif	/* __CARL9170_SHARED_PHY_H */
diff --git a/carl9170fw/include/shared/version.h b/carl9170fw/include/shared/version.h
new file mode 100644
index 0000000..2ec3e91
--- /dev/null
+++ b/carl9170fw/include/shared/version.h
@@ -0,0 +1,7 @@
+#ifndef __CARL9170_SHARED_VERSION_H
+#define __CARL9170_SHARED_VERSION_H
+#define CARL9170FW_VERSION_YEAR 12
+#define CARL9170FW_VERSION_MONTH 7
+#define CARL9170FW_VERSION_DAY 7
+#define CARL9170FW_VERSION_GIT "1.9.6"
+#endif /* __CARL9170_SHARED_VERSION_H */
diff --git a/carl9170fw/include/shared/wlan.h b/carl9170fw/include/shared/wlan.h
new file mode 100644
index 0000000..ea17995
--- /dev/null
+++ b/carl9170fw/include/shared/wlan.h
@@ -0,0 +1,435 @@
+/*
+ * Shared Atheros AR9170 Header
+ *
+ * RX/TX meta descriptor format
+ *
+ * Copyright 2008, Johannes Berg <johannes@sipsolutions.net>
+ * Copyright 2009-2011 Christian Lamparter <chunkeey@googlemail.com>
+ *
+ * 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.
+ *
+ * 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.
+ */
+
+#ifndef __CARL9170_SHARED_WLAN_H
+#define __CARL9170_SHARED_WLAN_H
+
+#include "fwcmd.h"
+
+#define	AR9170_RX_PHY_RATE_CCK_1M		0x0a
+#define	AR9170_RX_PHY_RATE_CCK_2M		0x14
+#define	AR9170_RX_PHY_RATE_CCK_5M		0x37
+#define	AR9170_RX_PHY_RATE_CCK_11M		0x6e
+
+#define	AR9170_ENC_ALG_NONE			0x0
+#define	AR9170_ENC_ALG_WEP64			0x1
+#define	AR9170_ENC_ALG_TKIP			0x2
+#define	AR9170_ENC_ALG_AESCCMP			0x4
+#define	AR9170_ENC_ALG_WEP128			0x5
+#define	AR9170_ENC_ALG_WEP256			0x6
+#define	AR9170_ENC_ALG_CENC			0x7
+
+#define	AR9170_RX_ENC_SOFTWARE			0x8
+
+#define	AR9170_RX_STATUS_MODULATION		0x03
+#define	AR9170_RX_STATUS_MODULATION_S		0
+#define	AR9170_RX_STATUS_MODULATION_CCK		0x00
+#define	AR9170_RX_STATUS_MODULATION_OFDM	0x01
+#define	AR9170_RX_STATUS_MODULATION_HT		0x02
+#define	AR9170_RX_STATUS_MODULATION_DUPOFDM	0x03
+
+/* depends on modulation */
+#define	AR9170_RX_STATUS_SHORT_PREAMBLE		0x08
+#define	AR9170_RX_STATUS_GREENFIELD		0x08
+
+#define	AR9170_RX_STATUS_MPDU			0x30
+#define	AR9170_RX_STATUS_MPDU_S			4
+#define	AR9170_RX_STATUS_MPDU_SINGLE		0x00
+#define	AR9170_RX_STATUS_MPDU_FIRST		0x20
+#define	AR9170_RX_STATUS_MPDU_MIDDLE		0x30
+#define	AR9170_RX_STATUS_MPDU_LAST		0x10
+
+#define	AR9170_RX_STATUS_CONT_AGGR		0x40
+#define	AR9170_RX_STATUS_TOTAL_ERROR		0x80
+
+#define	AR9170_RX_ERROR_RXTO			0x01
+#define	AR9170_RX_ERROR_OVERRUN			0x02
+#define	AR9170_RX_ERROR_DECRYPT			0x04
+#define	AR9170_RX_ERROR_FCS			0x08
+#define	AR9170_RX_ERROR_WRONG_RA		0x10
+#define	AR9170_RX_ERROR_PLCP			0x20
+#define	AR9170_RX_ERROR_MMIC			0x40
+
+/* these are either-or */
+#define	AR9170_TX_MAC_PROT_RTS			0x0001
+#define	AR9170_TX_MAC_PROT_CTS			0x0002
+#define	AR9170_TX_MAC_PROT			0x0003
+
+#define	AR9170_TX_MAC_NO_ACK			0x0004
+/* if unset, MAC will only do SIFS space before frame */
+#define	AR9170_TX_MAC_BACKOFF			0x0008
+#define	AR9170_TX_MAC_BURST			0x0010
+#define	AR9170_TX_MAC_AGGR			0x0020
+
+/* encryption is a two-bit field */
+#define	AR9170_TX_MAC_ENCR_NONE			0x0000
+#define	AR9170_TX_MAC_ENCR_RC4			0x0040
+#define	AR9170_TX_MAC_ENCR_CENC			0x0080
+#define	AR9170_TX_MAC_ENCR_AES			0x00c0
+
+#define	AR9170_TX_MAC_MMIC			0x0100
+#define	AR9170_TX_MAC_HW_DURATION		0x0200
+#define	AR9170_TX_MAC_QOS_S			10
+#define	AR9170_TX_MAC_QOS			0x0c00
+#define	AR9170_TX_MAC_DISABLE_TXOP		0x1000
+#define	AR9170_TX_MAC_TXOP_RIFS			0x2000
+#define	AR9170_TX_MAC_IMM_BA			0x4000
+
+/* either-or */
+#define	AR9170_TX_PHY_MOD_CCK			0x00000000
+#define	AR9170_TX_PHY_MOD_OFDM			0x00000001
+#define	AR9170_TX_PHY_MOD_HT			0x00000002
+
+/* depends on modulation */
+#define	AR9170_TX_PHY_SHORT_PREAMBLE		0x00000004
+#define	AR9170_TX_PHY_GREENFIELD		0x00000004
+
+#define	AR9170_TX_PHY_BW_S			3
+#define	AR9170_TX_PHY_BW			(3 << AR9170_TX_PHY_BW_SHIFT)
+#define	AR9170_TX_PHY_BW_20MHZ			0
+#define	AR9170_TX_PHY_BW_40MHZ			2
+#define	AR9170_TX_PHY_BW_40MHZ_DUP		3
+
+#define	AR9170_TX_PHY_TX_HEAVY_CLIP_S		6
+#define	AR9170_TX_PHY_TX_HEAVY_CLIP		(7 << \
+						 AR9170_TX_PHY_TX_HEAVY_CLIP_S)
+
+#define	AR9170_TX_PHY_TX_PWR_S			9
+#define	AR9170_TX_PHY_TX_PWR			(0x3f << \
+						 AR9170_TX_PHY_TX_PWR_S)
+
+#define	AR9170_TX_PHY_TXCHAIN_S			15
+#define	AR9170_TX_PHY_TXCHAIN			(7 << \
+						 AR9170_TX_PHY_TXCHAIN_S)
+#define	AR9170_TX_PHY_TXCHAIN_1			1
+/* use for cck, ofdm 6/9/12/18/24 and HT if capable */
+#define	AR9170_TX_PHY_TXCHAIN_2			5
+
+#define	AR9170_TX_PHY_MCS_S			18
+#define	AR9170_TX_PHY_MCS			(0x7f << \
+						 AR9170_TX_PHY_MCS_S)
+
+#define	AR9170_TX_PHY_RATE_CCK_1M		0x0
+#define	AR9170_TX_PHY_RATE_CCK_2M		0x1
+#define	AR9170_TX_PHY_RATE_CCK_5M		0x2
+#define	AR9170_TX_PHY_RATE_CCK_11M		0x3
+
+/* same as AR9170_RX_PHY_RATE */
+#define	AR9170_TXRX_PHY_RATE_OFDM_6M		0xb
+#define	AR9170_TXRX_PHY_RATE_OFDM_9M		0xf
+#define	AR9170_TXRX_PHY_RATE_OFDM_12M		0xa
+#define	AR9170_TXRX_PHY_RATE_OFDM_18M		0xe
+#define	AR9170_TXRX_PHY_RATE_OFDM_24M		0x9
+#define	AR9170_TXRX_PHY_RATE_OFDM_36M		0xd
+#define	AR9170_TXRX_PHY_RATE_OFDM_48M		0x8
+#define	AR9170_TXRX_PHY_RATE_OFDM_54M		0xc
+
+#define	AR9170_TXRX_PHY_RATE_HT_MCS0		0x0
+#define	AR9170_TXRX_PHY_RATE_HT_MCS1		0x1
+#define	AR9170_TXRX_PHY_RATE_HT_MCS2		0x2
+#define	AR9170_TXRX_PHY_RATE_HT_MCS3		0x3
+#define	AR9170_TXRX_PHY_RATE_HT_MCS4		0x4
+#define	AR9170_TXRX_PHY_RATE_HT_MCS5		0x5
+#define	AR9170_TXRX_PHY_RATE_HT_MCS6		0x6
+#define	AR9170_TXRX_PHY_RATE_HT_MCS7		0x7
+#define	AR9170_TXRX_PHY_RATE_HT_MCS8		0x8
+#define	AR9170_TXRX_PHY_RATE_HT_MCS9		0x9
+#define	AR9170_TXRX_PHY_RATE_HT_MCS10		0xa
+#define	AR9170_TXRX_PHY_RATE_HT_MCS11		0xb
+#define	AR9170_TXRX_PHY_RATE_HT_MCS12		0xc
+#define	AR9170_TXRX_PHY_RATE_HT_MCS13		0xd
+#define	AR9170_TXRX_PHY_RATE_HT_MCS14		0xe
+#define	AR9170_TXRX_PHY_RATE_HT_MCS15		0xf
+
+#define	AR9170_TX_PHY_SHORT_GI			0x80000000
+
+#ifdef __CARL9170FW__
+struct ar9170_tx_hw_mac_control {
+	union {
+		struct {
+			/*
+			 * Beware of compiler bugs in all gcc pre 4.4!
+			 */
+
+			u8 erp_prot:2;
+			u8 no_ack:1;
+			u8 backoff:1;
+			u8 burst:1;
+			u8 ampdu:1;
+
+			u8 enc_mode:2;
+
+			u8 hw_mmic:1;
+			u8 hw_duration:1;
+
+			u8 qos_queue:2;
+
+			u8 disable_txop:1;
+			u8 txop_rifs:1;
+
+			u8 ba_end:1;
+			u8 probe:1;
+		} __packed;
+
+		__le16 set;
+	} __packed;
+} __packed;
+
+struct ar9170_tx_hw_phy_control {
+	union {
+		struct {
+			/*
+			 * Beware of compiler bugs in all gcc pre 4.4!
+			 */
+
+			u8 modulation:2;
+			u8 preamble:1;
+			u8 bandwidth:2;
+			u8:1;
+			u8 heavy_clip:3;
+			u8 tx_power:6;
+			u8 chains:3;
+			u8 mcs:7;
+			u8:6;
+			u8 short_gi:1;
+		} __packed;
+
+		__le32 set;
+	} __packed;
+} __packed;
+
+struct ar9170_tx_rate_info {
+	u8 tries:3;
+	u8 erp_prot:2;
+	u8 ampdu:1;
+	u8 free:2; /* free for use (e.g.:RIFS/TXOP/AMPDU) */
+} __packed;
+
+struct carl9170_tx_superdesc {
+	__le16 len;
+	u8 rix;
+	u8 cnt;
+	u8 cookie;
+	u8 ampdu_density:3;
+	u8 ampdu_factor:2;
+	u8 ampdu_commit_density:1;
+	u8 ampdu_commit_factor:1;
+	u8 ampdu_unused_bit:1;
+	u8 queue:2;
+	u8 assign_seq:1;
+	u8 vif_id:3;
+	u8 fill_in_tsf:1;
+	u8 cab:1;
+	u8 padding2;
+	struct ar9170_tx_rate_info ri[CARL9170_TX_MAX_RATES];
+	struct ar9170_tx_hw_phy_control rr[CARL9170_TX_MAX_RETRY_RATES];
+} __packed;
+
+struct ar9170_tx_hwdesc {
+	__le16 length;
+	struct ar9170_tx_hw_mac_control mac;
+	struct ar9170_tx_hw_phy_control phy;
+} __packed;
+
+struct ar9170_tx_frame {
+	struct ar9170_tx_hwdesc hdr;
+
+	union {
+		struct ieee80211_hdr i3e;
+		u8 payload[0];
+	} data;
+} __packed;
+
+struct carl9170_tx_superframe {
+	struct carl9170_tx_superdesc s;
+	struct ar9170_tx_frame f;
+} __packed __aligned(4);
+
+#endif /* __CARL9170FW__ */
+
+struct _ar9170_tx_hwdesc {
+	__le16 length;
+	__le16 mac_control;
+	__le32 phy_control;
+} __packed;
+
+#define	CARL9170_TX_SUPER_AMPDU_DENSITY_S		0
+#define	CARL9170_TX_SUPER_AMPDU_DENSITY			0x7
+#define	CARL9170_TX_SUPER_AMPDU_FACTOR			0x18
+#define	CARL9170_TX_SUPER_AMPDU_FACTOR_S		3
+#define	CARL9170_TX_SUPER_AMPDU_COMMIT_DENSITY		0x20
+#define	CARL9170_TX_SUPER_AMPDU_COMMIT_DENSITY_S	5
+#define	CARL9170_TX_SUPER_AMPDU_COMMIT_FACTOR		0x40
+#define	CARL9170_TX_SUPER_AMPDU_COMMIT_FACTOR_S		6
+
+#define CARL9170_TX_SUPER_MISC_QUEUE			0x3
+#define CARL9170_TX_SUPER_MISC_QUEUE_S			0
+#define CARL9170_TX_SUPER_MISC_ASSIGN_SEQ		0x4
+#define	CARL9170_TX_SUPER_MISC_VIF_ID			0x38
+#define	CARL9170_TX_SUPER_MISC_VIF_ID_S			3
+#define	CARL9170_TX_SUPER_MISC_FILL_IN_TSF		0x40
+#define	CARL9170_TX_SUPER_MISC_CAB			0x80
+
+#define CARL9170_TX_SUPER_RI_TRIES			0x7
+#define CARL9170_TX_SUPER_RI_TRIES_S			0
+#define CARL9170_TX_SUPER_RI_ERP_PROT			0x18
+#define CARL9170_TX_SUPER_RI_ERP_PROT_S			3
+#define CARL9170_TX_SUPER_RI_AMPDU			0x20
+#define CARL9170_TX_SUPER_RI_AMPDU_S			5
+
+struct _carl9170_tx_superdesc {
+	__le16 len;
+	u8 rix;
+	u8 cnt;
+	u8 cookie;
+	u8 ampdu_settings;
+	u8 misc;
+	u8 padding;
+	u8 ri[CARL9170_TX_MAX_RATES];
+	__le32 rr[CARL9170_TX_MAX_RETRY_RATES];
+} __packed;
+
+struct _carl9170_tx_superframe {
+	struct _carl9170_tx_superdesc s;
+	struct _ar9170_tx_hwdesc f;
+	u8 frame_data[0];
+} __packed __aligned(4);
+
+#define	CARL9170_TX_SUPERDESC_LEN		24
+#define	AR9170_TX_HWDESC_LEN			8
+#define	CARL9170_TX_SUPERFRAME_LEN		(CARL9170_TX_SUPERDESC_LEN + \
+						 AR9170_TX_HWDESC_LEN)
+
+struct ar9170_rx_head {
+	u8 plcp[12];
+} __packed;
+
+#define	AR9170_RX_HEAD_LEN			12
+
+struct ar9170_rx_phystatus {
+	union {
+		struct {
+			u8 rssi_ant0, rssi_ant1, rssi_ant2,
+				rssi_ant0x, rssi_ant1x, rssi_ant2x,
+				rssi_combined;
+		} __packed;
+		u8 rssi[7];
+	} __packed;
+
+	u8 evm_stream0[6], evm_stream1[6];
+	u8 phy_err;
+} __packed;
+
+#define	AR9170_RX_PHYSTATUS_LEN			20
+
+struct ar9170_rx_macstatus {
+	u8 SAidx, DAidx;
+	u8 error;
+	u8 status;
+} __packed;
+
+#define	AR9170_RX_MACSTATUS_LEN			4
+
+struct ar9170_rx_frame_single {
+	struct ar9170_rx_head phy_head;
+	struct ieee80211_hdr i3e;
+	struct ar9170_rx_phystatus phy_tail;
+	struct ar9170_rx_macstatus macstatus;
+} __packed;
+
+struct ar9170_rx_frame_head {
+	struct ar9170_rx_head phy_head;
+	struct ieee80211_hdr i3e;
+	struct ar9170_rx_macstatus macstatus;
+} __packed;
+
+struct ar9170_rx_frame_middle {
+	struct ieee80211_hdr i3e;
+	struct ar9170_rx_macstatus macstatus;
+} __packed;
+
+struct ar9170_rx_frame_tail {
+	struct ieee80211_hdr i3e;
+	struct ar9170_rx_phystatus phy_tail;
+	struct ar9170_rx_macstatus macstatus;
+} __packed;
+
+struct ar9170_rx_frame {
+	union {
+		struct ar9170_rx_frame_single single;
+		struct ar9170_rx_frame_head head;
+		struct ar9170_rx_frame_middle middle;
+		struct ar9170_rx_frame_tail tail;
+	} __packed;
+} __packed;
+
+static inline u8 ar9170_get_decrypt_type(struct ar9170_rx_macstatus *t)
+{
+	return (t->SAidx & 0xc0) >> 4 |
+	       (t->DAidx & 0xc0) >> 6;
+}
+
+/*
+ * This is an workaround for several undocumented bugs.
+ * Don't mess with the QoS/AC <-> HW Queue map, if you don't
+ * know what you are doing.
+ *
+ * Known problems [hardware]:
+ *  * The MAC does not aggregate frames on anything other
+ *    than the first HW queue.
+ *  * when an AMPDU is placed [in the first hw queue] and
+ *    additional frames are already queued on a different
+ *    hw queue, the MAC will ALWAYS freeze.
+ *
+ * In a nutshell: The hardware can either do QoS or
+ * Aggregation but not both at the same time. As a
+ * result, this makes the device pretty much useless
+ * for any serious 802.11n setup.
+ */
+enum ar9170_txq {
+	AR9170_TXQ_BK = 0,	/* TXQ0 */
+	AR9170_TXQ_BE,		/* TXQ1	*/
+	AR9170_TXQ_VI,		/* TXQ2	*/
+	AR9170_TXQ_VO,		/* TXQ3 */
+
+	__AR9170_NUM_TXQ,
+};
+
+#define	AR9170_TXQ_DEPTH			32
+
+#endif /* __CARL9170_SHARED_WLAN_H */
diff --git a/carl9170fw/minifw/CMakeLists.txt b/carl9170fw/minifw/CMakeLists.txt
new file mode 100644
index 0000000..adf5e08
--- /dev/null
+++ b/carl9170fw/minifw/CMakeLists.txt
@@ -0,0 +1,20 @@
+cmake_minimum_required(VERSION 2.8)
+
+project(miniboot.fw)
+
+include("../extra/sh-elf-linux.cmake")
+include("../config.cmake")
+
+set(miniboot_src miniboot.S)
+set_source_files_properties(miniboot.S PROPERTIES LANGUAGE C)
+
+add_executable(miniboot.elf miniboot.S)
+
+set_target_properties(miniboot.elf PROPERTIES LINKER_LANGUAGE C)
+
+set_target_properties(miniboot.elf PROPERTIES LINK_FLAGS "-Tminiboot.lds")
+
+add_custom_target(
+	miniboot.fw ALL
+	${OBJCOPY} --strip-unneeded -O binary -R .sram -R .eeprom -R .fwdsc miniboot.elf miniboot.fw
+	DEPENDS miniboot.elf)
diff --git a/carl9170fw/minifw/Kconfig b/carl9170fw/minifw/Kconfig
new file mode 100644
index 0000000..f429bd2
--- /dev/null
+++ b/carl9170fw/minifw/Kconfig
@@ -0,0 +1,3 @@
+config CARL9170FW_BUILD_MINIBOOT
+	def_bool y
+	prompt "Build MiniBoot Firmware Header"
diff --git a/carl9170fw/minifw/miniboot.S b/carl9170fw/minifw/miniboot.S
new file mode 100644
index 0000000..e5d598e
--- /dev/null
+++ b/carl9170fw/minifw/miniboot.S
@@ -0,0 +1,7 @@
+	.globl _start
+	.type  _start, @function
+	.section ".boot", "ax"
+	_start:
+		mov.l startcode, r0
+		jmp @r0
+startcode:	.long 0x00000008
diff --git a/carl9170fw/minifw/miniboot.lds b/carl9170fw/minifw/miniboot.lds
new file mode 100644
index 0000000..51e5ac4
--- /dev/null
+++ b/carl9170fw/minifw/miniboot.lds
@@ -0,0 +1,20 @@
+ENTRY(_start);
+
+MEMORY
+{
+    pram     : ORIGIN = 0x200000, LENGTH = 16k
+}
+
+SECTIONS
+{
+	.padding : {
+		/* NOP NOP just in case */
+		LONG(0x00090009)
+	} > pram
+
+	.boot   : { *(.boot) } > pram
+	.text	: { *(.text*) } > pram
+	.rodata	: { *(.rodata*) } > pram
+	.bss	: { *(.bss) } > pram
+	.data	: { *(.data*) } > pram
+}
diff --git a/carl9170fw/toolchain/Makefile b/carl9170fw/toolchain/Makefile
new file mode 100644
index 0000000..2b25ffe
--- /dev/null
+++ b/carl9170fw/toolchain/Makefile
@@ -0,0 +1,66 @@
+BINUTILS_VER=2.22
+BINUTILS_URL=http://mirrors.kernel.org/gnu/binutils/binutils-$(BINUTILS_VER).tar.bz2
+BINUTILS_TAR=binutils-$(BINUTILS_VER).tar.bz2
+
+NEWLIB_VER=1.20.0
+NEWLIB_URL=ftp://sources.redhat.com/pub/newlib/newlib-$(NEWLIB_VER).tar.gz
+NEWLIB_TAR=newlib-$(NEWLIB_VER).tar.gz
+
+GCC_VER=4.7.1
+GCC_URL=http://mirrors.kernel.org/gnu/gcc/gcc-$(GCC_VER)/gcc-$(GCC_VER).tar.bz2
+GCC_TAR=gcc-$(GCC_VER).tar.bz2
+
+BASEDIR=$(shell pwd)
+
+define checksum
+@if grep -q '  $(subst .,\.,$(1))$$' SHA256SUMS; then			\
+	grep '  $(subst .,\.,$(1))$$' SHA256SUMS | sha256sum -c;	\
+else									\
+	echo "WARNING: no checksum defined for $(1)";			\
+fi
+endef
+
+all: gcc
+
+src/$(BINUTILS_TAR):
+	wget -P src $(BINUTILS_URL)
+	$(call checksum,$@)
+
+src/$(NEWLIB_TAR):
+	wget -P src $(NEWLIB_URL)
+	$(call checksum,$@)
+
+src/$(GCC_TAR):
+	wget -P src $(GCC_URL)
+	$(call checksum,$@)
+
+src/binutils-$(BINUTILS_VER): src/$(BINUTILS_TAR)
+	tar -C src -xjf $<
+
+src/newlib-$(NEWLIB_VER): src/$(NEWLIB_TAR)
+	tar -C src -xzf $<
+
+src/gcc-$(GCC_VER): src/$(GCC_TAR) src/newlib-$(NEWLIB_VER)
+	tar -C src -xjf $<
+	ln -s $(BASEDIR)/src/newlib-$(NEWLIB_VER)/newlib $@
+	ln -s $(BASEDIR)/src/newlib-$(NEWLIB_VER)/libgloss $@
+
+binutils: src/binutils-$(BINUTILS_VER)
+	mkdir -p build/binutils
+	cd build/binutils; \
+	$(BASEDIR)/$</configure --target=sh-elf --prefix=$(BASEDIR)/inst; \
+	$(MAKE) -j3; \
+	$(MAKE) install
+
+gcc: src/gcc-$(GCC_VER) binutils
+	mkdir -p build/gcc
+	cd build/gcc; \
+	$(BASEDIR)/$</configure --target=sh-elf --prefix=$(BASEDIR)/inst -enable-languages=c --without-pkgversion --with-newlib; \
+	$(MAKE) -j3; \
+	$(MAKE) install
+
+clean:
+	rm -rf build inst
+
+distclean: clean
+	rm -rf src
diff --git a/carl9170fw/toolchain/SHA256SUMS b/carl9170fw/toolchain/SHA256SUMS
new file mode 100644
index 0000000..00c3911
--- /dev/null
+++ b/carl9170fw/toolchain/SHA256SUMS
@@ -0,0 +1,3 @@
+6c7af8ed1c8cf9b4b9d6e6fe09a3e1d3d479fe63984ba8b9b26bf356b6313ca9  src/binutils-2.22.tar.bz2
+16093f6fa01732adf378d97fe338f113c933bdf56da22bf87c76beff13da406f  src/gcc-4.7.1.tar.bz2
+c644b2847244278c57bec2ddda69d8fab5a7c767f3b9af69aa7aa3da823ff692  src/newlib-1.20.0.tar.gz
diff --git a/carl9170fw/tools/CMakeLists.txt b/carl9170fw/tools/CMakeLists.txt
new file mode 100644
index 0000000..51d71fa
--- /dev/null
+++ b/carl9170fw/tools/CMakeLists.txt
@@ -0,0 +1,38 @@
+cmake_minimum_required(VERSION 2.8)
+
+project(tools)
+
+if (CONFIG_CARL9170FW_MAKE_RELEASE)
+	set(CMAKE_BUILD_TYPE Release)
+endif (CONFIG_CARL9170FW_MAKE_RELEASE)
+
+set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/extra)
+
+include(GCCVersion)
+include("../config.cmake")
+
+_COMPILER_DUMPVERSION(_COMPILER_VERSION)
+
+if (("${_COMPILER_VERSION}" VERSION_GREATER 44) OR
+    ("${_COMPILER_VERSION}" VERSION_EQUAL 44))
+
+	include_directories (../include/linux ../include/shared ../include lib include)
+	add_subdirectory(lib)
+	add_subdirectory(src)
+
+	if (CONFIG_CARL9170FW_BUILD_TOOLS_CARLU)
+		find_package(SDL QUIET)
+		find_package(USB-1.0 QUIET)
+
+		if ("${USB-1.0_FOUND}" AND "${SDL_FOUND}")
+			add_subdirectory(carlu)
+		else()
+			if ("${USB-1.0_FOUND}")
+				MESSAGE(ERROR "LibUSB not found\n")
+			endif ("${USB-1.0_FOUND}")
+			if ("${SDL_FOUND}")
+				MESSAGE(ERROR "SDL not found\n")
+			endif ("${SDL_FOUND}")
+		endif ()
+	endif (CONFIG_CARL9170FW_BUILD_TOOLS_CARLU)
+endif ()
diff --git a/carl9170fw/tools/Kconfig b/carl9170fw/tools/Kconfig
new file mode 100644
index 0000000..5e4eba2
--- /dev/null
+++ b/carl9170fw/tools/Kconfig
@@ -0,0 +1,12 @@
+menu "Firmware Tools"
+
+config CARL9170FW_BUILD_TOOLS
+	def_bool y
+	prompt "Build Firmware Tools"
+
+config CARL9170FW_BUILD_TOOLS_CARLU
+	def_bool n
+	prompt "Build CARLU testbench"
+	depends on CARL9170FW_BUILD_TOOLS
+
+endmenu
diff --git a/carl9170fw/tools/carlu/CMakeLists.txt b/carl9170fw/tools/carlu/CMakeLists.txt
new file mode 100644
index 0000000..0ea6a05
--- /dev/null
+++ b/carl9170fw/tools/carlu/CMakeLists.txt
@@ -0,0 +1,18 @@
+cmake_minimum_required(VERSION 2.8)
+
+project(carlu)
+
+find_package(SDL REQUIRED)
+find_package(USB-1.0 REQUIRED)
+
+set(carlu_src src/debug.c src/cmd.c src/usb.c src/rx.c src/tx.c src/fw.c
+	      src/test.c src/main.c)
+
+add_definitions(-D_GNU_SOURCE ${USB-1.0_DEFINITIONS})
+add_definitions(-DCARLU_PATH="${CMAKE_CURRENT_SOURCE_DIR}")
+
+include_directories(${SDL_INCLUDE_DIR} ${USB-1.0_INCLUDE_DIRS})
+
+add_executable(carlu ${carlu_src})
+
+target_link_libraries (carlu ${SDL_LIBRARY} ${USB-1.0_LIBRARIES} SDLmain carlfw)
diff --git a/carl9170fw/tools/carlu/src/carlu.h b/carl9170fw/tools/carlu/src/carlu.h
new file mode 100644
index 0000000..5e2c6bb
--- /dev/null
+++ b/carl9170fw/tools/carlu/src/carlu.h
@@ -0,0 +1,147 @@
+/*
+ * carlu - userspace testing utility for ar9170 devices
+ *
+ * common API declaration
+ *
+ * Copyright 2009-2011 Christian Lamparter <chunkeey@googlemail.com>
+ *
+ * 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; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef __CARL9170USER_H
+#define __CARL9170USER_H
+
+#include "SDL.h"
+#include "SDL_thread.h"
+
+#include "carlfw.h"
+
+#include "debug.h"
+#include "hw.h"
+#include "fwcmd.h"
+#include "frame.h"
+#include "eeprom.h"
+#include "ieee80211.h"
+#include "wlan.h"
+#include "usb.h"
+
+struct carlu {
+	libusb_device_handle *dev;
+	libusb_context *ctx;
+
+	SDL_Thread *event_thread;
+	bool stop_event_polling;
+
+	struct libusb_transfer *rx_ring[AR9170_RX_BULK_BUFS];
+
+	struct libusb_transfer *rx_interrupt;
+	unsigned char irq_buf[AR9170_RX_BULK_IRQ_SIZE];
+
+	union {
+		unsigned char buf[CARL9170_MAX_CMD_LEN];
+		uint32_t buf4[CARL9170_MAX_CMD_LEN / sizeof(uint32_t)];
+		struct carl9170_cmd cmd;
+		struct carl9170_rsp rsp;
+	} cmd;
+
+	struct list_head tx_queue;
+	SDL_mutex *tx_queue_lock;
+	unsigned int tx_queue_len;
+
+	struct list_head dev_list;
+	unsigned int idx;
+
+	unsigned int miniboot_size;
+	unsigned int rx_max;
+
+	int event_pipe[2];
+
+	SDL_cond *resp_pend;
+	SDL_mutex *resp_lock;
+	uint8_t *resp_buf;
+	size_t resp_len;
+
+	int tx_pending;
+	uint8_t cookie;
+
+	void (*tx_cb)(struct carlu *, struct frame *);
+	void (*tx_fb_cb)(struct carlu *, struct frame *);
+	void (*rx_cb)(struct carlu *, void *, unsigned int);
+	int (*cmd_cb)(struct carlu *, struct carl9170_rsp *,
+		      void *, unsigned int);
+
+	struct carlfw *fw;
+
+	struct ar9170_eeprom eeprom;
+
+	struct frame_queue tx_sent_queue[__AR9170_NUM_TXQ];
+
+	SDL_mutex *mem_lock;
+	unsigned int dma_chunks;
+	unsigned int dma_chunk_size;
+	unsigned int used_dma_chunks;
+
+	unsigned int extra_headroom;
+	bool tx_stream;
+	bool rx_stream;
+
+	/* statistics */
+	unsigned int rxed;
+	unsigned int txed;
+
+	unsigned long tx_octets;
+	unsigned long rx_octets;
+};
+
+struct carlu_rate {
+	int8_t rix;
+	int8_t cnt;
+	uint8_t flags;
+};
+
+struct carlu_tx_info_tx {
+	unsigned int key;
+};
+
+struct carlu_tx_info {
+	uint32_t flags;
+
+	struct carlu_rate rates[CARL9170_TX_MAX_RATES];
+
+	union {
+		struct carlu_tx_info_tx tx;
+	};
+};
+
+static inline struct carlu_tx_info *get_tx_info(struct frame *frame)
+{
+	return (void *) frame->cb;
+}
+
+void *carlu_alloc_driver(size_t size);
+void carlu_free_driver(struct carlu *ar);
+
+int carlu_fw_check(struct carlu *ar);
+void carlu_fw_info(struct carlu *ar);
+
+void carlu_rx(struct carlu *ar, struct frame *frame);
+int carlu_tx(struct carlu *ar, struct frame *frame);
+void carlu_tx_feedback(struct carlu *ar,
+			  struct carl9170_rsp *cmd);
+void carlu_handle_command(struct carlu *ar, void *buf, unsigned int len);
+
+struct frame *carlu_alloc_frame(struct carlu *ar, unsigned int size);
+void carlu_free_frame(struct carlu *ar, struct frame *frame);
+#endif /* __CARL9170USER_H */
diff --git a/carl9170fw/tools/carlu/src/cmd.c b/carl9170fw/tools/carlu/src/cmd.c
new file mode 100644
index 0000000..bb87399
--- /dev/null
+++ b/carl9170fw/tools/carlu/src/cmd.c
@@ -0,0 +1,189 @@
+/*
+ * carlu - userspace testing utility for ar9170 devices
+ *
+ * Abstraction Layer for FW/HW command interface
+ *
+ * Copyright 2009-2011 Christian Lamparter <chunkeey@googlemail.com>
+ *
+ * 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; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdio.h>
+#include <stdbool.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <string.h>
+#include <stdlib.h>
+#include "libusb.h"
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+#include "carlu.h"
+#include "usb.h"
+#include "debug.h"
+#include "fwcmd.h"
+#include "eeprom.h"
+#include "cmd.h"
+
+int carlu_cmd_echo(struct carlu *ar, const uint32_t message)
+{
+	uint32_t _message;
+	int ret;
+
+	ret = carlusb_cmd(ar, CARL9170_CMD_ECHO,
+			     (uint8_t *)&message, sizeof(message),
+			     (uint8_t *)&_message, sizeof(_message));
+
+	if (ret == 0)
+		ret = (message == _message) ? 0 : -EIO;
+
+	return ret;
+}
+
+struct carl9170_cmd *carlu_cmd_buf(struct carlu *ar,
+	const enum carl9170_cmd_oids cmd, const unsigned int len)
+{
+	struct carl9170_cmd *tmp;
+
+	if (len % 4 || (sizeof(struct carl9170_cmd_head) + len > 64))
+		return ERR_PTR(-EINVAL);
+
+	tmp = malloc(sizeof(struct carl9170_cmd_head) + len);
+	if (tmp) {
+		tmp->hdr.cmd = cmd;
+		tmp->hdr.len = len;
+	}
+	return tmp;
+}
+
+int carlu_cmd_reboot(struct carlu *ar)
+{
+	struct carl9170_cmd *reboot;
+	int err;
+
+	/* sure, we could put the struct on the stack too. */
+	reboot = carlu_cmd_buf(ar, CARL9170_CMD_REBOOT_ASYNC, 0);
+	if (IS_ERR_OR_NULL(reboot))
+		return reboot ? PTR_ERR(reboot) : -ENOMEM;
+
+	err = carlusb_cmd_async(ar, reboot, true);
+	return err;
+}
+
+int carlu_cmd_mem_dump(struct carlu *ar, const uint32_t start,
+			const unsigned int len, void *_buf)
+{
+#define RW	8	/* number of words to read at once */
+#define RB	(sizeof(uint32_t) * RW)
+	uint8_t *buf = _buf;
+	unsigned int i, j, block;
+	int err;
+	__le32 offsets[RW];
+
+	for (i = 0; i < (len + RB - 1) / RB; i++) {
+		block = min_t(unsigned int, (len - RB * i) / sizeof(uint32_t), RW);
+		for (j = 0; j < block; j++)
+			offsets[j] = cpu_to_le32(start + RB * i + 4 * j);
+
+		err = carlusb_cmd(ar, CARL9170_CMD_RREG,
+				    (void *) &offsets, block * sizeof(uint32_t),
+				    (void *) buf + RB * i, RB);
+
+		if (err)
+			return err;
+	}
+
+#undef RW
+#undef RB
+
+	return 0;
+}
+
+int carlu_cmd_mem_watch(struct carlu *ar, const uint32_t mem,
+			const unsigned int len, void *_buf)
+{
+#define RW	8	/* number of words to read at once */
+#define RB	(sizeof(uint32_t) * RW)
+	uint8_t *buf = _buf;
+	unsigned int i, j, block;
+	int err;
+	__le32 offsets[RW];
+
+	for (i = 0; i < (len + RB - 1) / RB; i++) {
+		block = min_t(unsigned int, (len - RB * i) / sizeof(uint32_t), RW);
+		for (j = 0; j < block; j++)
+			offsets[j] = cpu_to_le32(mem);
+
+		err = carlusb_cmd(ar, CARL9170_CMD_RREG,
+				    (void *) &offsets, block * sizeof(uint32_t),
+				    (void *) buf + RB * i, RB);
+
+		if (err)
+			return err;
+	}
+
+#undef RW
+#undef RB
+
+	return 0;
+}
+
+int carlu_cmd_write_mem(struct carlu *ar, const uint32_t addr,
+			const uint32_t val)
+{
+	int err;
+	__le32 msg, block[2] = { cpu_to_le32(addr), cpu_to_le32(val) };
+
+	err = carlusb_cmd(ar, CARL9170_CMD_WREG,
+			  (void *) &block, sizeof(block),
+			  (void *) &msg, sizeof(msg));
+	return err;
+}
+
+int carlu_cmd_read_mem(struct carlu *ar, const uint32_t _addr,
+		       uint32_t *val)
+{
+	int err;
+	__le32 msg, addr = { cpu_to_le32(_addr) };
+	err = carlusb_cmd(ar, CARL9170_CMD_RREG, (void *) &addr, sizeof(addr),
+			  (void *) &msg, sizeof(msg));
+
+	*val = le32_to_cpu(msg);
+	return err;
+}
+
+int carlu_cmd_read_eeprom(struct carlu *ar)
+{
+
+	int err;
+
+	err = carlu_cmd_mem_dump(ar, AR9170_EEPROM_START, sizeof(ar->eeprom),
+				  &ar->eeprom);
+
+#ifndef __CHECKER__
+	/* don't want to handle trailing remains */
+	BUILD_BUG_ON(sizeof(ar->eeprom) % 8);
+#endif
+
+	if (ar->eeprom.length == cpu_to_le16(0xffff))
+		return -ENODATA;
+
+	return 0;
+}
diff --git a/carl9170fw/tools/carlu/src/cmd.h b/carl9170fw/tools/carlu/src/cmd.h
new file mode 100644
index 0000000..ccc9a43
--- /dev/null
+++ b/carl9170fw/tools/carlu/src/cmd.h
@@ -0,0 +1,135 @@
+/*
+ * carlu - userspace testing utility for ar9170 devices
+ *
+ * register/memory/command access functions
+ *
+ * Copyright 2009-2011 Christian Lamparter <chunkeey@googlemail.com>
+ *
+ * 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; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef __CARL9170USER_CMD_H
+#define __CARL9170USER_CMD_H
+
+#include "carlu.h"
+
+int carlu_cmd_echo(struct carlu *ar, const uint32_t message);
+int carlu_cmd_reboot(struct carlu *ar);
+int carlu_cmd_read_eeprom(struct carlu *ar);
+int carlu_cmd_mem_dump(struct carlu *ar, const uint32_t start,
+			const unsigned int len, void *_buf);
+int carlu_cmd_write_mem(struct carlu *ar, const uint32_t addr,
+			const uint32_t val);
+int carlu_cmd_mem_watch(struct carlu *ar, const uint32_t mem,
+			const unsigned int len, void *_buf);
+
+struct carl9170_cmd *carlu_cmd_buf(struct carlu *ar,
+	const enum carl9170_cmd_oids cmd, const unsigned int len);
+
+#define PAYLOAD_MAX	(CARL9170_MAX_CMD_LEN / 4 - 1)
+/*
+ * Macros to facilitate writing multiple registers in a single
+ * write-combining USB command. Note that when the first group
+ * fails the whole thing will fail without any others attempted,
+ * but you won't know which write in the group failed.
+ */
+#define carlu_regwrite_begin(ar)					\
+do {									\
+	struct carlu *__ar = ar;					\
+	unsigned int __nreg = 0;					\
+	int __err = 0;							\
+	uint32_t __dummy;
+
+#define carlu_regwrite_flush()						\
+	if (__nreg) {							\
+		__err = carlusb_cmd(__ar, CARL9170_CMD_WREG,		\
+			(u8 *)&__ar->cmd.cmd.data, 8 * __nreg,		\
+			(u8 *)&__dummy, sizeof(__dummy));		\
+		__nreg = 0;						\
+		if (__err)						\
+			goto __regwrite_out;				\
+	}
+
+#define carlu_regwrite(r, v) do {					\
+	__ar->cmd.buf4[2 * __nreg + 1] = cpu_to_le32(r);		\
+	__ar->cmd.buf4[2 * __nreg + 2] = cpu_to_le32(v);		\
+	__nreg++;							\
+	if ((__nreg >= PAYLOAD_MAX / 2)) {				\
+		__err = carlusb_cmd(__ar, CARL9170_CMD_WREG,		\
+			(u8 *)&__ar->cmd.cmd.data, 8 * __nreg,		\
+			(u8 *)&__dummy, sizeof(__dummy));		\
+									\
+		__nreg = 0;						\
+		if (__err)						\
+			goto __regwrite_out;				\
+	}								\
+} while (0)
+
+#define carlu_regwrite_finish()						\
+__regwrite_out :							\
+	if (__err == 0 && __nreg)					\
+		carlu_regwrite_flush();
+
+#define carlu_regwrite_result()						\
+	__err;								\
+} while (0);
+
+
+#define carlu_async_get_buf()						\
+do {									\
+	__cmd = carlu_cmd_buf(__carl, CARL9170_CMD_WREG_ASYNC,		\
+				 CARL9170_MAX_CMD_PAYLOAD_LEN);		\
+	if (IS_ERR_OR_NULL(__cmd)) {					\
+		__err = __cmd ? PTR_ERR(__cmd) : -ENOMEM;		\
+		goto __async_regwrite_out;				\
+	}								\
+} while (0);
+
+#define carlu_async_regwrite_begin(carl)				\
+do {									\
+	int __nreg = 0, __err = 0;					\
+	struct carlu *__carl = carl;					\
+	struct carl9170_cmd *__cmd;					\
+	carlu_async_get_buf();						\
+
+#define carlu_async_regwrite_flush()					\
+	if (__nreg) {							\
+		__cmd->hdr.len = 8 * __nreg;				\
+		__err = carlusb_cmd_async(__carl, __cmd, true);		\
+		__nreg = 0;						\
+		if (__err)						\
+			goto __async_regwrite_out;			\
+		__cmd = NULL;						\
+		carlu_async_get_buf();					\
+	}
+
+#define carlu_async_regwrite(r, v) do {					\
+	__cmd->wreg.regs[__nreg].addr = cpu_to_le32(r);			\
+	__cmd->wreg.regs[__nreg].val = cpu_to_le32(v);			\
+	__nreg++;							\
+	if ((__nreg >= PAYLOAD_MAX / 2))				\
+		carlu_async_regwrite_flush();				\
+} while (0)
+
+#define carlu_async_regwrite_finish()					\
+__async_regwrite_out :							\
+	if (__err == 0 && __nreg)					\
+		carlu_async_regwrite_flush();
+
+#define carlu_async_regwrite_result()					\
+	__err;								\
+} while (0);
+
+#endif /* __CARL9170USER_CMD_H */
diff --git a/carl9170fw/tools/carlu/src/debug.c b/carl9170fw/tools/carlu/src/debug.c
new file mode 100644
index 0000000..f8d6372
--- /dev/null
+++ b/carl9170fw/tools/carlu/src/debug.c
@@ -0,0 +1,101 @@
+/*
+ * carlu - userspace testing utility for ar9170 devices
+ *
+ * Random assortment of debug stuff
+ *
+ * Copyright 2009-2011 Christian Lamparter <chunkeey@googlemail.com>
+ *
+ * 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; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdio.h>
+#include <stdbool.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <string.h>
+#include <stdlib.h>
+#include <ctype.h>
+
+#include "debug.h"
+
+bool print_message_debug_level;
+enum debug_level_t debug_level;
+FILE *_stdout;
+FILE *_stddbg;
+FILE *_stderr;
+
+void init_debug()
+{
+	debug_level = VERBOSE;
+	debug_level = INFO;
+	print_message_debug_level = false;
+
+	_stdout = stdout;
+	_stddbg = stdout;
+	_stderr = stderr;
+}
+
+FILE *dbg_lvl_to_fh(const enum debug_level_t lvl)
+{
+	switch (lvl) {
+	case ERROR:
+	case WARNING:
+		return _stderr;
+	case INFO:
+		return _stdout;
+	case VERBOSE:
+		return _stddbg;
+	default:
+		BUG_ON(1);
+	}
+}
+
+void print_hex_dump_bytes(const enum debug_level_t lvl, const char *pre,
+			  const void *buf, size_t len)
+{
+	char line[58];
+	char str[17] = { 0 };
+	const unsigned char *tmp = (void *) buf;
+	char *pbuf = line;
+	size_t i, j;
+
+	for (i = 0; i < len; i++) {
+		if (i % 16 == 0) {
+			if (pbuf != line) {
+				__fprintf(lvl, "%s%s: %s\n", pre, line, str);
+				pbuf = line;
+			}
+
+			pbuf += sprintf(pbuf, "0x%04lx: ", (unsigned long)i);
+		}
+
+		pbuf += sprintf(pbuf, "%.2x ", tmp[i]);
+		str[i % 16] = (isprint(tmp[i]) && isascii(tmp[i])) ? tmp[i] : '.';
+	}
+	if (pbuf != line) {
+		if ((i % 16)) {
+			str[i % 16] = '\0';
+
+			for (j = 0; j < (16 - (i % 16)); j++)
+				pbuf += sprintf(pbuf, "   ");
+		}
+
+		__fprintf(lvl, "%s%s: %s\n", pre, line, str);
+	}
+}
diff --git a/carl9170fw/tools/carlu/src/debug.h b/carl9170fw/tools/carlu/src/debug.h
new file mode 100644
index 0000000..5c78056
--- /dev/null
+++ b/carl9170fw/tools/carlu/src/debug.h
@@ -0,0 +1,72 @@
+/*
+ * carlu - userspace testing utility for ar9170 devices
+ *
+ * Debug API definition
+ *
+ * Copyright 2009-2011 Christian Lamparter <chunkeey@googlemail.com>
+ *
+ * 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; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef __CARL9170USER_DEBUG_H
+#define __CARL9170USER_DEBUG_H
+
+#include <stdio.h>
+#include "compiler.h"
+
+enum debug_level_t {
+	SILENT,
+	ERROR,
+	WARNING,
+	INFO,
+	VERBOSE,
+
+	/* KEEP LAST */
+	ALL,
+};
+
+extern bool print_message_debug_level;
+extern enum debug_level_t debug_level;
+
+#define __fprintf(lvl, fmt, args...)		do {						\
+		if (lvl <= debug_level) {							\
+			if (print_message_debug_level)						\
+				fprintf(dbg_lvl_to_fh(lvl), "<%d>:" fmt, lvl, ##args);		\
+			else									\
+				fprintf(dbg_lvl_to_fh(lvl), fmt, ##args);			\
+		}										\
+	} while (0);
+
+#define dbg(fmt, args...) __fprintf(VERBOSE, fmt, ##args)
+#define info(fmt, args...) __fprintf(INFO, fmt, ##args)
+#define warn(fmt, args...) __fprintf(WARNING, fmt, ##args)
+#define err(fmt, args...) __fprintf(ERROR, fmt, ##args)
+
+#define BUG_ON(a)										\
+	do {											\
+		if (a) {									\
+			__fprintf(ERROR, "!!!=>BUG IN function \"%s\" at line %d<=!!! %s\n",	\
+				 __func__, __LINE__, #a);					\
+			fflush(stderr);								\
+			abort();								\
+		}										\
+	} while (0)
+
+FILE *dbg_lvl_to_fh(const enum debug_level_t lvl);
+void init_debug(void);
+void print_hex_dump_bytes(const enum debug_level_t lvl, const char *prefix,
+			  const void *buf, size_t len);
+
+#endif /* __CARL9170USER_DEBUG_H */
diff --git a/carl9170fw/tools/carlu/src/fw.c b/carl9170fw/tools/carlu/src/fw.c
new file mode 100644
index 0000000..fa4b388
--- /dev/null
+++ b/carl9170fw/tools/carlu/src/fw.c
@@ -0,0 +1,131 @@
+/*
+ * carlu - userspace testing utility for ar9170 devices
+ *
+ * Firmware parsers
+ *
+ * Copyright 2009-2011 Christian Lamparter <chunkeey@googlemail.com>
+ *
+ * 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; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdio.h>
+#include <stdbool.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <string.h>
+#include <stdlib.h>
+#include "libusb.h"
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+#include "carlu.h"
+#include "usb.h"
+#include "debug.h"
+
+int carlu_fw_check(struct carlu *ar)
+{
+	struct carl9170fw_otus_desc *otus_desc;
+
+	otus_desc = carlfw_find_desc(ar->fw, (uint8_t *) OTUS_MAGIC,
+				     sizeof(*otus_desc),
+				     CARL9170FW_OTUS_DESC_CUR_VER);
+
+	if (!otus_desc) {
+		err("No valid OTUS descriptor found.\n");
+		return -EINVAL;
+	}
+
+	if (!carl9170fw_supports(otus_desc->feature_set, CARL9170FW_DUMMY_FEATURE)) {
+		err("Invalid Firmware Descriptor.\n");
+		return -EIO;
+	}
+
+	if (carl9170fw_supports(otus_desc->feature_set, CARL9170FW_UNUSABLE))
+		dbg("Firmware is marked as unuseable.\n");
+
+	info("Firmware Version: %d.\n", otus_desc->api_ver);
+
+	return 0;
+}
+
+int carlusb_fw_check(struct carlu *ar)
+{
+	struct carl9170fw_otus_desc *otus_desc;
+
+	otus_desc = carlfw_find_desc(ar->fw, (uint8_t *) OTUS_MAGIC,
+				     sizeof(*otus_desc),
+				     CARL9170FW_OTUS_DESC_CUR_VER);
+
+	if (!otus_desc) {
+		err("No valid USB descriptor found.\n");
+		return -ENODATA;
+	}
+
+	if (!carl9170fw_supports(otus_desc->feature_set, CARL9170FW_DUMMY_FEATURE)) {
+		err("Invalid Firmware Descriptor.\n");
+		return -EINVAL;
+	}
+
+	if (!carl9170fw_supports(otus_desc->feature_set, CARL9170FW_USB_INIT_FIRMWARE)) {
+		err("Firmware does not know how to initialize USB core.\n");
+		return -EOPNOTSUPP;
+	}
+
+	if (carl9170fw_supports(otus_desc->feature_set, CARL9170FW_USB_DOWN_STREAM)) {
+		dbg("Enabled tx stream mode.\n");
+		ar->tx_stream = true;
+		ar->extra_headroom = sizeof(struct ar9170_stream);
+	}
+
+	if (carl9170fw_supports(otus_desc->feature_set, CARL9170FW_USB_UP_STREAM)) {
+		dbg("Enabled rx stream mode.\n");
+		ar->rx_stream = true;
+	}
+
+	if (carl9170fw_supports(otus_desc->feature_set, CARL9170FW_USB_RESP_EP2))
+		dbg("Firmware sends traps over EP2.\n");
+
+	ar->dma_chunk_size = le16_to_cpu(otus_desc->tx_frag_len);
+	ar->dma_chunks = otus_desc->tx_descs;
+	ar->rx_max = le16_to_cpu(otus_desc->rx_max_frame_len);
+
+	if (carl9170fw_supports(otus_desc->feature_set, CARL9170FW_MINIBOOT))
+		ar->miniboot_size = le16_to_cpu(otus_desc->miniboot_size);
+
+	return 0;
+}
+
+void carlu_fw_info(struct carlu *ar)
+{
+	struct carl9170fw_motd_desc *motd_desc;
+	unsigned int fw_date;
+
+	motd_desc = carlfw_find_desc(ar->fw, (uint8_t *) MOTD_MAGIC,
+				     sizeof(*motd_desc),
+				     CARL9170FW_MOTD_DESC_CUR_VER);
+
+	if (motd_desc) {
+		fw_date = le32_to_cpu(motd_desc->fw_year_month_day);
+
+		info("Firmware Date: 2%.3d-%.2d-%.2d\n",
+		     CARL9170FW_GET_YEAR(fw_date), CARL9170FW_GET_MONTH(fw_date),
+		     CARL9170FW_GET_DAY(fw_date));
+	}
+}
diff --git a/carl9170fw/tools/carlu/src/main.c b/carl9170fw/tools/carlu/src/main.c
new file mode 100644
index 0000000..c1b3277
--- /dev/null
+++ b/carl9170fw/tools/carlu/src/main.c
@@ -0,0 +1,307 @@
+/*
+ * carlu - userspace testing utility for ar9170 devices
+ *
+ * main program routine
+ *
+ * Copyright 2009-2011 Christian Lamparter <chunkeey@googlemail.com>
+ *
+ * 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; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdio.h>
+#include <stdbool.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <string.h>
+#include <stdlib.h>
+#include "SDL.h"
+#include <SDL_version.h>
+
+#include "debug.h"
+#include "carlu.h"
+#include "usb.h"
+#include "frame.h"
+#include "test.h"
+#include "cmd.h"
+
+void *carlu_alloc_driver(size_t size)
+{
+	unsigned int i;
+	struct carlu *ar;
+
+	if (size < sizeof(*ar)) {
+		err("bogus driver context request.");
+		return NULL;
+	}
+
+	ar = malloc(size);
+	if (ar == NULL) {
+		err("failed to alloc driver context.");
+		return NULL;
+	}
+	memset(ar, 0, size);
+
+	for (i = 0; i < __AR9170_NUM_TXQ; i++)
+		frame_queue_init(&ar->tx_sent_queue[i]);
+	ar->resp_lock = SDL_CreateMutex();
+	ar->mem_lock = SDL_CreateMutex();
+	ar->resp_pend = SDL_CreateCond();
+	ar->tx_pending = 0;
+	return ar;
+}
+
+void carlu_free_driver(struct carlu *ar)
+{
+	unsigned int i;
+
+	dbg("destroy driver struct.\n");
+	SDL_DestroyMutex(ar->resp_lock);
+	SDL_DestroyMutex(ar->mem_lock);
+	SDL_DestroyCond(ar->resp_pend);
+
+	for (i = 0; i < __AR9170_NUM_TXQ; i++)
+		frame_queue_kill(&ar->tx_sent_queue[i]);
+
+	free(ar);
+}
+
+static int carlu_init()
+{
+	struct SDL_version compiled;
+	int ret;
+
+	SDL_VERSION(&compiled);
+	dbg("=== SDL %d.%d.%d ===\n", compiled.major, compiled.minor, compiled.patch);
+
+	ret = SDL_Init(SDL_INIT_TIMER);
+	if (ret != 0) {
+		err("Unable to initialize SDL: (%s)\n", SDL_GetError());
+		return EXIT_FAILURE;
+	}
+
+	return usb_init();
+}
+
+static void carlu_exit()
+{
+	SDL_Quit();
+	usb_exit();
+}
+
+static int carlu_dump_eeprom(void)
+{
+	struct carlu *carl = NULL;
+	uint8_t data[8192] = { 0 };
+	int err;
+
+	err = carlu_init();
+	if (err)
+		goto out;
+
+	carl = carlusb_probe();
+	if (IS_ERR_OR_NULL(carl)) {
+		err = PTR_ERR(carl);
+		goto out;
+	}
+
+	err = carlu_cmd_mem_dump(carl, 0, sizeof(data), &data);
+	if (err)
+		goto out_close;
+
+	print_hex_dump_bytes(INFO, "EEPROM:", data, sizeof(data));
+
+out_close:
+	carlusb_close(carl);
+
+out:
+	carlu_exit();
+	return err ? EXIT_FAILURE : EXIT_SUCCESS;
+}
+
+static int carlu_run_gpio_test(void)
+{
+	struct carlu *carl = NULL;
+	int err;
+
+	err = carlu_init();
+	if (err)
+		goto out;
+
+	carl = carlusb_probe();
+	if (IS_ERR_OR_NULL(carl)) {
+		err = PTR_ERR(carl);
+		goto out;
+	}
+
+	err = carlu_gpio_test(carl);
+	if (err)
+		goto out_close;
+
+out_close:
+	carlusb_close(carl);
+
+out:
+	carlu_exit();
+	return err ? EXIT_FAILURE : EXIT_SUCCESS;
+}
+
+static int carlu_run_random_test(void)
+{
+	struct carlu *carl = NULL;
+	int err;
+
+	err = carlu_init();
+	if (err)
+		goto out;
+
+	carl = carlusb_probe();
+	if (IS_ERR_OR_NULL(carl)) {
+		err = PTR_ERR(carl);
+		goto out;
+	}
+
+	err = carlu_random_test(carl);
+	if (err)
+		goto out_close;
+
+out_close:
+	carlusb_close(carl);
+
+out:
+	carlu_exit();
+	return err ? EXIT_FAILURE : EXIT_SUCCESS;
+}
+
+static int carlu_run_loop_test(void)
+{
+	struct carlu *carl;
+	int err;
+
+	err = carlu_init();
+	if (err)
+		return EXIT_FAILURE;
+
+	carl = carlusb_probe();
+	if (IS_ERR_OR_NULL(carl)) {
+		err = PTR_ERR(carl);
+		goto out;
+	}
+
+	carlu_cmd_write_mem(carl, AR9170_MAC_REG_BCN_PERIOD, 0xFFFFFFFF);
+	carlu_cmd_write_mem(carl, AR9170_MAC_REG_PRETBTT, 0xFFFFFFFF);
+
+	/* different payload test */
+	carlu_loopback_test(carl, 9000, 1000, 1566, 1566);
+	carlusb_close(carl);
+
+out:
+	return err ? EXIT_FAILURE : EXIT_SUCCESS;
+}
+
+static int carlu_probe_all(void)
+{
+	struct carlu *carl[32] = { 0 };
+	unsigned int devs;
+	int ret;
+
+	ret = carlu_init();
+	if (ret)
+		return EXIT_FAILURE;
+
+	for (devs = 0; devs < ARRAY_SIZE(carl); devs++) {
+		carl[devs] = carlusb_probe();
+		if (IS_ERR_OR_NULL(carl[devs]))
+			break;
+	}
+
+	info("Found %d devices\n", devs);
+
+	for (; devs > 0; devs--)
+		carlusb_close(carl[devs - 1]);
+
+	carlu_exit();
+	return EXIT_SUCCESS;
+}
+
+struct menu_struct {
+	char option;
+	unsigned int parameters;
+	int (*function)(void);
+	char help_text[80];
+};
+
+#define MENU_ITEM(op, func, helpme)	\
+	{				\
+		.option = op,		\
+		.parameters = 0,	\
+		.function = func,	\
+		.help_text = helpme,	\
+	}
+
+static int show_help(void);
+
+static const struct menu_struct menu[] = {
+	[0] = MENU_ITEM('h', show_help, "shows this useless help message text."),	/* keep this entry at 0! */
+	      MENU_ITEM('e', carlu_dump_eeprom, "hexdumps eeprom content to stdout."),
+	      MENU_ITEM('l', carlusb_print_known_devices, "list of all known ar9170 usb devices."),
+	      MENU_ITEM('p', carlu_probe_all, "probe all possible devices."),
+	      MENU_ITEM('t', carlu_run_loop_test, "run tx/rx test."),
+	      MENU_ITEM('g', carlu_run_gpio_test, "flash the leds."),
+	      MENU_ITEM('r', carlu_run_random_test, "get random numbers."),
+};
+
+static int show_help(void)
+{
+	unsigned int i;
+	char parameters[ARRAY_SIZE(menu) + 1];
+
+	for (i = 0; i < ARRAY_SIZE(menu); i++)
+		parameters[i] = menu[i].option;
+
+	parameters[ARRAY_SIZE(menu)] = '\0';
+
+	info("usage: ar9170user -[%s]\n", parameters);
+
+	for (i = 0; i < ARRAY_SIZE(menu); i++)
+		info("\t-%c\t%s\n", menu[i].option, menu[i].help_text);
+
+	return EXIT_FAILURE;
+}
+
+static int select_menu_item(const char arg)
+{
+	unsigned int i;
+
+	for (i = ARRAY_SIZE(menu) - 1; i != 0; i--) {
+		if (arg == menu[i].option)
+			break;
+	}
+
+	return menu[i].function();
+}
+
+int main(int argc, char *argv[])
+{
+	init_debug();
+
+	if (argc != 2 || strlen(argv[1]) != 2 || argv[1][0] != '-')
+		return show_help();
+
+	return select_menu_item(argv[1][1]);
+}
diff --git a/carl9170fw/tools/carlu/src/rx.c b/carl9170fw/tools/carlu/src/rx.c
new file mode 100644
index 0000000..2a77334
--- /dev/null
+++ b/carl9170fw/tools/carlu/src/rx.c
@@ -0,0 +1,181 @@
+/*
+ * carlu - userspace testing utility for ar9170 devices
+ *
+ * RX data processing
+ *
+ * Copyright 2009-2011 Christian Lamparter <chunkeey@googlemail.com>
+ *
+ * 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; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdio.h>
+#include <stdbool.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <string.h>
+#include <stdlib.h>
+#include "libusb.h"
+
+#include "carlu.h"
+#include "debug.h"
+#include "frame.h"
+#include "ieee80211.h"
+#include "wlan.h"
+
+static void carlu_handle_data(struct carlu *ar, void *buf,
+			       unsigned int len)
+{
+	if (ar->rx_cb) {
+		ar->rx_cb(ar, buf, len);
+	} else {
+		dbg("unhandled data:\n");
+		print_hex_dump_bytes(VERBOSE, "DATA:", buf, len);
+	}
+}
+
+void carlu_handle_command(struct carlu *ar, void *buf,
+			  unsigned int len)
+{
+	struct carl9170_rsp *cmd;
+	int ret = 0;
+
+	cmd = (void *) buf;
+
+	if ((cmd->hdr.cmd & CARL9170_RSP_FLAG) != CARL9170_RSP_FLAG) {
+		if ((cmd->hdr.cmd & CARL9170_CMD_ASYNC_FLAG))
+			return;
+
+		SDL_mutexP(ar->resp_lock);
+		if (ar->resp_buf && ar->resp_len && ar->resp_len >= (len - 4)) {
+			memcpy(ar->resp_buf, buf + 4, len - 4);
+			ar->resp_buf = NULL;
+		} else {
+			warn("spurious command response (%d / %d)\n",
+			     (int) len - 4, (int) ar->resp_len);
+			print_hex_dump_bytes(WARNING, "RSP:", buf, len);
+		}
+		SDL_mutexV(ar->resp_lock);
+
+		SDL_CondSignal(ar->resp_pend);
+		return;
+	}
+
+	if (ar->cmd_cb)
+		ret = ar->cmd_cb(ar, cmd, buf, len);
+
+	if (ret) {
+		switch (cmd->hdr.cmd) {
+		case CARL9170_RSP_TXCOMP:
+			carlu_tx_feedback(ar, cmd);
+			break;
+
+		case CARL9170_RSP_TEXT:
+			info("carl9170 FW: %.*s\n", (int)len - 4, (char *)buf + 4);
+			break;
+
+		case CARL9170_RSP_HEXDUMP:
+			info("carl9170 FW: hexdump\n");
+			print_hex_dump_bytes(INFO, "HEX:", (char *)buf + 4, len - 4);
+			break;
+
+		case CARL9170_RSP_WATCHDOG:
+			err("Woof Woof! Watchdog notification.\n");
+			break;
+
+		case CARL9170_RSP_GPIO:
+			info("GPIO Interrupt => GPIO state %.8x\n",
+			    le32_to_cpu(cmd->gpio.gpio));
+			break;
+
+		case CARL9170_RSP_RADAR:
+			info("RADAR Interrupt");
+			break;
+
+		default:
+			warn("received unhandled event 0x%x\n", cmd->hdr.cmd);
+			print_hex_dump_bytes(WARNING, "RSP:", (char *)buf + 4, len - 4);
+			break;
+		}
+	}
+}
+
+static void __carlu_rx(struct carlu *ar, uint8_t *buf, unsigned int len)
+{
+	unsigned int i;
+
+	i = 0;
+
+	/* weird thing, but this is the same in the original driver */
+	while (len > 2 && i < 12 && buf[0] == 0xff && buf[1] == 0xff) {
+		i += 2;
+		len -= 2;
+		buf += 2;
+	}
+
+	if (i == 12) {
+		struct carl9170_rsp *cmd;
+		i = 0;
+
+		while (i < len) {
+			cmd = (void *) &buf[i];
+
+			carlu_handle_command(ar, cmd, cmd->hdr.len + 4);
+			i += cmd->hdr.len + 4;
+		}
+	} else {
+		carlu_handle_data(ar, buf, len);
+	}
+}
+
+static void carlu_rx_stream(struct carlu *ar, struct frame *frame)
+{
+	void *buf = frame->data;
+	unsigned int len = frame->len;
+
+	while (len >= 4) {
+		struct ar9170_stream *rx_stream;
+		unsigned int resplen, elen;
+
+		rx_stream = (void *) buf;
+		resplen = le16_to_cpu(rx_stream->length);
+		elen = roundup(resplen + 4, 4);
+
+		if (rx_stream->tag != cpu_to_le16(0x4e00)) {
+			warn("frame has no tag %p %u %x.\n",
+			      buf, (int) len, rx_stream->tag);
+			print_hex_dump_bytes(WARNING, "FRAME:", frame->data, frame->len);
+
+			__carlu_rx(ar, buf, len);
+			return;
+		}
+
+		__carlu_rx(ar, rx_stream->payload, resplen);
+
+		len -= elen;
+		buf += elen;
+	}
+}
+
+void carlu_rx(struct carlu *ar, struct frame *frame)
+{
+	if (ar->rx_stream)
+		carlu_rx_stream(ar, frame);
+	else
+		__carlu_rx(ar, frame->data, frame->len);
+}
diff --git a/carl9170fw/tools/carlu/src/test.c b/carl9170fw/tools/carlu/src/test.c
new file mode 100644
index 0000000..bf49559
--- /dev/null
+++ b/carl9170fw/tools/carlu/src/test.c
@@ -0,0 +1,237 @@
+/*
+ * carlu - userspace testing utility for ar9170 devices
+ *
+ * Various tests
+ *
+ * Copyright 2009-2011 Christian Lamparter <chunkeey@googlemail.com>
+ *
+ * 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; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdio.h>
+#include <stdbool.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <string.h>
+#include <stdlib.h>
+#include "libusb.h"
+#include "SDL.h"
+
+#include "carlu.h"
+#include "debug.h"
+#include "frame.h"
+#include "usb.h"
+#include "cmd.h"
+
+void debug_test(void)
+{
+	err("This is an error.\n");
+	warn("This is a warnig.\n");
+	info("This is an informative message.\n");
+	dbg("This is just utter useless babble.\n");
+}
+
+void carlu_frame_test(struct carlu *ar)
+{
+	struct frame *frame;
+
+	frame = carlu_alloc_frame(ar, 0x40);
+	frame_reserve(frame, 0x10);
+
+	memset(frame_put(frame, 0x10), 0x11, 0x10);
+	memset(frame_put(frame, 0x10), 0x22, 0x10);
+	memset(frame_push(frame, 0x10), 0x33, 0x10);
+	memset(frame_put(frame, 0x10), 0x44, 0x10);
+
+	print_hex_dump_bytes(INFO, "DATA:", frame->data, frame->len);
+
+	print_hex_dump_bytes(INFO, "PAYLOAD:", frame->payload, frame->alloced);
+
+	frame_free(frame);
+}
+
+static void carlu_loopback_tx_cb(struct carlu *ar __unused,
+				    struct frame *frame __unused)
+{
+}
+
+static int carlu_loopback_cmd(struct carlu *ar __unused,
+			      struct carl9170_rsp *cmd, void *buf __unused,
+			      unsigned int len __unused)
+{
+	unsigned int i, n;
+
+	switch (cmd->hdr.cmd) {
+	case CARL9170_RSP_TXCOMP:
+		n = cmd->hdr.ext;
+		dbg("received tx feedback (%d).\n", n);
+
+		for (i = 0; i < n; i++) {
+			dbg("cookie:%x info:%x\n",
+				cmd->_tx_status[i].cookie,
+				cmd->_tx_status[i].info);
+		}
+		return -1;
+
+	default:
+		return -1;
+	}
+}
+
+static void carlu_loopback_rx(struct carlu *ar,
+				void *buf __unused, unsigned int len)
+{
+	ar->rxed++;
+	ar->rx_octets += len;
+}
+
+static void carlu_loopback_mark_tx_frames(struct frame *frame)
+{
+	unsigned int i;
+
+	for (i = 0; i < frame->len; i++)
+		frame->data[i] = (uint8_t) i;
+}
+
+void carlu_loopback_test(struct carlu *ar, const unsigned int total_runs,
+			  const unsigned int interval, const unsigned int min_len, const unsigned int max_len)
+{
+	struct frame *frame;
+	uint32_t start_time, total_time = 0;
+	float moctets, dtime;
+	unsigned int runs = 0, i = 0, j = 0, len;
+	int ret;
+
+	if (min_len > max_len) {
+		err("stresstest: invalid parameters => min_len:%d > max_len:%d",
+		    min_len, max_len);
+		return;
+	}
+
+	if (min_len < 4) {
+		err("stresstest: invalid parameters => min_len is smaller than 4");
+		return;
+	}
+
+	len = min_len;
+	frame = carlu_alloc_frame(ar, len);
+	frame_put(frame, len);
+
+	carlu_loopback_mark_tx_frames(frame);
+
+	ar->rx_cb = carlu_loopback_rx;
+	ar->cmd_cb = carlu_loopback_cmd;
+	ar->tx_cb = carlu_loopback_tx_cb;
+
+	start_time = SDL_GetTicks();
+	while (runs <= total_runs) {
+		if (frame && carlu_tx(ar, frame) == 0) {
+			len = min_len;
+			i++;
+		} else {
+			frame_free(frame);
+		}
+
+		frame = NULL;
+
+		frame = carlu_alloc_frame(ar, len);
+		frame_put(frame, len);
+
+		carlu_loopback_mark_tx_frames(frame);
+		j++;
+
+		total_time = SDL_GetTicks() - start_time;
+
+		if (total_time >= interval) {
+			moctets = ((float)ar->tx_octets) / (1024.0f * 1024.0f);
+			dtime = ((float)total_time) / 1000;
+			info("%d: tx %d of %d => %.2f MiB in %.2f secs => %.4f MBits/s\n",
+				runs, i, j, moctets, dtime, (moctets * 8.0f) / dtime);
+
+			moctets = ((float)ar->rx_octets) / (1024.0f * 1024.0f);
+			info("%d: rx %d of %d => %.2f MiB in %.2f secs => %.4f MBits/s\n",
+				runs, ar->rxed, i, moctets, dtime, (moctets * 8.0f) / dtime);
+
+			if ((ar->rxed == 0 && i) || !i) {
+				ret = carlu_cmd_echo(ar, 0xdeadbeef);
+				if (ret)
+					warn("firmware crashed... echo_cmd: (%d)\n", ret);
+			}
+
+			total_time = 0;
+			i = 0;
+			j = 0;
+			ar->rxed = 0;
+			ar->txed = 0;
+			ar->rx_octets = 0;
+			ar->tx_octets = 0;
+			runs++;
+			start_time = SDL_GetTicks();
+		}
+	}
+
+	ar->rx_cb = NULL;
+	ar->cmd_cb = NULL;
+	ar->tx_cb = NULL;
+}
+
+int carlu_gpio_test(struct carlu *ar)
+{
+	uint32_t gpio;
+
+#define CHK(cmd)				\
+	do {					\
+		int __err = cmd;		\
+		if ((__err))			\
+			return __err;		\
+	} while (0)
+
+	CHK(carlu_cmd_read_mem(ar, AR9170_GPIO_REG_PORT_DATA, &gpio));
+	info("GPIO state:%x\n", gpio);
+
+	/* turn both LEDs on */
+	CHK(carlu_cmd_write_mem(ar, AR9170_GPIO_REG_PORT_DATA,
+	    AR9170_GPIO_PORT_LED_0 | AR9170_GPIO_PORT_LED_1));
+
+	SDL_Delay(700);
+
+	CHK(carlu_cmd_read_mem(ar, AR9170_GPIO_REG_PORT_DATA, &gpio));
+	info("GPIO state:%x\n", gpio);
+
+	/* turn LEDs off everything */
+	CHK(carlu_cmd_write_mem(ar, AR9170_GPIO_REG_PORT_DATA, 0));
+
+	CHK(carlu_cmd_read_mem(ar, AR9170_GPIO_REG_PORT_DATA, &gpio));
+	info("GPIO state:%x\n", gpio);
+}
+
+int carlu_random_test(struct carlu *ar)
+{
+	uint32_t buf[4096];
+	int err, i;
+
+	err = carlu_cmd_mem_watch(ar, AR9170_RAND_REG_NUM, sizeof(buf), buf);
+	if (err)
+		return err;
+
+	for (i = 0; i < ARRAY_SIZE(buf); i++)
+		info("%.2x %.2x ", buf[i] & 0xff, buf[i] >> 8);
+
+	info("\n");
+}
diff --git a/carl9170fw/tools/carlu/src/test.h b/carl9170fw/tools/carlu/src/test.h
new file mode 100644
index 0000000..373ba08
--- /dev/null
+++ b/carl9170fw/tools/carlu/src/test.h
@@ -0,0 +1,35 @@
+/*
+ * carlu - userspace testing utility for ar9170 devices
+ *
+ * test.c header
+ *
+ * Copyright 2009-2011 Christian Lamparter <chunkeey@googlemail.com>
+ *
+ * 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; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef __CARL9170USER_TEST_H
+#define __CARL9170USER_TEST_H
+
+#include "carlu.h"
+
+void carlu_loopback_test(struct carlu *ar, const unsigned int total_runs,
+			 const unsigned int interval, const unsigned int min_len,
+			 const unsigned int max_len);
+
+int carlu_gpio_test(struct carlu *ar);
+int carlu_random_test(struct carlu *ar);
+
+#endif /* __CARL9170USER_TEST_H */
diff --git a/carl9170fw/tools/carlu/src/tx.c b/carl9170fw/tools/carlu/src/tx.c
new file mode 100644
index 0000000..ec97502
--- /dev/null
+++ b/carl9170fw/tools/carlu/src/tx.c
@@ -0,0 +1,213 @@
+/*
+ * carlu - userspace testing utility for ar9170 devices
+ *
+ * xmit - related functions
+ *
+ * Copyright 2009-2011 Christian Lamparter <chunkeey@googlemail.com>
+ *
+ * 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; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdio.h>
+#include <stdbool.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <string.h>
+#include <stdlib.h>
+#include "libusb.h"
+
+#include "carlu.h"
+#include "debug.h"
+#include "frame.h"
+#include "usb.h"
+#include "ieee80211.h"
+#include "wlan.h"
+
+struct frame *carlu_alloc_frame(struct carlu *ar, unsigned int size)
+{
+	struct frame *tmp;
+	unsigned int total_len;
+
+	total_len = ar->extra_headroom + sizeof(struct _carl9170_tx_superframe) + size;
+
+	tmp = frame_alloc(total_len);
+	if (!tmp)
+		return NULL;
+
+	frame_reserve(tmp, sizeof(struct _carl9170_tx_superframe) + ar->extra_headroom);
+
+	tmp->queue = 2;
+
+	return tmp;
+}
+
+static int carlu_alloc_dev_mem(struct carlu *ar,
+				struct frame *frame)
+{
+	struct _carl9170_tx_superframe *txp = (void *)frame->data;
+	unsigned int len, chunks;
+
+	len = roundup(frame->len, ar->dma_chunk_size);
+	chunks = len / ar->dma_chunk_size;
+
+	SDL_mutexP(ar->mem_lock);
+	if (ar->tx_pending >= ar->dma_chunks ||
+	    ar->used_dma_chunks + chunks >= ar->dma_chunks) {
+		SDL_mutexV(ar->mem_lock);
+		return -ENOSPC;
+	}
+
+	ar->used_dma_chunks += chunks;
+	ar->tx_pending++;
+	txp->s.cookie = ar->cookie++;
+	SDL_mutexV(ar->mem_lock);
+
+	return 0;
+}
+
+static void carlu_free_dev_mem(struct carlu *ar,
+				 struct frame *frame)
+{
+	struct _carl9170_tx_superframe *txp = (void *)frame->data;
+	unsigned int len, chunks;
+
+	len = roundup(frame->len, ar->dma_chunk_size);
+	chunks = len / ar->dma_chunk_size;
+
+	SDL_mutexP(ar->mem_lock);
+	ar->used_dma_chunks -= chunks;
+	ar->tx_pending--;
+	SDL_mutexV(ar->mem_lock);
+}
+
+void carlu_free_frame(struct carlu *ar __unused,
+			 struct frame *frame)
+{
+	frame_free(frame);
+}
+
+static struct frame *carlu_find_frame(struct carlu *ar,
+					 unsigned int queue, uint8_t cookie)
+{
+	struct frame *frame = NULL;
+
+	BUG_ON(queue >= __AR9170_NUM_TXQ);
+	BUG_ON(SDL_mutexP(ar->tx_sent_queue[queue].lock) != 0);
+	FRAME_WALK(frame, &ar->tx_sent_queue[queue]) {
+		struct _carl9170_tx_superframe *super;
+
+		super = (void *) frame->data;
+		if (super->s.cookie == cookie) {
+			__frame_unlink(&ar->tx_sent_queue[queue], frame);
+			SDL_mutexV(ar->tx_sent_queue[queue].lock);
+			return frame;
+		}
+	}
+	SDL_mutexV(ar->tx_sent_queue[queue].lock);
+
+	return NULL;
+}
+
+static void carlu_tx_fb_cb(struct carlu *ar,
+			      struct frame *frame)
+{
+	if (ar->tx_fb_cb)
+		ar->tx_fb_cb(ar, frame);
+	else
+		carlu_free_frame(ar, frame);
+
+}
+
+void carlu_tx_feedback(struct carlu *ar,
+		       struct carl9170_rsp *cmd)
+{
+	unsigned int i, n, k, q;
+	struct frame *frame;
+	struct carlu_tx_info *tx_info;
+
+	n = cmd->hdr.ext;
+
+	for (i = 0; i < n; i++) {
+		q = (cmd->_tx_status[i].info >> CARL9170_TX_STATUS_QUEUE_S) &
+		    CARL9170_TX_STATUS_QUEUE;
+		frame = carlu_find_frame(ar, q, cmd->_tx_status[i].cookie);
+		if (frame) {
+			carlu_free_dev_mem(ar, frame);
+			tx_info = get_tx_info(frame);
+
+			k = (cmd->_tx_status[i].info >> CARL9170_TX_STATUS_RIX)
+			    & CARL9170_TX_STATUS_RIX_S;
+			tx_info->rates[k].cnt = (cmd->_tx_status[i].info >>
+						 CARL9170_TX_STATUS_TRIES_S) &
+						CARL9170_TX_STATUS_TRIES;
+			for (k++; k < CARL9170_TX_MAX_RATES; k++) {
+				tx_info->rates[k].rix = -1;
+				tx_info->rates[k].cnt = -1;
+			}
+
+			carlu_tx_fb_cb(ar, frame);
+		} else {
+			err("Found no frame for cookie %d.\n",
+			    cmd->_tx_status[i].cookie);
+		}
+	}
+}
+
+int carlu_tx(struct carlu *ar, struct frame *frame)
+{
+	struct _carl9170_tx_superframe *txp;
+	unsigned int len, queue;
+	int cookie, err;
+
+	len = frame->len;
+
+	txp = (void *) frame_push(frame, sizeof(struct _carl9170_tx_superframe));
+
+	if (txp->s.rix)
+		goto err_out;
+
+	err = carlu_alloc_dev_mem(ar, frame);
+	if (err)
+		goto err_out;
+
+	txp->s.len = cpu_to_le16(frame->len);
+
+	queue = (frame->queue % __AR9170_NUM_TXQ);
+
+	SET_VAL(CARL9170_TX_SUPER_MISC_QUEUE, txp->s.misc, queue);
+
+	txp->f.length = len + FCS_LEN; /* + I(C)V_LEN */
+
+	txp->f.mac_control = cpu_to_le16(AR9170_TX_MAC_HW_DURATION |
+					 AR9170_TX_MAC_BACKOFF);
+	txp->f.mac_control |= cpu_to_le16(queue << AR9170_TX_MAC_QOS_S);
+
+	txp->f.phy_control = cpu_to_le32(AR9170_TX_PHY_MOD_CCK | AR9170_TX_PHY_BW_20MHZ |
+					 ((17 * 2) << AR9170_TX_PHY_TX_PWR_S) |
+					 (AR9170_TX_PHY_TXCHAIN_1 << AR9170_TX_PHY_TXCHAIN_S) |
+					 (11 << AR9170_TX_PHY_MCS_S));
+
+	frame_queue_tail(&ar->tx_sent_queue[queue], frame);
+	carlusb_tx(ar, frame);
+	return 0;
+
+err_out:
+	frame_pull(frame, sizeof(struct _carl9170_tx_superframe));
+	return err;
+}
diff --git a/carl9170fw/tools/carlu/src/usb.c b/carl9170fw/tools/carlu/src/usb.c
new file mode 100644
index 0000000..ebc19a9
--- /dev/null
+++ b/carl9170fw/tools/carlu/src/usb.c
@@ -0,0 +1,793 @@
+/*
+ * carlu - userspace testing utility for ar9170 devices
+ *
+ * USB back-end driver
+ *
+ * Copyright 2009-2011 Christian Lamparter <chunkeey@googlemail.com>
+ *
+ * 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; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdio.h>
+#include <stdbool.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <stdlib.h>
+#include "libusb.h"
+
+#include "carlu.h"
+#include "usb.h"
+#include "debug.h"
+#include "list.h"
+#include "cmd.h"
+
+#define ADD_DEV(_vid, _pid, _vs, _ps)	{		\
+	.idVendor = _vid,				\
+	.idProduct = _pid,				\
+	.vendor_name = _vs,				\
+	.product_name = _ps				\
+}
+
+static const struct {
+	uint16_t idVendor;
+	uint16_t idProduct;
+	char *vendor_name;
+	char *product_name;
+} dev_list[] = {
+	ADD_DEV(0x0cf3, 0x9170, "Atheros", "9170"),
+	ADD_DEV(0x0cf3, 0x1001, "Atheros", "TG121N"),
+	ADD_DEV(0x0cf3, 0x1002, "TP-Link", "TL-WN821N v2"),
+	ADD_DEV(0xcace, 0x0300, "Cace", "Airpcap NX"),
+	ADD_DEV(0x07d1, 0x3c10, "D-Link", "DWA 160 A1"),
+	ADD_DEV(0x07d1, 0x3a09, "D-Link", "DWA 160 A2"),
+	ADD_DEV(0x0846, 0x9010, "Netgear", "WNDA3100"),
+	ADD_DEV(0x0846, 0x9001, "Netgear", "WN111 v2"),
+	ADD_DEV(0x0ace, 0x1221, "Zydas", "ZD1221"),
+	ADD_DEV(0x0586, 0x3417, "ZyXEL", "NWD271N"),
+	ADD_DEV(0x0cde, 0x0023, "Z-Com", "UB81 BG"),
+	ADD_DEV(0x0cde, 0x0026, "Z-Com", "UB82 ABG"),
+	ADD_DEV(0x0cde, 0x0027, "Sphairon", "Homelink 1202"),
+	ADD_DEV(0x083a, 0xf522, "Arcadyan", "WN7512"),
+	ADD_DEV(0x2019, 0x5304, "Planex", "GWUS300"),
+	ADD_DEV(0x04bb, 0x093f, "IO-Data", "WNGDNUS2"),
+	ADD_DEV(0x057C, 0x8401, "AVM", "FRITZ!WLAN USB Stick N"),
+	ADD_DEV(0x057C, 0x8402, "AVM", "FRITZ!WLAN USB Stick N 2.4"),
+};
+
+static libusb_context *usb_ctx;
+static LIST_HEAD(active_dev_list);
+
+static int carlusb_event_thread(void *_ar)
+{
+	struct carlu *ar = (void *)_ar;
+	dbg("event thread active and polling.\n");
+
+	while (!ar->stop_event_polling)
+		libusb_handle_events(ar->ctx);
+
+	dbg("==> event thread desixed.\n");
+	return 0;
+}
+
+static int carlusb_is_ar9170(struct libusb_device_descriptor *desc)
+{
+	unsigned int i;
+
+	for (i = 0; i < ARRAY_SIZE(dev_list); i++) {
+		if ((desc->idVendor == dev_list[i].idVendor) &&
+		    (desc->idProduct == dev_list[i].idProduct)) {
+			dbg("== found device \"%s %s\" [0x%04x:0x%04x]\n",
+				dev_list[i].vendor_name, dev_list[i].product_name,
+				desc->idVendor, desc->idProduct);
+
+			return i;
+		}
+	}
+
+	return -1;
+}
+
+static bool carlusb_is_dev(struct carlu *iter,
+			       struct libusb_device *dev)
+{
+	libusb_device *list_dev;
+
+	if (!iter->dev)
+		return false;
+
+	list_dev = libusb_get_device(iter->dev);
+
+	if (libusb_get_bus_number(list_dev) == libusb_get_bus_number(dev) &&
+	    libusb_get_device_address(list_dev) == libusb_get_device_address(dev))
+		return true;
+
+	return false;
+}
+
+int carlusb_show_devinfo(struct carlu *ar)
+{
+	struct libusb_device_descriptor desc;
+	libusb_device *dev;
+	int err;
+
+	dev = libusb_get_device(ar->dev);
+
+	err = libusb_get_device_descriptor(dev, &desc);
+	if (err)
+		return err;
+
+	info("USB Device Information:\n");
+	info("\tUSB VendorID:%.4x(%s), ProductID:%.4x(%s)\n",
+	     dev_list[ar->idx].idVendor, dev_list[ar->idx].vendor_name,
+	     dev_list[ar->idx].idProduct, dev_list[ar->idx].product_name);
+	info("\tBus:%d Address:%d\n", libusb_get_bus_number(dev),
+	     libusb_get_device_address(dev));
+
+	return 0;
+}
+
+static int carlusb_get_dev(struct carlu *ar, bool reset)
+{
+	struct carlu *iter;
+	libusb_device_handle *dev;
+	libusb_device **list;
+	int ret, err, i, idx = -1;
+
+	ret = libusb_get_device_list(usb_ctx, &list);
+	if (ret < 0) {
+		err("usb device enum failed (%d)\n", ret);
+		return ret;
+	}
+
+	for (i = 0; i < ret; i++) {
+		struct libusb_device_descriptor desc;
+
+		memset(&desc, 0, sizeof(desc));
+		err = libusb_get_device_descriptor(list[i], &desc);
+		if (err != 0)
+			continue;
+
+		idx = carlusb_is_ar9170(&desc);
+		if (idx < 0)
+			continue;
+
+		list_for_each_entry(iter, &active_dev_list, dev_list) {
+			if (carlusb_is_dev(iter, list[i])) {
+				err = -EALREADY;
+				break;
+			}
+		}
+
+		if (err)
+			continue;
+
+		err = libusb_open(list[i], &dev);
+		if (err != 0) {
+			err("failed to open device (%d)\n", err);
+			continue;
+		}
+
+		err = libusb_kernel_driver_active(dev, 0);
+		switch (err) {
+		case 0:
+			break;
+		default:
+			err("failed to aquire exculusive access (%d).\n", err);
+			goto skip;
+		}
+
+		if (reset) {
+			err = libusb_reset_device(dev);
+			if (err != 0) {
+				err("failed to reset device (%d)\n", err);
+				goto skip;
+			}
+		}
+
+		err = libusb_claim_interface(dev, 0);
+		if (err == 0) {
+			dbg(">device is now under our control.\n");
+			break;
+		} else {
+			err("failed to claim device (%d)\n", err);
+			goto skip;
+		}
+
+skip:
+		libusb_close(dev);
+	}
+
+	if (i != ret) {
+		ar->idx = idx;
+		ar->ctx = usb_ctx;
+		ar->dev = dev;
+		list_add_tail(&ar->dev_list, &active_dev_list);
+		ret = 0;
+	} else {
+		ret = -ENODEV;
+	}
+
+	libusb_free_device_list(list, 1);
+	return ret;
+}
+
+static void carlusb_tx_cb(struct carlu *ar,
+			      struct frame *frame)
+{
+	if (ar->tx_cb)
+		ar->tx_cb(ar, frame);
+
+	ar->tx_octets += frame->len;
+
+	carlu_free_frame(ar, frame);
+}
+
+static void carlusb_zap_queues(struct carlu *ar)
+{
+	struct frame *frame;
+
+	BUG_ON(SDL_mutexP(ar->tx_queue_lock) != 0);
+	while (!list_empty(&ar->tx_queue)) {
+		frame = list_first_entry(&ar->tx_queue, struct frame, dcb.list);
+		list_del(&frame->dcb.list);
+		carlusb_tx_cb(ar, frame);
+	}
+	SDL_mutexV(ar->tx_queue_lock);
+}
+
+static void carlusb_free_driver(struct carlu *ar)
+{
+	if (!IS_ERR_OR_NULL(ar)) {
+		if (ar->event_pipe[0] > -1)
+			close(ar->event_pipe[0]);
+
+		if (ar->event_pipe[1] > -1)
+			close(ar->event_pipe[1]);
+
+		carlusb_zap_queues(ar);
+		carlfw_release(ar->fw);
+		ar->fw = NULL;
+
+		if (ar->dev) {
+			libusb_release_interface(ar->dev, 0);
+			libusb_close(ar->dev);
+			ar->dev = NULL;
+		}
+		carlu_free_driver(ar);
+	}
+}
+
+static int carlusb_init(struct carlu *ar)
+{
+	init_list_head(&ar->tx_queue);
+	ar->tx_queue_lock = SDL_CreateMutex();
+	ar->event_pipe[0] = ar->event_pipe[1] = -1;
+
+	return 0;
+}
+
+static struct carlu *carlusb_open(void)
+{
+	struct carlu *tmp;
+	int err;
+
+	tmp = carlu_alloc_driver(sizeof(*tmp));
+	if (tmp == NULL)
+		return NULL;
+
+	err = carlusb_init(tmp);
+	if (err < 0)
+		goto err_out;
+
+	err = carlusb_get_dev(tmp, true);
+	if (err < 0)
+		goto err_out;
+
+	return tmp;
+
+err_out:
+	carlusb_free_driver(tmp);
+	return ERR_PTR(err);
+}
+
+static void carlusb_cancel_rings(struct carlu *ar)
+{
+	unsigned int i;
+
+	for (i = 0; i < ARRAY_SIZE(ar->rx_ring); i++)
+		libusb_cancel_transfer(ar->rx_ring[i]);
+
+	libusb_cancel_transfer(ar->rx_interrupt);
+}
+
+static void carlusb_free_rings(struct carlu *ar)
+{
+	unsigned int i;
+
+	for (i = 0; i < ARRAY_SIZE(ar->rx_ring); i++)
+		libusb_free_transfer(ar->rx_ring[i]);
+
+	libusb_free_transfer(ar->rx_interrupt);
+}
+
+static void carlusb_destroy(struct carlu *ar)
+{
+	int event_thread_status;
+
+	dbg("==>release device.\n");
+
+	ar->stop_event_polling = true;
+
+	carlusb_cancel_rings(ar);
+
+	SDL_WaitThread(ar->event_thread, &event_thread_status);
+
+	carlusb_free_rings(ar);
+	list_del(&ar->dev_list);
+}
+
+static void carlusb_tx_bulk_cb(struct libusb_transfer *transfer);
+
+static void carlusb_tx_pending(struct carlu *ar)
+{
+	struct frame *frame;
+	struct libusb_transfer *urb;
+	int err;
+
+	BUG_ON(SDL_mutexP(ar->tx_queue_lock) != 0);
+	if (ar->tx_queue_len >= (AR9170_TX_MAX_ACTIVE_URBS) ||
+	    list_empty(&ar->tx_queue))
+		goto out;
+
+	ar->tx_queue_len++;
+
+	urb = libusb_alloc_transfer(0);
+	if (urb == NULL)
+		goto out;
+
+	frame = list_first_entry(&ar->tx_queue, struct frame, dcb.list);
+	list_del(&frame->dcb.list);
+
+	if (ar->tx_stream) {
+		struct ar9170_stream *tx_stream;
+
+		tx_stream = frame_push(frame, sizeof(*tx_stream));
+		tx_stream->length = cpu_to_le16(frame->len);
+		tx_stream->tag = cpu_to_le16(0x697e);
+	}
+
+	libusb_fill_bulk_transfer(urb, ar->dev, AR9170_EP_TX, (unsigned char *)
+		frame->data, frame->len, carlusb_tx_bulk_cb, (void *)frame, 0);
+
+	/* FIXME: ZERO_PACKET support! */
+	urb->flags |= LIBUSB_TRANSFER_FREE_TRANSFER;
+/*	urb->flags |= LIBUSB_TRANSFER_ZERO_PACKET; */
+	frame->dev = (void *) ar;
+	frame_get(frame);
+
+	err = libusb_submit_transfer(urb);
+	if (err != 0) {
+		err("->usb bulk tx submit failed (%d).\n", err);
+		libusb_free_transfer(urb);
+	}
+
+out:
+	SDL_mutexV(ar->tx_queue_lock);
+	return;
+}
+
+void carlusb_tx(struct carlu *ar, struct frame *frame)
+{
+	BUG_ON(SDL_mutexP(ar->tx_queue_lock) != 0);
+
+	list_add_tail(&frame->dcb.list, &ar->tx_queue);
+	SDL_mutexV(ar->tx_queue_lock);
+
+	carlusb_tx_pending(ar);
+}
+
+static void carlusb_tx_bulk_cb(struct libusb_transfer *transfer)
+{
+	struct frame *frame = (void *) transfer->user_data;
+	struct carlu *ar = (void *) frame->dev;
+
+	BUG_ON(SDL_mutexP(ar->tx_queue_lock) != 0);
+	ar->tx_queue_len--;
+	SDL_mutexV(ar->tx_queue_lock);
+
+	if (ar->tx_stream)
+		frame_pull(frame, 4);
+
+	carlusb_tx_cb(ar, frame);
+	carlusb_tx_pending(ar);
+}
+
+static void carlusb_rx_interrupt_cb(struct libusb_transfer *transfer)
+{
+	struct carlu *ar = (void *) transfer->user_data;
+	int err;
+
+	switch (transfer->status) {
+	case LIBUSB_TRANSFER_COMPLETED:
+		carlu_handle_command(ar, transfer->buffer, transfer->actual_length);
+		break;
+
+	case LIBUSB_TRANSFER_CANCELLED:
+		return;
+
+	default:
+		err("==>rx_irq urb died (%d)\n", transfer->status);
+		break;
+	}
+
+	err = libusb_submit_transfer(transfer);
+	if (err != 0)
+		err("==>rx_irq urb resubmit failed (%d)\n", err);
+}
+
+static void carlusb_rx_bulk_cb(struct libusb_transfer *transfer)
+{
+	struct frame *frame = (void *) transfer->user_data;
+	struct carlu *ar = (void *) frame->dev;
+	int err;
+
+	switch (transfer->status) {
+	case LIBUSB_TRANSFER_COMPLETED:
+		frame_put(frame, transfer->actual_length);
+
+		carlu_rx(ar, frame);
+
+		frame_trim(frame, 0);
+		break;
+
+	case LIBUSB_TRANSFER_CANCELLED:
+		return;
+
+	default:
+		err("==>rx_bulk urb died (%d)\n", transfer->status);
+		break;
+	}
+
+	err = libusb_submit_transfer(transfer);
+	if (err != 0)
+		err("->rx_bulk urb resubmit failed (%d)\n", err);
+}
+
+static int carlusb_initialize_rxirq(struct carlu *ar)
+{
+	int err;
+
+	ar->rx_interrupt = libusb_alloc_transfer(0);
+	if (ar->rx_interrupt == NULL) {
+		err("==>cannot alloc rx interrupt urb\n");
+		return -1;
+	}
+
+	libusb_fill_interrupt_transfer(ar->rx_interrupt, ar->dev, AR9170_EP_IRQ,
+				       (unsigned char *)&ar->irq_buf, sizeof(ar->irq_buf),
+				       carlusb_rx_interrupt_cb, (void *) ar, 0);
+
+	err = libusb_submit_transfer(ar->rx_interrupt);
+	if (err != 0) {
+		err("==>failed to submit rx interrupt (%d)\n", err);
+		return err;
+	}
+
+	dbg("rx interrupt is now operational.\n");
+	return 0;
+}
+
+static int carlusb_initialize_rxrings(struct carlu *ar)
+{
+	struct frame *tmp;
+	unsigned int i;
+	int err;
+
+	for (i = 0; i < ARRAY_SIZE(ar->rx_ring); i++) {
+		tmp = frame_alloc(ar->rx_max);
+		if (tmp == NULL)
+			return -ENOMEM;
+
+		tmp->dev = (void *) ar;
+
+		ar->rx_ring[i] = libusb_alloc_transfer(0);
+		if (ar->rx_ring[i] == NULL) {
+			frame_free(tmp);
+			return -ENOMEM;
+		}
+
+		libusb_fill_bulk_transfer(ar->rx_ring[i], ar->dev,
+			AR9170_EP_RX, (unsigned char *)tmp->data,
+			ar->rx_max, carlusb_rx_bulk_cb, (void *)tmp, 0);
+
+		err = libusb_submit_transfer(ar->rx_ring[i]);
+		if (err != 0) {
+			err("==>failed to submit rx buld urb (%d)\n", err);
+			return EXIT_FAILURE;
+		}
+	}
+
+	dbg("rx ring is now ready to receive.\n");
+	return 0;
+}
+
+static int carlusb_load_firmware(struct carlu *ar)
+{
+	int ret = 0;
+
+	dbg("loading firmware...\n");
+
+	ar->fw = carlfw_load(CARL9170_FIRMWARE_FILE);
+	if (IS_ERR_OR_NULL(ar->fw))
+		return PTR_ERR(ar->fw);
+
+	ret = carlu_fw_check(ar);
+	if (ret)
+		return ret;
+
+	ret = carlusb_fw_check(ar);
+	if (ret)
+		return ret;
+
+	return 0;
+}
+
+static int carlusb_upload_firmware(struct carlu *ar, bool boot)
+{
+	uint32_t addr = 0x200000;
+	size_t len;
+	void *buf;
+	int ret = 0;
+
+	dbg("initiating firmware image upload procedure.\n");
+
+	buf = carlfw_get_fw(ar->fw, &len);
+	if (IS_ERR_OR_NULL(buf))
+		return PTR_ERR(buf);
+
+	if (ar->miniboot_size) {
+		dbg("Miniboot firmware size:%d\n", ar->miniboot_size);
+		len -= ar->miniboot_size;
+		buf += ar->miniboot_size;
+	}
+
+	while (len) {
+		int blocklen = len > 4096 ? 4096 : len;
+
+		ret = libusb_control_transfer(ar->dev, 0x40, 0x30, addr >> 8, 0, buf, blocklen, 1000);
+		if (ret != blocklen && ret != LIBUSB_ERROR_TIMEOUT) {
+			err("==>firmware upload failed (%d)\n", ret);
+			return -EXIT_FAILURE;
+		}
+
+		dbg("uploaded %d bytes to start address 0x%04x.\n", blocklen, addr);
+
+		buf += blocklen;
+		addr += blocklen;
+		len -= blocklen;
+	}
+
+	if (boot) {
+		ret = libusb_control_transfer(ar->dev, 0x40, 0x31, 0, 0, NULL, 0, 5000);
+		if (ret < 0) {
+			err("unable to boot firmware (%d)\n", ret);
+			return -EXIT_FAILURE;
+		}
+
+		/* give the firmware some time to reset & reboot */
+		SDL_Delay(100);
+
+		/*
+		 * since the device did a full usb reset,
+		 * we have to get a new "dev".
+		 */
+		libusb_release_interface(ar->dev, 0);
+		libusb_close(ar->dev);
+		ar->dev = NULL;
+		list_del(&ar->dev_list);
+
+		ret = carlusb_get_dev(ar, false);
+	}
+
+	return 0;
+}
+
+int carlusb_cmd_async(struct carlu *ar, struct carl9170_cmd *cmd,
+		      const bool free_buf)
+{
+	struct libusb_transfer *urb;
+	int ret, send;
+
+	if (cmd->hdr.len > (CARL9170_MAX_CMD_LEN - 4)) {
+		err("|-> too much payload\n");
+		ret = -EINVAL;
+		goto out;
+	}
+
+	if (cmd->hdr.len % 4) {
+		err("|-> invalid command length\n");
+		ret = -EINVAL;
+		goto out;
+	}
+
+	ret = libusb_interrupt_transfer(ar->dev, AR9170_EP_CMD, (void *) cmd, cmd->hdr.len + 4, &send, 32);
+	if (ret != 0) {
+		err("OID:0x%.2x failed due to (%d) (%d).\n", cmd->hdr.cmd, ret, send);
+		print_hex_dump_bytes(ERROR, "CMD:", cmd, cmd->hdr.len);
+	}
+
+out:
+	if (free_buf)
+		free((void *)cmd);
+
+	return ret;
+}
+
+int carlusb_cmd(struct carlu *ar, uint8_t oid,
+		      uint8_t *cmd, size_t clen,
+		      uint8_t *rsp, size_t rlen)
+{
+	int ret, send;
+
+	if (clen > (CARL9170_MAX_CMD_LEN - 4)) {
+		err("|-> OID:0x%.2x has too much payload (%d octs)\n", oid, (int)clen);
+		return -EINVAL;
+	}
+
+	ret = SDL_mutexP(ar->resp_lock);
+	if (ret != 0) {
+		err("failed to acquire resp_lock.\n");
+		print_hex_dump_bytes(ERROR, "CMD:", ar->cmd.buf, clen);
+		return -1;
+	}
+
+	ar->cmd.cmd.hdr.len = clen;
+	ar->cmd.cmd.hdr.cmd = oid;
+	/* buf[2] & buf[3] are padding */
+	if (clen && cmd != (uint8_t *)(&ar->cmd.cmd.data))
+		memcpy(&ar->cmd.cmd.data, cmd, clen);
+
+	ar->resp_buf = (uint8_t *)rsp;
+	ar->resp_len = rlen;
+
+	ret = carlusb_cmd_async(ar, &ar->cmd.cmd, false);
+	if (ret != 0) {
+		err("OID:0x%.2x failed due to (%d) (%d).\n", oid, ret, send);
+		print_hex_dump_bytes(ERROR, "CMD:", ar->cmd.buf, clen);
+		SDL_mutexV(ar->resp_lock);
+		return ret;
+	}
+
+	ret = SDL_CondWaitTimeout(ar->resp_pend, ar->resp_lock, 100);
+	if (ret != 0) {
+		err("|-> OID:0x%.2x timed out %d.\n", oid, ret);
+		ar->resp_buf = NULL;
+		ar->resp_len = 0;
+		ret = -ETIMEDOUT;
+	}
+
+	SDL_mutexV(ar->resp_lock);
+	return ret;
+}
+
+struct carlu *carlusb_probe(void)
+{
+	struct carlu *ar;
+	int ret = -ENOMEM;
+
+	ar = carlusb_open();
+	if (IS_ERR_OR_NULL(ar)) {
+		if (IS_ERR(ar))
+			ret = PTR_ERR(ar);
+		goto err_out;
+	}
+
+	ret = carlusb_show_devinfo(ar);
+	if (ret)
+		goto err_out;
+
+	ret = carlusb_load_firmware(ar);
+	if (ret)
+		goto err_out;
+
+	ret = pipe(ar->event_pipe);
+	if (ret)
+		goto err_out;
+
+	ar->stop_event_polling = false;
+	ar->event_thread = SDL_CreateThread(carlusb_event_thread, ar);
+
+	ret = carlusb_upload_firmware(ar, true);
+	if (ret)
+		goto err_kill;
+
+	ret = carlusb_initialize_rxirq(ar);
+	if (ret)
+		goto err_kill;
+
+	ret = carlusb_initialize_rxrings(ar);
+	if (ret)
+		goto err_kill;
+
+	ret = carlu_cmd_echo(ar, 0x44110dee);
+	if (ret) {
+		err("echo test failed...\n");
+		goto err_kill;
+	}
+
+	info("firmware is active and running.\n");
+
+	carlu_fw_info(ar);
+
+	return ar;
+
+err_kill:
+	carlusb_destroy(ar);
+
+err_out:
+	carlusb_free_driver(ar);
+	err("usb device rendezvous failed (%d).\n", ret);
+	return ERR_PTR(ret);
+}
+
+void carlusb_close(struct carlu *ar)
+{
+	carlu_cmd_reboot(ar);
+
+	carlusb_destroy(ar);
+	carlusb_free_driver(ar);
+}
+
+int carlusb_print_known_devices(void)
+{
+	unsigned int i;
+
+	debug_level = INFO;
+
+	info("==> dumping known device list <==\n");
+	for (i = 0; i < ARRAY_SIZE(dev_list); i++) {
+		info("Vendor:\"%-9s\" Product:\"%-26s\" => USBID:[0x%04x:0x%04x]\n",
+		     dev_list[i].vendor_name, dev_list[i].product_name,
+		     dev_list[i].idVendor, dev_list[i].idProduct);
+	}
+	info("==> end of device list <==\n");
+
+	return EXIT_SUCCESS;
+}
+
+int usb_init(void)
+{
+	int ret;
+
+	ret = libusb_init(&usb_ctx);
+	if (ret != 0) {
+		err("failed to initialize usb subsystem (%d)\n", ret);
+		return ret;
+	}
+
+	/* like a silent chatterbox! */
+	libusb_set_debug(usb_ctx, 2);
+
+	return 0;
+}
+
+void usb_exit(void)
+{
+	libusb_exit(usb_ctx);
+}
diff --git a/carl9170fw/tools/carlu/src/usb.h b/carl9170fw/tools/carlu/src/usb.h
new file mode 100644
index 0000000..66c674f
--- /dev/null
+++ b/carl9170fw/tools/carlu/src/usb.h
@@ -0,0 +1,68 @@
+/*
+ * carlu - userspace testing utility for ar9170 devices
+ *
+ * USB back-end API declaration
+ *
+ * Copyright 2009-2011 Christian Lamparter <chunkeey@googlemail.com>
+ *
+ * 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; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef __CARL9170USER_USB_H
+#define __CARL9170USER_USB_H
+
+#include "SDL.h"
+#include "SDL_thread.h"
+#include "libusb.h"
+#include "frame.h"
+#include "list.h"
+
+#include "fwcmd.h"
+#include <unistd.h>
+#include "carlu.h"
+
+#define AR9170_RX_BULK_BUFS		16
+#define AR9170_RX_BULK_BUF_SIZE		8192
+#define AR9170_RX_BULK_IRQ_SIZE		64
+
+/* endpoints */
+#define AR9170_EP_TX				(LIBUSB_ENDPOINT_OUT | AR9170_USB_EP_TX)
+#define AR9170_EP_RX				(LIBUSB_ENDPOINT_IN  | AR9170_USB_EP_RX)
+#define AR9170_EP_IRQ				(LIBUSB_ENDPOINT_IN  | AR9170_USB_EP_IRQ)
+#define AR9170_EP_CMD				(LIBUSB_ENDPOINT_OUT | AR9170_USB_EP_CMD)
+
+#define AR9170_TX_MAX_ACTIVE_URBS		8
+
+#define CARL9170_FIRMWARE_FILE (CARLU_PATH "/../../carlfw/carl9170.fw")
+
+struct carlu;
+
+void carlusb_reset_txep(struct carlu *ar);
+
+int usb_init(void);
+void usb_exit(void);
+
+struct carlu *carlusb_probe(void);
+void carlusb_close(struct carlu *ar);
+
+void carlusb_tx(struct carlu *ar, struct frame *frame);
+int carlusb_fw_check(struct carlu *ar);
+
+int carlusb_cmd(struct carlu *_ar, uint8_t oid, uint8_t *cmd, size_t clen,
+		uint8_t *rsp, size_t rlen);
+
+int carlusb_print_known_devices(void);
+
+#endif /* __CARL9170USER_USB_H */
diff --git a/carl9170fw/tools/include/frame.h b/carl9170fw/tools/include/frame.h
new file mode 100644
index 0000000..f753fe3
--- /dev/null
+++ b/carl9170fw/tools/include/frame.h
@@ -0,0 +1,401 @@
+/*
+ * 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 version 2 of the License.
+ *
+ * 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 Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Most ideas and some code are copied from the linux' kernels
+ *	include/linux/skbuff.h
+ */
+
+#ifndef __TOOLS_FRAME_H
+#define __TOOLS_FRAME_H
+
+#include "SDL.h"
+#include "list.h"
+
+/**
+ * struct frame_queue - sk_buff_head like frame queue
+ *
+ * @list: pointer to head and tail
+ * @lock: mutex lock for serialize access
+ * @len: exact number of queued frames
+ */
+
+struct frame_queue {
+	struct list_head list;
+	SDL_mutex *lock;
+	size_t len;
+};
+
+/**
+ * struct frame - frame data structure (like sk_buff)
+ *
+ * @list: storage for double-linked &struct frame_queue list
+ * @dev: pointer to private device/driver structure
+ * @timestamp: space for the current timestamp
+ * @cb: private driver data
+ * @dcb: more reserved space for low-level / backend driver
+ * @queue: selected frame queue / priority
+ * @ref: reference counter
+ * @alloced: maximum available space
+ * @total_len: currently consumed and reserved memory
+ * @len: current frame length
+ * @head: points to the buffer head
+ * @data: current frame data pointer
+ * @tail: frame data tail pointer
+ * @payload: frame data storage container
+ */
+
+struct frame {
+	struct list_head list;
+	void *dev;
+	unsigned long timestamp;
+	uint8_t cb[64];
+	union {
+		struct list_head list;
+		uint8_t raw_data[32];
+	} dcb;
+
+	unsigned int queue;
+	unsigned int ref;
+	unsigned int alloced;
+	unsigned int total_len;
+	unsigned int len;
+	uint8_t *head;
+	uint8_t *data;
+	uint8_t *tail;
+
+	/* payload must be the last entry */
+	uint8_t payload[0];
+};
+
+/**
+ * frame_put - append more data to &struct frame
+ *
+ * Allocate @size bytes from &struct frame tail and
+ * returns a pointer to the requested location.
+ *
+ * @frame: frame to alter
+ * @size: extra size
+ */
+static inline void *frame_put(struct frame *frame, unsigned int size)
+{
+	void *tmp;
+
+	BUG_ON(frame->total_len + size > frame->alloced);
+
+	frame->len += size;
+	frame->total_len += size;
+
+	tmp = (void *) frame->tail;
+	frame->tail += size;
+
+	BUG_ON(frame->tail > (frame->payload + frame->alloced));
+
+	return tmp;
+}
+
+/**
+ * frame_push - allocate head
+ *
+ * returns a pointer to a newly allocate area at &struct frame head.
+ *
+ * @frame: frame to modify
+ * @size: requested extra size
+ */
+static inline void *frame_push(struct frame *frame, unsigned int size)
+{
+	frame->len += size;
+	frame->data -= size;
+
+	BUG_ON(frame->data < frame->payload);
+	return frame->data;
+}
+
+/**
+ * frame_get - reference frame buffer
+ *
+ * grab a reference from the frame buffer, in order to
+ * prevent it from being freed prematurely by a different user.
+ *
+ * @frame: frame pointer
+ */
+static inline struct frame *frame_get(struct frame *frame)
+{
+	frame->ref++;
+	return frame;
+}
+
+/**
+ * frame_pull - remove space from &struct frame head
+ *
+ * Does the opposite of frame_push() and removes freed-up
+ * space at the frames's head.
+ *
+ * @frame: pointer to frame structure
+ * @size: bytes to remove from head
+ */
+static inline void *frame_pull(struct frame *frame, unsigned int size)
+{
+	BUG_ON(frame->len < size);
+
+	frame->len -= size;
+	frame->total_len -= size;
+	frame->data += size;
+
+	return frame->data;
+}
+
+/**
+ * frame_reserve - reserve frame headroom
+ *
+ * Reserve a certain amount of space to allow headroom manipulations
+ * in the future.
+ *
+ * @frame: frame to adjust
+ * @size: bytes to reserve
+ */
+static inline void frame_reserve(struct frame *frame, unsigned int size)
+{
+	BUG_ON(frame->total_len + size > frame->alloced);
+	BUG_ON(frame->len != 0);
+
+	frame->total_len += size;
+	frame->data += size;
+	frame->tail += size;
+}
+
+/**
+ * frame_trim - set frame length
+ *
+ * cut the frame to @size length.
+ *
+ * @frame: frame to be trimmed
+ * @size: new length
+ */
+static inline void frame_trim(struct frame *frame, unsigned int size)
+{
+	BUG_ON(size > frame->total_len);
+
+	frame->len = size;
+	frame->total_len = size;
+	frame->data = frame->head;
+	frame->tail = frame->head + size;
+}
+
+/**
+ * frame_alloc - alloc and initialize new frame
+ *
+ * returns a newly created &struct frame object.
+ *
+ * @size: maximum frame size of the new frame
+ */
+static inline struct frame *frame_alloc(unsigned int size)
+{
+	struct frame *tmp;
+
+	tmp = malloc(size + sizeof(*tmp));
+	if (tmp != NULL) {
+		memset(tmp, 0, sizeof(*tmp));
+		init_list_head(&tmp->list);
+		init_list_head(&tmp->dcb.list);
+		tmp->len = 0;
+		tmp->total_len = 0;
+		tmp->alloced = size;
+
+		tmp->head = tmp->payload;
+		tmp->data = tmp->payload;
+		tmp->tail = tmp->payload;
+		tmp->ref = 1;
+	}
+	return tmp;
+}
+
+/**
+ * frame_free - unref and free frame
+ *
+ * Unreference frame and free it up, if all users are gone.
+ *
+ * @frame: frame to be freed
+ */
+static inline void frame_free(struct frame *frame)
+{
+	if (!--frame->ref)
+		free(frame);
+}
+
+/**
+ * FRAME_WALK - MACRO walker
+ *
+ * Walks over all queued elements in &struct frame_queue
+ *
+ * NOTE: This function is vulnerable in concurrent access
+ *	 scenarios without proper locking.
+ *
+ * @pos: current position inside the queue
+ * @head: &struct frame_queue head
+ */
+#define FRAME_WALK(pos, head)					\
+	list_for_each_entry((pos), &(head)->list, list)
+
+static inline void __frame_queue_init(struct frame_queue *queue)
+{
+	queue->len = 0;
+	init_list_head(&queue->list);
+}
+
+/**
+ * frame_queue_init - initialize frame_queue
+ *
+ * Initialize the given &struct frame_queue object.
+ *
+ * @queue: frame_queue to be initialized
+ */
+static inline void frame_queue_init(struct frame_queue *queue)
+{
+	queue->lock = SDL_CreateMutex();
+	__frame_queue_init(queue);
+}
+
+/**
+ * frame_queue_len - returns number of queue elements
+ *
+ * @queue: frame_queue object
+ */
+static inline unsigned int frame_queue_len(struct frame_queue *queue)
+{
+	return queue->len;
+}
+
+/**
+ * frame_queue_empty - returns %TRUE whenever queue is empty
+ *
+ * @queue: frame_queue object
+ */
+static inline bool frame_queue_empty(struct frame_queue *queue)
+{
+	return list_empty(&queue->list);
+}
+
+static inline void __frame_queue_head(struct frame_queue *queue, struct frame *frame)
+{
+	list_add_head(&frame->list, &queue->list);
+	queue->len++;
+}
+
+/**
+ * frame_queue_head - queue a frame at the queues head
+ * @queue: queue to use
+ */
+static inline void frame_queue_head(struct frame_queue *queue, struct frame *frame)
+{
+	BUG_ON((SDL_mutexP(queue->lock) != 0));
+	__frame_queue_head(queue, frame);
+	SDL_mutexV(queue->lock);
+}
+
+static inline void __frame_queue_tail(struct frame_queue *queue, struct frame *frame)
+{
+	list_add_tail(&frame->list, &queue->list);
+	queue->len++;
+}
+
+/**
+ * frame_queue_head - queue a frame at the queues tail
+ * @queue: queue to use
+ */
+static inline void frame_queue_tail(struct frame_queue *queue, struct frame *frame)
+{
+	BUG_ON((SDL_mutexP(queue->lock) != 0));
+	__frame_queue_tail(queue, frame);
+	SDL_mutexV(queue->lock);
+}
+
+static inline void __frame_unlink(struct frame_queue *queue, struct frame *frame)
+{
+	list_del(&frame->list);
+	queue->len--;
+}
+
+/**
+ * frame_queue_unlink - remove a frame from the queue
+ * @queue: queue to use
+ * @frame: frame to remove
+ */
+static inline void frame_unlink(struct frame_queue *queue, struct frame *frame)
+{
+	BUG_ON((SDL_mutexP(queue->lock) != 0));
+	__frame_unlink(queue, frame);
+	SDL_mutexV(queue->lock);
+}
+
+
+static inline struct frame *__frame_dequeue(struct frame_queue *queue)
+{
+	struct frame *tmp = NULL;
+
+	if (!frame_queue_empty(queue)) {
+		tmp = list_entry(queue->list.next, struct frame, list);
+		__frame_unlink(queue, tmp);
+	}
+
+	return tmp;
+}
+
+/**
+ * frame_dequeue - remove frame from the head of the queue
+ *
+ * @queue: queue to dequeue from
+ */
+static inline struct frame *frame_dequeue(struct frame_queue *queue)
+{
+	struct frame *tmp;
+
+	BUG_ON((SDL_mutexP(queue->lock) != 0));
+
+	tmp = __frame_dequeue(queue);
+	SDL_mutexV(queue->lock);
+	return tmp;
+}
+
+static inline void __frame_queue_purge(struct frame_queue *queue)
+{
+	while (list_empty(&queue->list) == false)
+		frame_free(__frame_dequeue(queue));
+}
+
+/**
+ * frame_queue_purge - frees all queued &struct frame objects
+ *
+ * @queue: queue to be freed
+ */
+static inline void frame_queue_purge(struct frame_queue *queue)
+{
+	BUG_ON((SDL_mutexP(queue->lock) != 0));
+	__frame_queue_purge(queue);
+	SDL_mutexV(queue->lock);
+}
+
+/**
+ * frame_queue_kill - destroys frame_queue object
+ *
+ * Destroy object and frees up all remaining elements
+ *
+ * @queue: frame_queue victim
+ */
+static inline void frame_queue_kill(struct frame_queue *queue)
+{
+	SDL_DestroyMutex(queue->lock);
+	__frame_queue_purge(queue);
+}
+
+#endif /* __TOOLS_FRAME_H */
diff --git a/carl9170fw/tools/include/list.h b/carl9170fw/tools/include/list.h
new file mode 100644
index 0000000..1991d97
--- /dev/null
+++ b/carl9170fw/tools/include/list.h
@@ -0,0 +1,92 @@
+/*
+ * list.h List Utilities
+ *
+ *	This library is free software; you can redistribute it and/or
+ *	modify it under the terms of the GNU Lesser General Public
+ *	License as published by the Free Software Foundation version 2.1
+ *	of the License.
+ *
+ * Copyright (c) 2003-2006 Thomas Graf <tgraf@suug.ch>
+ */
+
+#ifndef __LIST_H
+#define __LIST_H
+
+struct list_head {
+	struct list_head *next;
+	struct list_head *prev;
+};
+
+static inline void list_add(struct list_head *obj,
+			    struct list_head *prev,
+			    struct list_head *next)
+{
+	prev->next = obj;
+	obj->prev = prev;
+	next->prev = obj;
+	obj->next = next;
+}
+
+static inline void list_add_tail(struct list_head *obj,
+				 struct list_head *head)
+{
+	list_add(obj, head->prev, head);
+}
+
+static inline void list_add_head(struct list_head *obj,
+				 struct list_head *head)
+{
+	list_add(obj, head, head->next);
+}
+
+static inline void list_del(struct list_head *obj)
+{
+	obj->prev->next = obj->next;
+	obj->next->prev = obj->prev;
+	obj->next = obj->prev = obj;
+}
+
+static inline void list_replace(struct list_head *old,
+				struct list_head *obj)
+{
+	obj->next = old->next;
+	obj->next->prev = obj;
+	obj->prev = old->prev;
+	obj->prev->next = obj;
+}
+
+static inline int list_empty(struct list_head *head)
+{
+	return head->next == head;
+}
+
+#define list_entry(ptr, type, member) \
+	container_of(ptr, type, member)
+
+#define list_first_entry(ptr, type, member) \
+	container_of((ptr)->next, type, member)
+
+#define list_at_tail(pos, head, member) \
+	((pos)->member.next == (head))
+
+#define list_at_head(pos, head, member) \
+	((pos)->member.prev == (head))
+
+#define LIST_HEAD(name) \
+	struct list_head name = { &(name), &(name) }
+
+#define list_for_each_entry(pos, head, member)				\
+	for (pos = list_entry((head)->next, typeof(*pos), member);	\
+	     &(pos)->member != (head);					\
+	     (pos) = list_entry((pos)->member.next, typeof(*(pos)), member))
+
+#define list_for_each_entry_safe(pos, n, head, member)			\
+	for (pos = list_entry((head)->next, typeof(*pos), member),	\
+	     n = list_entry(pos->member.next, typeof(*pos), member);	\
+	     &(pos)->member != (head);					\
+	     pos = n, n = list_entry(n->member.next, typeof(*n), member))
+
+#define init_list_head(head) \
+	do { (head)->next = (head); (head)->prev = (head); } while (0)
+
+#endif /* __LIST_H */
diff --git a/carl9170fw/tools/lib/CMakeLists.txt b/carl9170fw/tools/lib/CMakeLists.txt
new file mode 100644
index 0000000..2d139e6
--- /dev/null
+++ b/carl9170fw/tools/lib/CMakeLists.txt
@@ -0,0 +1,7 @@
+cmake_minimum_required(VERSION 2.8)
+
+project(libcarlfw)
+
+set(carlfw_src carlfw.c)
+
+add_library( carlfw STATIC ${carlfw_src})
diff --git a/carl9170fw/tools/lib/carlfw.c b/carl9170fw/tools/lib/carlfw.c
new file mode 100644
index 0000000..ce61afb
--- /dev/null
+++ b/carl9170fw/tools/lib/carlfw.c
@@ -0,0 +1,630 @@
+/*
+ * Copyright 2010-2011 Christian Lamparter <chunkeey@googlemail.com>
+ *
+ * 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 version 2 of the License.
+ *
+ * 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 Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <error.h>
+#include <string.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+#include "carlfw.h"
+
+struct carlfw_file {
+	char *name;
+	size_t len;
+	char *data;
+};
+
+struct carlfw {
+	struct carlfw_file fw;
+	struct carlfw_file hdr;
+
+	struct list_head desc_list;
+	unsigned int desc_list_entries,
+		     desc_list_len;
+};
+
+#define carlfw_walk_descs(iter, fw)					\
+	list_for_each_entry(iter, &fw->desc_list, h.list)
+
+struct carlfw_list_entry_head {
+	struct list_head list;
+};
+
+struct carlfw_list_entry {
+	struct carlfw_list_entry_head h;
+	union {
+		struct carl9170fw_desc_head head;
+		uint32_t data[0];
+		char text[0];
+	};
+};
+
+static inline struct carlfw_list_entry *carlfw_desc_to_entry(struct carl9170fw_desc_head *head)
+{
+	return container_of(head, struct carlfw_list_entry, head);
+}
+
+static inline struct carl9170fw_desc_head *carlfw_entry_to_desc(struct carlfw_list_entry *entry)
+{
+	return &entry->head;
+}
+
+static void carlfw_entry_unlink(struct carlfw *fw,
+	struct carlfw_list_entry *entry)
+{
+	fw->desc_list_entries--;
+	fw->desc_list_len -= le16_to_cpu(entry->head.length);
+	list_del(&entry->h.list);
+}
+
+static void carlfw_entry_del(struct carlfw *fw,
+	struct carlfw_list_entry *entry)
+{
+	carlfw_entry_unlink(fw, entry);
+	free(entry);
+}
+
+static struct carlfw_list_entry *carlfw_find_entry(struct carlfw *fw,
+						   const uint8_t descid[4],
+						   unsigned int len,
+						   uint8_t compatible_revision)
+{
+	struct carlfw_list_entry *iter;
+
+	carlfw_walk_descs(iter, fw) {
+		if (carl9170fw_desc_cmp(&iter->head, descid, len,
+					 compatible_revision))
+			return (void *)iter;
+	}
+
+	return NULL;
+}
+
+static struct carlfw_list_entry *__carlfw_entry_add_prepare(struct carlfw *fw,
+	const struct carl9170fw_desc_head *desc)
+{
+	struct carlfw_list_entry *tmp;
+	unsigned int len;
+
+	len = le16_to_cpu(desc->length);
+
+	if (len < sizeof(struct carl9170fw_desc_head))
+		return ERR_PTR(-EINVAL);
+
+	tmp = malloc(sizeof(*tmp) + len);
+	if (!tmp)
+		return ERR_PTR(-ENOMEM);
+
+	fw->desc_list_entries++;
+	fw->desc_list_len += len;
+
+	memcpy(tmp->data, desc, len);
+	return tmp;
+}
+
+static void __carlfw_release(struct carlfw_file *f)
+{
+	f->len = 0;
+	if (f->name)
+		free(f->name);
+	f->name = NULL;
+
+	if (f->data)
+		free(f->data);
+	f->data = NULL;
+}
+
+void carlfw_release(struct carlfw *fw)
+{
+	struct carlfw_list_entry *entry;
+
+	if (!IS_ERR_OR_NULL(fw)) {
+		while (!list_empty(&fw->desc_list)) {
+			entry = list_entry(fw->desc_list.next,
+					   struct carlfw_list_entry, h.list);
+			carlfw_entry_del(fw, entry);
+		}
+
+		__carlfw_release(&fw->fw);
+		__carlfw_release(&fw->hdr);
+		free(fw);
+	}
+}
+
+static int __carlfw_load(struct carlfw_file *file, const char *name, const char *mode)
+{
+	struct stat file_stat;
+	FILE *fh;
+	int err;
+
+	fh = fopen(name, mode);
+	if (fh == NULL)
+		return errno ? -errno : -1;
+
+	err = fstat(fileno(fh), &file_stat);
+	if (err)
+		return errno ? -errno : -1;
+
+	file->len = file_stat.st_size;
+	file->data = malloc(file->len);
+	if (file->data == NULL)
+		return -ENOMEM;
+
+	err = fread(file->data, file->len, 1, fh);
+	if (err != 1)
+		return -ferror(fh);
+
+	file->name = strdup(name);
+	fclose(fh);
+
+	if (!file->name)
+		return -ENOMEM;
+
+	return 0;
+}
+
+static void *__carlfw_find_desc(struct carlfw_file *file,
+				uint8_t descid[4],
+				unsigned int len,
+				uint8_t compatible_revision)
+{
+	int scan = file->len, found = 0;
+	struct carl9170fw_desc_head *tmp = NULL;
+
+	while (scan >= 0) {
+		if (file->data[scan] == descid[CARL9170FW_MAGIC_SIZE - found - 1])
+			found++;
+		else
+			found = 0;
+
+		if (found == CARL9170FW_MAGIC_SIZE)
+			break;
+
+		scan--;
+	}
+
+	if (found == CARL9170FW_MAGIC_SIZE) {
+		tmp = (void *) &file->data[scan];
+
+		if (!CHECK_HDR_VERSION(tmp, compatible_revision) &&
+		    (le16_to_cpu(tmp->length) >= len))
+			return tmp;
+	}
+
+	return NULL;
+}
+
+void *carlfw_find_desc(struct carlfw *fw,
+		       const uint8_t descid[4],
+		       const unsigned int len,
+		       const uint8_t compatible_revision)
+{
+	struct carlfw_list_entry *tmp;
+
+	tmp = carlfw_find_entry(fw, descid, len, compatible_revision);
+
+	return tmp ? carlfw_entry_to_desc(tmp) : NULL;
+}
+
+int carlfw_desc_add_tail(struct carlfw *fw,
+	const struct carl9170fw_desc_head *desc)
+{
+	struct carlfw_list_entry *tmp;
+
+	tmp = __carlfw_entry_add_prepare(fw, desc);
+	if (IS_ERR(tmp))
+		return PTR_ERR(tmp);
+
+	list_add_tail(&tmp->h.list, &fw->desc_list);
+	return 0;
+}
+
+int carlfw_desc_add(struct carlfw *fw,
+		    const struct carl9170fw_desc_head *desc,
+		    struct carl9170fw_desc_head *prev,
+		    struct carl9170fw_desc_head *next)
+{
+	struct carlfw_list_entry *tmp;
+
+	tmp = __carlfw_entry_add_prepare(fw, desc);
+	if (IS_ERR(tmp))
+		return PTR_ERR(tmp);
+
+	list_add(&tmp->h.list, &((carlfw_desc_to_entry(prev))->h.list),
+		 &((carlfw_desc_to_entry(next))->h.list));
+	return 0;
+}
+
+int carlfw_desc_add_before(struct carlfw *fw,
+			   const struct carl9170fw_desc_head *desc,
+			   struct carl9170fw_desc_head *pos)
+{
+	struct carl9170fw_desc_head *prev;
+	struct carlfw_list_entry *prev_entry;
+
+	prev_entry = carlfw_desc_to_entry(pos);
+
+	prev = carlfw_entry_to_desc((struct carlfw_list_entry *) prev_entry->h.list.prev);
+
+	return carlfw_desc_add(fw, desc, prev, pos);
+}
+
+void carlfw_desc_unlink(struct carlfw *fw,
+	struct carl9170fw_desc_head *desc)
+{
+	carlfw_entry_unlink(fw, carlfw_desc_to_entry(desc));
+}
+
+void carlfw_desc_del(struct carlfw *fw,
+	struct carl9170fw_desc_head *desc)
+{
+	carlfw_entry_del(fw, carlfw_desc_to_entry(desc));
+}
+
+void *carlfw_desc_mod_len(struct carlfw *fw __unused,
+	struct carl9170fw_desc_head *desc, size_t len)
+{
+	struct carlfw_list_entry *obj, tmp;
+	int new_len = le16_to_cpu(desc->length) + len;
+
+	if (new_len < (int)sizeof(*desc))
+		return ERR_PTR(-EINVAL);
+
+	if (new_len > CARL9170FW_DESC_MAX_LENGTH)
+		return ERR_PTR(-E2BIG);
+
+	obj = carlfw_desc_to_entry(desc);
+
+	memcpy(&tmp, obj, sizeof(tmp));
+	obj = realloc(obj, new_len + sizeof(struct carlfw_list_entry_head));
+	if (obj == NULL)
+		return ERR_PTR(-ENOMEM);
+
+	list_replace(&tmp.h.list, &obj->h.list);
+
+	desc = carlfw_entry_to_desc(obj);
+	desc->length = le16_to_cpu(new_len);
+	fw->desc_list_len += len;
+
+	return desc;
+}
+
+void *carlfw_desc_next(struct carlfw *fw,
+		       struct carl9170fw_desc_head *pos)
+{
+	struct carlfw_list_entry *entry;
+
+	if (!pos)
+		entry = (struct carlfw_list_entry *) &fw->desc_list;
+	else
+		entry = carlfw_desc_to_entry(pos);
+
+	if (list_at_tail(entry, &fw->desc_list, h.list))
+		return NULL;
+
+	entry = (struct carlfw_list_entry *) entry->h.list.next;
+
+	return carlfw_entry_to_desc(entry);
+}
+
+static int carlfw_parse_descs(struct carlfw *fw,
+			      struct carl9170fw_otus_desc *otus_desc)
+{
+	const struct carl9170fw_desc_head *iter = NULL;
+	int err;
+
+	carl9170fw_for_each_hdr(iter, &otus_desc->head) {
+		err = carlfw_desc_add_tail(fw, iter);
+		if (err)
+			return err;
+	}
+	/* LAST is added automatically by carlfw_store */
+
+	return err;
+}
+
+#if BYTE_ORDER == LITTLE_ENDIAN
+#define CRCPOLY_LE 0xedb88320
+
+/* copied from the linux kernel  */
+static uint32_t crc32_le(uint32_t crc, unsigned char const *p, size_t len)
+{
+	int i;
+	while (len--) {
+		crc ^= *p++;
+		for (i = 0; i < 8; i++)
+			crc = (crc >> 1) ^ ((crc & 1) ? CRCPOLY_LE : 0);
+	}
+	return crc;
+}
+#else
+#error "this tool does not work with a big endian host yet!"
+#endif
+
+static int carlfw_check_crc32s(struct carlfw *fw)
+{
+	struct carl9170fw_chk_desc *chk_desc;
+	struct carlfw_list_entry *iter;
+	unsigned int elen;
+	uint32_t crc32;
+
+	chk_desc = carlfw_find_desc(fw, (uint8_t *) CHK_MAGIC,
+				    sizeof(*chk_desc),
+				    CARL9170FW_CHK_DESC_CUR_VER);
+	if (!chk_desc)
+		return -ENODATA;
+
+	crc32 = crc32_le(~0, (void *) fw->fw.data, fw->fw.len);
+	if (crc32 != le32_to_cpu(chk_desc->fw_crc32))
+		return -EINVAL;
+
+	carlfw_walk_descs(iter, fw) {
+		elen = le16_to_cpu(iter->head.length);
+
+		if (carl9170fw_desc_cmp(&iter->head, (uint8_t *) CHK_MAGIC,
+					sizeof(*chk_desc),
+					CARL9170FW_CHK_DESC_CUR_VER))
+			continue;
+
+		crc32 = crc32_le(crc32, (void *) &iter->head, elen);
+	}
+
+	if (crc32 != le32_to_cpu(chk_desc->hdr_crc32))
+		return -EINVAL;
+
+	return 0;
+}
+
+struct carlfw *carlfw_load(const char *basename)
+{
+	char filename[256];
+	struct carlfw *fw;
+	struct carl9170fw_otus_desc *otus_desc;
+	struct carl9170fw_last_desc *last_desc;
+	struct carlfw_file *hdr_file;
+	unsigned long fin, diff, off, rem;
+	int err;
+
+	fw = calloc(1, sizeof(*fw));
+	if (!fw)
+		return ERR_PTR(-ENOMEM);
+
+	init_list_head(&fw->desc_list);
+
+	err = __carlfw_load(&fw->fw, basename, "r");
+	if (err)
+		goto err_out;
+
+	if (fw->hdr.name)
+		hdr_file = &fw->hdr;
+	else
+		hdr_file = &fw->fw;
+
+	otus_desc = __carlfw_find_desc(hdr_file, (uint8_t *) OTUS_MAGIC,
+				       sizeof(*otus_desc),
+				       CARL9170FW_OTUS_DESC_CUR_VER);
+	last_desc = __carlfw_find_desc(hdr_file, (uint8_t *) LAST_MAGIC,
+				       sizeof(*last_desc),
+				       CARL9170FW_LAST_DESC_CUR_VER);
+
+	if (!otus_desc || !last_desc ||
+	    (unsigned long) otus_desc > (unsigned long) last_desc) {
+		err = -ENODATA;
+		goto err_out;
+	}
+
+	err = carlfw_parse_descs(fw, otus_desc);
+	if (err)
+		goto err_out;
+
+	fin = (unsigned long)last_desc + sizeof(*last_desc);
+	diff = fin - (unsigned long)otus_desc;
+	rem = hdr_file->len - (fin - (unsigned long) hdr_file->data);
+
+	if (rem) {
+		off = (unsigned long)otus_desc - (unsigned long)hdr_file->data;
+		memmove(&hdr_file->data[off],
+			((uint8_t *)last_desc) + sizeof(*last_desc), rem);
+	}
+
+	hdr_file->len -= diff;
+	hdr_file->data = realloc(hdr_file->data, hdr_file->len);
+	if (!hdr_file->data && hdr_file->len) {
+		err = -ENOMEM;
+		goto err_out;
+	}
+
+	err = carlfw_check_crc32s(fw);
+	if (err && err != -ENODATA)
+		goto err_out;
+
+	return fw;
+
+err_out:
+	carlfw_release(fw);
+	return ERR_PTR(err);
+}
+
+static int carlfw_apply_checksums(struct carlfw *fw)
+{
+	struct carlfw_list_entry *iter;
+	struct carl9170fw_chk_desc tmp = {
+		CARL9170FW_FILL_DESC(CHK_MAGIC, sizeof(tmp),
+				      CARL9170FW_CHK_DESC_MIN_VER,
+				      CARL9170FW_CHK_DESC_CUR_VER) };
+	struct carl9170fw_chk_desc *chk_desc = NULL;
+	int err = 0;
+	unsigned int len = 0, elen, max_len;
+	uint32_t crc32;
+
+	chk_desc = carlfw_find_desc(fw, (uint8_t *) CHK_MAGIC,
+				    sizeof(*chk_desc),
+				    CARL9170FW_CHK_DESC_CUR_VER);
+	if (chk_desc) {
+		carlfw_desc_del(fw, &chk_desc->head);
+		chk_desc = NULL;
+	}
+
+	max_len = fw->desc_list_len;
+
+	crc32 = crc32_le(~0, (void *) fw->fw.data, fw->fw.len);
+	tmp.fw_crc32 = cpu_to_le32(crc32);
+
+	/*
+	 * NOTE:
+	 *
+	 * The descriptor checksum is seeded with the firmware's crc32.
+	 * This neat trick ensures that the driver can check whenever
+	 * descriptor actually belongs to the firmware, or not.
+	 */
+
+	carlfw_walk_descs(iter, fw) {
+		elen = le16_to_cpu(iter->head.length);
+
+		if (max_len < len + elen)
+			return -EMSGSIZE;
+
+		crc32 = crc32_le(crc32, (void *) &iter->head, elen);
+		len += elen;
+	}
+
+	tmp.hdr_crc32 = cpu_to_le32(crc32);
+
+	err = carlfw_desc_add_tail(fw, &tmp.head);
+
+	return err;
+}
+
+int carlfw_store(struct carlfw *fw)
+{
+	struct carl9170fw_last_desc last_desc = {
+		CARL9170FW_FILL_DESC(LAST_MAGIC, sizeof(last_desc),
+			CARL9170FW_LAST_DESC_MIN_VER,
+			CARL9170FW_LAST_DESC_CUR_VER) };
+
+	struct carlfw_list_entry *iter;
+	FILE *fh;
+	int err, elen;
+
+	err = carlfw_apply_checksums(fw);
+	if (err)
+		return err;
+
+	fh = fopen(fw->fw.name, "w");
+	if (!fh)
+		return -errno;
+
+	err = fwrite(fw->fw.data, fw->fw.len, 1, fh);
+	if (err != 1) {
+		err = -errno;
+		goto close_out;
+	}
+
+	if (fw->hdr.name) {
+		fclose(fh);
+
+		fh = fopen(fw->hdr.name, "w");
+	}
+
+	carlfw_walk_descs(iter, fw) {
+		elen = le16_to_cpu(iter->head.length);
+
+		if (elen > CARL9170FW_DESC_MAX_LENGTH) {
+			err = -E2BIG;
+			goto close_out;
+		}
+
+		err = fwrite(iter->data, elen, 1, fh);
+		if (err != 1) {
+			err = -ferror(fh);
+			goto close_out;
+		}
+	}
+
+	err = fwrite(&last_desc, sizeof(last_desc), 1, fh);
+	if (err != 1) {
+		err = -ferror(fh);
+		goto close_out;
+	}
+
+	err = 0;
+
+close_out:
+	fclose(fh);
+	return err;
+}
+
+void *carlfw_mod_tailroom(struct carlfw *fw, ssize_t len)
+{
+	size_t new_len;
+	void *buf;
+
+	new_len = fw->fw.len + len;
+
+	if (!carl9170fw_size_check(new_len))
+		return ERR_PTR(-EINVAL);
+
+	buf = realloc(fw->fw.data, new_len);
+	if (buf == NULL)
+		return ERR_PTR(-ENOMEM);
+
+	fw->fw.len = new_len;
+	fw->fw.data = buf;
+	return &fw->fw.data[new_len - len];
+}
+
+void *carlfw_mod_headroom(struct carlfw *fw, ssize_t len)
+{
+	size_t new_len;
+	void *ptr;
+
+	new_len = fw->fw.len + len;
+	if (!carl9170fw_size_check(new_len))
+		return ERR_PTR(-EINVAL);
+
+	if (len < 0)
+		memmove(fw->fw.data, &fw->fw.data[len], new_len);
+
+	ptr = carlfw_mod_tailroom(fw, len);
+	if (IS_ERR_OR_NULL(ptr))
+		return ptr;
+
+	if (len > 0)
+		memmove(&fw->fw.data[len], &fw->fw.data[0], new_len - len);
+
+	return fw->fw.data;
+}
+
+void *carlfw_get_fw(struct carlfw *fw, size_t *len)
+{
+	*len = fw->fw.len;
+	return fw->fw.data;
+}
+
+unsigned int carlfw_get_descs_num(struct carlfw *fw)
+{
+	return fw->desc_list_entries;
+}
+
+unsigned int carlfw_get_descs_size(struct carlfw *fw)
+{
+	return fw->desc_list_len;
+}
diff --git a/carl9170fw/tools/lib/carlfw.h b/carl9170fw/tools/lib/carlfw.h
new file mode 100644
index 0000000..6e722c9
--- /dev/null
+++ b/carl9170fw/tools/lib/carlfw.h
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2010-2011 Christian Lamparter <chunkeey@googlemail.com>
+ *
+ * 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 version 2 of the License.
+ *
+ * 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 Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef __CARLFW_H
+#define __CARLFW_H
+
+#include <linux/types.h>
+#include "compiler.h"
+#include "fwdesc.h"
+#include "list.h"
+
+struct carlfw;
+
+void carlfw_release(struct carlfw *fw);
+struct carlfw *carlfw_load(const char *basename);
+int carlfw_store(struct carlfw *fw);
+void *carlfw_find_desc(struct carlfw *fw,
+	const uint8_t descid[4], const unsigned int len,
+	const uint8_t compatible_revision);
+
+int carlfw_desc_add_tail(struct carlfw *fw,
+			 const struct carl9170fw_desc_head *desc);
+
+int carlfw_desc_add(struct carlfw *fw,
+		    const struct carl9170fw_desc_head *desc,
+		    struct carl9170fw_desc_head *prev,
+		    struct carl9170fw_desc_head *next);
+
+void *carlfw_desc_mod_len(struct carlfw *fw,
+			  struct carl9170fw_desc_head *desc,
+			  size_t len);
+
+int carlfw_desc_add_before(struct carlfw *fw,
+			   const struct carl9170fw_desc_head *desc,
+			   struct carl9170fw_desc_head *pos);
+
+void carlfw_desc_unlink(struct carlfw *fw,
+			struct carl9170fw_desc_head *desc);
+
+void carlfw_desc_del(struct carlfw *fw,
+		     struct carl9170fw_desc_head *entry);
+
+void *carlfw_desc_next(struct carlfw *fw,
+		       struct carl9170fw_desc_head *pos);
+
+void *carlfw_mod_tailroom(struct carlfw *fw, ssize_t len);
+void *carlfw_mod_headroom(struct carlfw *fw, ssize_t len);
+
+void *carlfw_get_fw(struct carlfw *fw, size_t *len);
+
+unsigned int carlfw_get_descs_num(struct carlfw *fw);
+unsigned int carlfw_get_descs_size(struct carlfw *fw);
+#endif /* __CARLFW_H */
diff --git a/carl9170fw/tools/src/CMakeLists.txt b/carl9170fw/tools/src/CMakeLists.txt
new file mode 100644
index 0000000..3cd31fd
--- /dev/null
+++ b/carl9170fw/tools/src/CMakeLists.txt
@@ -0,0 +1,13 @@
+cmake_minimum_required(VERSION 2.8)
+
+project(tools)
+
+add_custom_target(wol ALL COMMAND gcc wol.c -o wol)
+
+set(tools fwinfo miniboot checksum eeprom_fix)
+
+foreach(tool ${tools})
+	add_executable( ${tool} ${tool}.c )
+	add_definitions("-std=gnu99 -Wall -Wextra -Wshadow")
+	target_link_libraries( ${tool} carlfw )
+endforeach()
diff --git a/carl9170fw/tools/src/checksum.c b/carl9170fw/tools/src/checksum.c
new file mode 100644
index 0000000..b394174
--- /dev/null
+++ b/carl9170fw/tools/src/checksum.c
@@ -0,0 +1,89 @@
+/*
+ * Copyright 2010-2011 Christian Lamparter <chunkeey@googlemail.com>
+ *
+ * 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 version 2 of the License.
+ *
+ * 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 Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <error.h>
+#include <string.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+#include "carlfw.h"
+
+#include "compiler.h"
+
+static void checksum_help(void)
+{
+	fprintf(stderr, "Usage:\n");
+	fprintf(stderr, "\tchecksum FW-FILE\n");
+
+	fprintf(stderr, "\nDescription:\n");
+	fprintf(stderr, "\tThis simple utility adds/updates various "
+			"checksums.\n");
+
+	fprintf(stderr, "\nParameteres:\n");
+	fprintf(stderr, "\t 'FW-FILE'	= firmware name\n");
+	fprintf(stderr, "\n");
+}
+
+int main(int argc, char *args[])
+{
+	struct carlfw *fw = NULL;
+	int err = 0;
+
+	if (argc != 2) {
+		err = -EINVAL;
+		goto out;
+	}
+
+	fw = carlfw_load(args[1]);
+	if (IS_ERR_OR_NULL(fw)) {
+		err = PTR_ERR(fw);
+		fprintf(stderr, "Failed to open file \"%s\" (%d).\n",
+			args[1], err);
+		goto out;
+	}
+
+	/*
+	 * No magic here, The checksum descriptor is added/update
+	 * automatically in a subroutine of carlfw_store().
+	 *
+	 * This tools serves as a skeleton/example.
+	 */
+	err = carlfw_store(fw);
+	if (err) {
+		fprintf(stderr, "Failed to apply checksum (%d).\n", err);
+		goto out;
+	}
+
+out:
+	switch (err) {
+	case 0:
+		fprintf(stdout, "checksum applied.\n");
+		break;
+	case -EINVAL:
+		checksum_help();
+		break;
+	default:
+		break;
+	}
+
+	carlfw_release(fw);
+	return err ? EXIT_FAILURE : EXIT_SUCCESS;
+}
diff --git a/carl9170fw/tools/src/eeprom_fix.c b/carl9170fw/tools/src/eeprom_fix.c
new file mode 100644
index 0000000..088510e
--- /dev/null
+++ b/carl9170fw/tools/src/eeprom_fix.c
@@ -0,0 +1,326 @@
+/*
+ * Copyright 2010-2011 Christian Lamparter <chunkeey@googlemail.com>
+ *
+ * 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 version 2 of the License.
+ *
+ * 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 Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <error.h>
+#include <string.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+#include "carlfw.h"
+
+#include "compiler.h"
+
+static int get_val(char *str, unsigned int *val)
+{
+	int err;
+
+	err = sscanf(str, "%8x", val);
+	if (err != 1)
+		return -EINVAL;
+
+	return 0;
+}
+
+static int get_addr(char *str, unsigned int *val)
+{
+	int err;
+
+	err = get_val(str, val);
+	if (*val & 3) {
+		fprintf(stderr, "Address 0x%.8x is not a multiple of 4.\n",
+			*val);
+
+		return -EINVAL;
+	}
+
+	return err;
+}
+
+static int
+new_fix_entry(struct carlfw *fw, struct carl9170fw_fix_entry *fix_entry)
+{
+	struct carl9170fw_fix_desc *fix;
+	unsigned int len;
+
+	len = sizeof(*fix) + sizeof(*fix_entry);
+	fix = malloc(len);
+	if (!fix)
+		return -ENOMEM;
+
+	carl9170fw_fill_desc(&fix->head, (uint8_t *) FIX_MAGIC,
+			      cpu_to_le16(len),
+			      CARL9170FW_FIX_DESC_MIN_VER,
+			      CARL9170FW_FIX_DESC_CUR_VER);
+
+	memcpy(&fix->data[0], fix_entry, sizeof(*fix_entry));
+
+	return carlfw_desc_add_tail(fw, &fix->head);
+}
+
+static struct carl9170fw_fix_entry *
+scan_for_similar_fix(struct carl9170fw_fix_desc *fix, __le32 address)
+{
+	unsigned int i, entries;
+
+	entries = (le16_to_cpu(fix->head.length) - sizeof(*fix)) /
+		   sizeof(struct carl9170fw_fix_entry);
+
+	for (i = 0; i < entries; i++) {
+		if (address == fix->data[i].address)
+			return &fix->data[i];
+	}
+
+	return NULL;
+}
+
+static int
+add_another_fix_entry(struct carlfw *fw, struct carl9170fw_fix_desc *fix,
+		 struct carl9170fw_fix_entry *fix_entry)
+{
+	unsigned int entry;
+
+	fix = carlfw_desc_mod_len(fw, &fix->head, sizeof(*fix_entry));
+	if (IS_ERR_OR_NULL(fix))
+		return (int) PTR_ERR(fix);
+
+	entry = (le16_to_cpu(fix->head.length) - sizeof(*fix)) /
+		sizeof(*fix_entry) - 1;
+
+	memcpy(&fix->data[entry], fix_entry, sizeof(*fix_entry));
+	return 0;
+}
+
+static int
+update_entry(char option, struct carl9170fw_fix_entry *entry,
+	     struct carl9170fw_fix_entry *fix)
+{
+	switch (option) {
+	case '=':
+		entry->mask = fix->mask;
+		entry->value = fix->value;
+		break;
+
+	case 'O':
+		entry->mask |= fix->mask;
+		entry->value |= fix->value;
+		break;
+
+	case 'A':
+		entry->mask &= fix->mask;
+		entry->value &= fix->value;
+		break;
+
+	default:
+		fprintf(stderr, "Unknown option: '%c'\n", option);
+		return -EINVAL;
+	}
+
+	return 0;
+}
+
+static void user_education(void)
+{
+	fprintf(stderr, "Usage:\n");
+	fprintf(stderr, "\teeprom_fix FW-FILE SWITCH [ADDRESS [VALUE MASK]]\n");
+
+	fprintf(stderr, "\nDescription:\n");
+	fprintf(stderr, "\tThis utility manage a set of overrides which "
+			"commands the driver\n\tto load customized EEPROM' "
+			"data for all specified addresses.\n");
+
+	fprintf(stderr, "\nParameters:\n");
+	fprintf(stderr, "\t'FW-FILE'  = firmware file [basename]\n");
+	fprintf(stderr, "\t'SWITCH'   = [=|d|D]\n");
+	fprintf(stderr, "\t | '='       => add/set value for address\n");
+	fprintf(stderr, "\t | 'D'       => removes all EEPROM overrides\n");
+	fprintf(stderr, "\t * 'd'       => removed override for 'address'\n");
+	fprintf(stderr, "\n\t'ADDRESS'  = location of the EEPROM override\n");
+	fprintf(stderr, "\t\t     NB: must be a multiple of 4.\n");
+	fprintf(stderr, "\t\t     an address map can be found in eeprom.h.\n");
+	fprintf(stderr, "\n\t'VALUE'    = replacement value\n");
+	fprintf(stderr, "\t'MASK'     = mask for the value placement.\n\n");
+
+	exit(EXIT_FAILURE);
+}
+
+static int
+set_fix(struct carlfw *fw, struct carl9170fw_fix_desc *fix,
+	char __unused option, int __unused argc, char *args[])
+{
+	struct carl9170fw_fix_entry fix_entry, *entry = NULL;
+	unsigned int address, value, mask;
+	int err;
+
+	err = get_addr(args[3], &address);
+	if (err)
+		return err;
+
+	err = get_val(args[4], &value);
+	if (err)
+		return err;
+
+	err = get_val(args[5], &mask);
+	if (err)
+		return err;
+
+	fix_entry.address = cpu_to_le32(address);
+	fix_entry.value = cpu_to_le32(value);
+	fix_entry.mask = cpu_to_le32(mask);
+
+	if (!fix) {
+		err = new_fix_entry(fw, &fix_entry);
+	} else {
+		entry = scan_for_similar_fix(fix, fix_entry.address);
+		if (entry) {
+			err = update_entry(option, entry, &fix_entry);
+			if (err)
+				fprintf(stdout, "Overwrite old entry.\n");
+		} else {
+			err = add_another_fix_entry(fw, fix, &fix_entry);
+		}
+	}
+
+	return err;
+}
+
+static int
+del_fix(struct carlfw *fw, struct carl9170fw_fix_desc *fix,
+	char __unused option, int __unused argc, char *args[])
+{
+	struct carl9170fw_fix_entry *entry = NULL;
+	unsigned int address;
+	unsigned long off;
+	unsigned int rem_len;
+	int err;
+
+	err = get_addr(args[3], &address);
+	if (err)
+		return err;
+
+	if (fix)
+		entry = scan_for_similar_fix(fix, cpu_to_le32(address));
+
+	if (!entry) {
+		fprintf(stderr, "Entry for 0x%.8x not found\n", address);
+		return -EINVAL;
+	}
+
+	off = (unsigned long) entry - (unsigned long) fix->data;
+	rem_len = le16_to_cpu(fix->head.length) - off;
+
+	if (rem_len) {
+		unsigned long cont;
+		cont = (unsigned long) entry + sizeof(*entry);
+		memmove(entry, (void *)cont, rem_len);
+	}
+
+	fix = carlfw_desc_mod_len(fw, &fix->head, -sizeof(*entry));
+	err = IS_ERR_OR_NULL(fix);
+	return err;
+}
+
+static int del_all(struct carlfw *fw, struct carl9170fw_fix_desc *fix,
+	char __unused option, int __unused argc, char __unused *args[])
+{
+	if (!fix)
+		return 0;
+
+	carlfw_desc_del(fw, &fix->head);
+	return 0;
+}
+
+static const struct {
+	char option;
+	int argc;
+	int (*func)(struct carlfw *, struct carl9170fw_fix_desc *,
+		    char, int, char **);
+} programm_function[] = {
+	{ '=', 6, set_fix },
+	{ 'O', 6, set_fix },
+	{ 'A', 6, set_fix },
+	{ 'd', 4, del_fix },
+	{ 'D', 3, del_all },
+};
+
+int main(int argc, char *args[])
+{
+	struct carl9170fw_fix_desc *fix;
+	struct carlfw *fw = NULL;
+	unsigned int i;
+	int err = 0;
+	char option;
+
+	if (argc < 3 || argc > 6) {
+		err = -EINVAL;
+		goto out;
+	}
+
+	fw = carlfw_load(args[1]);
+	if (IS_ERR_OR_NULL(fw)) {
+		err = PTR_ERR(fw);
+		fprintf(stderr, "Failed to open file \"%s\" (%d).\n",
+			args[1], err);
+		goto out;
+	}
+
+	fix = carlfw_find_desc(fw, (uint8_t *)FIX_MAGIC, sizeof(*fix),
+			       CARL9170FW_FIX_DESC_CUR_VER);
+
+	option = args[2][0];
+	for (i = 0; i < ARRAY_SIZE(programm_function); i++) {
+		if (programm_function[i].option != option)
+			continue;
+
+		if (argc != programm_function[i].argc) {
+			err = -EINVAL;
+			goto out;
+		}
+
+		err = programm_function[i].func(fw, fix, option, argc, args);
+		if (err)
+			goto out;
+
+		break;
+	}
+	if (i == ARRAY_SIZE(programm_function)) {
+		fprintf(stderr, "Unknown option: '%c'\n",
+			args[2][0]);
+		goto out;
+	}
+
+	err = carlfw_store(fw);
+	if (err) {
+		fprintf(stderr, "Failed to apply changes (%d).\n", err);
+		goto out;
+	}
+
+out:
+	carlfw_release(fw);
+
+	if (err) {
+		if (err == -EINVAL)
+			user_education();
+		else
+			fprintf(stderr, "%s\n", strerror(err));
+	}
+
+	return err ? EXIT_FAILURE : EXIT_SUCCESS;
+}
diff --git a/carl9170fw/tools/src/fwinfo.c b/carl9170fw/tools/src/fwinfo.c
new file mode 100644
index 0000000..0d5cd09
--- /dev/null
+++ b/carl9170fw/tools/src/fwinfo.c
@@ -0,0 +1,331 @@
+/*
+ * Copyright 2010-2011 Christian Lamparter <chunkeey@googlemail.com>
+ *
+ * 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 version 2 of the License.
+ *
+ * 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 Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <error.h>
+#include <string.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <ctype.h>
+
+#include "carlfw.h"
+
+#include "fwcmd.h"
+#include "compiler.h"
+
+struct feature_list {
+	unsigned int id;
+	char name[64];
+	void (*func)(const struct carl9170fw_desc_head *, struct carlfw *fw);
+};
+
+#define CHECK_FOR_FEATURE(feature_enum)					\
+	{ .id = feature_enum, .name = #feature_enum, .func = NULL }
+
+#define CHECK_FOR_FEATURE_FUNC(feature_enum, _func)			\
+	{ .id = feature_enum, .name = #feature_enum, .func = _func }
+
+static void show_miniboot_info(const struct carl9170fw_desc_head *head,
+			       struct carlfw *fw __unused)
+{
+	const struct carl9170fw_otus_desc *otus = (const void *) head;
+
+	fprintf(stdout, "\t\t\tminiboot size: %d Bytes\n", otus->miniboot_size);
+}
+
+static const struct feature_list known_otus_features_v1[] = {
+	CHECK_FOR_FEATURE(CARL9170FW_DUMMY_FEATURE),
+	CHECK_FOR_FEATURE_FUNC(CARL9170FW_MINIBOOT, show_miniboot_info),
+	CHECK_FOR_FEATURE(CARL9170FW_USB_INIT_FIRMWARE),
+	CHECK_FOR_FEATURE(CARL9170FW_USB_RESP_EP2),
+	CHECK_FOR_FEATURE(CARL9170FW_USB_DOWN_STREAM),
+	CHECK_FOR_FEATURE(CARL9170FW_USB_UP_STREAM),
+	CHECK_FOR_FEATURE(CARL9170FW_UNUSABLE),
+	CHECK_FOR_FEATURE(CARL9170FW_COMMAND_PHY),
+	CHECK_FOR_FEATURE(CARL9170FW_COMMAND_CAM),
+	CHECK_FOR_FEATURE(CARL9170FW_WLANTX_CAB),
+	CHECK_FOR_FEATURE(CARL9170FW_HANDLE_BACK_REQ),
+	CHECK_FOR_FEATURE(CARL9170FW_GPIO_INTERRUPT),
+	CHECK_FOR_FEATURE(CARL9170FW_PSM),
+	CHECK_FOR_FEATURE(CARL9170FW_RX_FILTER),
+	CHECK_FOR_FEATURE(CARL9170FW_WOL),
+	CHECK_FOR_FEATURE(CARL9170FW_FIXED_5GHZ_PSM),
+	CHECK_FOR_FEATURE(CARL9170FW_HW_COUNTERS),
+	CHECK_FOR_FEATURE(CARL9170FW_RX_BA_FILTER),
+};
+
+static void check_feature_list(const struct carl9170fw_desc_head *head,
+			       const __le32 bitmap,
+			       const struct feature_list *list,
+			       const unsigned int entries,
+			       struct carlfw *fw)
+{
+	unsigned int i;
+
+	for (i = 0; i < entries; i++) {
+		if (!carl9170fw_supports(bitmap, list[i].id))
+			continue;
+
+		fprintf(stdout, "\t\t%2d = %s\n", list[i].id, list[i].name);
+		if (list[i].func)
+			list[i].func(head, fw);
+	}
+}
+
+static void show_otus_desc(const struct carl9170fw_desc_head *head,
+			   struct carlfw *fw)
+{
+	const struct carl9170fw_otus_desc *otus = (const void *) head;
+
+	BUILD_BUG_ON(ARRAY_SIZE(known_otus_features_v1) != __CARL9170FW_FEATURE_NUM);
+
+	fprintf(stdout, "\tFirmware upload pointer: 0x%x\n",
+		otus->fw_address);
+	fprintf(stdout, "\tBeacon Address: %x, (reserved:%d Bytes)\n",
+		le32_to_cpu(otus->bcn_addr), le16_to_cpu(otus->bcn_len));
+	fprintf(stdout, "\tTX DMA chunk size:%d Bytes, TX DMA chunks:%d\n",
+		otus->tx_frag_len, otus->tx_descs);
+	fprintf(stdout, "\t=> %d Bytes are reserved for the TX queues\n",
+		otus->tx_frag_len * otus->tx_descs);
+	fprintf(stdout, "\tCommand response buffers:%d\n", otus->cmd_bufs);
+	fprintf(stdout, "\tMax. RX stream block size:%d Bytes\n",
+		otus->rx_max_frame_len);
+	fprintf(stdout, "\tSupported Firmware Interfaces: %d\n", otus->vif_num);
+	fprintf(stdout, "\tFirmware API Version: %d\n", otus->api_ver);
+	fprintf(stdout, "\tSupported Features: (raw:%.08x)\n",
+		le32_to_cpu(otus->feature_set));
+
+	check_feature_list(head, otus->feature_set, known_otus_features_v1,
+			   ARRAY_SIZE(known_otus_features_v1), fw);
+}
+
+static void show_motd_desc(const struct carl9170fw_desc_head *head,
+			   struct carlfw *fw __unused)
+{
+	const struct carl9170fw_motd_desc *motd = (const void *) head;
+	char buf[CARL9170FW_MOTD_STRING_LEN];
+	unsigned int fw_date;
+
+	fw_date = motd->fw_year_month_day;
+	fprintf(stdout, "\tFirmware Build Date (YYYY-MM-DD): 2%03d-%02d-%02d\n",
+		CARL9170FW_GET_YEAR(fw_date), CARL9170FW_GET_MONTH(fw_date),
+		CARL9170FW_GET_DAY(fw_date));
+
+	strncpy(buf, motd->desc, CARL9170FW_MOTD_STRING_LEN);
+	fprintf(stdout, "\tFirmware Text:\"%s\"\n", buf);
+
+	strncpy(buf, motd->release, CARL9170FW_MOTD_STRING_LEN);
+	fprintf(stdout, "\tFirmware Release:\"%s\"\n", buf);
+}
+
+static void show_fix_desc(const struct carl9170fw_desc_head *head,
+			  struct carlfw *fw __unused)
+{
+	const struct carl9170fw_fix_desc *fix = (const void *) head;
+	const struct carl9170fw_fix_entry *iter;
+	unsigned int i;
+
+	for (i = 0; i < (head->length - sizeof(*head)) / sizeof(*iter); i++) {
+		iter = &fix->data[i];
+		fprintf(stdout, "\t\t%d: 0x%.8x := 0x%.8x (0x%.8x)\n", i,
+			le32_to_cpu(iter->address), le32_to_cpu(iter->value),
+			le32_to_cpu(iter->mask));
+	}
+}
+
+static void show_dbg_desc(const struct carl9170fw_desc_head *head,
+			    struct carlfw *fw __unused)
+{
+	const struct carl9170fw_dbg_desc *dbg = (const void *) head;
+
+#define DBG_ADDR(_name, _reg) do {					\
+	unsigned int __tmp = le32_to_cpu(dbg->_reg);			\
+	if (__tmp)							\
+		fprintf(stdout, "\t\t" _name " = 0x%.8x\n", __tmp);	\
+	} while (0);
+
+	fprintf(stdout, "\tFirmware Debug Registers/Counters\n");
+	DBG_ADDR("bogoclock    ", bogoclock_addr);
+	DBG_ADDR("counter      ", counter_addr);
+	DBG_ADDR("rx total     ", rx_total_addr);
+	DBG_ADDR("rx overrun   ", rx_overrun_addr);
+	DBG_ADDR("rx filer     ", rx_filter);
+}
+
+static void show_txsq_desc(const struct carl9170fw_desc_head *head,
+			   struct carlfw *fw __unused)
+{
+	const struct carl9170fw_txsq_desc *txsq = (const void *) head;
+
+	fprintf(stdout, "\t\ttx-seq table addr: 0x%x\n",
+		le32_to_cpu(txsq->seq_table_addr));
+}
+
+
+static const struct feature_list wol_triggers_v1[] = {
+	CHECK_FOR_FEATURE(CARL9170_WOL_DISCONNECT),
+	CHECK_FOR_FEATURE(CARL9170_WOL_MAGIC_PKT),
+};
+
+static void show_wol_desc(const struct carl9170fw_desc_head *head,
+			  struct carlfw *fw __unused)
+{
+	const struct carl9170fw_wol_desc *wol = (const void *) head;
+
+	fprintf(stdout, "\tSupported WOWLAN triggers: (raw:%.08x)\n",
+		le32_to_cpu(wol->supported_triggers));
+
+	check_feature_list(head, wol->supported_triggers, wol_triggers_v1,
+			   ARRAY_SIZE(wol_triggers_v1), fw);
+}
+
+static void show_chk_desc(const struct carl9170fw_desc_head *head,
+			  struct carlfw *fw __unused)
+{
+	const struct carl9170fw_chk_desc *chk = (const void *) head;
+
+	fprintf(stdout, "\tFirmware Descriptor CRC32: %08x\n",
+		le32_to_cpu(chk->hdr_crc32));
+	fprintf(stdout, "\tFirmware Image CRC32: %08x\n",
+		le32_to_cpu(chk->fw_crc32));
+}
+
+static void show_last_desc(const struct carl9170fw_desc_head *head,
+			   struct carlfw *fw __unused)
+
+{
+	const struct carl9170fw_last_desc *last __unused = (const void *) head;
+
+	/* Nothing here */
+}
+
+#define ADD_HANDLER(_magic, _func)				\
+	{							\
+	  .magic = _magic##_MAGIC,				\
+	  .min_ver = CARL9170FW_## _magic##_DESC_CUR_VER,	\
+	  .func = _func,					\
+	  .size = CARL9170FW_## _magic##_DESC_SIZE,		\
+	}
+
+static const struct {
+	uint8_t magic[4];
+	uint8_t min_ver;
+	void (*func)(const struct carl9170fw_desc_head *, struct carlfw *);
+	uint16_t size;
+} known_magics[] = {
+	ADD_HANDLER(OTUS, show_otus_desc),
+	ADD_HANDLER(TXSQ, show_txsq_desc),
+	ADD_HANDLER(MOTD, show_motd_desc),
+	ADD_HANDLER(DBG, show_dbg_desc),
+	ADD_HANDLER(FIX, show_fix_desc),
+	ADD_HANDLER(CHK, show_chk_desc),
+	ADD_HANDLER(WOL, show_wol_desc),
+	ADD_HANDLER(LAST, show_last_desc),
+};
+
+static const uint8_t otus_magic[4] = { OTUS_MAGIC };
+
+static void show_desc_head(struct carl9170fw_desc_head *head)
+{
+#define P(c) (isprint(c) ? c :  ' ')
+
+	fprintf(stdout, ">\t%c%c%c%c Descriptor: size:%d, compatible:%d, "
+			"version:%d\n",
+		P(head->magic[0]), P(head->magic[1]), P(head->magic[2]),
+		P(head->magic[3]), le16_to_cpu(head->length), head->min_ver,
+		head->cur_ver);
+}
+
+static void fwinfo_info(void)
+{
+	fprintf(stderr, "Usage:\n");
+	fprintf(stderr, "\tfwinfo FW-FILE\n");
+
+	fprintf(stderr, "\nDescription:\n");
+	fprintf(stderr, "\tDisplay firmware descriptors information in "
+			"a human readable form.\n");
+
+	fprintf(stderr, "\nParameteres:\n");
+	fprintf(stderr, "\t 'FW-FILE'	= firmware file/base-name\n\n");
+}
+
+int main(int argc, char *args[])
+{
+	struct carlfw *fw = NULL;
+	struct carl9170fw_desc_head *fw_desc;
+	unsigned int i;
+	int err = 0;
+	size_t len;
+
+	if (argc != 2) {
+		err = -EINVAL;
+		goto out;
+	}
+
+	fw = carlfw_load(args[1]);
+	if (IS_ERR_OR_NULL(fw)) {
+		err = PTR_ERR(fw);
+		fprintf(stderr, "Failed to open firmware \"%s\" (%d).\n",
+			args[1], err);
+		goto out;
+	}
+
+	carlfw_get_fw(fw, &len);
+	fprintf(stdout, "General Firmware Statistics:\n");
+	fprintf(stdout, "\tFirmware file size: %u Bytes\n", (unsigned int)len);
+	fprintf(stdout, "\t%d Descriptors in %d Bytes\n",
+		carlfw_get_descs_num(fw), carlfw_get_descs_size(fw));
+
+	fw_desc = NULL;
+	fprintf(stdout, "\nDetailed Descriptor Description:\n");
+	while ((fw_desc = carlfw_desc_next(fw, fw_desc))) {
+		show_desc_head(fw_desc);
+
+		for (i = 0; i < ARRAY_SIZE(known_magics); i++) {
+			if (carl9170fw_desc_cmp(fw_desc, known_magics[i].magic,
+			    known_magics[i].size, known_magics[i].min_ver)) {
+				known_magics[i].func(fw_desc, fw);
+				break;
+			}
+		}
+
+		if (i == ARRAY_SIZE(known_magics))
+			fprintf(stderr, "Unknown Descriptor.\n");
+
+		fprintf(stdout, "\n");
+	}
+
+out:
+	switch (err) {
+	case 0:
+		break;
+
+	case -EINVAL:
+		fwinfo_info();
+		break;
+
+	default:
+		fprintf(stderr, "%s\n", strerror(-err));
+		break;
+	}
+
+	carlfw_release(fw);
+	return err ? EXIT_FAILURE : EXIT_SUCCESS;
+}
diff --git a/carl9170fw/tools/src/miniboot.c b/carl9170fw/tools/src/miniboot.c
new file mode 100644
index 0000000..509d82d
--- /dev/null
+++ b/carl9170fw/tools/src/miniboot.c
@@ -0,0 +1,200 @@
+/*
+ * Copyright 2010-2011 Christian Lamparter <chunkeey@googlemail.com>
+ *
+ * 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 version 2 of the License.
+ *
+ * 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 Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <error.h>
+#include <string.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+#include "carlfw.h"
+
+#include "compiler.h"
+
+static void mini_help(void)
+{
+	fprintf(stderr, "Usage:\n");
+	fprintf(stderr, "\tminiboot ACTION FW-FILE [MB-FILE]\n");
+
+	fprintf(stderr, "\nDescription:\n");
+	fprintf(stderr, "\tFirmware concatenation utility.\n");
+
+	fprintf(stderr, "\nParameteres:\n");
+	fprintf(stderr, "\t'ACTION'	= [a|d]\n");
+	fprintf(stderr, "\t | 'a'	= Add miniboot firmware.\n");
+	fprintf(stderr, "\t * 'd'	= remove miniboot firmware.\n");
+	fprintf(stderr, "\t'FW-FILE'	= destination for the package.\n");
+	fprintf(stderr, "\t'MB-FILE'	= extra firmware image.\n");
+}
+
+static int add_mini(struct carlfw *fw, const char *mini)
+{
+	struct stat file_stat;
+	struct carl9170fw_otus_desc *otus_desc = NULL;
+	FILE *m = NULL;
+	char *buf = NULL;
+	size_t extra;
+	int err;
+
+	m = fopen(mini, "r");
+	if (m == NULL) {
+		fprintf(stderr, "Failed to open file %s (%d).\n",
+			mini, errno);
+		err = -errno;
+		goto fail;
+	}
+
+	err = fstat(fileno(m), &file_stat);
+	if (err) {
+		fprintf(stderr, "Failed to query file infos from "
+				"\"%s\" (%d).\n", mini, errno);
+		err = -errno;
+		goto fail;
+	}
+	extra = file_stat.st_size;
+
+	otus_desc = carlfw_find_desc(fw, (uint8_t *) OTUS_MAGIC,
+				     sizeof(*otus_desc),
+				     CARL9170FW_OTUS_DESC_CUR_VER);
+	if (!otus_desc) {
+		fprintf(stderr, "No OTUS descriptor found\n");
+		goto fail;
+	}
+
+	if (carl9170fw_supports(otus_desc->feature_set, CARL9170FW_MINIBOOT)) {
+		fprintf(stderr, "Firmware has already a miniboot image.\n");
+		goto fail;
+	}
+
+	otus_desc->feature_set |= cpu_to_le32(BIT(CARL9170FW_MINIBOOT));
+	otus_desc->miniboot_size = cpu_to_le16(extra);
+
+	buf = carlfw_mod_headroom(fw, extra);
+	if (IS_ERR_OR_NULL(buf)) {
+		fprintf(stderr, "Unable to add miniboot image.\n");
+		goto fail;
+	}
+
+	err = fread(buf, extra, 1, m);
+	if (err != 1) {
+		fprintf(stderr, "Unable to load miniboot.\n");
+		goto fail;
+	}
+
+	carlfw_store(fw);
+	fclose(m);
+
+	return 0;
+
+fail:
+	if (m)
+		fclose(m);
+
+	return err;
+}
+
+static int del_mini(struct carlfw *fw)
+{
+	struct carl9170fw_otus_desc *otus_desc = NULL;
+	void *buf;
+	int cut;
+
+	otus_desc = carlfw_find_desc(fw, (uint8_t *) OTUS_MAGIC,
+				     sizeof(*otus_desc),
+				     CARL9170FW_OTUS_DESC_CUR_VER);
+	if (!otus_desc) {
+		fprintf(stderr, "Firmware is not for USB devices.\n");
+		return -ENODATA;
+	}
+
+	if (!carl9170fw_supports(otus_desc->feature_set, CARL9170FW_MINIBOOT)) {
+		fprintf(stderr, "Firmware has no miniboot image.\n");
+		return -EINVAL;
+	}
+
+	cut = le16_to_cpu(otus_desc->miniboot_size);
+
+	buf = carlfw_mod_headroom(fw, -cut);
+	if (IS_ERR_OR_NULL(buf)) {
+		fprintf(stderr, "Unable to remove miniboot.\n");
+		return PTR_ERR(buf);
+	}
+
+	otus_desc->feature_set &= cpu_to_le32(~BIT(CARL9170FW_MINIBOOT));
+	otus_desc->miniboot_size = cpu_to_le16(0);
+
+	carlfw_store(fw);
+	return 0;
+}
+
+int main(int argc, char *args[])
+{
+	struct carlfw *fw = NULL;
+	int err;
+
+	if (argc < 3 || argc > 4) {
+		err = -EINVAL;
+		goto err_param;
+	}
+
+	switch (args[1][0]) {
+	case 'a':
+		if (argc != 4)
+			goto err_param;
+
+		fw = carlfw_load(args[2]);
+		if (IS_ERR_OR_NULL(fw)) {
+			err = PTR_ERR(fw);
+			goto err_out;
+		}
+
+		err = add_mini(fw, args[3]);
+		break;
+	case 'd':
+		if (argc != 3)
+			goto err_param;
+
+		fw = carlfw_load(args[2]);
+		if (IS_ERR_OR_NULL(fw)) {
+			err = PTR_ERR(fw);
+			goto err_out;
+		}
+
+		err = del_mini(fw);
+		break;
+
+	default:
+		goto err_param;
+		break;
+	}
+
+	carlfw_release(fw);
+	return EXIT_SUCCESS;
+
+err_out:
+	carlfw_release(fw);
+	fprintf(stderr, "miniboot action failed (%d).\n", err);
+	return EXIT_FAILURE;
+
+err_param:
+	carlfw_release(fw);
+	mini_help();
+	return EXIT_FAILURE;
+}
diff --git a/carl9170fw/tools/src/wol.c b/carl9170fw/tools/src/wol.c
new file mode 100644
index 0000000..41daba2
--- /dev/null
+++ b/carl9170fw/tools/src/wol.c
@@ -0,0 +1,209 @@
+/*
+ * Copyright 2011, Christian Lamparter <chunkeey@googlemail.com>
+ *
+ * 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 version 2 of the License.
+ *
+ * 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 Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+#include <unistd.h>
+#include <stdbool.h>
+
+#include <sys/types.h>
+#include <sys/socket.h>
+
+#include <linux/types.h>
+#include <linux/if_ether.h>	/* ETH_P_ALL */
+#include <linux/if_packet.h>	/* sockaddr_ll */
+#include <linux/if.h>		/* IFNAMSIZ */
+
+static int monitor_init(const char *ifname)
+{
+	struct sockaddr_ll ll;
+	int monitor_sock;
+
+	memset(&ll, 0, sizeof(ll));
+	ll.sll_family = AF_PACKET;
+	ll.sll_ifindex = if_nametoindex(ifname);
+	if (ll.sll_ifindex == 0) {
+		fprintf(stderr, "Monitor interface '%s' does not exist\n", ifname);
+		return -1;
+	}
+
+	monitor_sock = socket(PF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
+	if (monitor_sock < 0) {
+		fprintf(stderr, "socket(PF_PACKET,SOCK_RAW): %s\n", strerror(errno));
+		return -1;
+	}
+
+	if (bind(monitor_sock, (struct sockaddr *) &ll, sizeof(ll)) < 0) {
+		fprintf(stderr, "bind(PACKET): %s\n", strerror(errno));
+		close(monitor_sock);
+		return -1;
+	}
+
+	return monitor_sock;
+}
+
+static int inject_frame(int s, const void *data, size_t len)
+{
+#define IEEE80211_RADIOTAP_F_FRAG       0x08
+	unsigned char rtap_hdr[] = {
+		0x00, 0x00, /* radiotap version */
+		0x0e, 0x00, /* radiotap length */
+		0x02, 0xc0, 0x00, 0x00, /* bmap: flags, tx and rx flags */
+		IEEE80211_RADIOTAP_F_FRAG, /* F_FRAG (fragment if required) */
+		0x00,       /* padding */
+		0x00, 0x00, /* RX and TX flags to indicate that */
+		0x00, 0x00, /* this is the injected frame directly */
+	};
+	struct iovec iov[2] = {
+		{
+			.iov_base = &rtap_hdr,
+			.iov_len = sizeof(rtap_hdr),
+		},
+		{
+			.iov_base = (void *) data,
+			.iov_len = len,
+		}
+	};
+	struct msghdr msg = {
+		.msg_name = NULL,
+		.msg_namelen = 0,
+		.msg_iov = iov,
+		.msg_iovlen = 2,
+		.msg_control = NULL,
+		.msg_controllen = 0,
+		.msg_flags = 0,
+	};
+	int ret;
+
+	ret = sendmsg(s, &msg, 0);
+	if (ret < 0)
+		perror("sendmsg");
+	return ret;
+}
+
+static unsigned char wol_magic_tmpl[30 + 6 + 16 * 6] = {
+	0x08, 0x00, 0x00, 0x00,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff,	/* RA */
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff,	/* TA */
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff,	/* SA */
+	0x00, 0x00,
+
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+};
+
+static void prepare_wol(unsigned char *wol_magic, unsigned char *mac)
+{
+	int i;
+
+	for (i = 0; i < 16; i++)
+		memcpy(&wol_magic[30 + i * 6], mac, 6);
+}
+
+void usage(void)
+{
+	fprintf(stderr, "Usage:\n");
+	fprintf(stderr, "\twol -i monitor_dev -m DE:VI:CE:MA:CW:OL -n #num -v\n");
+
+	fprintf(stderr, "\nDescription:\n");
+	fprintf(stderr, "\tThis utility generates a WOL packet for the"
+			"given [MAC] address and tries to injects"
+			"it into [monitor_dev]\n");
+
+	exit(EXIT_FAILURE);
+}
+
+#define MAC_STR "%2X:%2X:%2X:%2X:%2X:%2X"
+
+#define M(a, i) ((unsigned int *)&a[i])
+#define MAC_ARG(a) M(a, 0), M(a, 1), M(a, 2), M(a, 3), M(a, 4), M(a, 5)
+
+#define M2(a, i) (a[i])
+#define MAC_ARG2(a) M2(a, 0), M2(a, 1), M2(a, 2), M2(a, 3), M2(a, 4), M2(a, 5)
+
+int main(int argc, char **args)
+{
+	int sock, err = 0, opt, num = 10;
+	unsigned char mac[ETH_ALEN];
+	char dev_name[IFNAMSIZ + 1] = { 0 };
+	bool has_mac = false, has_dev = false, verbose = false;
+
+	while ((opt = getopt(argc, args, "m:i:n:v")) != -EXIT_FAILURE) {
+		switch (opt) {
+		case 'i':
+			has_dev = true;
+			strncpy(dev_name, optarg, IFNAMSIZ);
+			break;
+		case 'm':
+			has_mac = true;
+			err = sscanf(optarg, MAC_STR, MAC_ARG(mac)) != 6;
+			if (err)
+				fprintf(stderr, "invalid MAC: \"%s\"\n", optarg);
+			break;
+
+		case 'n':
+			err = sscanf(optarg, "%d", &num) != 1;
+			err |= num < 1 | num > 1000;
+			if (err)
+				fprintf(stderr, "invalid tries: \"%s\"\n", optarg);
+			break;
+
+		case 'v':
+			verbose = true;
+			break;
+
+		default:
+			err = -EINVAL;
+			break;
+		}
+
+		if (err)
+			break;
+	}
+
+	if (!has_mac || !has_dev || err)
+		usage();
+
+	if (verbose)
+		fprintf(stdout, "Opening monitor injection interface [%s].\n", dev_name);
+
+	sock = monitor_init(dev_name);
+	if (sock < 0)
+		return EXIT_FAILURE;
+
+	if (verbose)
+		fprintf(stdout, "Generating %d WOL packet for ["MAC_STR"].\n", num, MAC_ARG2(mac));
+
+	prepare_wol(wol_magic_tmpl, mac);
+
+	while (num--) {
+		err = inject_frame(sock, wol_magic_tmpl, sizeof(wol_magic_tmpl));
+		if (err < 0) {
+			fprintf(stderr, "failed to send WOL packet.\n");
+			break;
+		} else if (verbose) {
+			fprintf(stdout, "WOL packet sent.\n");
+		}
+	}
+
+	close(sock);
+	if (err < 0)
+		return EXIT_FAILURE;
+
+	return 0;
+}
diff --git a/cbfw-3.2.1.1.bin b/cbfw-3.2.1.1.bin
new file mode 100644
index 0000000..e7863ee
--- /dev/null
+++ b/cbfw-3.2.1.1.bin
Binary files differ
diff --git a/cis/3CCFEM556.cis b/cis/3CCFEM556.cis
new file mode 100644
index 0000000..e950230
--- /dev/null
+++ b/cis/3CCFEM556.cis
Binary files differ
diff --git a/cis/3CXEM556.cis b/cis/3CXEM556.cis
new file mode 100644
index 0000000..52408ac
--- /dev/null
+++ b/cis/3CXEM556.cis
Binary files differ
diff --git a/cis/COMpad2.cis b/cis/COMpad2.cis
new file mode 100644
index 0000000..daaedd7
--- /dev/null
+++ b/cis/COMpad2.cis
Binary files differ
diff --git a/cis/COMpad4.cis b/cis/COMpad4.cis
new file mode 100644
index 0000000..9ca6f0a
--- /dev/null
+++ b/cis/COMpad4.cis
Binary files differ
diff --git a/cis/DP83903.cis b/cis/DP83903.cis
new file mode 100644
index 0000000..9755300
--- /dev/null
+++ b/cis/DP83903.cis
Binary files differ
diff --git a/cis/LA-PCM.cis b/cis/LA-PCM.cis
new file mode 100644
index 0000000..f6f1208
--- /dev/null
+++ b/cis/LA-PCM.cis
Binary files differ
diff --git a/cis/MT5634ZLX.cis b/cis/MT5634ZLX.cis
new file mode 100644
index 0000000..0d59fa4
--- /dev/null
+++ b/cis/MT5634ZLX.cis
Binary files differ
diff --git a/cis/Makefile b/cis/Makefile
new file mode 100644
index 0000000..0a222f1
--- /dev/null
+++ b/cis/Makefile
@@ -0,0 +1,14 @@
+# The pack_cis tool from cis-tools
+# <http://git.kernel.org/?p=utils/cis-tools/cis-tools.git>.
+PACK_CIS = pack_cis
+
+CIS_SRC := $(wildcard src/*.cis)
+CIS_BIN := $(notdir $(CIS_SRC))
+
+all: $(CIS_BIN)
+
+%.cis: src/%.cis
+	$(PACK_CIS) -o $@ $<
+
+clean:
+	rm -f $(CIS_BIN)
diff --git a/cis/NE2K.cis b/cis/NE2K.cis
new file mode 100644
index 0000000..6dac8c1
--- /dev/null
+++ b/cis/NE2K.cis
Binary files differ
diff --git a/cis/PCMLM28.cis b/cis/PCMLM28.cis
new file mode 100644
index 0000000..a35d93e
--- /dev/null
+++ b/cis/PCMLM28.cis
Binary files differ
diff --git a/cis/PE-200.cis b/cis/PE-200.cis
new file mode 100644
index 0000000..266e061
--- /dev/null
+++ b/cis/PE-200.cis
Binary files differ
diff --git a/cis/PE520.cis b/cis/PE520.cis
new file mode 100644
index 0000000..f34fa91
--- /dev/null
+++ b/cis/PE520.cis
Binary files differ
diff --git a/cis/RS-COM-2P.cis b/cis/RS-COM-2P.cis
new file mode 100644
index 0000000..f258252
--- /dev/null
+++ b/cis/RS-COM-2P.cis
Binary files differ
diff --git a/cis/SW_555_SER.cis b/cis/SW_555_SER.cis
new file mode 100644
index 0000000..12f474b
--- /dev/null
+++ b/cis/SW_555_SER.cis
Binary files differ
diff --git a/cis/SW_7xx_SER.cis b/cis/SW_7xx_SER.cis
new file mode 100644
index 0000000..fbfc852
--- /dev/null
+++ b/cis/SW_7xx_SER.cis
Binary files differ
diff --git a/cis/SW_8xx_SER.cis b/cis/SW_8xx_SER.cis
new file mode 100644
index 0000000..18fd613
--- /dev/null
+++ b/cis/SW_8xx_SER.cis
Binary files differ
diff --git a/cis/src/3CCFEM556.cis b/cis/src/3CCFEM556.cis
new file mode 100644
index 0000000..be627d0
--- /dev/null
+++ b/cis/src/3CCFEM556.cis
@@ -0,0 +1,22 @@
+#
+# This card is MFC-compliant, but identifies itself as single function
+#
+vers_1 5.0, "3Com", "Megahertz 3CCFEM556", "LAN + 56k Modem"
+manfid 0x0101, 0x0556
+funcid 0
+
+mfc {
+  funcid network_adapter
+  config base 0x1000 mask 0x267 last_index 0x07
+  cftable_entry 0x07
+    Vcc Vnom 5V
+    irq mask 0xffff [level]
+    io  0x0000-0x000f [8bit] [16bit]
+}, {
+  funcid serial_port
+  config base 0x1100 mask 0x277 last_index 0x27
+  cftable_entry 0x27
+    Vcc Vnom 5V
+    irq mask 0xffff [level]
+    io  0x0000-0x0007 [8bit]
+}
diff --git a/cis/src/3CXEM556.cis b/cis/src/3CXEM556.cis
new file mode 100644
index 0000000..819f08f
--- /dev/null
+++ b/cis/src/3CXEM556.cis
@@ -0,0 +1,22 @@
+#
+# This card is MFC-compliant, but identifies itself as single function
+#
+vers_1 5.0, "3Com", "Megahertz 3CXEM556", "LAN + 56k Modem"
+manfid 0x0101, 0x0035
+funcid 0
+
+mfc {
+  funcid network_adapter
+  config base 0x0800 mask 0x63 last_index 0x07
+  cftable_entry 0x07
+    Vcc Vnom 5V
+    irq mask 0xffff [level]
+    io  0x0000-0x000f [8bit] [16bit]
+}, {
+  funcid serial_port
+  config base 0x900 mask 0x63 last_index 0x27
+  cftable_entry 0x27
+    Vcc Vnom 5V
+    irq mask 0xffff [level]
+    io  0x0000-0x0007 [8bit]
+}
diff --git a/cis/src/COMpad2.cis b/cis/src/COMpad2.cis
new file mode 100644
index 0000000..bfc2374
--- /dev/null
+++ b/cis/src/COMpad2.cis
@@ -0,0 +1,20 @@
+#
+# Replacement CIS for Advantech COMpad-32/85
+#
+dev_info
+  NULL 0ns, 512b
+vers_1 4.1, "ADVANTECH", "COMpad-32/85", "1.0"
+funcid serial_port [post]
+config base 0x0100 mask 0x0003 last_index 0x05
+cftable_entry 0x01 [default]
+  [mwait]
+  io 0x02e8-0x02ef, 0x03e8-0x03ef [lines=10] [8bit] [range]
+  irq mask 0x9eb8 [level]
+cftable_entry 0x02
+  io 0x0330-0x033f [lines=10] [8bit] [range]
+cftable_entry 0x03
+  io 0x0340-0x034f [lines=10] [8bit] [range]
+cftable_entry 0x04
+  io 0x0350-0x035f [lines=10] [8bit] [range]
+cftable_entry 0x05
+  io 0x0360-0x036f [lines=10] [8bit] [range]
diff --git a/cis/src/COMpad4.cis b/cis/src/COMpad4.cis
new file mode 100644
index 0000000..325991c
--- /dev/null
+++ b/cis/src/COMpad4.cis
@@ -0,0 +1,14 @@
+#
+# Replacement CIS for Advantech COMpad-32/85B-4
+#
+dev_info
+  NULL 0ns, 512b
+vers_1 4.1, "ADVANTECH", "COMpad-32/85B-4"
+funcid serial_port [post]
+config base 0x0100 mask 0x0001 last_index 0x02
+cftable_entry 0x01 [default]
+  [mwait]
+  io 0x0240-0x025f [lines=10] [8bit] [range]
+  irq mask 0x9eb8 [level]
+cftable_entry 0x02
+  io 0x0340-0x035f [lines=10] [8bit] [range]
diff --git a/cis/src/DP83903.cis b/cis/src/DP83903.cis
new file mode 100644
index 0000000..ce86f45
--- /dev/null
+++ b/cis/src/DP83903.cis
@@ -0,0 +1,24 @@
+#
+# This CIS is for cards based on the National Semiconductor
+# DP83903 Multiple Function Interface Chip
+#
+vers_1 4.1, "Multifunction Card", "", "", "NSC MF LAN/Modem"
+manfid 0x0175, 0x0000
+funcid 0
+
+mfc {
+  funcid network_adapter
+  config base 0x1020 mask 0x277 last_index 0x17
+  cftable_entry 0x17
+    Vcc Vnom 5V
+    irq mask 0xffff [level]
+    io  0x0000-0x001f [8bit] [16bit]
+    memory 0x0000-0x3fff @ 0x0000
+}, {
+  funcid serial_port
+  config base 0x1040 mask 0x0277 last_index 0x07
+  cftable_entry 0x07
+    Vcc Vnom 5V
+    irq mask 0xffff [level]
+    io  0x0000-0x0007 [8bit]
+}
diff --git a/cis/src/LA-PCM.cis b/cis/src/LA-PCM.cis
new file mode 100644
index 0000000..5c427bd
--- /dev/null
+++ b/cis/src/LA-PCM.cis
@@ -0,0 +1,44 @@
+#
+# Replacement CIS for Allied Telesis LA-PCM
+#
+dev_info
+  fn_specific 100ns, 64kb
+  FLASH 150ns, 60kb
+attr_dev_info
+  FLASH 150ns, 4kb
+manfid 0xc00f, 0x0002
+funcid network_adapter [post] [rom]
+vers_1 4.1, "Allied Telesis,K.K", "Ethernet LAN Card", "CentreCOM", "LA-PCM"
+config base 0x20000 mask 0x000b last_index 0x10
+cftable_entry 0x01
+  io 0x0200-0x021f [8bit] [16bit]
+cftable_entry 0x02
+  io 0x0220-0x023f [8bit] [16bit]
+cftable_entry 0x03
+  io 0x0240-0x025f [8bit] [16bit]
+cftable_entry 0x04
+  io 0x0260-0x027f [8bit] [16bit]
+cftable_entry 0x05
+  io 0x0280-0x029f [8bit] [16bit]
+cftable_entry 0x06
+  io 0x02a0-0x02bf [8bit] [16bit]
+cftable_entry 0x07
+  io 0x02c0-0x02df [8bit] [16bit]
+cftable_entry 0x08
+  io 0x02e0-0x02ff [8bit] [16bit]
+cftable_entry 0x09
+  io 0x0300-0x031f [8bit] [16bit]
+cftable_entry 0x0a
+  io 0x0320-0x033f [8bit] [16bit]
+cftable_entry 0x0b
+  io 0x0340-0x035f [8bit] [16bit]
+cftable_entry 0x0c
+  io 0x0360-0x037f [8bit] [16bit]
+cftable_entry 0x0d
+  io 0x0380-0x039f [8bit] [16bit]
+cftable_entry 0x0e
+  io 0x03a0-0x03bf [8bit] [16bit]
+cftable_entry 0x0f
+  io 0x03c0-0x03df [8bit] [16bit]
+cftable_entry 0x10
+  io 0x03e0-0x03ff [8bit] [16bit]
diff --git a/cis/src/MT5634ZLX.cis b/cis/src/MT5634ZLX.cis
new file mode 100644
index 0000000..52249b3
--- /dev/null
+++ b/cis/src/MT5634ZLX.cis
@@ -0,0 +1,18 @@
+#
+# Replacement CIS for Multitech MT5634ZLX modems
+#
+dev_info no_info
+vers_1 4.1, "MultiTech", "PCMCIA 56K DataFax"
+manfid 0x0200, 0x0001
+funcid serial_port
+config base 0xff80 mask 0x0067 last_index 0x27
+cftable_entry 0x0f [default]
+  [rdybsy] [audio] [pwrdown]
+  Vcc Vnom 5V Vpp1 Vnom 5V Vpp2 Vnom 5V
+  io 0x03f8-0x03ff [lines=10] [8bit]
+cftable_entry 0x17
+  io 0x02f8-0x02ff [lines=10] [8bit]
+cftable_entry 0x1f
+  io 0x03e8-0x03ef [lines=10] [8bit]
+cftable_entry 0x27
+  io 0x02e8-0x02ef [lines=10] [8bit]
diff --git a/cis/src/NE2K.cis b/cis/src/NE2K.cis
new file mode 100644
index 0000000..d1d47f3
--- /dev/null
+++ b/cis/src/NE2K.cis
@@ -0,0 +1,10 @@
+#
+# Replacement CIS for various busted NE2000-compatible cards
+#
+vers_1 4.1, "PCMCIA", "Ethernet"
+funcid network_adapter
+config base 0x03f8 mask 0x03 last_index 0x20
+cftable_entry 0x20 [default]
+  Vcc Vnom 5V
+  irq mask 0xffff [level]
+  io 0x0000-0x001f [8bit] [16bit]
diff --git a/cis/src/PCMLM28.cis b/cis/src/PCMLM28.cis
new file mode 100644
index 0000000..39c6d16
--- /dev/null
+++ b/cis/src/PCMLM28.cis
@@ -0,0 +1,37 @@
+#
+# The on-card CIS says it is MFC-compliant, but it is not
+#
+vers_1 4.1, "LINKSYS", "PCMLM28"
+manfid 0x0143, 0xc0ab
+funcid 0
+config base 0x03f8 mask 0x03 last_index 0x2f
+
+cftable_entry 0x24 [default]
+  Vcc Vnom 5V
+  irq mask 0xffff [level]
+  io 0x0300-0x031f, 0x02f8-0x02ff [8bit] [16bit]
+
+cftable_entry 0x25
+  io 0x0320-0x033f, 0x02f8-0x02ff [8bit] [16bit]
+cftable_entry 0x26
+  io 0x0340-0x035f, 0x02f8-0x02ff [8bit] [16bit]
+cftable_entry 0x27
+  io 0x0360-0x037f, 0x02f8-0x02ff [8bit] [16bit]
+
+cftable_entry 0x28
+  io 0x0300-0x031f, 0x03e8-0x03ef [8bit] [16bit]
+cftable_entry 0x29
+  io 0x0320-0x033f, 0x03e8-0x03ef [8bit] [16bit]
+cftable_entry 0x2a
+  io 0x0340-0x035f, 0x03e8-0x03ef [8bit] [16bit]
+cftable_entry 0x2b
+  io 0x0360-0x037f, 0x03e8-0x03ef [8bit] [16bit]
+
+cftable_entry 0x2c
+  io 0x0300-0x031f, 0x02e8-0x02ef [8bit] [16bit]
+cftable_entry 0x2d
+  io 0x0320-0x033f, 0x02e8-0x02ef [8bit] [16bit]
+cftable_entry 0x2e
+  io 0x0340-0x035f, 0x02e8-0x02ef [8bit] [16bit]
+cftable_entry 0x2f
+  io 0x0360-0x037f, 0x02e8-0x02ef [8bit] [16bit]
diff --git a/cis/src/PE-200.cis b/cis/src/PE-200.cis
new file mode 100644
index 0000000..7db7494
--- /dev/null
+++ b/cis/src/PE-200.cis
@@ -0,0 +1,11 @@
+#
+# Replacement CIS for PE-200 ethernet card
+#
+vers_1 4.1, "PMX   ", "PE-200", "ETHERNET", "R01"
+funcid network_adapter [post] [rom]
+config base 0x0100 mask 0x0001 last_index 0x01
+cftable_entry 0x1 [default]
+  [mwait]
+  Vcc Vnom 5V
+  irq mask 0xffff [level]
+  io 0x0000-0x000f, 0x0010-0x001f [8bit] [16bit]
diff --git a/cis/src/PE520.cis b/cis/src/PE520.cis
new file mode 100644
index 0000000..fb411ab
--- /dev/null
+++ b/cis/src/PE520.cis
@@ -0,0 +1,11 @@
+#
+# Replacement CIS for LanPro EP-4000A ethernet card
+#
+vers_1 4.1, "KTI", "PE520 PLUS", "PCMCIA Ethernet"
+manfid 0x0161, 0x0010
+funcid network_adapter
+config base 0x0fd0 mask 0x0b last_index 0x01
+cftable_entry 0x01 [default]
+  Vcc Vnom 5V
+  irq mask 0xffff [level]
+  io 0x0000-0x001f [8bit] [16bit]
diff --git a/cis/src/RS-COM-2P.cis b/cis/src/RS-COM-2P.cis
new file mode 100644
index 0000000..2e385cb
--- /dev/null
+++ b/cis/src/RS-COM-2P.cis
@@ -0,0 +1,14 @@
+#
+# Replacement CIS for dual-serial-port IO card
+#
+vers_1 4.1, "PCMCIA", "RS-COM 2P"
+funcid serial_port [post]
+config base 0x0100 mask 0x0001 last_index 0x03
+cftable_entry 0x01 [default]
+  [mwait]
+  io 0x03e8-0x03ef, 0x02e8-0x02ef [lines=10] [8bit] [range]
+  irq mask 0x9eb8 [level]
+cftable_entry 0x02
+  io 0x0250-0x0257, 0x0258-0x025f [lines=10] [8bit] [range]
+cftable_entry 0x03
+  io 0x0260-0x0267, 0x0268-0x026f [lines=10] [8bit] [range]
diff --git a/cis/src/tamarack.cis b/cis/src/tamarack.cis
new file mode 100644
index 0000000..8802694
--- /dev/null
+++ b/cis/src/tamarack.cis
@@ -0,0 +1,17 @@
+#
+# Replacement CIS for Surecom, Tamarack NE2000 cards
+#
+dev_info
+  fn_specific 100ns, 512b
+attr_dev_info
+  EEPROM 250ns, 512b
+vers_1 4.1, "TAMARACK", "Ethernet", "A", "004743118001"
+funcid network_adapter
+config base 0x03f8 mask 0x0003 last_index 0x20
+cftable_entry 0x20 [default]
+  [mwait]
+  Vcc Vnom 5V Vmin 4500mV Vmax 5500mV Istatic 100mA
+    Iavg 170mA Ipeak 200mA
+  timing wait 15us
+  io 0x0000-0x000f, 0x0010-0x001f [lines=5] [8bit] [16bit]
+  irq mask 0xffff [level]
diff --git a/cis/tamarack.cis b/cis/tamarack.cis
new file mode 100644
index 0000000..29c88b8
--- /dev/null
+++ b/cis/tamarack.cis
Binary files differ
diff --git a/configure b/configure
new file mode 100644
index 0000000..3260f9a
--- /dev/null
+++ b/configure
@@ -0,0 +1,4 @@
+#!/bin/bash
+# -*- mode: sh -*-
+# Our Makefile doesn't do srcdir != builddir
+#buildapi-variable-no-builddir
diff --git a/cpia2/stv0672_vp4.bin b/cpia2/stv0672_vp4.bin
new file mode 100644
index 0000000..8565890
--- /dev/null
+++ b/cpia2/stv0672_vp4.bin
Binary files differ
diff --git a/ct2fw-3.2.1.1.bin b/ct2fw-3.2.1.1.bin
new file mode 100644
index 0000000..1258409
--- /dev/null
+++ b/ct2fw-3.2.1.1.bin
Binary files differ
diff --git a/ctefx.bin b/ctefx.bin
new file mode 100644
index 0000000..a29458d
--- /dev/null
+++ b/ctefx.bin
Binary files differ
diff --git a/ctfw-3.2.1.1.bin b/ctfw-3.2.1.1.bin
new file mode 100644
index 0000000..92f42a1
--- /dev/null
+++ b/ctfw-3.2.1.1.bin
Binary files differ
diff --git a/ctspeq.bin b/ctspeq.bin
new file mode 100644
index 0000000..dcf0203
--- /dev/null
+++ b/ctspeq.bin
Binary files differ
diff --git a/cxgb3/ael2005_opt_edc.bin b/cxgb3/ael2005_opt_edc.bin
new file mode 100644
index 0000000..df2ffd9
--- /dev/null
+++ b/cxgb3/ael2005_opt_edc.bin
Binary files differ
diff --git a/cxgb3/ael2005_twx_edc.bin b/cxgb3/ael2005_twx_edc.bin
new file mode 100644
index 0000000..d3e91fa
--- /dev/null
+++ b/cxgb3/ael2005_twx_edc.bin
Binary files differ
diff --git a/cxgb3/ael2020_twx_edc.bin b/cxgb3/ael2020_twx_edc.bin
new file mode 100644
index 0000000..4ecf70a
--- /dev/null
+++ b/cxgb3/ael2020_twx_edc.bin
Binary files differ
diff --git a/cxgb3/t3b_psram-1.1.0.bin b/cxgb3/t3b_psram-1.1.0.bin
new file mode 100644
index 0000000..14d4369
--- /dev/null
+++ b/cxgb3/t3b_psram-1.1.0.bin
Binary files differ
diff --git a/cxgb3/t3c_psram-1.1.0.bin b/cxgb3/t3c_psram-1.1.0.bin
new file mode 100644
index 0000000..fe58712
--- /dev/null
+++ b/cxgb3/t3c_psram-1.1.0.bin
Binary files differ
diff --git a/cxgb3/t3fw-7.0.0.bin b/cxgb3/t3fw-7.0.0.bin
new file mode 100644
index 0000000..cb48e4a
--- /dev/null
+++ b/cxgb3/t3fw-7.0.0.bin
Binary files differ
diff --git a/cxgb3/t3fw-7.1.0.bin b/cxgb3/t3fw-7.1.0.bin
new file mode 100644
index 0000000..f1285ce
--- /dev/null
+++ b/cxgb3/t3fw-7.1.0.bin
Binary files differ
diff --git a/cxgb3/t3fw-7.10.0.bin b/cxgb3/t3fw-7.10.0.bin
new file mode 100644
index 0000000..ed5c3b3
--- /dev/null
+++ b/cxgb3/t3fw-7.10.0.bin
Binary files differ
diff --git a/cxgb3/t3fw-7.12.0.bin b/cxgb3/t3fw-7.12.0.bin
new file mode 100644
index 0000000..339ce9b
--- /dev/null
+++ b/cxgb3/t3fw-7.12.0.bin
Binary files differ
diff --git a/cxgb3/t3fw-7.4.0.bin b/cxgb3/t3fw-7.4.0.bin
new file mode 100644
index 0000000..07d8fc2
--- /dev/null
+++ b/cxgb3/t3fw-7.4.0.bin
Binary files differ
diff --git a/cxgb4/t4fw-1.6.2.0.bin b/cxgb4/t4fw-1.6.2.0.bin
new file mode 100644
index 0000000..cf2b50f
--- /dev/null
+++ b/cxgb4/t4fw-1.6.2.0.bin
Binary files differ
diff --git a/cxgb4/t4fw.bin b/cxgb4/t4fw.bin
new file mode 120000
index 0000000..830cc68
--- /dev/null
+++ b/cxgb4/t4fw.bin
@@ -0,0 +1 @@
+t4fw-1.6.2.0.bin
\ No newline at end of file
diff --git a/dabusb/bitstream.bin b/dabusb/bitstream.bin
new file mode 100644
index 0000000..acbc319
--- /dev/null
+++ b/dabusb/bitstream.bin
Binary files differ
diff --git a/dabusb/firmware.fw b/dabusb/firmware.fw
new file mode 100644
index 0000000..9df46d8
--- /dev/null
+++ b/dabusb/firmware.fw
Binary files differ
diff --git a/dsp56k/Makefile b/dsp56k/Makefile
new file mode 100644
index 0000000..c758a28
--- /dev/null
+++ b/dsp56k/Makefile
@@ -0,0 +1,6 @@
+bootstrap.bin: bootstrap.asm concat-bootstrap.pl
+	a56 bootstrap.asm >/dev/null
+	perl concat-bootstrap.pl <a56.out >bootstrap.bin
+
+clean:
+	rm -f a56.out bootstrap.bin
diff --git a/dsp56k/bootstrap.asm b/dsp56k/bootstrap.asm
new file mode 100644
index 0000000..a411047
--- /dev/null
+++ b/dsp56k/bootstrap.asm
@@ -0,0 +1,98 @@
+; Author: Frederik Noring <noring@nocrew.org>
+;
+; This file is subject to the terms and conditions of the GNU General Public
+; License.  See the file COPYING in the main directory of this archive
+; for more details.
+
+; DSP56k loader
+
+; Host Interface
+M_BCR   EQU     $FFFE           ; Port A Bus Control Register
+M_PBC   EQU     $FFE0           ; Port B Control Register
+M_PBDDR EQU     $FFE2           ; Port B Data Direction Register
+M_PBD   EQU     $FFE4           ; Port B Data Register
+M_PCC   EQU     $FFE1           ; Port C Control Register
+M_PCDDR EQU     $FFE3           ; Port C Data Direction Register
+M_PCD   EQU     $FFE5           ; Port C Data Register
+
+M_HCR   EQU     $FFE8           ; Host Control Register
+M_HSR   EQU     $FFE9           ; Host Status Register
+M_HRX   EQU     $FFEB           ; Host Receive Data Register
+M_HTX   EQU     $FFEB           ; Host Transmit Data Register
+
+; SSI, Synchronous Serial Interface
+M_RX    EQU     $FFEF           ; Serial Receive Data Register
+M_TX    EQU     $FFEF           ; Serial Transmit Data Register
+M_CRA   EQU     $FFEC           ; SSI Control Register A
+M_CRB   EQU     $FFED           ; SSI Control Register B
+M_SR    EQU     $FFEE           ; SSI Status Register
+M_TSR   EQU     $FFEE           ; SSI Time Slot Register
+
+; Exception Processing
+M_IPR   EQU     $FFFF           ; Interrupt Priority Register
+
+        org     P:$0
+start   jmp     <$40
+
+        org     P:$40
+;       ; Zero 16384 DSP X and Y words
+;       clr     A #0,r0
+;       clr     B #0,r4
+;       do      #64,<_block1
+;       rep     #256
+;       move    A,X:(r0)+ B,Y:(r4)+
+;_block1        ; Zero (32768-512) Program words
+;       clr     A #512,r0
+;       do      #126,<_block2
+;       rep     #256
+;       move    A,P:(r0)+
+;_block2
+
+        ; Copy DSP program control
+        move    #real,r0
+        move    #upload,r1
+        do      #upload_end-upload,_copy
+        movem    P:(r0)+,x0
+        movem    x0,P:(r1)+
+_copy   movep   #4,X:<<M_HCR
+        movep   #$c00,X:<<M_IPR
+        and     #<$fe,mr
+        jmp     upload
+
+real
+        org     P:$7ea9
+upload
+        movep   #1,X:<<M_PBC
+        movep   #0,X:<<M_BCR
+
+next    jclr    #0,X:<<M_HSR,*
+        movep   X:<<M_HRX,A
+        move    #>3,x0
+        cmp     x0,A #>1,x0
+        jeq     <$0
+_get_address
+        jclr    #0,X:<<M_HSR,_get_address
+        movep   X:<<M_HRX,r0
+_get_length
+        jclr    #0,X:<<M_HSR,_get_length
+        movep   X:<<M_HRX,y0
+        cmp     x0,A #>2,x0
+        jeq     load_X
+        cmp     x0,A
+        jeq     load_Y
+
+load_P  do      y0,_load_P
+        jclr    #0,X:<<M_HSR,*
+        movep   X:<<M_HRX,P:(r0)+
+_load_P jmp     next
+load_X  do      y0,_load_X
+        jclr    #0,X:<<M_HSR,*
+        movep   X:<<M_HRX,X:(r0)+
+_load_X jmp     next
+load_Y  do      y0,_load_Y
+        jclr    #0,X:<<M_HSR,*
+        movep   X:<<M_HRX,Y:(r0)+
+_load_Y jmp     next
+
+upload_end
+        end
diff --git a/dsp56k/bootstrap.bin b/dsp56k/bootstrap.bin
new file mode 100644
index 0000000..3180ce8
--- /dev/null
+++ b/dsp56k/bootstrap.bin
Binary files differ
diff --git a/dsp56k/concat-bootstrap.pl b/dsp56k/concat-bootstrap.pl
new file mode 100644
index 0000000..b6d9003
--- /dev/null
+++ b/dsp56k/concat-bootstrap.pl
@@ -0,0 +1,33 @@
+# Postprocessor for dsp56k bootstrap code.
+#
+# Copyright Ben Hutchings 2011.
+#
+# 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.
+
+use strict;
+use warnings;
+
+my @memory;
+my %symbol;
+
+# Reconstruct memory image and symbol table
+while (<>) {
+    if (/^P ([0-9A-F]{4}) ([0-9A-F]{6})\n/) {
+	$memory[hex($1)] = hex($2);
+    } elsif (/^I ([0-9A-F]{6}) (\w+)\n/) {
+	$symbol{$2} = hex($1);
+    } else {
+	print STDERR "W: did not recognise line $.\n";
+    }
+}
+
+# Concatenate first and second stage.  Second stage is assembled
+# between 'upload' and 'upload_end', but initially loaded at
+# 'real' (end of the first stage).
+for (0 .. ($symbol{real} - 1), $symbol{upload} .. ($symbol{upload_end} - 1)) {
+    my $word = $memory[$_] || 0;
+    print pack('CCC', $word / 65536, ($word / 256) % 256, $word % 256);
+}
diff --git a/dvb-fe-xc5000-1.6.114.fw b/dvb-fe-xc5000-1.6.114.fw
new file mode 100644
index 0000000..350f8c7
--- /dev/null
+++ b/dvb-fe-xc5000-1.6.114.fw
Binary files differ
diff --git a/dvb-usb-dib0700-1.20.fw b/dvb-usb-dib0700-1.20.fw
new file mode 100644
index 0000000..ce41240
--- /dev/null
+++ b/dvb-usb-dib0700-1.20.fw
Binary files differ
diff --git a/dvb-usb-terratec-h5-drxk.fw b/dvb-usb-terratec-h5-drxk.fw
new file mode 100644
index 0000000..ebad392
--- /dev/null
+++ b/dvb-usb-terratec-h5-drxk.fw
Binary files differ
diff --git a/e100/d101m_ucode.bin b/e100/d101m_ucode.bin
new file mode 100644
index 0000000..b700b75
--- /dev/null
+++ b/e100/d101m_ucode.bin
Binary files differ
diff --git a/e100/d101s_ucode.bin b/e100/d101s_ucode.bin
new file mode 100644
index 0000000..d869e06
--- /dev/null
+++ b/e100/d101s_ucode.bin
Binary files differ
diff --git a/e100/d102e_ucode.bin b/e100/d102e_ucode.bin
new file mode 100644
index 0000000..3cfc65b
--- /dev/null
+++ b/e100/d102e_ucode.bin
Binary files differ
diff --git a/edgeport/boot.fw b/edgeport/boot.fw
new file mode 100644
index 0000000..c29f660
--- /dev/null
+++ b/edgeport/boot.fw
Binary files differ
diff --git a/edgeport/boot2.fw b/edgeport/boot2.fw
new file mode 100644
index 0000000..d49002d
--- /dev/null
+++ b/edgeport/boot2.fw
Binary files differ
diff --git a/edgeport/down.fw b/edgeport/down.fw
new file mode 100644
index 0000000..cd16ce5
--- /dev/null
+++ b/edgeport/down.fw
Binary files differ
diff --git a/edgeport/down2.fw b/edgeport/down2.fw
new file mode 100644
index 0000000..8dec9e4
--- /dev/null
+++ b/edgeport/down2.fw
Binary files differ
diff --git a/edgeport/down3.bin b/edgeport/down3.bin
new file mode 100644
index 0000000..c506dd1
--- /dev/null
+++ b/edgeport/down3.bin
Binary files differ
diff --git a/emi26/bitstream.fw b/emi26/bitstream.fw
new file mode 100644
index 0000000..221abfd
--- /dev/null
+++ b/emi26/bitstream.fw
Binary files differ
diff --git a/emi26/firmware.fw b/emi26/firmware.fw
new file mode 100644
index 0000000..245b6b2
--- /dev/null
+++ b/emi26/firmware.fw
Binary files differ
diff --git a/emi26/loader.fw b/emi26/loader.fw
new file mode 100644
index 0000000..dc9a693
--- /dev/null
+++ b/emi26/loader.fw
Binary files differ
diff --git a/emi62/bitstream.fw b/emi62/bitstream.fw
new file mode 100644
index 0000000..221abfd
--- /dev/null
+++ b/emi62/bitstream.fw
Binary files differ
diff --git a/emi62/loader.fw b/emi62/loader.fw
new file mode 100644
index 0000000..860e5ee
--- /dev/null
+++ b/emi62/loader.fw
Binary files differ
diff --git a/emi62/midi.fw b/emi62/midi.fw
new file mode 100644
index 0000000..a72c859
--- /dev/null
+++ b/emi62/midi.fw
Binary files differ
diff --git a/emi62/spdif.fw b/emi62/spdif.fw
new file mode 100644
index 0000000..f7691a0
--- /dev/null
+++ b/emi62/spdif.fw
Binary files differ
diff --git a/ene-ub6250/ms_init.bin b/ene-ub6250/ms_init.bin
new file mode 100644
index 0000000..613f0ed
--- /dev/null
+++ b/ene-ub6250/ms_init.bin
Binary files differ
diff --git a/ene-ub6250/ms_rdwr.bin b/ene-ub6250/ms_rdwr.bin
new file mode 100644
index 0000000..f2a8df8
--- /dev/null
+++ b/ene-ub6250/ms_rdwr.bin
Binary files differ
diff --git a/ene-ub6250/msp_rdwr.bin b/ene-ub6250/msp_rdwr.bin
new file mode 100644
index 0000000..dfba6ce
--- /dev/null
+++ b/ene-ub6250/msp_rdwr.bin
Binary files differ
diff --git a/ene-ub6250/sd_init1.bin b/ene-ub6250/sd_init1.bin
new file mode 100644
index 0000000..7574f88
--- /dev/null
+++ b/ene-ub6250/sd_init1.bin
Binary files differ
diff --git a/ene-ub6250/sd_init2.bin b/ene-ub6250/sd_init2.bin
new file mode 100644
index 0000000..0d29019
--- /dev/null
+++ b/ene-ub6250/sd_init2.bin
Binary files differ
diff --git a/ene-ub6250/sd_rdwr.bin b/ene-ub6250/sd_rdwr.bin
new file mode 100644
index 0000000..938a1b2
--- /dev/null
+++ b/ene-ub6250/sd_rdwr.bin
Binary files differ
diff --git a/ess/maestro3_assp_kernel.fw b/ess/maestro3_assp_kernel.fw
new file mode 100644
index 0000000..91c7147
--- /dev/null
+++ b/ess/maestro3_assp_kernel.fw
Binary files differ
diff --git a/ess/maestro3_assp_minisrc.fw b/ess/maestro3_assp_minisrc.fw
new file mode 100644
index 0000000..5d70e37
--- /dev/null
+++ b/ess/maestro3_assp_minisrc.fw
Binary files differ
diff --git a/f2255usb.bin b/f2255usb.bin
new file mode 100644
index 0000000..d80b5d6
--- /dev/null
+++ b/f2255usb.bin
Binary files differ
diff --git a/go7007/go7007fw.bin b/go7007/go7007fw.bin
new file mode 100644
index 0000000..5d44b82
--- /dev/null
+++ b/go7007/go7007fw.bin
Binary files differ
diff --git a/go7007/go7007tv.bin b/go7007/go7007tv.bin
new file mode 100644
index 0000000..24a7abd
--- /dev/null
+++ b/go7007/go7007tv.bin
Binary files differ
diff --git a/go7007/lr192.fw b/go7007/lr192.fw
new file mode 100644
index 0000000..09e2d94
--- /dev/null
+++ b/go7007/lr192.fw
Binary files differ
diff --git a/go7007/px-m402u.fw b/go7007/px-m402u.fw
new file mode 100644
index 0000000..f422163
--- /dev/null
+++ b/go7007/px-m402u.fw
Binary files differ
diff --git a/go7007/px-tv402u.fw b/go7007/px-tv402u.fw
new file mode 100644
index 0000000..8ca03ac
--- /dev/null
+++ b/go7007/px-tv402u.fw
Binary files differ
diff --git a/go7007/s2250-1.fw b/go7007/s2250-1.fw
new file mode 100644
index 0000000..da70aab
--- /dev/null
+++ b/go7007/s2250-1.fw
Binary files differ
diff --git a/go7007/s2250-2.fw b/go7007/s2250-2.fw
new file mode 100644
index 0000000..86fdbdf
--- /dev/null
+++ b/go7007/s2250-2.fw
Binary files differ
diff --git a/go7007/wis-startrek.fw b/go7007/wis-startrek.fw
new file mode 100644
index 0000000..a119517
--- /dev/null
+++ b/go7007/wis-startrek.fw
Binary files differ
diff --git a/htc_7010.fw b/htc_7010.fw
new file mode 100644
index 0000000..2d83820
--- /dev/null
+++ b/htc_7010.fw
Binary files differ
diff --git a/htc_9271.fw b/htc_9271.fw
new file mode 100644
index 0000000..ea8f50b
--- /dev/null
+++ b/htc_9271.fw
Binary files differ
diff --git a/i2400m-fw-usb-1.4.sbcf b/i2400m-fw-usb-1.4.sbcf
new file mode 100644
index 0000000..93079c3
--- /dev/null
+++ b/i2400m-fw-usb-1.4.sbcf
Binary files differ
diff --git a/i2400m-fw-usb-1.5.sbcf b/i2400m-fw-usb-1.5.sbcf
new file mode 100644
index 0000000..cbb9635
--- /dev/null
+++ b/i2400m-fw-usb-1.5.sbcf
Binary files differ
diff --git a/i6050-fw-usb-1.5.sbcf b/i6050-fw-usb-1.5.sbcf
new file mode 100644
index 0000000..03845db
--- /dev/null
+++ b/i6050-fw-usb-1.5.sbcf
Binary files differ
diff --git a/intel/ibt-hw-37.7.10-fw-1.0.2.3.d.bseq b/intel/ibt-hw-37.7.10-fw-1.0.2.3.d.bseq
new file mode 100644
index 0000000..cd23169
--- /dev/null
+++ b/intel/ibt-hw-37.7.10-fw-1.0.2.3.d.bseq
Binary files differ
diff --git a/intel/ibt-hw-37.7.10-fw-1.80.2.3.d.bseq b/intel/ibt-hw-37.7.10-fw-1.80.2.3.d.bseq
new file mode 100644
index 0000000..44736e4
--- /dev/null
+++ b/intel/ibt-hw-37.7.10-fw-1.80.2.3.d.bseq
Binary files differ
diff --git a/intel/ibt-hw-37.7.bseq b/intel/ibt-hw-37.7.bseq
new file mode 100644
index 0000000..6c3cdba
--- /dev/null
+++ b/intel/ibt-hw-37.7.bseq
Binary files differ
diff --git a/intelliport2.bin b/intelliport2.bin
new file mode 100644
index 0000000..24ea567
--- /dev/null
+++ b/intelliport2.bin
Binary files differ
diff --git a/isci/Makefile b/isci/Makefile
new file mode 100644
index 0000000..3849373
--- /dev/null
+++ b/isci/Makefile
@@ -0,0 +1,23 @@
+# Makefile for create_fw
+#
+CC=gcc
+CFLAGS=-c -Wall -O2 -g
+LDFLAGS=
+SOURCES=create_fw.c
+OBJECTS=$(SOURCES:.cpp=.o)
+EXECUTABLE=create_fw
+BLOB=isci_firmware.bin
+
+all: $(SOURCES) $(EXECUTABLE) $(BLOB)
+
+$(EXECUTABLE): $(OBJECTS)
+	$(CC) $(LDFLAGS) $(OBJECTS) -o $@
+
+.c.o:
+	$(CC) $(CFLAGS) $< -O $@
+
+$(BLOB): $(EXECUTABLE)
+	./$(EXECUTABLE) >$@
+
+clean:
+	rm -f *.o $(EXECUTABLE)
diff --git a/isci/README b/isci/README
new file mode 100644
index 0000000..8e63ac3
--- /dev/null
+++ b/isci/README
@@ -0,0 +1,36 @@
+This defines the temporary binary blow we are to pass to the SCU
+driver to emulate the binary firmware that we will eventually be
+able to access via NVRAM on the SCU controller.
+
+The current size of the binary blob is expected to be 149 bytes or larger
+
+Header Types:
+0x1: Phy Masks
+0x2: Phy Gens
+0x3: SAS Addrs
+0xff: End of Data
+
+ID string - u8[12]: "#SCU MAGIC#\0"
+Version - u8: 1
+SubVersion - u8: 0
+
+Header Type - u8: 0x1
+Size - u8: 8
+Phy Mask - u32[8]
+
+Header Type - u8: 0x2
+Size - u8: 8
+Phy Gen - u32[8]
+
+Header Type - u8: 0x3
+Size - u8: 8
+Sas Addr - u64[8]
+
+Header Type - u8: 0xf
+
+
+==============================================================================
+
+Place isci_firmware.bin in /lib/firmware/isci
+Be sure to recreate the initramfs image to include the firmware.
+
diff --git a/isci/create_fw.c b/isci/create_fw.c
new file mode 100644
index 0000000..af037fc
--- /dev/null
+++ b/isci/create_fw.c
@@ -0,0 +1,99 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+#include <errno.h>
+#include <asm/types.h>
+#include <strings.h>
+#include <stdint.h>
+
+#include "create_fw.h"
+
+int write_blob(struct isci_orom *isci_orom)
+{
+	FILE *fd;
+	int err;
+	size_t count;
+
+	fd = fopen(blob_name, "w+");
+	if (!fd) {
+		perror("Open file for write failed");
+		fclose(fd);
+		return -EIO;
+	}
+
+	count = fwrite(isci_orom, sizeof(struct isci_orom), 1, fd);
+	if (count != 1) {
+		perror("Write data failed");
+		fclose(fd);
+		return -EIO;
+	}
+
+	fclose(fd);
+
+	return 0;
+}
+
+void set_binary_values(struct isci_orom *isci_orom)
+{
+	int c, phy_idx, port_idx;
+
+	/* setting OROM signature */
+	strncpy(isci_orom->hdr.signature, sig, strlen(sig));
+	isci_orom->hdr.version = version;
+	isci_orom->hdr.total_block_length = sizeof(struct isci_orom);
+	isci_orom->hdr.hdr_length = sizeof(struct sci_bios_oem_param_block_hdr);
+	isci_orom->hdr.num_elements = num_elements;
+
+	for (c = 0; c < 2; c++) {
+		struct sci_oem_params *ctrl = &isci_orom->ctrl[c];
+		__u8 cable_selection_mask = 0;
+
+		ctrl->controller.mode_type = mode_type;
+		ctrl->controller.max_concurr_spin_up = max_num_concurrent_dev_spin_up;
+		ctrl->controller.do_enable_ssc = enable_ssc;
+
+		for (port_idx = 0; port_idx < SCI_MAX_PORTS; port_idx++)
+			ctrl->ports[port_idx].phy_mask = phy_mask[c][port_idx];
+
+		for (phy_idx = 0; phy_idx < SCI_MAX_PHYS; phy_idx++) {
+			struct sci_phy_oem_params *phy = &ctrl->phys[phy_idx];
+			__u8 cable_phy = cable_selection[c][phy_idx];
+
+			phy->sas_address.high = sas_addr[c][phy_idx] >> 32;
+			phy->sas_address.low = sas_addr[c][phy_idx];
+
+			phy->afe_tx_amp_control0 = afe_tx_amp_control0;
+			phy->afe_tx_amp_control1 = afe_tx_amp_control1;
+			phy->afe_tx_amp_control2 = afe_tx_amp_control2;
+			phy->afe_tx_amp_control3 = afe_tx_amp_control3;
+
+			cable_selection_mask |= (cable_phy & 1) << phy_idx;
+			cable_selection_mask |= (cable_phy & 2) << (phy_idx + 3);
+		}
+		ctrl->controller.cable_selection_mask = cable_selection_mask;
+	}
+}
+
+int main(void)
+{
+	int err;
+	struct isci_orom *isci_orom;
+
+	isci_orom = malloc(sizeof(struct isci_orom));
+	memset(isci_orom, 0, sizeof(struct isci_orom));
+
+	set_binary_values(isci_orom);
+
+	err = write_blob(isci_orom);
+	if (err < 0) {
+		free(isci_orom);
+		return err;
+	}
+
+	free(isci_orom);
+	return 0;
+}
diff --git a/isci/create_fw.h b/isci/create_fw.h
new file mode 100644
index 0000000..f9b04ba
--- /dev/null
+++ b/isci/create_fw.h
@@ -0,0 +1,86 @@
+#ifndef _CREATE_FW_H_
+#define _CREATE_FW_H_
+#include "probe_roms.h"
+
+
+/* we are configuring for 2 SCUs */
+static const int num_elements = 2;
+
+/*
+ * For all defined arrays:
+ * elements 0-3 are for SCU0, ports 0-3
+ * elements 4-7 are for SCU1, ports 0-3
+ *
+ * valid configurations for one SCU are:
+ *  P0  P1  P2  P3
+ * ----------------
+ * 0xF,0x0,0x0,0x0 # 1 x4 port
+ * 0x3,0x0,0x4,0x8 # Phys 0 and 1 are a x2 port, phy 2 and phy 3 are each x1
+ *                 # ports
+ * 0x1,0x2,0xC,0x0 # Phys 0 and 1 are each x1 ports, phy 2 and phy 3 are a x2
+ *                 # port
+ * 0x3,0x0,0xC,0x0 # Phys 0 and 1 are a x2 port, phy 2 and phy 3 are a x2 port
+ * 0x1,0x2,0x4,0x8 # Each phy is a x1 port (this is the default configuration)
+ *
+ * if there is a port/phy on which you do not wish to override the default
+ * values, use the value assigned to UNINIT_PARAM (255).
+ */
+
+/* discovery mode type (port auto config mode by default ) */
+
+/*
+ * if there is a port/phy on which you do not wish to override the default
+ * values, use the value "0000000000000000". SAS address of zero's is
+ * considered invalid and will not be used.
+ */
+#ifdef MPC
+static const int mode_type = SCIC_PORT_MANUAL_CONFIGURATION_MODE;
+static const __u8 phy_mask[2][4] = { {1, 2, 4, 8},
+				     {1, 2, 4, 8} };
+static const unsigned long long sas_addr[2][4] = { { 0x5FCFFFFFF0000001ULL,
+						     0x5FCFFFFFF0000002ULL,
+						     0x5FCFFFFFF0000003ULL,
+						     0x5FCFFFFFF0000004ULL },
+						   { 0x5FCFFFFFF0000005ULL,
+						     0x5FCFFFFFF0000006ULL,
+						     0x5FCFFFFFF0000007ULL,
+						     0x5FCFFFFFF0000008ULL } };
+#else	/* APC (default) */
+static const int mode_type = SCIC_PORT_AUTOMATIC_CONFIGURATION_MODE;
+static const __u8 phy_mask[2][4];
+static const unsigned long long sas_addr[2][4] = { { 0x5FCFFFFF00000001ULL,
+						     0x5FCFFFFF00000001ULL,
+						     0x5FCFFFFF00000001ULL,
+						     0x5FCFFFFF00000001ULL },
+						   { 0x5FCFFFFF00000002ULL,
+						     0x5FCFFFFF00000002ULL,
+						     0x5FCFFFFF00000002ULL,
+						     0x5FCFFFFF00000002ULL } };
+#endif
+
+static const int cable_selection[2][4];
+
+/* Maximum number of concurrent device spin up */
+static const int max_num_concurrent_dev_spin_up = 1;
+
+/* enable of ssc operation */
+/*
+ * NOTE: also see probe_roms.h. This value can be set for ssc values.
+ * Values can be set for:
+ * ssc_sata_tx_spread_level
+ * ssc_sas_tx_spread_level
+ * ssc_sas_tx_type
+ */
+static const __u8 enable_ssc;
+
+/* AFE_TX_AMP_CONTROL */
+static const unsigned int afe_tx_amp_control0 = 0x000bdd08;
+static const unsigned int afe_tx_amp_control1 = 0x000ffc00;
+static const unsigned int afe_tx_amp_control2 = 0x000b7c09;
+static const unsigned int afe_tx_amp_control3 = 0x000afc6e;
+
+static const char blob_name[] = "isci_firmware.bin";
+static const char sig[] = "ISCUOEMB";
+static const unsigned char version = ISCI_ROM_VER_LATEST;
+
+#endif
diff --git a/isci/isci_firmware.bin b/isci/isci_firmware.bin
new file mode 100644
index 0000000..4254fa4
--- /dev/null
+++ b/isci/isci_firmware.bin
Binary files differ
diff --git a/isci/probe_roms.h b/isci/probe_roms.h
new file mode 100644
index 0000000..bb0e9d4
--- /dev/null
+++ b/isci/probe_roms.h
@@ -0,0 +1,332 @@
+/*
+ * This file is provided under a dual BSD/GPLv2 license.  When using or
+ * redistributing this file, you may do so under either license.
+ *
+ * GPL LICENSE SUMMARY
+ *
+ * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of version 2 of the GNU General Public License 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.
+ * The full GNU General Public License is included in this distribution
+ * in the file called LICENSE.GPL.
+ *
+ * BSD LICENSE
+ *
+ * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ *   * Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *   * Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in
+ *     the documentation and/or other materials provided with the
+ *     distribution.
+ *   * Neither the name of Intel Corporation nor the names of its
+ *     contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef _ISCI_PROBE_ROMS_H_
+#define _ISCI_PROBE_ROMS_H_
+
+#ifdef __KERNEL__
+#include <linux/firmware.h>
+#include <linux/pci.h>
+#include <linux/efi.h>
+#include "isci.h"
+
+#define SCIC_SDS_PARM_NO_SPEED   0
+
+/* generation 1 (i.e. 1.5 Gb/s) */
+#define SCIC_SDS_PARM_GEN1_SPEED 1
+
+/* generation 2 (i.e. 3.0 Gb/s) */
+#define SCIC_SDS_PARM_GEN2_SPEED 2
+
+/* generation 3 (i.e. 6.0 Gb/s) */
+#define SCIC_SDS_PARM_GEN3_SPEED 3
+#define SCIC_SDS_PARM_MAX_SPEED SCIC_SDS_PARM_GEN3_SPEED
+
+/* parameters that can be set by module parameters */
+struct sci_user_parameters {
+	struct sci_phy_user_params {
+		/**
+		 * This field specifies the NOTIFY (ENABLE SPIN UP) primitive
+		 * insertion frequency for this phy index.
+		 */
+		u32 notify_enable_spin_up_insertion_frequency;
+
+		/**
+		 * This method specifies the number of transmitted DWORDs within which
+		 * to transmit a single ALIGN primitive.  This value applies regardless
+		 * of what type of device is attached or connection state.  A value of
+		 * 0 indicates that no ALIGN primitives will be inserted.
+		 */
+		u16 align_insertion_frequency;
+
+		/**
+		 * This method specifies the number of transmitted DWORDs within which
+		 * to transmit 2 ALIGN primitives.  This applies for SAS connections
+		 * only.  A minimum value of 3 is required for this field.
+		 */
+		u16 in_connection_align_insertion_frequency;
+
+		/**
+		 * This field indicates the maximum speed generation to be utilized
+		 * by phys in the supplied port.
+		 * - A value of 1 indicates generation 1 (i.e. 1.5 Gb/s).
+		 * - A value of 2 indicates generation 2 (i.e. 3.0 Gb/s).
+		 * - A value of 3 indicates generation 3 (i.e. 6.0 Gb/s).
+		 */
+		u8 max_speed_generation;
+
+	} phys[SCI_MAX_PHYS];
+
+	/**
+	 * This field specifies the maximum number of direct attached devices
+	 * that can have power supplied to them simultaneously.
+	 */
+	u8 max_concurr_spinup;
+
+	/**
+	 * This field specifies the number of seconds to allow a phy to consume
+	 * power before yielding to another phy.
+	 *
+	 */
+	u8 phy_spin_up_delay_interval;
+
+	/**
+	 * These timer values specifies how long a link will remain open with no
+	 * activity in increments of a microsecond, it can be in increments of
+	 * 100 microseconds if the upper most bit is set.
+	 *
+	 */
+	u16 stp_inactivity_timeout;
+	u16 ssp_inactivity_timeout;
+
+	/**
+	 * These timer values specifies how long a link will remain open in increments
+	 * of 100 microseconds.
+	 *
+	 */
+	u16 stp_max_occupancy_timeout;
+	u16 ssp_max_occupancy_timeout;
+
+	/**
+	 * This timer value specifies how long a link will remain open with no
+	 * outbound traffic in increments of a microsecond.
+	 *
+	 */
+	u8 no_outbound_task_timeout;
+
+};
+
+#define SCIC_SDS_PARM_PHY_MASK_MIN 0x0
+#define SCIC_SDS_PARM_PHY_MASK_MAX 0xF
+#define MAX_CONCURRENT_DEVICE_SPIN_UP_COUNT 4
+
+struct sci_oem_params;
+int sci_oem_parameters_validate(struct sci_oem_params *oem, u8 version);
+
+struct isci_orom;
+struct isci_orom *isci_request_oprom(struct pci_dev *pdev);
+enum sci_status isci_parse_oem_parameters(struct sci_oem_params *oem,
+					  struct isci_orom *orom, int scu_index);
+struct isci_orom *isci_request_firmware(struct pci_dev *pdev, const struct firmware *fw);
+struct isci_orom *isci_get_efi_var(struct pci_dev *pdev);
+
+struct isci_oem_hdr {
+	u8 sig[4];
+	u8 rev_major;
+	u8 rev_minor;
+	u16 len;
+	u8 checksum;
+	u8 reserved1;
+	u16 reserved2;
+} __attribute__ ((packed));
+
+#else
+#define SCI_MAX_PORTS 4
+#define SCI_MAX_PHYS 4
+#define SCI_MAX_CONTROLLERS 2
+#endif
+
+#define ISCI_FW_NAME		"isci/isci_firmware.bin"
+
+#define ROMSIGNATURE		0xaa55
+
+#define ISCI_OEM_SIG		"$OEM"
+#define ISCI_OEM_SIG_SIZE	4
+#define ISCI_ROM_SIG		"ISCUOEMB"
+#define ISCI_ROM_SIG_SIZE	8
+
+#define ISCI_EFI_VENDOR_GUID	\
+	EFI_GUID(0x193dfefa, 0xa445, 0x4302, 0x99, 0xd8, 0xef, 0x3a, 0xad, \
+			0x1a, 0x04, 0xc6)
+#define ISCI_EFI_VAR_NAME	"RstScuO"
+
+#define ISCI_ROM_VER_1_0	0x10
+#define ISCI_ROM_VER_1_1	0x11
+#define ISCI_ROM_VER_1_3	0x13
+#define ISCI_ROM_VER_LATEST	ISCI_ROM_VER_1_3
+
+/* Allowed PORT configuration modes APC Automatic PORT configuration mode is
+ * defined by the OEM configuration parameters providing no PHY_MASK parameters
+ * for any PORT. i.e. There are no phys assigned to any of the ports at start.
+ * MPC Manual PORT configuration mode is defined by the OEM configuration
+ * parameters providing a PHY_MASK value for any PORT.  It is assumed that any
+ * PORT with no PHY_MASK is an invalid port and not all PHYs must be assigned.
+ * A PORT_PHY mask that assigns just a single PHY to a port and no other PHYs
+ * being assigned is sufficient to declare manual PORT configuration.
+ */
+enum sci_port_configuration_mode {
+	SCIC_PORT_MANUAL_CONFIGURATION_MODE = 0,
+	SCIC_PORT_AUTOMATIC_CONFIGURATION_MODE = 1
+};
+
+struct sci_bios_oem_param_block_hdr {
+	uint8_t signature[ISCI_ROM_SIG_SIZE];
+	uint16_t total_block_length;
+	uint8_t hdr_length;
+	uint8_t version;
+	uint8_t preboot_source;
+	uint8_t num_elements;
+	uint16_t element_length;
+	uint8_t reserved[8];
+} __attribute__ ((packed));
+
+struct sci_oem_params {
+	struct {
+		uint8_t mode_type;
+		uint8_t max_concurr_spin_up;
+		/*
+		 * This bitfield indicates the OEM's desired default Tx
+		 * Spread Spectrum Clocking (SSC) settings for SATA and SAS.
+		 * NOTE: Default SSC Modulation Frequency is 31.5KHz.
+		 */
+		union {
+			struct {
+			/*
+			 * NOTE: Max spread for SATA is +0 / -5000 PPM.
+			 * Down-spreading SSC (only method allowed for SATA):
+			 *  SATA SSC Tx Disabled                    = 0x0
+			 *  SATA SSC Tx at +0 / -1419 PPM Spread    = 0x2
+			 *  SATA SSC Tx at +0 / -2129 PPM Spread    = 0x3
+			 *  SATA SSC Tx at +0 / -4257 PPM Spread    = 0x6
+			 *  SATA SSC Tx at +0 / -4967 PPM Spread    = 0x7
+			 */
+				uint8_t ssc_sata_tx_spread_level:4;
+			/*
+			 * SAS SSC Tx Disabled                     = 0x0
+			 *
+			 * NOTE: Max spread for SAS down-spreading +0 /
+			 *	 -2300 PPM
+			 * Down-spreading SSC:
+			 *  SAS SSC Tx at +0 / -1419 PPM Spread     = 0x2
+			 *  SAS SSC Tx at +0 / -2129 PPM Spread     = 0x3
+			 *
+			 * NOTE: Max spread for SAS center-spreading +2300 /
+			 *	 -2300 PPM
+			 * Center-spreading SSC:
+			 *  SAS SSC Tx at +1064 / -1064 PPM Spread  = 0x3
+			 *  SAS SSC Tx at +2129 / -2129 PPM Spread  = 0x6
+			 */
+				uint8_t ssc_sas_tx_spread_level:3;
+			/*
+			 * NOTE: Refer to the SSC section of the SAS 2.x
+			 * Specification for proper setting of this field.
+			 * For standard SAS Initiator SAS PHY operation it
+			 * should be 0 for Down-spreading.
+			 * SAS SSC Tx spread type:
+			 *  Down-spreading SSC      = 0
+			 *  Center-spreading SSC    = 1
+			 */
+				uint8_t ssc_sas_tx_type:1;
+			};
+			uint8_t do_enable_ssc;
+		};
+		/*
+		 * This field indicates length of the SAS/SATA cable between
+		 * host and device.
+		 * This field is used make relationship between analog
+		 * parameters of the phy in the silicon and length of the cable.
+		 * Supported cable attenuation levels:
+		 * "short"- up to 3m, "medium"-3m to 6m, and "long"- more than
+		 * 6m.
+		 *
+		 * This is bit mask field:
+		 *
+		 * BIT:      (MSB) 7     6     5     4
+		 * ASSIGNMENT:   <phy3><phy2><phy1><phy0>  - Medium cable
+		 *                                           length assignment
+		 * BIT:            3     2     1     0  (LSB)
+		 * ASSIGNMENT:   <phy3><phy2><phy1><phy0>  - Long cable length
+		 *                                           assignment
+		 *
+		 * BITS 7-4 are set when the cable length is assigned to medium
+		 * BITS 3-0 are set when the cable length is assigned to long
+		 *
+		 * The BIT positions are clear when the cable length is
+		 * assigned to short.
+		 *
+		 * Setting the bits for both long and medium cable length is
+		 * undefined.
+		 *
+		 * A value of 0x84 would assign
+		 *    phy3 - medium
+		 *    phy2 - long
+		 *    phy1 - short
+		 *    phy0 - short
+		 */
+		uint8_t cable_selection_mask;
+	} controller;
+
+	struct {
+		uint8_t phy_mask;
+	} ports[SCI_MAX_PORTS];
+
+	struct sci_phy_oem_params {
+		struct {
+			uint32_t high;
+			uint32_t low;
+		} sas_address;
+
+		uint32_t afe_tx_amp_control0;
+		uint32_t afe_tx_amp_control1;
+		uint32_t afe_tx_amp_control2;
+		uint32_t afe_tx_amp_control3;
+	} phys[SCI_MAX_PHYS];
+} __attribute__ ((packed));
+
+struct isci_orom {
+	struct sci_bios_oem_param_block_hdr hdr;
+	struct sci_oem_params ctrl[SCI_MAX_CONTROLLERS];
+} __attribute__ ((packed));
+
+#endif
diff --git a/iwlwifi-100-5.ucode b/iwlwifi-100-5.ucode
new file mode 100644
index 0000000..0e69a1a
--- /dev/null
+++ b/iwlwifi-100-5.ucode
Binary files differ
diff --git a/iwlwifi-1000-3.ucode b/iwlwifi-1000-3.ucode
new file mode 100644
index 0000000..f374446
--- /dev/null
+++ b/iwlwifi-1000-3.ucode
Binary files differ
diff --git a/iwlwifi-1000-5.ucode b/iwlwifi-1000-5.ucode
new file mode 100644
index 0000000..7aa466c
--- /dev/null
+++ b/iwlwifi-1000-5.ucode
Binary files differ
diff --git a/iwlwifi-105-6.ucode b/iwlwifi-105-6.ucode
new file mode 100644
index 0000000..7d532e5
--- /dev/null
+++ b/iwlwifi-105-6.ucode
Binary files differ
diff --git a/iwlwifi-135-6.ucode b/iwlwifi-135-6.ucode
new file mode 100644
index 0000000..a0a32ed
--- /dev/null
+++ b/iwlwifi-135-6.ucode
Binary files differ
diff --git a/iwlwifi-2000-6.ucode b/iwlwifi-2000-6.ucode
new file mode 100644
index 0000000..3d58016
--- /dev/null
+++ b/iwlwifi-2000-6.ucode
Binary files differ
diff --git a/iwlwifi-2030-6.ucode b/iwlwifi-2030-6.ucode
new file mode 100644
index 0000000..6ad7656
--- /dev/null
+++ b/iwlwifi-2030-6.ucode
Binary files differ
diff --git a/iwlwifi-3160-7.ucode b/iwlwifi-3160-7.ucode
new file mode 100644
index 0000000..f6646d5
--- /dev/null
+++ b/iwlwifi-3160-7.ucode
Binary files differ
diff --git a/iwlwifi-3945-2.ucode b/iwlwifi-3945-2.ucode
new file mode 100644
index 0000000..b8806a2
--- /dev/null
+++ b/iwlwifi-3945-2.ucode
Binary files differ
diff --git a/iwlwifi-4965-2.ucode b/iwlwifi-4965-2.ucode
new file mode 100644
index 0000000..dad4acf
--- /dev/null
+++ b/iwlwifi-4965-2.ucode
Binary files differ
diff --git a/iwlwifi-5000-1.ucode b/iwlwifi-5000-1.ucode
new file mode 100644
index 0000000..5519149
--- /dev/null
+++ b/iwlwifi-5000-1.ucode
Binary files differ
diff --git a/iwlwifi-5000-2.ucode b/iwlwifi-5000-2.ucode
new file mode 100644
index 0000000..9e76e0d
--- /dev/null
+++ b/iwlwifi-5000-2.ucode
Binary files differ
diff --git a/iwlwifi-5000-5.ucode b/iwlwifi-5000-5.ucode
new file mode 100644
index 0000000..184f0c7
--- /dev/null
+++ b/iwlwifi-5000-5.ucode
Binary files differ
diff --git a/iwlwifi-5150-2.ucode b/iwlwifi-5150-2.ucode
new file mode 100644
index 0000000..04d6586
--- /dev/null
+++ b/iwlwifi-5150-2.ucode
Binary files differ
diff --git a/iwlwifi-6000-4.ucode b/iwlwifi-6000-4.ucode
new file mode 100644
index 0000000..dce03ae
--- /dev/null
+++ b/iwlwifi-6000-4.ucode
Binary files differ
diff --git a/iwlwifi-6000g2a-5.ucode b/iwlwifi-6000g2a-5.ucode
new file mode 100644
index 0000000..b8b8fa5
--- /dev/null
+++ b/iwlwifi-6000g2a-5.ucode
Binary files differ
diff --git a/iwlwifi-6000g2a-6.ucode b/iwlwifi-6000g2a-6.ucode
new file mode 100644
index 0000000..a1f2454
--- /dev/null
+++ b/iwlwifi-6000g2a-6.ucode
Binary files differ
diff --git a/iwlwifi-6000g2b-5.ucode b/iwlwifi-6000g2b-5.ucode
new file mode 100644
index 0000000..6850959
--- /dev/null
+++ b/iwlwifi-6000g2b-5.ucode
Binary files differ
diff --git a/iwlwifi-6000g2b-6.ucode b/iwlwifi-6000g2b-6.ucode
new file mode 100644
index 0000000..baaf9db
--- /dev/null
+++ b/iwlwifi-6000g2b-6.ucode
Binary files differ
diff --git a/iwlwifi-6050-4.ucode b/iwlwifi-6050-4.ucode
new file mode 100644
index 0000000..8e20bdf
--- /dev/null
+++ b/iwlwifi-6050-4.ucode
Binary files differ
diff --git a/iwlwifi-6050-5.ucode b/iwlwifi-6050-5.ucode
new file mode 100644
index 0000000..74a2085
--- /dev/null
+++ b/iwlwifi-6050-5.ucode
Binary files differ
diff --git a/iwlwifi-7260-7.ucode b/iwlwifi-7260-7.ucode
new file mode 100644
index 0000000..324c7f2
--- /dev/null
+++ b/iwlwifi-7260-7.ucode
Binary files differ
diff --git a/kaweth/new_code.bin b/kaweth/new_code.bin
new file mode 100644
index 0000000..97f06cf
--- /dev/null
+++ b/kaweth/new_code.bin
Binary files differ
diff --git a/kaweth/new_code_fix.bin b/kaweth/new_code_fix.bin
new file mode 100644
index 0000000..5318843
--- /dev/null
+++ b/kaweth/new_code_fix.bin
Binary files differ
diff --git a/kaweth/trigger_code.bin b/kaweth/trigger_code.bin
new file mode 100644
index 0000000..f4cd7b9
--- /dev/null
+++ b/kaweth/trigger_code.bin
Binary files differ
diff --git a/kaweth/trigger_code_fix.bin b/kaweth/trigger_code_fix.bin
new file mode 100644
index 0000000..65af2d2
--- /dev/null
+++ b/kaweth/trigger_code_fix.bin
Binary files differ
diff --git a/keyspan/mpr.fw b/keyspan/mpr.fw
new file mode 100644
index 0000000..9190388
--- /dev/null
+++ b/keyspan/mpr.fw
Binary files differ
diff --git a/keyspan/usa18x.fw b/keyspan/usa18x.fw
new file mode 100644
index 0000000..d588293
--- /dev/null
+++ b/keyspan/usa18x.fw
Binary files differ
diff --git a/keyspan/usa19.fw b/keyspan/usa19.fw
new file mode 100644
index 0000000..9d40fc1
--- /dev/null
+++ b/keyspan/usa19.fw
Binary files differ
diff --git a/keyspan/usa19qi.fw b/keyspan/usa19qi.fw
new file mode 100644
index 0000000..d655bd8
--- /dev/null
+++ b/keyspan/usa19qi.fw
Binary files differ
diff --git a/keyspan/usa19qw.fw b/keyspan/usa19qw.fw
new file mode 100644
index 0000000..551ae97
--- /dev/null
+++ b/keyspan/usa19qw.fw
Binary files differ
diff --git a/keyspan/usa19w.fw b/keyspan/usa19w.fw
new file mode 100644
index 0000000..1ea50d6
--- /dev/null
+++ b/keyspan/usa19w.fw
Binary files differ
diff --git a/keyspan/usa28.fw b/keyspan/usa28.fw
new file mode 100644
index 0000000..549fd86
--- /dev/null
+++ b/keyspan/usa28.fw
Binary files differ
diff --git a/keyspan/usa28x.fw b/keyspan/usa28x.fw
new file mode 100644
index 0000000..1f69f3c
--- /dev/null
+++ b/keyspan/usa28x.fw
Binary files differ
diff --git a/keyspan/usa28xa.fw b/keyspan/usa28xa.fw
new file mode 100644
index 0000000..8dfd48a
--- /dev/null
+++ b/keyspan/usa28xa.fw
Binary files differ
diff --git a/keyspan/usa28xb.fw b/keyspan/usa28xb.fw
new file mode 100644
index 0000000..0dfe24c
--- /dev/null
+++ b/keyspan/usa28xb.fw
Binary files differ
diff --git a/keyspan/usa49w.fw b/keyspan/usa49w.fw
new file mode 100644
index 0000000..a214d7a
--- /dev/null
+++ b/keyspan/usa49w.fw
Binary files differ
diff --git a/keyspan/usa49wlc.fw b/keyspan/usa49wlc.fw
new file mode 100644
index 0000000..a70057c
--- /dev/null
+++ b/keyspan/usa49wlc.fw
Binary files differ
diff --git a/keyspan_pda/Makefile b/keyspan_pda/Makefile
new file mode 100644
index 0000000..fc37ea4
--- /dev/null
+++ b/keyspan_pda/Makefile
@@ -0,0 +1,12 @@
+CC = gcc
+IHEX2FW = ihex2fw
+
+all: keyspan_pda.fw xircom_pgs.fw
+
+%.fw: %.S
+	$(CC) -x assembler-with-cpp -P -E -o $*.asm $<
+	as31 -l $*.asm
+	$(IHEX2FW) $*.hex $@
+
+clean:
+	rm -f *.asm *.fw *.hex *.lst *.obj
diff --git a/keyspan_pda/keyspan_pda.S b/keyspan_pda/keyspan_pda.S
new file mode 100644
index 0000000..602bcce
--- /dev/null
+++ b/keyspan_pda/keyspan_pda.S
@@ -0,0 +1,1129 @@
+/*  $Id: loop.s,v 1.23 2000/03/20 09:49:06 warner Exp $
+ * 
+ *  Firmware for the Keyspan PDA Serial Adapter, a USB serial port based on
+ *  the EzUSB microcontroller.
+ * 
+ *  (C) Copyright 2000 Brian Warner <warner@lothar.com>
+ * 
+ * 	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.
+ * 
+ *  "Keyspan PDA Serial Adapter" is probably a copyright of Keyspan, the
+ *  company.
+ * 
+ *  This serial adapter is basically an EzUSB chip and an RS-232 line driver
+ *  in a little widget that has a DB-9 on one end and a USB plug on the other.
+ *  It uses the EzUSB's internal UART0 (using the pins from Port C) and timer2
+ *  as a baud-rate generator. The wiring is:
+ *   PC0/RxD0 <- rxd (DB9 pin 2)         PC4 <- dsr pin 6
+ *   PC1/TxD0 -> txd pin 3               PC5 <- ri  pin 9
+ *   PC2      -> rts pin 7               PC6 <- dcd pin 1
+ *   PC3      <- cts pin 8               PC7 -> dtr pin 4
+ *   PB1 -> line driver standby
+ *
+ *  The EzUSB register constants below come from their excellent documentation
+ *  and sample code (which used to be available at www.anchorchips.com, but
+ *  that has now been absorbed into Cypress' site and the CD-ROM contents
+ *  don't appear to be available online anymore). If we get multiple
+ *  EzUSB-based drivers into the kernel, it might be useful to pull them out
+ *  into a separate .h file.
+ * 
+ * THEORY OF OPERATION:
+ *
+ *   There are two 256-byte ring buffers, one for tx, one for rx.
+ *
+ *   EP2out is pure tx data. When it appears, the data is copied into the tx
+ *   ring and serial transmission is started if it wasn't already running. The
+ *   "tx buffer empty" interrupt may kick off another character if the ring
+ *   still has data. If the host is tx-blocked because the ring filled up,
+ *   it will request a "tx unthrottle" interrupt. If sending a serial character
+ *   empties the ring below the desired threshold, we set a bit that will send
+ *   up the tx unthrottle message as soon as the rx buffer becomes free.
+ *
+ *   EP2in (interrupt) is used to send both rx chars and rx status messages
+ *   (only "tx unthrottle" at this time) back up to the host. The first byte
+ *   of the rx message indicates data (0) or status msg (1). Status messages
+ *   are sent before any data.
+ *
+ *   Incoming serial characters are put into the rx ring by the serial
+ *   interrupt, and the EP2in buffer sent if it wasn't already in transit.
+ *   When the EP2in buffer returns, the interrupt prompts us to send more
+ *   rx chars (or status messages) if they are pending.
+ *
+ *   Device control happens through "vendor specific" control messages on EP0.
+ *   All messages are destined for the "Interface" (with the index always 0,
+ *   so that if their two-port device might someday use similar firmware, we
+ *   can use index=1 to refer to the second port). The messages defined are:
+ *
+ *    bRequest = 0 : set baud/bits/parity
+ *               1 : unused
+ *               2 : reserved for setting HW flow control (CTSRTS)
+ *               3 : get/set "modem info" (pin states: DTR, RTS, DCD, RI, etc)
+ *               4 : set break (on/off)
+ *               5 : reserved for requesting interrupts on pin state change
+ *               6 : query buffer room or chars in tx buffer
+ *               7 : request tx unthrottle interrupt
+ *
+ *  The host-side driver is set to recognize the device ID values stashed in
+ *  serial EEPROM (0x06cd, 0x0103), program this firmware into place, then
+ *  start it running. This firmware will use EzUSB's "renumeration" trick by
+ *  simulating a bus disconnect, then reconnect with a different device ID
+ *  (encoded in the desc_device descriptor below). The host driver then
+ *  recognizes the new device ID and glues it to the real serial driver code.
+ *
+ * USEFUL DOCS:
+ *  EzUSB Technical Reference Manual: <http://www.anchorchips.com>
+ *  8051 manuals: everywhere, but try www.dalsemi.com because the EzUSB is
+ *   basically the Dallas enhanced 8051 code. Remember that the EzUSB IO ports
+ *   use totally different registers!
+ *  USB 1.1 spec: www.usb.org
+ *
+ * HOW TO BUILD:
+ *  gcc -x assembler-with-cpp -P -E -o keyspan_pda.asm keyspan_pda.s
+ *  as31 -l keyspan_pda.asm
+ *  mv keyspan_pda.obj keyspan_pda.hex
+ *  perl ezusb_convert.pl keyspan_pda < keyspan_pda.hex > keyspan_pda_fw.h
+ * Get as31 from <http://www.pjrc.com/tech/8051/index.html>, and hack on it
+ * a bit to make it build.
+ *
+ * THANKS:
+ *  Greg Kroah-Hartman, for coordinating the whole usb-serial thing.
+ *  AnchorChips, for making such an incredibly useful little microcontroller.
+ *  KeySpan, for making a handy, cheap ($40) widget that was so easy to take
+ *           apart and trace with an ohmmeter.
+ *
+ * TODO:
+ *  lots. grep for TODO. Interrupt safety needs stress-testing. Better flow
+ *  control. Interrupting host upon change in DCD, etc, counting transitions.
+ *  Need to find a safe device id to use (the one used by the Keyspan firmware
+ *  under Windows would be ideal.. can anyone figure out what it is?). Parity.
+ *  More baud rates. Oh, and the string-descriptor-length silicon bug
+ *  workaround should be implemented, but I'm lazy, and the consequence is
+ *  that the device name strings that show up in your kernel log will have
+ *  lots of trailing binary garbage in them (appears as ????). Device strings
+ *  should be made more accurate.
+ *
+ * Questions, bugs, patches to Brian.
+ *
+ *  -Brian Warner <warner@lothar.com>
+ *
+ */
+	
+#define HIGH(x) (((x) & 0xff00) / 256)
+#define LOW(x) ((x) & 0xff)
+
+#define dpl1 0x84
+#define dph1 0x85
+#define dps 0x86
+
+;;; our bit assignments
+#define TX_RUNNING 0
+#define DO_TX_UNTHROTTLE 1
+	
+	;; stack from 0x60 to 0x7f: should really set SP to 0x60-1, not 0x60
+#define STACK #0x60-1
+
+#define EXIF 0x91
+#define EIE 0xe8
+	.flag EUSB, EIE.0
+	.flag ES0, IE.4
+
+#define EP0CS #0x7fb4
+#define EP0STALLbit #0x01
+#define IN0BUF #0x7f00
+#define IN0BC #0x7fb5
+#define OUT0BUF #0x7ec0
+#define OUT0BC #0x7fc5		
+#define IN2BUF #0x7e00
+#define IN2BC #0x7fb9
+#define IN2CS #0x7fb8
+#define OUT2BC #0x7fc9
+#define OUT2CS #0x7fc8
+#define OUT2BUF #0x7dc0
+#define IN4BUF #0x7d00
+#define IN4BC #0x7fbd
+#define IN4CS #0x7fbc
+#define OEB #0x7f9d
+#define OUTB #0x7f97
+#define OEC #0x7f9e
+#define OUTC #0x7f98
+#define PINSC #0x7f9b
+#define PORTCCFG #0x7f95
+#define IN07IRQ #0x7fa9
+#define OUT07IRQ #0x7faa
+#define IN07IEN #0x7fac
+#define OUT07IEN #0x7fad
+#define USBIRQ #0x7fab
+#define USBIEN #0x7fae
+#define USBBAV #0x7faf
+#define USBCS #0x7fd6
+#define SUDPTRH #0x7fd4
+#define SUDPTRL #0x7fd5
+#define SETUPDAT #0x7fe8
+		
+	;; usb interrupt : enable is EIE.0 (0xe8), flag is EXIF.4 (0x91)
+
+	.org 0
+	ljmp start
+	;; interrupt vectors
+	.org 23H
+	ljmp serial_int
+	.byte 0
+	
+	.org 43H
+	ljmp USB_Jump_Table
+	.byte 0			; filled in by the USB core
+
+;;; local variables. These are not initialized properly: do it by hand.
+	.org 30H
+rx_ring_in:	.byte 0
+rx_ring_out:	.byte 0
+tx_ring_in:	.byte 0
+tx_ring_out:	.byte 0
+tx_unthrottle_threshold:	.byte 0
+		
+	.org 0x100H		; wants to be on a page boundary
+USB_Jump_Table:
+	ljmp	ISR_Sudav	; Setup Data Available
+	.byte 0
+	ljmp	0		; Start of Frame
+	.byte 0
+	ljmp	0		; Setup Data Loading
+	.byte 0
+	ljmp	0		; Global Suspend
+	.byte 	0
+	ljmp	0		; USB Reset  	
+	.byte	0
+	ljmp	0		; Reserved
+	.byte	0
+	ljmp	0		; End Point 0 In
+	.byte	0
+	ljmp	0		; End Point 0 Out
+	.byte	0
+	ljmp	0		; End Point 1 In
+	.byte	0
+	ljmp	0		; End Point 1 Out
+	.byte	0
+	ljmp	ISR_Ep2in
+	.byte	0
+	ljmp	ISR_Ep2out
+	.byte	0
+
+
+	.org 0x200
+		
+start:	mov SP,STACK-1 ; set stack
+	;; clear local variables
+	clr a
+	mov tx_ring_in, a
+	mov tx_ring_out, a
+	mov rx_ring_in, a
+	mov rx_ring_out, a
+	mov tx_unthrottle_threshold, a
+	clr TX_RUNNING
+	clr DO_TX_UNTHROTTLE
+	
+	;; clear fifo with "fe"
+	mov r1, 0
+	mov a, #0xfe
+	mov dptr, #tx_ring
+clear_tx_ring_loop:
+	movx @dptr, a
+	inc dptr
+	djnz r1, clear_tx_ring_loop
+
+	mov a, #0xfd
+	mov dptr, #rx_ring
+clear_rx_ring_loop:
+	movx @dptr, a
+	inc dptr
+	djnz r1, clear_rx_ring_loop
+
+;;; turn on the RS-232 driver chip (bring the STANDBY pin low)
+	;; set OEB.1
+	mov a, #02H
+	mov dptr,OEB
+	movx @dptr,a
+	;; clear PB1
+	mov a, #00H
+	mov dptr,OUTB
+	movx @dptr,a
+	;; set OEC.[127]
+	mov a, #0x86
+	mov dptr,OEC
+	movx @dptr,a
+	;; set PORTCCFG.[01] to route TxD0,RxD0 to serial port
+	mov dptr, PORTCCFG
+	mov a, #0x03
+	movx @dptr, a
+	
+	;; set up interrupts, autovectoring
+	mov dptr, USBBAV
+	movx a,@dptr
+	setb acc.0		; AVEN bit to 0
+	movx @dptr, a
+
+	mov a,#0x01		; enable SUDAV:	setup data available (for ep0)
+	mov dptr, USBIRQ
+	movx @dptr, a		; clear SUDAVI
+	mov dptr, USBIEN
+	movx @dptr, a
+	
+	mov dptr, IN07IEN
+	mov a,#0x04		; enable IN2 int
+	movx @dptr, a
+	
+	mov dptr, OUT07IEN
+	mov a,#0x04		; enable OUT2 int
+	movx @dptr, a
+	mov dptr, OUT2BC
+	movx @dptr, a		; arm OUT2
+
+	mov a, #0x84		; turn on RTS, DTR
+	mov dptr,OUTC
+	movx @dptr, a
+	;; setup the serial port. 9600 8N1.
+	;; Original source had:
+	;;mov a,#01010011		; mode 1, enable rx, clear int
+	;; This was presumably meant to be a binary constant, but it's
+	;; really decimal and out of 8-bit range.  as31 used to treat
+	;; it as 0 and that seems to have worked, so carry on with 0.
+	mov a,#0
+	mov SCON, a
+	;;  using timer2, in 16-bit baud-rate-generator mode
+	;;   (xtal 12MHz, internal fosc 24MHz)
+	;;  RCAP2H,RCAP2L = 65536 - fosc/(32*baud)
+	;;  57600: 0xFFF2.F, say 0xFFF3
+	;;   9600: 0xFFB1.E, say 0xFFB2
+	;;    300: 0xF63C
+#define BAUD 9600
+#define BAUD_TIMEOUT(rate) (65536 - (24 * 1000 * 1000) / (32 * rate))
+#define BAUD_HIGH(rate) HIGH(BAUD_TIMEOUT(rate))
+#define BAUD_LOW(rate) LOW(BAUD_TIMEOUT(rate))
+		
+	mov T2CON, #030h	; rclk=1,tclk=1,cp=0,tr2=0(enable later)
+	mov r3, #5
+	acall set_baud
+	setb TR2
+	mov SCON, #050h
+	
+#if 0
+	mov r1, #0x40
+	mov a, #0x41
+send:	
+	mov SBUF, a
+	inc a
+	anl a, #0x3F
+	orl a, #0x40
+;	xrl a, #0x02
+wait1:	
+	jnb TI, wait1
+	clr TI
+	djnz r1, send
+;done:	sjmp done
+
+#endif
+	
+	setb EUSB
+	setb EA
+	setb ES0
+	;acall dump_stat
+
+	;; hey, what say we RENUMERATE! (TRM p.62)
+	mov a, #0
+	mov dps, a
+	mov dptr, USBCS
+	mov a, #0x02		; DISCON=0, DISCOE=0, RENUM=1
+	movx @dptr, a
+	;; now presence pin is floating, simulating disconnect. wait 0.5s
+	mov r1, #46
+renum_wait1:
+	mov r2, #0
+renum_wait2:
+	mov r3, #0
+renum_wait3:
+	djnz r3, renum_wait3
+	djnz r2, renum_wait2
+	djnz r1, renum_wait1	; wait about n*(256^2) 6MHz clocks
+	mov a, #0x06		; DISCON=0, DISCOE=1, RENUM=1
+	movx @dptr, a
+	;; we are back online. the host device will now re-query us
+	
+	
+main:	sjmp main
+
+	
+
+ISR_Sudav:
+	push dps
+	push dpl
+	push dph
+	push dpl1
+	push dph1
+	push acc
+	mov a,EXIF
+	clr acc.4
+	mov EXIF,a		; clear INT2 first
+	mov dptr, USBIRQ	; clear USB int
+	mov a,#01h
+	movx @dptr,a
+
+	;; get request type
+	mov dptr, SETUPDAT
+	movx a, @dptr
+	mov r1, a		; r1 = bmRequestType
+	inc dptr
+	movx a, @dptr
+	mov r2, a		; r2 = bRequest
+	inc dptr
+	movx a, @dptr
+	mov r3, a		; r3 = wValueL
+	inc dptr
+	movx a, @dptr
+	mov r4, a		; r4 = wValueH
+
+	;; main switch on bmRequest.type: standard or vendor
+	mov a, r1
+	anl a, #0x60
+	cjne a, #0x00, setup_bmreq_type_not_standard
+	;; standard request: now main switch is on bRequest
+	ljmp setup_bmreq_is_standard
+	
+setup_bmreq_type_not_standard:	
+	;; a still has bmreq&0x60
+	cjne a, #0x40, setup_bmreq_type_not_vendor
+	;; Anchor reserves bRequest 0xa0-0xaf, we use small ones
+	;; switch on bRequest. bmRequest will always be 0x41 or 0xc1
+	cjne r2, #0x00, setup_ctrl_not_00
+	;; 00 is set baud, wValue[0] has baud rate index
+	lcall set_baud		; index in r3, carry set if error
+	jc setup_bmreq_type_not_standard__do_stall
+	ljmp setup_done_ack
+setup_bmreq_type_not_standard__do_stall:
+	ljmp setup_stall
+setup_ctrl_not_00:
+	cjne r2, #0x01, setup_ctrl_not_01
+	;; 01 is reserved for set bits (parity). TODO
+	ljmp setup_stall
+setup_ctrl_not_01:
+	cjne r2, #0x02, setup_ctrl_not_02
+	;; 02 is set HW flow control. TODO
+	ljmp setup_stall
+setup_ctrl_not_02:
+	cjne r2, #0x03, setup_ctrl_not_03
+	;; 03 is control pins (RTS, DTR).
+	ljmp control_pins	; will jump to setup_done_ack,
+				;  or setup_return_one_byte
+setup_ctrl_not_03:
+	cjne r2, #0x04, setup_ctrl_not_04
+	;; 04 is send break (really "turn break on/off"). TODO
+	cjne r3, #0x00, setup_ctrl_do_break_on
+	;; do break off: restore PORTCCFG.1 to reconnect TxD0 to serial port
+	mov dptr, PORTCCFG
+	movx a, @dptr
+	orl a, #0x02
+	movx @dptr, a
+	ljmp setup_done_ack
+setup_ctrl_do_break_on:
+	;; do break on: clear PORTCCFG.0, set TxD high(?) (b1 low)
+	mov dptr, OUTC
+	movx a, @dptr
+	anl a, #0xfd		; ~0x02
+	movx @dptr, a
+	mov dptr, PORTCCFG
+	movx a, @dptr
+	anl a, #0xfd		; ~0x02
+	movx @dptr, a
+	ljmp setup_done_ack
+setup_ctrl_not_04:
+	cjne r2, #0x05, setup_ctrl_not_05
+	;; 05 is set desired interrupt bitmap. TODO
+	ljmp setup_stall
+setup_ctrl_not_05:
+	cjne r2, #0x06, setup_ctrl_not_06
+	;; 06 is query room
+	cjne r3, #0x00, setup_ctrl_06_not_00
+	;; 06, wValue[0]=0 is query write_room
+	mov a, tx_ring_out
+	setb c
+	subb a, tx_ring_in	; out-1-in = 255 - (in-out)
+	ljmp setup_return_one_byte
+setup_ctrl_06_not_00:
+	cjne r3, #0x01, setup_ctrl_06_not_01
+	;; 06, wValue[0]=1 is query chars_in_buffer
+	mov a, tx_ring_in
+	clr c
+	subb a, tx_ring_out	; in-out
+	ljmp setup_return_one_byte
+setup_ctrl_06_not_01:	
+	ljmp setup_stall
+setup_ctrl_not_06:
+	cjne r2, #0x07, setup_ctrl_not_07
+	;; 07 is request tx unthrottle interrupt
+	mov tx_unthrottle_threshold, r3; wValue[0] is threshold value
+	ljmp setup_done_ack
+setup_ctrl_not_07:
+	ljmp setup_stall
+	
+setup_bmreq_type_not_vendor:
+	ljmp setup_stall
+
+
+setup_bmreq_is_standard:	
+	cjne r2, #0x00, setup_breq_not_00
+	;; 00:	Get_Status (sub-switch on bmRequestType: device, ep, int)
+	cjne r1, #0x80, setup_Get_Status_not_device
+	;; Get_Status(device)
+	;;  are we self-powered? no. can we do remote wakeup? no
+	;;   so return two zero bytes. This is reusable
+setup_return_two_zero_bytes:
+	mov dptr, IN0BUF
+	clr a
+	movx @dptr, a
+	inc dptr
+	movx @dptr, a
+	mov dptr, IN0BC
+	mov a, #2
+	movx @dptr, a
+	ljmp setup_done_ack
+setup_Get_Status_not_device:
+	cjne r1, #0x82, setup_Get_Status_not_endpoint
+	;; Get_Status(endpoint)
+	;;  must get stall bit for ep[wIndexL], return two bytes, bit in lsb 0
+	;; for now: cheat. TODO
+	sjmp setup_return_two_zero_bytes
+setup_Get_Status_not_endpoint:
+	cjne r1, #0x81, setup_Get_Status_not_interface
+	;; Get_Status(interface): return two zeros
+	sjmp setup_return_two_zero_bytes
+setup_Get_Status_not_interface:	
+	ljmp setup_stall
+	
+setup_breq_not_00:
+	cjne r2, #0x01, setup_breq_not_01
+	;; 01:	Clear_Feature (sub-switch on wValueL: stall, remote wakeup)
+	cjne r3, #0x00, setup_Clear_Feature_not_stall
+	;; Clear_Feature(stall). should clear a stall bit. TODO
+	ljmp setup_stall
+setup_Clear_Feature_not_stall:
+	cjne r3, #0x01, setup_Clear_Feature_not_rwake
+	;; Clear_Feature(remote wakeup). ignored.
+	ljmp setup_done_ack
+setup_Clear_Feature_not_rwake:
+	ljmp setup_stall
+	
+setup_breq_not_01:
+	cjne r2, #0x03, setup_breq_not_03
+	;; 03:	Set_Feature (sub-switch on wValueL: stall, remote wakeup)
+	cjne r3, #0x00, setup_Set_Feature_not_stall
+	;; Set_Feature(stall). Should set a stall bit. TODO
+	ljmp setup_stall
+setup_Set_Feature_not_stall:
+	cjne r3, #0x01, setup_Set_Feature_not_rwake
+	;; Set_Feature(remote wakeup). ignored.
+	ljmp setup_done_ack
+setup_Set_Feature_not_rwake:
+	ljmp setup_stall
+	
+setup_breq_not_03:	
+	cjne r2, #0x06, setup_breq_not_06
+	;; 06:	Get_Descriptor (s-switch on wValueH: dev, config[n], string[n])
+	cjne r4, #0x01, setup_Get_Descriptor_not_device
+	;; Get_Descriptor(device)
+	mov dptr, SUDPTRH
+	mov a, #HIGH(desc_device)
+	movx @dptr, a
+	mov dptr, SUDPTRL
+	mov a, #LOW(desc_device)
+	movx @dptr, a
+	ljmp setup_done_ack
+setup_Get_Descriptor_not_device:
+	cjne r4, #0x02, setup_Get_Descriptor_not_config
+	;; Get_Descriptor(config[n])
+	cjne r3, #0x00, setup_stall; only handle n==0
+	;; Get_Descriptor(config[0])
+	mov dptr, SUDPTRH
+	mov a, #HIGH(desc_config1)
+	movx @dptr, a
+	mov dptr, SUDPTRL
+	mov a, #LOW(desc_config1)
+	movx @dptr, a
+	ljmp setup_done_ack
+setup_Get_Descriptor_not_config:
+	cjne r4, #0x03, setup_Get_Descriptor_not_string
+	;; Get_Descriptor(string[wValueL])
+	;;  if (wValueL >= maxstrings) stall
+	mov a, #((desc_strings_end-desc_strings)/2)
+	clr c
+	subb a,r3		; a=4, r3 = 0..3 . if a<=0 then stall
+	jc  setup_stall
+	jz  setup_stall
+	mov a, r3
+	add a, r3		; a = 2*wValueL
+	mov dptr, #desc_strings
+	add a, dpl
+	mov dpl, a
+	mov a, #0
+	addc a, dph
+	mov dph, a		; dph = desc_strings[a]. big endian! (handy)
+	;; it looks like my adapter uses a revision of the EZUSB that
+	;; contains "rev D errata number 8", as hinted in the EzUSB example
+	;; code. I cannot find an actual errata description on the Cypress
+	;; web site, but from the example code it looks like this bug causes
+	;; the length of string descriptors to be read incorrectly, possibly
+	;; sending back more characters than the descriptor has. The workaround
+	;; is to manually send out all of the data. The consequence of not
+	;; using the workaround is that the strings gathered by the kernel
+	;; driver are too long and are filled with trailing garbage (including
+	;; leftover strings). Writing this out by hand is a nuisance, so for
+	;; now I will just live with the bug.
+	movx a, @dptr
+	mov r1, a
+	inc dptr
+	movx a, @dptr
+	mov r2, a
+	mov dptr, SUDPTRH
+	mov a, r1
+	movx @dptr, a
+	mov dptr, SUDPTRL
+	mov a, r2
+	movx @dptr, a
+	;; done
+	ljmp setup_done_ack
+	
+setup_Get_Descriptor_not_string:
+	ljmp setup_stall
+	
+setup_breq_not_06:
+	cjne r2, #0x08, setup_breq_not_08
+	;; Get_Configuration. always 1. return one byte.
+	;; this is reusable
+	mov a, #1
+setup_return_one_byte:	
+	mov dptr, IN0BUF
+	movx @dptr, a
+	mov a, #1
+	mov dptr, IN0BC
+	movx @dptr, a
+	ljmp setup_done_ack
+setup_breq_not_08:
+	cjne r2, #0x09, setup_breq_not_09
+	;; 09: Set_Configuration. ignored.
+	ljmp setup_done_ack
+setup_breq_not_09:
+	cjne r2, #0x0a, setup_breq_not_0a
+	;; 0a: Get_Interface. get the current altsetting for int[wIndexL]
+	;;  since we only have one interface, ignore wIndexL, return a 0
+	mov a, #0
+	ljmp setup_return_one_byte
+setup_breq_not_0a:
+	cjne r2, #0x0b, setup_breq_not_0b
+	;; 0b: Set_Interface. set altsetting for interface[wIndexL]. ignored
+	ljmp setup_done_ack
+setup_breq_not_0b:
+	ljmp setup_stall
+
+		
+setup_done_ack:	
+	;; now clear HSNAK
+	mov dptr, EP0CS
+	mov a, #0x02
+	movx @dptr, a
+	sjmp setup_done
+setup_stall:	
+	;; unhandled. STALL
+	;EP0CS |= bmEPSTALL
+	mov dptr, EP0CS
+	movx a, @dptr
+	orl a, EP0STALLbit
+	movx @dptr, a
+	sjmp setup_done
+	
+setup_done:	
+	pop acc
+	pop dph1
+	pop dpl1
+	pop dph
+	pop dpl
+	pop dps
+	reti
+
+;;; ==============================================================
+	
+set_baud:			; baud index in r3
+	;; verify a < 10
+	mov a, r3
+	jb ACC.7, set_baud__badbaud
+	clr c
+	subb a, #10
+	jnc set_baud__badbaud
+	mov a, r3
+	rl a			; a = index*2
+	add a, #LOW(baud_table)
+	mov dpl, a
+	mov a, #HIGH(baud_table)
+	addc a, #0
+	mov dph, a
+	;; TODO: shut down xmit/receive
+	;; TODO: wait for current xmit char to leave
+	;; TODO: shut down timer to avoid partial-char glitch
+	movx a,@dptr		; BAUD_HIGH
+	mov RCAP2H, a
+	mov TH2, a
+	inc dptr
+	movx a,@dptr		; BAUD_LOW
+	mov RCAP2L, a
+	mov TL2, a
+	;; TODO: restart xmit/receive
+	;; TODO: reenable interrupts, resume tx if pending
+	clr c			; c=0: success
+	ret
+set_baud__badbaud:
+	setb c			; c=1: failure
+	ret
+	
+;;; ==================================================
+control_pins:
+	cjne r1, #0x41, control_pins_in
+control_pins_out:
+	mov a, r3 ; wValue[0] holds new bits:	b7 is new DTR, b2 is new RTS
+	xrl a, #0xff		; 1 means active, 0V, +12V ?
+	anl a, #0x84
+	mov r3, a
+	mov dptr, OUTC
+	movx a, @dptr		; only change bits 7 and 2
+	anl a, #0x7b		; ~0x84
+	orl a, r3
+	movx @dptr, a		; other pins are inputs, bits ignored
+	ljmp setup_done_ack
+control_pins_in:
+	mov dptr, PINSC
+	movx a, @dptr
+	xrl a, #0xff
+	ljmp setup_return_one_byte
+
+;;; ========================================
+	
+ISR_Ep2in:
+	push dps
+	push dpl
+	push dph
+	push dpl1
+	push dph1
+	push acc
+	mov a,EXIF
+	clr acc.4
+	mov EXIF,a		; clear INT2 first
+	mov dptr, IN07IRQ	; clear USB int
+	mov a,#04h
+	movx @dptr,a
+
+	;; do stuff
+	lcall start_in
+	
+	pop acc
+	pop dph1
+	pop dpl1
+	pop dph
+	pop dpl
+	pop dps
+	reti
+
+ISR_Ep2out:
+	push dps
+	push dpl
+	push dph
+	push dpl1
+	push dph1
+	push acc
+	mov a,EXIF
+	clr acc.4
+	mov EXIF,a		; clear INT2 first
+	mov dptr, OUT07IRQ	; clear USB int
+	mov a,#04h
+	movx @dptr,a
+
+	;; do stuff
+
+	;; copy data into buffer. for now, assume we will have enough space
+	mov dptr, OUT2BC	; get byte count
+	movx a,@dptr
+	mov r1, a
+	clr a
+	mov dps, a
+	mov dptr, OUT2BUF	; load DPTR0 with source
+	mov dph1, #HIGH(tx_ring)	; load DPTR1 with target
+	mov dpl1, tx_ring_in
+OUT_loop:
+	movx a,@dptr		; read
+	inc dps			; switch to DPTR1: target
+	inc dpl1		; target = tx_ring_in+1
+	movx @dptr,a		; store
+	mov a,dpl1
+	cjne a, tx_ring_out, OUT_no_overflow
+	sjmp OUT_overflow
+OUT_no_overflow:	
+	inc tx_ring_in		; tx_ring_in++
+	inc dps			; switch to DPTR0: source
+	inc dptr
+	djnz r1, OUT_loop
+	sjmp OUT_done
+OUT_overflow:
+	;; signal overflow
+	;; fall through
+OUT_done:	
+	;; ack
+	mov dptr,OUT2BC
+	movx @dptr,a
+
+	;; start tx
+	acall maybe_start_tx
+	;acall dump_stat
+	
+	pop acc
+	pop dph1
+	pop dpl1
+	pop dph
+	pop dpl
+	pop dps
+	reti
+
+dump_stat:
+	;; fill in EP4in with a debugging message:
+	;;   tx_ring_in, tx_ring_out, rx_ring_in, rx_ring_out
+	;;   tx_active
+	;;   tx_ring[0..15]
+	;;   0xfc
+	;;   rx_ring[0..15]
+	clr a
+	mov dps, a
+	
+	mov dptr, IN4CS
+	movx a, @dptr
+	jb acc.1, dump_stat__done; busy: cannot dump, old one still pending
+	mov dptr, IN4BUF
+	
+	mov a, tx_ring_in
+	movx @dptr, a
+	inc dptr
+	mov a, tx_ring_out
+	movx @dptr, a
+	inc dptr
+
+	mov a, rx_ring_in
+	movx @dptr, a
+	inc dptr
+	mov a, rx_ring_out
+	movx @dptr, a
+	inc dptr
+	
+	clr a
+	jnb TX_RUNNING, dump_stat__no_tx_running
+	inc a
+dump_stat__no_tx_running:
+	movx @dptr, a
+	inc dptr
+	;; tx_ring[0..15]
+	inc dps
+	mov dptr, #tx_ring	; DPTR1: source
+	mov r1, #16
+dump_stat__tx_ring_loop:
+	movx a, @dptr
+	inc dptr
+	inc dps
+	movx @dptr, a
+	inc dptr
+	inc dps
+	djnz r1, dump_stat__tx_ring_loop
+	inc dps
+	
+	mov a, #0xfc
+	movx @dptr, a
+	inc dptr
+	
+	;; rx_ring[0..15]
+	inc dps
+	mov dptr, #rx_ring	; DPTR1: source
+	mov r1, #16
+dump_stat__rx_ring_loop:
+	movx a, @dptr
+	inc dptr
+	inc dps
+	movx @dptr, a
+	inc dptr
+	inc dps
+	djnz r1, dump_stat__rx_ring_loop
+	
+	;; now send it
+	clr a
+	mov dps, a
+	mov dptr, IN4BC
+	mov a, #38
+	movx @dptr, a
+dump_stat__done:	
+	ret
+		
+;;; ============================================================
+	
+maybe_start_tx:
+	;; make sure the tx process is running.
+	jb TX_RUNNING, start_tx_done
+start_tx:
+	;; is there work to be done?
+	mov a, tx_ring_in
+	cjne a,tx_ring_out, start_tx__work
+	ret			; no work
+start_tx__work:	
+	;; tx was not running. send the first character, setup the TI int
+	inc tx_ring_out		; [++tx_ring_out]
+	mov dph, #HIGH(tx_ring)
+	mov dpl, tx_ring_out
+	movx a, @dptr
+	mov sbuf, a
+	setb TX_RUNNING
+start_tx_done:
+	;; can we unthrottle the host tx process?
+	;;  step 1: do we care?
+	mov a, #0
+	cjne a, tx_unthrottle_threshold, start_tx__maybe_unthrottle_tx
+	;; nope
+start_tx_really_done:
+	ret
+start_tx__maybe_unthrottle_tx:
+	;;  step 2: is there now room?
+	mov a, tx_ring_out
+	setb c
+	subb a, tx_ring_in
+	;; a is now write_room. If thresh >= a, we can unthrottle
+	clr c
+	subb a, tx_unthrottle_threshold
+	jc start_tx_really_done	; nope
+	;; yes, we can unthrottle. remove the threshold and mark a request
+	mov tx_unthrottle_threshold, #0
+	setb DO_TX_UNTHROTTLE
+	;; prod rx, which will actually send the message when in2 becomes free
+	ljmp start_in
+	
+
+serial_int:
+	push dps
+	push dpl
+	push dph
+	push dpl1
+	push dph1
+	push acc
+	jnb TI, serial_int__not_tx
+	;; tx finished. send another character if we have one
+	clr TI			; clear int
+	clr TX_RUNNING
+	lcall start_tx
+serial_int__not_tx:
+	jnb RI, serial_int__not_rx
+	lcall get_rx_char
+	clr RI			; clear int
+serial_int__not_rx:	
+	;; return
+	pop acc
+	pop dph1
+	pop dpl1
+	pop dph
+	pop dpl
+	pop dps
+	reti
+
+get_rx_char:
+	mov dph, #HIGH(rx_ring)
+	mov dpl, rx_ring_in
+	inc dpl			; target = rx_ring_in+1
+	mov a, sbuf
+	movx @dptr, a
+	;; check for overflow before incrementing rx_ring_in
+	mov a, dpl
+	cjne a, rx_ring_out, get_rx_char__no_overflow
+	;; signal overflow
+	ret
+get_rx_char__no_overflow:	
+	inc rx_ring_in
+	;; kick off USB INpipe
+	acall start_in
+	ret
+
+start_in:
+	;; check if the inpipe is already running.
+	mov dptr, IN2CS
+	movx a, @dptr
+	jb acc.1, start_in__done; int will handle it
+	jb DO_TX_UNTHROTTLE, start_in__do_tx_unthrottle
+	;; see if there is any work to do. a serial interrupt might occur
+	;; during this sequence?
+	mov a, rx_ring_in
+	cjne a, rx_ring_out, start_in__have_work
+	ret			; nope
+start_in__have_work:	
+	;; now copy as much data as possible into the pipe. 63 bytes max.
+	clr a
+	mov dps, a
+	mov dph, #HIGH(rx_ring)	; load DPTR0 with source
+	inc dps
+	mov dptr, IN2BUF	; load DPTR1 with target
+	movx @dptr, a		; in[0] signals that rest of IN is rx data
+	inc dptr
+	inc dps
+	;; loop until we run out of data, or we have copied 64 bytes
+	mov r1, #1		; INbuf size counter
+start_in__loop:
+	mov a, rx_ring_in
+	cjne a, rx_ring_out, start_inlocal_irq_enablell_copying
+	sjmp start_in__kick
+start_inlocal_irq_enablell_copying:
+	inc rx_ring_out
+	mov dpl, rx_ring_out
+	movx a, @dptr
+	inc dps
+	movx @dptr, a		; write into IN buffer
+	inc dptr
+	inc dps
+	inc r1
+	cjne r1, #64, start_in__loop; loop
+start_in__kick:
+	;; either we ran out of data, or we copied 64 bytes. r1 has byte count
+	;; kick off IN
+	mov dptr, IN2BC
+	mov a, r1
+	jz start_in__done
+	movx @dptr, a
+	;; done
+start_in__done:
+	;acall dump_stat
+	ret
+start_in__do_tx_unthrottle:
+	;; special sequence: send a tx unthrottle message
+	clr DO_TX_UNTHROTTLE
+	clr a
+	mov dps, a
+	mov dptr, IN2BUF
+	mov a, #1
+	movx @dptr, a
+	inc dptr
+	mov a, #2
+	movx @dptr, a
+	mov dptr, IN2BC
+	movx @dptr, a
+	ret
+	
+putchar:
+	clr TI
+	mov SBUF, a
+putchar_wait:
+	jnb TI, putchar_wait
+	clr TI
+	ret
+
+	
+baud_table:			; baud_high, then baud_low
+	;; baud[0]: 110
+	.byte BAUD_HIGH(110)
+	.byte BAUD_LOW(110)
+	;; baud[1]: 300
+	.byte BAUD_HIGH(300)
+	.byte BAUD_LOW(300)
+	;; baud[2]: 1200
+	.byte BAUD_HIGH(1200)
+	.byte BAUD_LOW(1200)
+	;; baud[3]: 2400
+	.byte BAUD_HIGH(2400)
+	.byte BAUD_LOW(2400)
+	;; baud[4]: 4800
+	.byte BAUD_HIGH(4800)
+	.byte BAUD_LOW(4800)
+	;; baud[5]: 9600
+	.byte BAUD_HIGH(9600)
+	.byte BAUD_LOW(9600)
+	;; baud[6]: 19200
+	.byte BAUD_HIGH(19200)
+	.byte BAUD_LOW(19200)
+	;; baud[7]: 38400
+	.byte BAUD_HIGH(38400)
+	.byte BAUD_LOW(38400)
+	;; baud[8]: 57600
+	.byte BAUD_HIGH(57600)
+	.byte BAUD_LOW(57600)
+	;; baud[9]: 115200
+	.byte BAUD_HIGH(115200)
+	.byte BAUD_LOW(115200)
+
+desc_device:
+	.byte 0x12, 0x01, 0x00, 0x01, 0xff, 0xff, 0xff, 0x40
+	.byte 0xcd, 0x06, 0x04, 0x01, 0x89, 0xab, 1, 2, 3, 0x01
+;;; The "real" device id, which must match the host driver, is that
+;;; "0xcd 0x06 0x04 0x01" sequence, which is 0x06cd, 0x0104
+	
+desc_config1:
+	.byte 0x09, 0x02, 0x20, 0x00, 0x01, 0x01, 0x00, 0x80, 0x32
+	.byte 0x09, 0x04, 0x00, 0x00, 0x02, 0xff, 0xff, 0xff, 0x00
+	.byte 0x07, 0x05, 0x82, 0x03, 0x40, 0x00, 0x01
+	.byte 0x07, 0x05, 0x02, 0x02, 0x40, 0x00, 0x00
+
+desc_strings:
+	.word string_langids, string_mfg, string_product, string_serial
+desc_strings_end:
+
+string_langids:	.byte string_langids_end-string_langids
+	.byte 3
+	.word 0
+string_langids_end:
+
+	;; sigh. These strings are Unicode, meaning UTF16? 2 bytes each. Now
+	;; *that* is a pain in the ass to encode. And they are little-endian
+	;; too. Use this perl snippet to get the bytecodes:
+	/* while (<>) {
+	    @c = split(//);
+	    foreach $c (@c) {
+	     printf("0x%02x, 0x00, ", ord($c));
+	    }
+	   }
+	*/
+
+string_mfg:	.byte string_mfg_end-string_mfg
+	.byte 3
+;	.byte "ACME usb widgets"
+	.byte 0x41, 0x00, 0x43, 0x00, 0x4d, 0x00, 0x45, 0x00, 0x20, 0x00, 0x75, 0x00, 0x73, 0x00, 0x62, 0x00, 0x20, 0x00, 0x77, 0x00, 0x69, 0x00, 0x64, 0x00, 0x67, 0x00, 0x65, 0x00, 0x74, 0x00, 0x73, 0x00
+string_mfg_end:
+	
+string_product:	.byte string_product_end-string_product
+	.byte 3
+;	.byte "ACME USB serial widget"
+	.byte 0x41, 0x00, 0x43, 0x00, 0x4d, 0x00, 0x45, 0x00, 0x20, 0x00, 0x55, 0x00, 0x53, 0x00, 0x42, 0x00, 0x20, 0x00, 0x73, 0x00, 0x65, 0x00, 0x72, 0x00, 0x69, 0x00, 0x61, 0x00, 0x6c, 0x00, 0x20, 0x00, 0x77, 0x00, 0x69, 0x00, 0x64, 0x00, 0x67, 0x00, 0x65, 0x00, 0x74, 0x00
+string_product_end:
+	
+string_serial:	.byte string_serial_end-string_serial
+	.byte 3
+;	.byte "47"
+	.byte 0x34, 0x00, 0x37, 0x00
+string_serial_end:
+		
+;;; ring buffer memory
+	;; tx_ring_in+1 is where the next input byte will go
+	;; [tx_ring_out] has been sent
+	;; if tx_ring_in == tx_ring_out, theres no work to do
+	;; there are (tx_ring_in - tx_ring_out) chars to be written
+	;; dont let _in lap _out
+	;;   cannot inc if tx_ring_in+1 == tx_ring_out
+	;;  write [tx_ring_in+1] then tx_ring_in++
+	;;   if (tx_ring_in+1 == tx_ring_out), overflow
+	;;   else tx_ring_in++
+	;;  read/send [tx_ring_out+1], then tx_ring_out++
+
+	;; rx_ring_in works the same way
+	
+	.org 0x1000
+tx_ring:
+	.skip 0x100		; 256 bytes
+rx_ring:
+	.skip 0x100		; 256 bytes
+	
+	
+	.END
+	
diff --git a/keyspan_pda/keyspan_pda.fw b/keyspan_pda/keyspan_pda.fw
new file mode 100644
index 0000000..bbbce34
--- /dev/null
+++ b/keyspan_pda/keyspan_pda.fw
Binary files differ
diff --git a/keyspan_pda/xircom_pgs.S b/keyspan_pda/xircom_pgs.S
new file mode 100644
index 0000000..05d99dd
--- /dev/null
+++ b/keyspan_pda/xircom_pgs.S
@@ -0,0 +1,1192 @@
+/*  $Id: loop.s,v 1.23 2000/03/20 09:49:06 warner Exp $
+ * 
+ *  Firmware for the Keyspan PDA Serial Adapter, a USB serial port based on
+ *  the EzUSB microcontroller.
+ * 
+ *  (C) Copyright 2000 Brian Warner <warner@lothar.com>
+ * 
+ * 	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.
+ * 
+ *  "Keyspan PDA Serial Adapter" is probably a copyright of Keyspan, the
+ *  company.
+ * 
+ *  This serial adapter is basically an EzUSB chip and an RS-232 line driver
+ *  in a little widget that has a DB-9 on one end and a USB plug on the other.
+ *  It uses the EzUSB's internal UART0 (using the pins from Port C) and timer2
+ *  as a baud-rate generator. The wiring is:
+ *   PC0/RxD0 <- rxd (DB9 pin 2)         PC4 <- dsr pin 6
+ *   PC1/TxD0 -> txd pin 3               PC5 <- ri  pin 9
+ *   PC2      -> rts pin 7               PC6 <- dcd pin 1
+ *   PC3      <- cts pin 8               PC7 -> dtr pin 4
+ *   PB1 -> line driver standby
+ *
+ *  The EzUSB register constants below come from their excellent documentation
+ *  and sample code (which used to be available at www.anchorchips.com, but
+ *  that has now been absorbed into Cypress' site and the CD-ROM contents
+ *  don't appear to be available online anymore). If we get multiple
+ *  EzUSB-based drivers into the kernel, it might be useful to pull them out
+ *  into a separate .h file.
+ * 
+ * THEORY OF OPERATION:
+ *
+ *   There are two 256-byte ring buffers, one for tx, one for rx.
+ *
+ *   EP2out is pure tx data. When it appears, the data is copied into the tx
+ *   ring and serial transmission is started if it wasn't already running. The
+ *   "tx buffer empty" interrupt may kick off another character if the ring
+ *   still has data. If the host is tx-blocked because the ring filled up,
+ *   it will request a "tx unthrottle" interrupt. If sending a serial character
+ *   empties the ring below the desired threshold, we set a bit that will send
+ *   up the tx unthrottle message as soon as the rx buffer becomes free.
+ *
+ *   EP2in (interrupt) is used to send both rx chars and rx status messages
+ *   (only "tx unthrottle" at this time) back up to the host. The first byte
+ *   of the rx message indicates data (0) or status msg (1). Status messages
+ *   are sent before any data.
+ *
+ *   Incoming serial characters are put into the rx ring by the serial
+ *   interrupt, and the EP2in buffer sent if it wasn't already in transit.
+ *   When the EP2in buffer returns, the interrupt prompts us to send more
+ *   rx chars (or status messages) if they are pending.
+ *
+ *   Device control happens through "vendor specific" control messages on EP0.
+ *   All messages are destined for the "Interface" (with the index always 0,
+ *   so that if their two-port device might someday use similar firmware, we
+ *   can use index=1 to refer to the second port). The messages defined are:
+ *
+ *    bRequest = 0 : set baud/bits/parity
+ *               1 : unused
+ *               2 : reserved for setting HW flow control (CTSRTS)
+ *               3 : get/set "modem info" (pin states: DTR, RTS, DCD, RI, etc)
+ *               4 : set break (on/off)
+ *               5 : reserved for requesting interrupts on pin state change
+ *               6 : query buffer room or chars in tx buffer
+ *               7 : request tx unthrottle interrupt
+ *
+ *  The host-side driver is set to recognize the device ID values stashed in
+ *  serial EEPROM (0x06cd, 0x0103), program this firmware into place, then
+ *  start it running. This firmware will use EzUSB's "renumeration" trick by
+ *  simulating a bus disconnect, then reconnect with a different device ID
+ *  (encoded in the desc_device descriptor below). The host driver then
+ *  recognizes the new device ID and glues it to the real serial driver code.
+ *
+ * USEFUL DOCS:
+ *  EzUSB Technical Reference Manual: <http://www.anchorchips.com>
+ *  8051 manuals: everywhere, but try www.dalsemi.com because the EzUSB is
+ *   basically the Dallas enhanced 8051 code. Remember that the EzUSB IO ports
+ *   use totally different registers!
+ *  USB 1.1 spec: www.usb.org
+ *
+ * HOW TO BUILD:
+ *  gcc -x assembler-with-cpp -P -E -o keyspan_pda.asm keyspan_pda.s
+ *  as31 -l keyspan_pda.asm
+ *  mv keyspan_pda.obj keyspan_pda.hex
+ *  perl ezusb_convert.pl keyspan_pda < keyspan_pda.hex > keyspan_pda_fw.h
+ * Get as31 from <http://www.pjrc.com/tech/8051/index.html>, and hack on it
+ * a bit to make it build.
+ *
+ * THANKS:
+ *  Greg Kroah-Hartman, for coordinating the whole usb-serial thing.
+ *  AnchorChips, for making such an incredibly useful little microcontroller.
+ *  KeySpan, for making a handy, cheap ($40) widget that was so easy to take
+ *           apart and trace with an ohmmeter.
+ *
+ * TODO:
+ *  lots. grep for TODO. Interrupt safety needs stress-testing. Better flow
+ *  control. Interrupting host upon change in DCD, etc, counting transitions.
+ *  Need to find a safe device id to use (the one used by the Keyspan firmware
+ *  under Windows would be ideal.. can anyone figure out what it is?). Parity.
+ *  More baud rates. Oh, and the string-descriptor-length silicon bug
+ *  workaround should be implemented, but I'm lazy, and the consequence is
+ *  that the device name strings that show up in your kernel log will have
+ *  lots of trailing binary garbage in them (appears as ????). Device strings
+ *  should be made more accurate.
+ *
+ * Questions, bugs, patches to Brian.
+ *
+ *  -Brian Warner <warner@lothar.com>
+ *
+ */
+	
+#define HIGH(x) (((x) & 0xff00) / 256)
+#define LOW(x) ((x) & 0xff)
+
+#define dpl1 0x84
+#define dph1 0x85
+#define dps 0x86
+
+;;; our bit assignments
+#define TX_RUNNING 0
+#define DO_TX_UNTHROTTLE 1
+	
+	;; stack from 0x60 to 0x7f: should really set SP to 0x60-1, not 0x60
+#define STACK #0x60-1
+
+#define EXIF 0x91
+#define EIE 0xe8
+	.flag EUSB, EIE.0
+	.flag ES0, IE.4
+
+#define EP0CS #0x7fb4
+#define EP0STALLbit #0x01
+#define IN0BUF #0x7f00
+#define IN0BC #0x7fb5
+#define OUT0BUF #0x7ec0
+#define OUT0BC #0x7fc5		
+#define IN2BUF #0x7e00
+#define IN2BC #0x7fb9
+#define IN2CS #0x7fb8
+#define OUT2BC #0x7fc9
+#define OUT2CS #0x7fc8
+#define OUT2BUF #0x7dc0
+#define IN4BUF #0x7d00
+#define IN4BC #0x7fbd
+#define IN4CS #0x7fbc
+#define OEB #0x7f9d
+#define OUTB #0x7f97
+#define OEC #0x7f9e
+#define OUTC #0x7f98
+#define PINSC #0x7f9b
+#define PORTBCFG #0x7f94
+#define PORTCCFG #0x7f95
+#define OEA	#0x7f9c
+#define IN07IRQ #0x7fa9
+#define OUT07IRQ #0x7faa
+#define IN07IEN #0x7fac
+#define OUT07IEN #0x7fad
+#define USBIRQ #0x7fab
+#define USBIEN #0x7fae
+#define USBBAV #0x7faf
+#define USBCS #0x7fd6
+#define SUDPTRH #0x7fd4
+#define SUDPTRL #0x7fd5
+#define SETUPDAT #0x7fe8
+		
+	;; usb interrupt : enable is EIE.0 (0xe8), flag is EXIF.4 (0x91)
+
+	.org 0
+	ljmp start
+	;; interrupt vectors
+	.org 23H
+	ljmp serial_int
+	.byte 0
+	
+	.org 43H
+	ljmp USB_Jump_Table
+	.byte 0			; filled in by the USB core
+
+;;; local variables. These are not initialized properly: do it by hand.
+	.org 30H
+rx_ring_in:	.byte 0
+rx_ring_out:	.byte 0
+tx_ring_in:	.byte 0
+tx_ring_out:	.byte 0
+tx_unthrottle_threshold:	.byte 0
+		
+	.org 0x100H		; wants to be on a page boundary
+USB_Jump_Table:
+	ljmp	ISR_Sudav	; Setup Data Available
+	.byte 0
+	ljmp	0		; Start of Frame
+	.byte 0
+	ljmp	0		; Setup Data Loading
+	.byte 0
+	ljmp	0		; Global Suspend
+	.byte 	0
+	ljmp	0		; USB Reset  	
+	.byte	0
+	ljmp	0		; Reserved
+	.byte	0
+	ljmp	0		; End Point 0 In
+	.byte	0
+	ljmp	0		; End Point 0 Out
+	.byte	0
+	ljmp	0		; End Point 1 In
+	.byte	0
+	ljmp	0		; End Point 1 Out
+	.byte	0
+	ljmp	ISR_Ep2in
+	.byte	0
+	ljmp	ISR_Ep2out
+	.byte	0
+
+
+	.org 0x200
+		
+start:	mov SP,STACK-1 ; set stack
+	;; clear local variables
+	clr a
+	mov tx_ring_in, a
+	mov tx_ring_out, a
+	mov rx_ring_in, a
+	mov rx_ring_out, a
+	mov tx_unthrottle_threshold, a
+	clr TX_RUNNING
+	clr DO_TX_UNTHROTTLE
+	
+	;; clear fifo with "fe"
+	mov r1, 0
+	mov a, #0xfe
+	mov dptr, #tx_ring
+clear_tx_ring_loop:
+	movx @dptr, a
+	inc dptr
+	djnz r1, clear_tx_ring_loop
+
+	mov a, #0xfd
+	mov dptr, #rx_ring
+clear_rx_ring_loop:
+	movx @dptr, a
+	inc dptr
+	djnz r1, clear_rx_ring_loop
+
+;;; turn on the RS-232 driver chip (bring the STANDBY pin low)
+;;; on Xircom the STANDBY is wired to PB6 and PC4 
+	mov dptr, PORTBCFG
+        mov a, #0xBf
+        movx @dptr, a
+	mov dptr, PORTCCFG
+        mov a, #0xef
+        movx @dptr, a
+	
+	;; set OEC.4
+        mov a, #0x10
+        mov dptr,OEC
+        movx @dptr,a
+
+        ;; clear PC4
+        mov a, #0x00
+        mov dptr,OUTC
+        movx @dptr,a
+
+	;; set OEB.6
+	mov a, #0x40
+	mov dptr,OEB
+	movx @dptr,a
+
+	;; clear PB6
+	mov a, #0x00
+	mov dptr,OUTB
+	movx @dptr,a
+
+	;; set OEC.[17]
+	mov a, #0x82
+	mov dptr,OEC
+	movx @dptr,a
+
+
+	;; set PORTCCFG.[01] to route TxD0,RxD0 to serial port
+	mov dptr, PORTCCFG
+	mov a, #0x03
+	movx @dptr, a
+	
+	;; set up interrupts, autovectoring
+	;; set BKPT
+	mov dptr, USBBAV
+	movx a,@dptr
+	setb acc.0		; AVEN bit to 0
+	movx @dptr, a
+
+	mov a,#0x01		; enable SUDAV:	setup data available (for ep0)
+	mov dptr, USBIRQ
+	movx @dptr, a		; clear SUDAVI
+	mov dptr, USBIEN
+	movx @dptr, a
+	
+	mov dptr, IN07IEN
+	mov a,#0x04		; enable IN2 int
+	movx @dptr, a
+	
+	mov dptr, OUT07IEN
+	mov a,#0x04		; enable OUT2 int
+	movx @dptr, a
+	mov dptr, OUT2BC
+	movx @dptr, a		; arm OUT2
+
+;;	mov a, #0x84		; turn on RTS, DTR
+;;	mov dptr,OUTC
+;;	movx @dptr, a
+
+	mov a, #0x7             ; turn on  DTR
+        mov dptr,USBBAV
+        movx @dptr, a
+
+	mov a, #0x20             ; turn on the RED led 
+        mov dptr,OEA
+        movx @dptr, a
+
+	mov a, #0x80            ; turn on  RTS
+        mov dptr,OUTC
+        movx @dptr, a
+
+	;; setup the serial port. 9600 8N1.
+	mov a,#0x53		; mode 1, enable rx, clear int
+	mov SCON, a
+	;;  using timer2, in 16-bit baud-rate-generator mode
+	;;   (xtal 12MHz, internal fosc 24MHz)
+	;;  RCAP2H,RCAP2L = 65536 - fosc/(32*baud)
+	;;  57600: 0xFFF2.F, say 0xFFF3
+	;;   9600: 0xFFB1.E, say 0xFFB2
+	;;    300: 0xF63C
+#define BAUD 9600
+#define BAUD_TIMEOUT(rate) (65536 - (24 * 1000 * 1000) / (32 * rate))
+#define BAUD_HIGH(rate) HIGH(BAUD_TIMEOUT(rate))
+#define BAUD_LOW(rate) LOW(BAUD_TIMEOUT(rate))
+		
+	mov T2CON, #030h	; rclk=1,tclk=1,cp=0,tr2=0(enable later)
+	mov r3, #5
+	acall set_baud
+	setb TR2
+	mov SCON, #050h
+	
+#if 0
+	mov r1, #0x40
+	mov a, #0x41
+send:	
+	mov SBUF, a
+	inc a
+	anl a, #0x3F
+	orl a, #0x40
+;	xrl a, #0x02
+wait1:	
+	jnb TI, wait1
+	clr TI
+	djnz r1, send
+;done:	sjmp done
+
+#endif
+	
+	setb EUSB
+	setb EA
+	setb ES0
+	;acall dump_stat
+
+	;; hey, what say we RENUMERATE! (TRM p.62)
+	mov a, #0
+	mov dps, a
+	mov dptr, USBCS
+	mov a, #0x02		; DISCON=0, DISCOE=0, RENUM=1
+	movx @dptr, a
+	;; now presence pin is floating, simulating disconnect. wait 0.5s
+	mov r1, #46
+renum_wait1:
+	mov r2, #0
+renum_wait2:
+	mov r3, #0
+renum_wait3:
+	djnz r3, renum_wait3
+	djnz r2, renum_wait2
+	djnz r1, renum_wait1	; wait about n*(256^2) 6MHz clocks
+	mov a, #0x06		; DISCON=0, DISCOE=1, RENUM=1
+	movx @dptr, a
+	;; we are back online. the host device will now re-query us
+	
+	
+main:	sjmp main
+
+	
+
+ISR_Sudav:
+	push dps
+	push dpl
+	push dph
+	push dpl1
+	push dph1
+	push acc
+	mov a,EXIF
+	clr acc.4
+	mov EXIF,a		; clear INT2 first
+	mov dptr, USBIRQ	; clear USB int
+	mov a,#01h
+	movx @dptr,a
+
+	;; get request type
+	mov dptr, SETUPDAT
+	movx a, @dptr
+	mov r1, a		; r1 = bmRequestType
+	inc dptr
+	movx a, @dptr
+	mov r2, a		; r2 = bRequest
+	inc dptr
+	movx a, @dptr
+	mov r3, a		; r3 = wValueL
+	inc dptr
+	movx a, @dptr
+	mov r4, a		; r4 = wValueH
+
+	;; main switch on bmRequest.type: standard or vendor
+	mov a, r1
+	anl a, #0x60
+	cjne a, #0x00, setup_bmreq_type_not_standard
+	;; standard request: now main switch is on bRequest
+	ljmp setup_bmreq_is_standard
+	
+setup_bmreq_type_not_standard:	
+	;; a still has bmreq&0x60
+	cjne a, #0x40, setup_bmreq_type_not_vendor
+	;; Anchor reserves bRequest 0xa0-0xaf, we use small ones
+	;; switch on bRequest. bmRequest will always be 0x41 or 0xc1
+	cjne r2, #0x00, setup_ctrl_not_00
+	;; 00 is set baud, wValue[0] has baud rate index
+	lcall set_baud		; index in r3, carry set if error
+	jc setup_bmreq_type_not_standard__do_stall
+	ljmp setup_done_ack
+setup_bmreq_type_not_standard__do_stall:
+	ljmp setup_stall
+setup_ctrl_not_00:
+	cjne r2, #0x01, setup_ctrl_not_01
+	;; 01 is reserved for set bits (parity). TODO
+	ljmp setup_stall
+setup_ctrl_not_01:
+	cjne r2, #0x02, setup_ctrl_not_02
+	;; 02 is set HW flow control. TODO
+	ljmp setup_stall
+setup_ctrl_not_02:
+	cjne r2, #0x03, setup_ctrl_not_03
+	;; 03 is control pins (RTS, DTR).
+	ljmp control_pins	; will jump to setup_done_ack,
+				;  or setup_return_one_byte
+setup_ctrl_not_03:
+	cjne r2, #0x04, setup_ctrl_not_04
+	;; 04 is send break (really "turn break on/off"). TODO
+	cjne r3, #0x00, setup_ctrl_do_break_on
+	;; do break off: restore PORTCCFG.1 to reconnect TxD0 to serial port
+	mov dptr, PORTCCFG
+	movx a, @dptr
+	orl a, #0x02
+	movx @dptr, a
+	ljmp setup_done_ack
+setup_ctrl_do_break_on:
+	;; do break on: clear PORTCCFG.0, set TxD high(?) (b1 low)
+	mov dptr, OUTC
+	movx a, @dptr
+	anl a, #0xfd		; ~0x02
+	movx @dptr, a
+	mov dptr, PORTCCFG
+	movx a, @dptr
+	anl a, #0xfd		; ~0x02
+	movx @dptr, a
+	ljmp setup_done_ack
+setup_ctrl_not_04:
+	cjne r2, #0x05, setup_ctrl_not_05
+	;; 05 is set desired interrupt bitmap. TODO
+	ljmp setup_stall
+setup_ctrl_not_05:
+	cjne r2, #0x06, setup_ctrl_not_06
+	;; 06 is query room
+	cjne r3, #0x00, setup_ctrl_06_not_00
+	;; 06, wValue[0]=0 is query write_room
+	mov a, tx_ring_out
+	setb c
+	subb a, tx_ring_in	; out-1-in = 255 - (in-out)
+	ljmp setup_return_one_byte
+setup_ctrl_06_not_00:
+	cjne r3, #0x01, setup_ctrl_06_not_01
+	;; 06, wValue[0]=1 is query chars_in_buffer
+	mov a, tx_ring_in
+	clr c
+	subb a, tx_ring_out	; in-out
+	ljmp setup_return_one_byte
+setup_ctrl_06_not_01:	
+	ljmp setup_stall
+setup_ctrl_not_06:
+	cjne r2, #0x07, setup_ctrl_not_07
+	;; 07 is request tx unthrottle interrupt
+	mov tx_unthrottle_threshold, r3; wValue[0] is threshold value
+	ljmp setup_done_ack
+setup_ctrl_not_07:
+	ljmp setup_stall
+	
+setup_bmreq_type_not_vendor:
+	ljmp setup_stall
+
+
+setup_bmreq_is_standard:	
+	cjne r2, #0x00, setup_breq_not_00
+	;; 00:	Get_Status (sub-switch on bmRequestType: device, ep, int)
+	cjne r1, #0x80, setup_Get_Status_not_device
+	;; Get_Status(device)
+	;;  are we self-powered? no. can we do remote wakeup? no
+	;;   so return two zero bytes. This is reusable
+setup_return_two_zero_bytes:
+	mov dptr, IN0BUF
+	clr a
+	movx @dptr, a
+	inc dptr
+	movx @dptr, a
+	mov dptr, IN0BC
+	mov a, #2
+	movx @dptr, a
+	ljmp setup_done_ack
+setup_Get_Status_not_device:
+	cjne r1, #0x82, setup_Get_Status_not_endpoint
+	;; Get_Status(endpoint)
+	;;  must get stall bit for ep[wIndexL], return two bytes, bit in lsb 0
+	;; for now: cheat. TODO
+	sjmp setup_return_two_zero_bytes
+setup_Get_Status_not_endpoint:
+	cjne r1, #0x81, setup_Get_Status_not_interface
+	;; Get_Status(interface): return two zeros
+	sjmp setup_return_two_zero_bytes
+setup_Get_Status_not_interface:	
+	ljmp setup_stall
+	
+setup_breq_not_00:
+	cjne r2, #0x01, setup_breq_not_01
+	;; 01:	Clear_Feature (sub-switch on wValueL: stall, remote wakeup)
+	cjne r3, #0x00, setup_Clear_Feature_not_stall
+	;; Clear_Feature(stall). should clear a stall bit. TODO
+	ljmp setup_stall
+setup_Clear_Feature_not_stall:
+	cjne r3, #0x01, setup_Clear_Feature_not_rwake
+	;; Clear_Feature(remote wakeup). ignored.
+	ljmp setup_done_ack
+setup_Clear_Feature_not_rwake:
+	ljmp setup_stall
+	
+setup_breq_not_01:
+	cjne r2, #0x03, setup_breq_not_03
+	;; 03:	Set_Feature (sub-switch on wValueL: stall, remote wakeup)
+	cjne r3, #0x00, setup_Set_Feature_not_stall
+	;; Set_Feature(stall). Should set a stall bit. TODO
+	ljmp setup_stall
+setup_Set_Feature_not_stall:
+	cjne r3, #0x01, setup_Set_Feature_not_rwake
+	;; Set_Feature(remote wakeup). ignored.
+	ljmp setup_done_ack
+setup_Set_Feature_not_rwake:
+	ljmp setup_stall
+	
+setup_breq_not_03:	
+	cjne r2, #0x06, setup_breq_not_06
+	;; 06:	Get_Descriptor (s-switch on wValueH: dev, config[n], string[n])
+	cjne r4, #0x01, setup_Get_Descriptor_not_device
+	;; Get_Descriptor(device)
+	mov dptr, SUDPTRH
+	mov a, #HIGH(desc_device)
+	movx @dptr, a
+	mov dptr, SUDPTRL
+	mov a, #LOW(desc_device)
+	movx @dptr, a
+	ljmp setup_done_ack
+setup_Get_Descriptor_not_device:
+	cjne r4, #0x02, setup_Get_Descriptor_not_config
+	;; Get_Descriptor(config[n])
+	cjne r3, #0x00, setup_stall; only handle n==0
+	;; Get_Descriptor(config[0])
+	mov dptr, SUDPTRH
+	mov a, #HIGH(desc_config1)
+	movx @dptr, a
+	mov dptr, SUDPTRL
+	mov a, #LOW(desc_config1)
+	movx @dptr, a
+	ljmp setup_done_ack
+setup_Get_Descriptor_not_config:
+	cjne r4, #0x03, setup_Get_Descriptor_not_string
+	;; Get_Descriptor(string[wValueL])
+	;;  if (wValueL >= maxstrings) stall
+	mov a, #((desc_strings_end-desc_strings)/2)
+	clr c
+	subb a,r3		; a=4, r3 = 0..3 . if a<=0 then stall
+	jc  setup_stall
+	jz  setup_stall
+	mov a, r3
+	add a, r3		; a = 2*wValueL
+	mov dptr, #desc_strings
+	add a, dpl
+	mov dpl, a
+	mov a, #0
+	addc a, dph
+	mov dph, a		; dph = desc_strings[a]. big endian! (handy)
+	;; it looks like my adapter uses a revision of the EZUSB that
+	;; contains "rev D errata number 8", as hinted in the EzUSB example
+	;; code. I cannot find an actual errata description on the Cypress
+	;; web site, but from the example code it looks like this bug causes
+	;; the length of string descriptors to be read incorrectly, possibly
+	;; sending back more characters than the descriptor has. The workaround
+	;; is to manually send out all of the data. The consequence of not
+	;; using the workaround is that the strings gathered by the kernel
+	;; driver are too long and are filled with trailing garbage (including
+	;; leftover strings). Writing this out by hand is a nuisance, so for
+	;; now I will just live with the bug.
+	movx a, @dptr
+	mov r1, a
+	inc dptr
+	movx a, @dptr
+	mov r2, a
+	mov dptr, SUDPTRH
+	mov a, r1
+	movx @dptr, a
+	mov dptr, SUDPTRL
+	mov a, r2
+	movx @dptr, a
+	;; done
+	ljmp setup_done_ack
+	
+setup_Get_Descriptor_not_string:
+	ljmp setup_stall
+	
+setup_breq_not_06:
+	cjne r2, #0x08, setup_breq_not_08
+	;; Get_Configuration. always 1. return one byte.
+	;; this is reusable
+	mov a, #1
+setup_return_one_byte:	
+	mov dptr, IN0BUF
+	movx @dptr, a
+	mov a, #1
+	mov dptr, IN0BC
+	movx @dptr, a
+	ljmp setup_done_ack
+setup_breq_not_08:
+	cjne r2, #0x09, setup_breq_not_09
+	;; 09: Set_Configuration. ignored.
+	ljmp setup_done_ack
+setup_breq_not_09:
+	cjne r2, #0x0a, setup_breq_not_0a
+	;; 0a: Get_Interface. get the current altsetting for int[wIndexL]
+	;;  since we only have one interface, ignore wIndexL, return a 0
+	mov a, #0
+	ljmp setup_return_one_byte
+setup_breq_not_0a:
+	cjne r2, #0x0b, setup_breq_not_0b
+	;; 0b: Set_Interface. set altsetting for interface[wIndexL]. ignored
+	ljmp setup_done_ack
+setup_breq_not_0b:
+	ljmp setup_stall
+
+		
+setup_done_ack:	
+	;; now clear HSNAK
+	mov dptr, EP0CS
+	mov a, #0x02
+	movx @dptr, a
+	sjmp setup_done
+setup_stall:	
+	;; unhandled. STALL
+	;EP0CS |= bmEPSTALL
+	mov dptr, EP0CS
+	movx a, @dptr
+	orl a, EP0STALLbit
+	movx @dptr, a
+	sjmp setup_done
+	
+setup_done:	
+	pop acc
+	pop dph1
+	pop dpl1
+	pop dph
+	pop dpl
+	pop dps
+	reti
+
+;;; ==============================================================
+	
+set_baud:			; baud index in r3
+	;; verify a < 10
+	mov a, r3
+	jb ACC.7, set_baud__badbaud
+	clr c
+	subb a, #10
+	jnc set_baud__badbaud
+	mov a, r3
+	rl a			; a = index*2
+	add a, #LOW(baud_table)
+	mov dpl, a
+	mov a, #HIGH(baud_table)
+	addc a, #0
+	mov dph, a
+	;; TODO: shut down xmit/receive
+	;; TODO: wait for current xmit char to leave
+	;; TODO: shut down timer to avoid partial-char glitch
+	movx a,@dptr		; BAUD_HIGH
+	mov RCAP2H, a
+	mov TH2, a
+	inc dptr
+	movx a,@dptr		; BAUD_LOW
+	mov RCAP2L, a
+	mov TL2, a
+	;; TODO: restart xmit/receive
+	;; TODO: reenable interrupts, resume tx if pending
+	clr c			; c=0: success
+	ret
+set_baud__badbaud:
+	setb c			; c=1: failure
+	ret
+	
+;;; ==================================================
+control_pins:
+	cjne r1, #0x41, control_pins_in
+control_pins_out:
+		;TODO BKPT is DTR
+	mov a, r3 ; wValue[0] holds new bits:	b7 is new RTS
+	xrl a, #0xff		; 1 means active, 0V, +12V ?
+	anl a, #0x80
+	mov r3, a
+	mov dptr, OUTC
+	movx a, @dptr		; only change bit 7 
+	anl a, #0x7F		; ~0x84
+	orl a, r3
+	movx @dptr, a		; other pins are inputs, bits ignored
+	ljmp setup_done_ack
+control_pins_in:
+	mov dptr, PINSC
+	movx a, @dptr
+	xrl a, #0xff
+	ljmp setup_return_one_byte
+
+;;; ========================================
+	
+ISR_Ep2in:
+	push dps
+	push dpl
+	push dph
+	push dpl1
+	push dph1
+	push acc
+	mov a,EXIF
+	clr acc.4
+	mov EXIF,a		; clear INT2 first
+	mov dptr, IN07IRQ	; clear USB int
+	mov a,#04h
+	movx @dptr,a
+
+	mov a, #0x20             ; Turn off the green LED
+        mov dptr,OEA
+        movx @dptr, a
+
+
+	;; do stuff
+	lcall start_in
+
+	mov a, #0x20             ; Turn off the green LED
+        mov dptr,OEA
+        movx @dptr, a
+
+
+	
+	pop acc
+	pop dph1
+	pop dpl1
+	pop dph
+	pop dpl
+	pop dps
+	reti
+
+ISR_Ep2out:
+	push dps
+	push dpl
+	push dph
+	push dpl1
+	push dph1
+	push acc
+
+        mov a, #0x10             ; Turn the green LED
+        mov dptr,OEA
+        movx @dptr, a
+
+
+
+	mov a,EXIF
+	clr acc.4
+	mov EXIF,a		; clear INT2 first
+	mov dptr, OUT07IRQ	; clear USB int
+	mov a,#04h
+	movx @dptr,a
+
+	;; do stuff
+
+	;; copy data into buffer. for now, assume we will have enough space
+	mov dptr, OUT2BC	; get byte count
+	movx a,@dptr
+	mov r1, a
+	clr a
+	mov dps, a
+	mov dptr, OUT2BUF	; load DPTR0 with source
+	mov dph1, #HIGH(tx_ring)	; load DPTR1 with target
+	mov dpl1, tx_ring_in
+OUT_loop:
+	movx a,@dptr		; read
+	inc dps			; switch to DPTR1: target
+	inc dpl1		; target = tx_ring_in+1
+	movx @dptr,a		; store
+	mov a,dpl1
+	cjne a, tx_ring_out, OUT_no_overflow
+	sjmp OUT_overflow
+OUT_no_overflow:	
+	inc tx_ring_in		; tx_ring_in++
+	inc dps			; switch to DPTR0: source
+	inc dptr
+	djnz r1, OUT_loop
+	sjmp OUT_done
+OUT_overflow:
+	;; signal overflow
+	;; fall through
+OUT_done:	
+	;; ack
+	mov dptr,OUT2BC
+	movx @dptr,a
+
+	;; start tx
+	acall maybe_start_tx
+	;acall dump_stat
+
+        mov a, #0x20             ; Turn off the green LED
+        mov dptr,OEA
+        movx @dptr, a
+	
+	pop acc
+	pop dph1
+	pop dpl1
+	pop dph
+	pop dpl
+	pop dps
+	reti
+
+dump_stat:
+	;; fill in EP4in with a debugging message:
+	;;   tx_ring_in, tx_ring_out, rx_ring_in, rx_ring_out
+	;;   tx_active
+	;;   tx_ring[0..15]
+	;;   0xfc
+	;;   rx_ring[0..15]
+	clr a
+	mov dps, a
+	
+	mov dptr, IN4CS
+	movx a, @dptr
+	jb acc.1, dump_stat__done; busy: cannot dump, old one still pending
+	mov dptr, IN4BUF
+	
+	mov a, tx_ring_in
+	movx @dptr, a
+	inc dptr
+	mov a, tx_ring_out
+	movx @dptr, a
+	inc dptr
+
+	mov a, rx_ring_in
+	movx @dptr, a
+	inc dptr
+	mov a, rx_ring_out
+	movx @dptr, a
+	inc dptr
+	
+	clr a
+	jnb TX_RUNNING, dump_stat__no_tx_running
+	inc a
+dump_stat__no_tx_running:
+	movx @dptr, a
+	inc dptr
+	;; tx_ring[0..15]
+	inc dps
+	mov dptr, #tx_ring	; DPTR1: source
+	mov r1, #16
+dump_stat__tx_ring_loop:
+	movx a, @dptr
+	inc dptr
+	inc dps
+	movx @dptr, a
+	inc dptr
+	inc dps
+	djnz r1, dump_stat__tx_ring_loop
+	inc dps
+	
+	mov a, #0xfc
+	movx @dptr, a
+	inc dptr
+	
+	;; rx_ring[0..15]
+	inc dps
+	mov dptr, #rx_ring	; DPTR1: source
+	mov r1, #16
+dump_stat__rx_ring_loop:
+	movx a, @dptr
+	inc dptr
+	inc dps
+	movx @dptr, a
+	inc dptr
+	inc dps
+	djnz r1, dump_stat__rx_ring_loop
+	
+	;; now send it
+	clr a
+	mov dps, a
+	mov dptr, IN4BC
+	mov a, #38
+	movx @dptr, a
+dump_stat__done:	
+	ret
+		
+;;; ============================================================
+	
+maybe_start_tx:
+	;; make sure the tx process is running.
+	jb TX_RUNNING, start_tx_done
+start_tx:
+	;; is there work to be done?
+	mov a, tx_ring_in
+	cjne a,tx_ring_out, start_tx__work
+	ret			; no work
+start_tx__work:	
+	;; tx was not running. send the first character, setup the TI int
+	inc tx_ring_out		; [++tx_ring_out]
+	mov dph, #HIGH(tx_ring)
+	mov dpl, tx_ring_out
+	movx a, @dptr
+	mov sbuf, a
+	setb TX_RUNNING
+start_tx_done:
+	;; can we unthrottle the host tx process?
+	;;  step 1: do we care?
+	mov a, #0
+	cjne a, tx_unthrottle_threshold, start_tx__maybe_unthrottle_tx
+	;; nope
+start_tx_really_done:
+	ret
+start_tx__maybe_unthrottle_tx:
+	;;  step 2: is there now room?
+	mov a, tx_ring_out
+	setb c
+	subb a, tx_ring_in
+	;; a is now write_room. If thresh >= a, we can unthrottle
+	clr c
+	subb a, tx_unthrottle_threshold
+	jc start_tx_really_done	; nope
+	;; yes, we can unthrottle. remove the threshold and mark a request
+	mov tx_unthrottle_threshold, #0
+	setb DO_TX_UNTHROTTLE
+	;; prod rx, which will actually send the message when in2 becomes free
+	ljmp start_in
+	
+
+serial_int:
+	push dps
+	push dpl
+	push dph
+	push dpl1
+	push dph1
+	push acc
+	jnb TI, serial_int__not_tx
+	;; tx finished. send another character if we have one
+	clr TI			; clear int
+	clr TX_RUNNING
+	lcall start_tx
+serial_int__not_tx:
+	jnb RI, serial_int__not_rx
+	lcall get_rx_char
+	clr RI			; clear int
+serial_int__not_rx:	
+	;; return
+	pop acc
+	pop dph1
+	pop dpl1
+	pop dph
+	pop dpl
+	pop dps
+	reti
+
+get_rx_char:
+	mov dph, #HIGH(rx_ring)
+	mov dpl, rx_ring_in
+	inc dpl			; target = rx_ring_in+1
+	mov a, sbuf
+	movx @dptr, a
+	;; check for overflow before incrementing rx_ring_in
+	mov a, dpl
+	cjne a, rx_ring_out, get_rx_char__no_overflow
+	;; signal overflow
+	ret
+get_rx_char__no_overflow:	
+	inc rx_ring_in
+	;; kick off USB INpipe
+	acall start_in
+	ret
+
+start_in:
+	;; check if the inpipe is already running.
+	mov  a,#0x10
+	mov dptr, OEA
+	movx @dptr,a
+
+	mov dptr, IN2CS
+	movx a, @dptr
+	jb acc.1, start_in__done; int will handle it
+	jb DO_TX_UNTHROTTLE, start_in__do_tx_unthrottle
+	;; see if there is any work to do. a serial interrupt might occur
+	;; during this sequence?
+	mov a, rx_ring_in
+	cjne a, rx_ring_out, start_in__have_work
+	ret			; nope
+start_in__have_work:	
+	;; now copy as much data as possible into the pipe. 63 bytes max.
+	clr a
+	mov dps, a
+	mov dph, #HIGH(rx_ring)	; load DPTR0 with source
+	inc dps
+	mov dptr, IN2BUF	; load DPTR1 with target
+	movx @dptr, a		; in[0] signals that rest of IN is rx data
+	inc dptr
+	inc dps
+	;; loop until we run out of data, or we have copied 64 bytes
+	mov r1, #1		; INbuf size counter
+start_in__loop:
+	mov a, rx_ring_in
+	cjne a, rx_ring_out, start_inlocal_irq_enablell_copying
+	sjmp start_in__kick
+start_inlocal_irq_enablell_copying:
+	inc rx_ring_out
+	mov dpl, rx_ring_out
+	movx a, @dptr
+	inc dps
+	movx @dptr, a		; write into IN buffer
+	inc dptr
+	inc dps
+	inc r1
+	cjne r1, #64, start_in__loop; loop
+start_in__kick:
+	;; either we ran out of data, or we copied 64 bytes. r1 has byte count
+	;; kick off IN
+	mov a, #0x10             ; Turn the green LED
+        mov dptr,OEA
+        movx @dptr, a
+	mov dptr, IN2BC
+	mov a, r1
+	jz start_in__done
+	movx @dptr, a
+	;; done
+start_in__done:
+	;acall dump_stat
+	ret
+start_in__do_tx_unthrottle:
+	;; special sequence: send a tx unthrottle message
+	clr DO_TX_UNTHROTTLE
+	clr a
+	mov dps, a
+	mov dptr, IN2BUF
+	mov a, #1
+	movx @dptr, a
+	inc dptr
+	mov a, #2
+	movx @dptr, a
+	mov dptr, IN2BC
+	movx @dptr, a
+	ret
+	
+putchar:
+	clr TI
+	mov SBUF, a
+putchar_wait:
+	jnb TI, putchar_wait
+	clr TI
+	ret
+
+	
+baud_table:			; baud_high, then baud_low
+	;; baud[0]: 110
+	.byte BAUD_HIGH(110)
+	.byte BAUD_LOW(110)
+	;; baud[1]: 300
+	.byte BAUD_HIGH(300)
+	.byte BAUD_LOW(300)
+	;; baud[2]: 1200
+	.byte BAUD_HIGH(1200)
+	.byte BAUD_LOW(1200)
+	;; baud[3]: 2400
+	.byte BAUD_HIGH(2400)
+	.byte BAUD_LOW(2400)
+	;; baud[4]: 4800
+	.byte BAUD_HIGH(4800)
+	.byte BAUD_LOW(4800)
+	;; baud[5]: 9600
+	.byte BAUD_HIGH(9600)
+	.byte BAUD_LOW(9600)
+	;; baud[6]: 19200
+	.byte BAUD_HIGH(19200)
+	.byte BAUD_LOW(19200)
+	;; baud[7]: 38400
+	.byte BAUD_HIGH(38400)
+	.byte BAUD_LOW(38400)
+	;; baud[8]: 57600
+	.byte BAUD_HIGH(57600)
+	.byte BAUD_LOW(57600)
+	;; baud[9]: 115200
+	.byte BAUD_HIGH(115200)
+	.byte BAUD_LOW(115200)
+
+desc_device:
+	.byte 0x12, 0x01, 0x00, 0x01, 0xff, 0xff, 0xff, 0x40
+	.byte 0xcd, 0x06, 0x04, 0x01, 0x89, 0xab, 1, 2, 3, 0x01
+;;; The "real" device id, which must match the host driver, is that
+;;; "0xcd 0x06 0x04 0x01" sequence, which is 0x06cd, 0x0104
+	
+desc_config1:
+	.byte 0x09, 0x02, 0x20, 0x00, 0x01, 0x01, 0x00, 0x80, 0x32
+	.byte 0x09, 0x04, 0x00, 0x00, 0x02, 0xff, 0xff, 0xff, 0x00
+	.byte 0x07, 0x05, 0x82, 0x03, 0x40, 0x00, 0x01
+	.byte 0x07, 0x05, 0x02, 0x02, 0x40, 0x00, 0x00
+
+desc_strings:
+	.word string_langids, string_mfg, string_product, string_serial
+desc_strings_end:
+
+string_langids:	.byte string_langids_end-string_langids
+	.byte 3
+	.word 0
+string_langids_end:
+
+	;; sigh. These strings are Unicode, meaning UTF16? 2 bytes each. Now
+	;; *that* is a pain in the ass to encode. And they are little-endian
+	;; too. Use this perl snippet to get the bytecodes:
+	/* while (<>) {
+	    @c = split(//);
+	    foreach $c (@c) {
+	     printf("0x%02x, 0x00, ", ord($c));
+	    }
+	   }
+	*/
+
+string_mfg:	.byte string_mfg_end-string_mfg
+	.byte 3
+;	.byte "ACME usb widgets"
+	.byte 0x41, 0x00, 0x43, 0x00, 0x4d, 0x00, 0x45, 0x00, 0x20, 0x00, 0x75, 0x00, 0x73, 0x00, 0x62, 0x00, 0x20, 0x00, 0x77, 0x00, 0x69, 0x00, 0x64, 0x00, 0x67, 0x00, 0x65, 0x00, 0x74, 0x00, 0x73, 0x00
+string_mfg_end:
+	
+string_product:	.byte string_product_end-string_product
+	.byte 3
+;	.byte "ACME USB serial widget"
+	.byte 0x41, 0x00, 0x43, 0x00, 0x4d, 0x00, 0x45, 0x00, 0x20, 0x00, 0x55, 0x00, 0x53, 0x00, 0x42, 0x00, 0x20, 0x00, 0x73, 0x00, 0x65, 0x00, 0x72, 0x00, 0x69, 0x00, 0x61, 0x00, 0x6c, 0x00, 0x20, 0x00, 0x77, 0x00, 0x69, 0x00, 0x64, 0x00, 0x67, 0x00, 0x65, 0x00, 0x74, 0x00
+string_product_end:
+	
+string_serial:	.byte string_serial_end-string_serial
+	.byte 3
+;	.byte "47"
+	.byte 0x34, 0x00, 0x37, 0x00
+string_serial_end:
+		
+;;; ring buffer memory
+	;; tx_ring_in+1 is where the next input byte will go
+	;; [tx_ring_out] has been sent
+	;; if tx_ring_in == tx_ring_out, theres no work to do
+	;; there are (tx_ring_in - tx_ring_out) chars to be written
+	;; dont let _in lap _out
+	;;   cannot inc if tx_ring_in+1 == tx_ring_out
+	;;  write [tx_ring_in+1] then tx_ring_in++
+	;;   if (tx_ring_in+1 == tx_ring_out), overflow
+	;;   else tx_ring_in++
+	;;  read/send [tx_ring_out+1], then tx_ring_out++
+
+	;; rx_ring_in works the same way
+	
+	.org 0x1000
+tx_ring:
+	.skip 0x100		; 256 bytes
+rx_ring:
+	.skip 0x100		; 256 bytes
+	
+	
+	.END
+	
diff --git a/keyspan_pda/xircom_pgs.fw b/keyspan_pda/xircom_pgs.fw
new file mode 100644
index 0000000..660f406
--- /dev/null
+++ b/keyspan_pda/xircom_pgs.fw
Binary files differ
diff --git a/korg/k1212.dsp b/korg/k1212.dsp
new file mode 100644
index 0000000..790b24c
--- /dev/null
+++ b/korg/k1212.dsp
Binary files differ
diff --git a/lbtf_usb.bin b/lbtf_usb.bin
new file mode 100644
index 0000000..8ee231a
--- /dev/null
+++ b/lbtf_usb.bin
Binary files differ
diff --git a/lgs8g75.fw b/lgs8g75.fw
new file mode 100644
index 0000000..b97c37d
--- /dev/null
+++ b/lgs8g75.fw
Binary files differ
diff --git a/libertas/cf8381.bin b/libertas/cf8381.bin
new file mode 100644
index 0000000..3dc456c
--- /dev/null
+++ b/libertas/cf8381.bin
Binary files differ
diff --git a/libertas/cf8381_helper.bin b/libertas/cf8381_helper.bin
new file mode 100644
index 0000000..053b9e7
--- /dev/null
+++ b/libertas/cf8381_helper.bin
Binary files differ
diff --git a/libertas/cf8385.bin b/libertas/cf8385.bin
new file mode 100644
index 0000000..463c02c
--- /dev/null
+++ b/libertas/cf8385.bin
Binary files differ
diff --git a/libertas/cf8385_helper.bin b/libertas/cf8385_helper.bin
new file mode 100644
index 0000000..349ca99
--- /dev/null
+++ b/libertas/cf8385_helper.bin
Binary files differ
diff --git a/libertas/gspi8682.bin b/libertas/gspi8682.bin
new file mode 100644
index 0000000..92199c0
--- /dev/null
+++ b/libertas/gspi8682.bin
Binary files differ
diff --git a/libertas/gspi8682_helper.bin b/libertas/gspi8682_helper.bin
new file mode 100644
index 0000000..424cfb3
--- /dev/null
+++ b/libertas/gspi8682_helper.bin
Binary files differ
diff --git a/libertas/gspi8686_v9.bin b/libertas/gspi8686_v9.bin
new file mode 100644
index 0000000..58dc03d
--- /dev/null
+++ b/libertas/gspi8686_v9.bin
Binary files differ
diff --git a/libertas/gspi8686_v9_helper.bin b/libertas/gspi8686_v9_helper.bin
new file mode 100644
index 0000000..424cfb3
--- /dev/null
+++ b/libertas/gspi8686_v9_helper.bin
Binary files differ
diff --git a/libertas/gspi8688.bin b/libertas/gspi8688.bin
new file mode 100644
index 0000000..fb7bb49
--- /dev/null
+++ b/libertas/gspi8688.bin
Binary files differ
diff --git a/libertas/gspi8688_helper.bin b/libertas/gspi8688_helper.bin
new file mode 100644
index 0000000..424cfb3
--- /dev/null
+++ b/libertas/gspi8688_helper.bin
Binary files differ
diff --git a/libertas/lbtf_sdio.bin b/libertas/lbtf_sdio.bin
new file mode 100644
index 0000000..a93d765
--- /dev/null
+++ b/libertas/lbtf_sdio.bin
Binary files differ
diff --git a/libertas/sd8385.bin b/libertas/sd8385.bin
new file mode 100644
index 0000000..8a28395
--- /dev/null
+++ b/libertas/sd8385.bin
Binary files differ
diff --git a/libertas/sd8385_helper.bin b/libertas/sd8385_helper.bin
new file mode 100644
index 0000000..af658c8
--- /dev/null
+++ b/libertas/sd8385_helper.bin
Binary files differ
diff --git a/libertas/sd8682.bin b/libertas/sd8682.bin
new file mode 100644
index 0000000..ea0fb93
--- /dev/null
+++ b/libertas/sd8682.bin
Binary files differ
diff --git a/libertas/sd8682_helper.bin b/libertas/sd8682_helper.bin
new file mode 100644
index 0000000..746ae0b
--- /dev/null
+++ b/libertas/sd8682_helper.bin
Binary files differ
diff --git a/libertas/sd8686_v8.bin b/libertas/sd8686_v8.bin
new file mode 100644
index 0000000..aef7bbc
--- /dev/null
+++ b/libertas/sd8686_v8.bin
Binary files differ
diff --git a/libertas/sd8686_v8_helper.bin b/libertas/sd8686_v8_helper.bin
new file mode 100644
index 0000000..c2ddfbe
--- /dev/null
+++ b/libertas/sd8686_v8_helper.bin
Binary files differ
diff --git a/libertas/sd8686_v9.bin b/libertas/sd8686_v9.bin
new file mode 100644
index 0000000..757c6f2
--- /dev/null
+++ b/libertas/sd8686_v9.bin
Binary files differ
diff --git a/libertas/sd8686_v9_helper.bin b/libertas/sd8686_v9_helper.bin
new file mode 100644
index 0000000..f450ee6
--- /dev/null
+++ b/libertas/sd8686_v9_helper.bin
Binary files differ
diff --git a/libertas/sd8688.bin b/libertas/sd8688.bin
new file mode 120000
index 0000000..46d817f
--- /dev/null
+++ b/libertas/sd8688.bin
@@ -0,0 +1 @@
+../mrvl/sd8688.bin
\ No newline at end of file
diff --git a/libertas/sd8688_helper.bin b/libertas/sd8688_helper.bin
new file mode 120000
index 0000000..6515a2c
--- /dev/null
+++ b/libertas/sd8688_helper.bin
@@ -0,0 +1 @@
+../mrvl/sd8688_helper.bin
\ No newline at end of file
diff --git a/libertas/usb8388_olpc.bin b/libertas/usb8388_olpc.bin
new file mode 100644
index 0000000..e01b6c2
--- /dev/null
+++ b/libertas/usb8388_olpc.bin
Binary files differ
diff --git a/libertas/usb8388_v5.bin b/libertas/usb8388_v5.bin
new file mode 100644
index 0000000..d98b089
--- /dev/null
+++ b/libertas/usb8388_v5.bin
Binary files differ
diff --git a/libertas/usb8388_v9.bin b/libertas/usb8388_v9.bin
new file mode 100644
index 0000000..38f28ca
--- /dev/null
+++ b/libertas/usb8388_v9.bin
Binary files differ
diff --git a/libertas/usb8682.bin b/libertas/usb8682.bin
new file mode 100644
index 0000000..f969104
--- /dev/null
+++ b/libertas/usb8682.bin
Binary files differ
diff --git a/matrox/g200_warp.fw b/matrox/g200_warp.fw
new file mode 100644
index 0000000..2c7f7fe
--- /dev/null
+++ b/matrox/g200_warp.fw
Binary files differ
diff --git a/matrox/g400_warp.fw b/matrox/g400_warp.fw
new file mode 100644
index 0000000..57f1088
--- /dev/null
+++ b/matrox/g400_warp.fw
Binary files differ
diff --git a/moxa/moxa-1250.fw b/moxa/moxa-1250.fw
new file mode 100644
index 0000000..61e7ea5
--- /dev/null
+++ b/moxa/moxa-1250.fw
Binary files differ
diff --git a/moxa/moxa-1251.fw b/moxa/moxa-1251.fw
new file mode 100644
index 0000000..7f40650
--- /dev/null
+++ b/moxa/moxa-1251.fw
Binary files differ
diff --git a/moxa/moxa-1410.fw b/moxa/moxa-1410.fw
new file mode 100644
index 0000000..e370bef
--- /dev/null
+++ b/moxa/moxa-1410.fw
Binary files differ
diff --git a/moxa/moxa-1450.fw b/moxa/moxa-1450.fw
new file mode 100644
index 0000000..9ba8374
--- /dev/null
+++ b/moxa/moxa-1450.fw
Binary files differ
diff --git a/moxa/moxa-1451.fw b/moxa/moxa-1451.fw
new file mode 100644
index 0000000..79164d3
--- /dev/null
+++ b/moxa/moxa-1451.fw
Binary files differ
diff --git a/moxa/moxa-1613.fw b/moxa/moxa-1613.fw
new file mode 100644
index 0000000..8466269
--- /dev/null
+++ b/moxa/moxa-1613.fw
Binary files differ
diff --git a/moxa/moxa-1618.fw b/moxa/moxa-1618.fw
new file mode 100644
index 0000000..89eda87
--- /dev/null
+++ b/moxa/moxa-1618.fw
Binary files differ
diff --git a/moxa/moxa-1653.fw b/moxa/moxa-1653.fw
new file mode 100644
index 0000000..e619689
--- /dev/null
+++ b/moxa/moxa-1653.fw
Binary files differ
diff --git a/moxa/moxa-1658.fw b/moxa/moxa-1658.fw
new file mode 100644
index 0000000..57cfb48
--- /dev/null
+++ b/moxa/moxa-1658.fw
Binary files differ
diff --git a/mrvl/pcie8897_uapsta.bin b/mrvl/pcie8897_uapsta.bin
new file mode 100644
index 0000000..858c100
--- /dev/null
+++ b/mrvl/pcie8897_uapsta.bin
Binary files differ
diff --git a/mrvl/sd8688.bin b/mrvl/sd8688.bin
new file mode 100644
index 0000000..199e32a
--- /dev/null
+++ b/mrvl/sd8688.bin
Binary files differ
diff --git a/mrvl/sd8688_helper.bin b/mrvl/sd8688_helper.bin
new file mode 100644
index 0000000..746ae0b
--- /dev/null
+++ b/mrvl/sd8688_helper.bin
Binary files differ
diff --git a/mrvl/sd8787_uapsta.bin b/mrvl/sd8787_uapsta.bin
new file mode 100644
index 0000000..3bf4e23
--- /dev/null
+++ b/mrvl/sd8787_uapsta.bin
Binary files differ
diff --git a/mrvl/sd8797_uapsta.bin b/mrvl/sd8797_uapsta.bin
new file mode 100644
index 0000000..8b6f9c1
--- /dev/null
+++ b/mrvl/sd8797_uapsta.bin
Binary files differ
diff --git a/mrvl/sd8897_uapsta.bin b/mrvl/sd8897_uapsta.bin
new file mode 100644
index 0000000..70732a6
--- /dev/null
+++ b/mrvl/sd8897_uapsta.bin
Binary files differ
diff --git a/mrvl/usb8797_uapsta.bin b/mrvl/usb8797_uapsta.bin
new file mode 100644
index 0000000..bd7c07c
--- /dev/null
+++ b/mrvl/usb8797_uapsta.bin
Binary files differ
diff --git a/mt7650.bin b/mt7650.bin
new file mode 100644
index 0000000..1bdf904
--- /dev/null
+++ b/mt7650.bin
Binary files differ
diff --git a/mts_cdma.fw b/mts_cdma.fw
new file mode 100644
index 0000000..5241976
--- /dev/null
+++ b/mts_cdma.fw
Binary files differ
diff --git a/mts_edge.fw b/mts_edge.fw
new file mode 100644
index 0000000..4414462
--- /dev/null
+++ b/mts_edge.fw
Binary files differ
diff --git a/mts_gsm.fw b/mts_gsm.fw
new file mode 100644
index 0000000..5241976
--- /dev/null
+++ b/mts_gsm.fw
Binary files differ
diff --git a/mts_mt9234mu.fw b/mts_mt9234mu.fw
new file mode 100644
index 0000000..09c1361
--- /dev/null
+++ b/mts_mt9234mu.fw
Binary files differ
diff --git a/mts_mt9234zba.fw b/mts_mt9234zba.fw
new file mode 100644
index 0000000..f3cb1dd
--- /dev/null
+++ b/mts_mt9234zba.fw
Binary files differ
diff --git a/mwl8k/fmimage_8366.fw b/mwl8k/fmimage_8366.fw
new file mode 100644
index 0000000..3e8ec24
--- /dev/null
+++ b/mwl8k/fmimage_8366.fw
Binary files differ
diff --git a/mwl8k/fmimage_8366_ap-1.fw b/mwl8k/fmimage_8366_ap-1.fw
new file mode 100644
index 0000000..d6dddb7
--- /dev/null
+++ b/mwl8k/fmimage_8366_ap-1.fw
Binary files differ
diff --git a/mwl8k/fmimage_8366_ap-2.fw b/mwl8k/fmimage_8366_ap-2.fw
new file mode 100644
index 0000000..8aea2d9
--- /dev/null
+++ b/mwl8k/fmimage_8366_ap-2.fw
Binary files differ
diff --git a/mwl8k/fmimage_8366_ap-3.fw b/mwl8k/fmimage_8366_ap-3.fw
new file mode 100644
index 0000000..c4a5926
--- /dev/null
+++ b/mwl8k/fmimage_8366_ap-3.fw
Binary files differ
diff --git a/mwl8k/fmimage_8687.fw b/mwl8k/fmimage_8687.fw
new file mode 100644
index 0000000..f0f16d5
--- /dev/null
+++ b/mwl8k/fmimage_8687.fw
Binary files differ
diff --git a/mwl8k/fmimage_8764_ap-1.fw b/mwl8k/fmimage_8764_ap-1.fw
new file mode 100644
index 0000000..064c8ce
--- /dev/null
+++ b/mwl8k/fmimage_8764_ap-1.fw
Binary files differ
diff --git a/mwl8k/helper_8366.fw b/mwl8k/helper_8366.fw
new file mode 100644
index 0000000..fe7efb5
--- /dev/null
+++ b/mwl8k/helper_8366.fw
Binary files differ
diff --git a/mwl8k/helper_8687.fw b/mwl8k/helper_8687.fw
new file mode 100644
index 0000000..a0221fb
--- /dev/null
+++ b/mwl8k/helper_8687.fw
Binary files differ
diff --git a/myri10ge_eth_z8e.dat b/myri10ge_eth_z8e.dat
new file mode 100644
index 0000000..0e6c3db
--- /dev/null
+++ b/myri10ge_eth_z8e.dat
Binary files differ
diff --git a/myri10ge_ethp_z8e.dat b/myri10ge_ethp_z8e.dat
new file mode 100644
index 0000000..43f49d3
--- /dev/null
+++ b/myri10ge_ethp_z8e.dat
Binary files differ
diff --git a/myri10ge_rss_eth_z8e.dat b/myri10ge_rss_eth_z8e.dat
new file mode 100644
index 0000000..fb2aa74
--- /dev/null
+++ b/myri10ge_rss_eth_z8e.dat
Binary files differ
diff --git a/myri10ge_rss_ethp_z8e.dat b/myri10ge_rss_ethp_z8e.dat
new file mode 100644
index 0000000..4617632
--- /dev/null
+++ b/myri10ge_rss_ethp_z8e.dat
Binary files differ
diff --git a/myricom/lanai.bin b/myricom/lanai.bin
new file mode 100644
index 0000000..ea09642
--- /dev/null
+++ b/myricom/lanai.bin
Binary files differ
diff --git a/ositech/Xilinx7OD.bin b/ositech/Xilinx7OD.bin
new file mode 100644
index 0000000..42de944
--- /dev/null
+++ b/ositech/Xilinx7OD.bin
@@ -0,0 +1 @@
+ÿ 6óìÿÿÿßûÿóÿÿÿï?ÿ÷ÿÿÿÿïþÿÎþþþþÞ½ÝýÿýÏ÷¿ÿ?þ¿ÿÿÿ¼ÿÿ½µ¿¿ÿïÿÿÿûÿ÷÷ÿÿÿÿþÞþþúÞ½ýíýýÏïïïïÇßßßßßÿ~þý}mîþ|ûôûÏÛßÿÿ»ÿÿ÷ÿž¿;¿¿~oßïõöýöõíëÿïïï~oÿþþþþþï¿ÿÿÿÿÿÿÿÿÿÿ¼îÿ¼·ÿßÿßï;ãÓÿûÿÿßÿÿÿº¿-Û½ýÛßúûÿïûÛóÿßýïûÿÿ¾¿'ºþûßÿöÿÿïûÛóٚ?ÿ¯¿ÿÿ¾?7½–ÿÿÿÿÿÿ®ûóóëÿÿÿÿÿÿ÷ú¼®þ¾þ»ýÿï÷û»×÷ÿ÷ÿÿ÷¼íý½}{û{{û¯ÿþýýþþÿÿÿÿ÷ª¹¿¿ßÿÿÿÏûëËëîÿÿ×ÿÿÿ>3?|üÿÿÿÿÿÏÓóãóûÿÿÿÿÿëþ5?=ýýÿÿÿ¿ÿïoãããïÿÿßÿÿ÷þ>^þÿÿÿÿýÿÿ¯ÏòËώÿÿÿÿÿýü>ž­ýÿÿ¿ÿÿïÿ³÷ç÷úÿÿÿÿÿî뫯ŸãÿÞÿîÿÿû:úÿòwÿÿ÷þÿþ½®Þ}}ýÿ¿îÿýÿÛûÿ÷ïûÿÿþÿ-¯¹ýyûúÿ¿ïÿÿ‘úûß÷÷ÿÿÿüÏ7¿¿ÿÿÿÿ¯ÿÿóûûÿõïÿÿ÷úÿÿîúþûUÝÿ¯þÿûûõÿ÷ïÿÿÿ¾½½½½}{{{{û®ÿýþÿÿÿÿÿÿÿ÷Ú·aÿ¹Yósóßoßï÷ëë×ÿ×ÿÿ÷þû>8söüÿÿÏÿ·û³³gÿçýÿïö·¼õ{ö÷õÿÿïÿ÷ÿ÷ÎçÿŸÿÿõþ}ÿ_ÿÿÿÿÿÿÿïÿöËÛîþÿßÿÿÿþ¾>þÿ}þÿÿï¿çÿããÿßçÿÿÿ¸ï·/îÿßÿ¿ÿïë¿£Óÿÿÿÿÿ÷¾ý?Ïýûÿÿÿÿÿ¯û¿»¿Ûýûÿÿÿÿ>þ?ººþÿÿÿïÿïò›ÿÿÿÿþÿÿ<ÿ?<ÿþÿÿÿÿÿ¯óþóãëÿÿÿûÿ÷šþ¯ž¾þÿßÿÿ{ï÷¿ûûûÿÿÿÿÿ¼½ý½Ý}{{{{û®ÿÿÿþþÿýÿÿÿ÷šÿŸÿ¯ïÿÿÿÿÏóÿëÿëÿÿ¿ÿÿïþÿ7ü¿ÿÿÿÿÿÿÏïýóÿîþÿÿÿÿÿný/ýÿýÿÿÿÿÿïÏÿó¿iÿÿÿÿÿÿþûŸÿ¿ýÿÿÿÿÿï‡þÚïÏÿÿÿÿÿÿþï¿ïïýÿÿÿÿÿïýÿ{ÿëþÿÿÿÿëøÿï¯ÿÿ½ÿÿÿîïÿ»ÿ¿ûÿÿÿ÷öû½ýÝõÿÿÿÿÿ¯ÿ_õßÿÿÿÿÿÿöóÿÞþïýÿÿÿÿïÿÞß_ßýÿÿÿÿÿþÿÿþþÿýÿÿÿÿ¯ÿÿïíÿßÿÿûÿÿÚ½¾®þýßÿÿïÿûûû÷ÿÿÿÿ÷¼ý½½½ý{{{{û®ÿÿýÿÿÿýÿÿÿÿúŸ¿¿Ïÿÿÿÿÿ¯ÿëëëÿ×þÿÿ¿çþ¿üÿÿíÿÿÿÿOÿûûÿÿÝÿÿÿÿÿþ½ßýß¹ÿÿÿÿïÿûïëÿÞÿÿÿÿÿöŸÿüþûýÿÿÿÿïßúÍÏ¿Ÿÿÿÿÿ÷þ¿ÿßï_ÿÿÿÿoÿ»ýÿÿÿÿÿÿÿÿ~ÿ_ÿ¿¿ùÿÿÿn{ÿïýëßÿÿÿÿ÷¶>üý¿~ûÿÿÿ÷ï÷ó÷ÿûÿÿÿÿÿÿn5yÿ¿üÿÿÿÿÿïûSßÿë¿ÿÿÿÿÿ¼ÿÿÿ¿ÿýÿÿÿÿ¯õÿ÷ÿûÿÿÿÿÿÿºªîþ?}ýÿÿÿ¯wûûÿû÷ÿÿÿÿ÷¾½½½½ý{{{{û®ÿïÿÿÿÿüÿÿÿÿšÙ¸ÿÿyÿÿÿÿÿÏûÿëÿë×ÿÿÿÿçÞøûþ?ûýÿÿÿÿÏ­¿úÿsßÿÿÿÿÿ:õ·ü?ùýÿÿÿïóÿ¿þóŸþÿÿÿ÷>ÿÿÿ¿ÿÿÿÿÿÿ¯ÓþÛÿÛßÿÿÿÿÿ>ÿ¿ÿÿýÿÿÿÿóÿíÿ÷ûÿÿÿÿïö<þÿÿÿÿÿÿÿŸïïÑÿÿÿÿÿÿÿÿÿ~¿ýÿÿÿÿÿÿÿ»ïßñÿÿÿÿÿÿÿÿÿî>þÿÿÿÿÿÿÿ¿ïýÃÿÿÿÿÿÿÿ¿ÿü>þÿÿÿÿÿÿÿÿ.ïóÿÿÿÿÿÿÿÿ÷º¾þÿÿÿÿÿÿÿ¯ûûýÿÿÿþÿÿÿòÖí½½½}{{{{û¯ßÿÿÿÿÿÿÿÿÿÿ’¿ÿÿÿÿÿÿÿÿ¯ëëÿÿÿÿÿÿÿÿçþ.þÿÿÿÿÿÿÿÿOïóÿÿÿÿÿÿÿÿÿþ<þÿÿÿÿÿÿÿÿïÎÃýÿÿÿÿÿÿÿÿþ]ÿÿÿÿÿÿÿÿÿïÏëÿÿÿÿÿÿÿÿ÷î>ÿÿÿÿÿÿÿÿïßâÿÿÿûÿÿÿÿÿö¾üÿÿÿÿÿÿÿî_æÿÿÿÿÿÿÿÿÿ>}ÿÿÿÿÿÿÿÿÿïóûÿÿÿÿÿÿÿ¿÷6¾þÿÿÿÿÿÿÿÿïÓöþÿÿÿÿÿÿÿÿüîÿÿÿÿÿÿÿÿ¯ïëÿÿÿÿÿÿÿÿÿº¾þÿÿÿÿÿÿÿÿîûúÿÿÿÿÿÿÿÿ÷Öý½½½}{{{{û®ÿ~ÿÿÿÿÿÿÿÿ÷º¿ÿÿÿÿÿÿÿÿïëkÿÿÿÿÿÿÿÿ÷þ¾þÿÿÿÿÿÿÿÿOï÷ÿÿÿÿÿÿÿÿï>nüÿÿÿÿÿÿÿÿïÃÉÿÿÿÿÿÿÿÿÿ>¿ÿÿÿÿÿÿÿÿÿïûÕÿÿÿÿÿÿÿÿÿþþþÿÿÿÿÿÿÿÿoïûÿÿÿûÿÿÿÿÿößÿÿÿÿÿÿÿþïÿÿÿÿÿÿÿÿÿçÿþÿ÷ÿÿÿÿÿÿúï¿ÿÿÿÿÿÿÿÿçÿþÿÿÿÿÿÿÿÿþï¿ÿÿÿÿÿÿÿÿ§ÿü÷ÿÿÿÿÿÿÿþ®ÿÿýÿÿÿÿÿÿç÷úÿýÿÿÿÿÿÿÿ¯ÿÿÿÿÿÿÿÿÿÿ÷¾½½½½}{{{{û¯ÿÿÿÿÿÿÿÿÿÿÊÿÿÿÿÿÿÿÿÿoÿÿÿÿÿÿÿÿÿÿçþÿÿÿÿÿÿÿÿÿÿÏþÿÿÿÿÿÿÿÿÿÿþßÿÿÿÿÿÿÿÿÿïÿþÿÿÿÿÿÿÿÿÿþÿÿÿÿÿÿÿÿÿÿïÿÿÿÿÿÿÿÿÿÿ÷þÿÿÿÿÿÿÿÿÿÿïÿþÿÿÿûÿÿÿÿçòüïÿÿÿÿÿÿÿ®ïÿÿÿÿÿÿÿÿÿ÷~ýÿÿÿÿÿÿÿÿÿïÿþÿÿÿ¿ÿÿÿ¿ÿþþÿÿÿÿÿÿÿÿßïÝþÿÿÿÿÿÿÿÿÿþþÿÿÿÿÿÿÿÿÿ¯ïÿÿÿÿÿÿÿÿÿÿºþÿÿÿÿÿÿÿÿÿïúþÿÿÿÿÿÿÿÿöœ½½½½}{{{{û®ÿÿÿÿÿÿÿÿÿÿ÷zÿÿÿÿßÿÿÿÿoï÷ÿÿÿßÿÿÿÿÿ÷þþÿÿÿßÿÿÿÿÿÏëÿÿÿÿÿÿÿÿÿïžüÿÿÿÿÿÿÿÿÿïïÿÿÿÿÿÿÿÿÿÿþÿÿÿÿÿÿÿÿÿïËÿÿÿÿÿýÿÿÿÿ¾ýÿÿÿÿÿÿÿÿÿïïÿÿÿßÿÿÿÿÿÿøÿÿÿÿ¿ÿÿÿÿÿïÿÿÿÿÿÿÿÿÿÿÿþÿÿÿÿÿÿÿÿÿû¯ÿÿÿßÿÿÿÿÿÿþïÿÿÿÿÿÿÿÿÿïÿÿÿÿÿÿÿÿÿ¿ÿþÿÿÿÿÿÿÿÿÿÿ®ÿÿÿÿÿÿÿÿÿÿ÷úÿÿÿÿÿÿÿÿÿïÿÿÿÿÿÿÿÿÿÿ÷¼½½½½}{{{{û¯ÿÿÿÿÿÿÿÿÿÿ÷úÿÿÿÿÿÿÿÿÿ¯ÿÿÿÿÿÿÿÿÿïþÿÿÿÿÿÿÿÿÿÿÏÿÿÿÿÿÿÿÿÿÿÿþÿÿÿÿÿÿûÿÿÿïÿÿÿÿÿÿÿÿÿÿÿþÿÿÿÿÿÿÿÿÿÿïÿÿÿÿÿÿ¿ÿÿÿÿüÿÿÿÿÿÿÿÿÿÿïÿÿÿÿÿûÿÿÿÿïþÿŸŸŸ?????ÿïßßßßÏ·¿¿¿¿ÿ¼¹½½}{{{{ûï×õóñÑeããã£ÿþþÞÞÿ½½½½ßïû÷óóóçççççûþÿÿÿÿÿÿÿÿÿÿÿÿ
\ No newline at end of file
diff --git a/phanfw.bin b/phanfw.bin
new file mode 100644
index 0000000..1649473
--- /dev/null
+++ b/phanfw.bin
Binary files differ
diff --git a/ql2100_fw.bin b/ql2100_fw.bin
new file mode 100644
index 0000000..a2b51b8
--- /dev/null
+++ b/ql2100_fw.bin
Binary files differ
diff --git a/ql2200_fw.bin b/ql2200_fw.bin
new file mode 100644
index 0000000..87cc832
--- /dev/null
+++ b/ql2200_fw.bin
Binary files differ
diff --git a/ql2300_fw.bin b/ql2300_fw.bin
new file mode 100644
index 0000000..ac9be2d
--- /dev/null
+++ b/ql2300_fw.bin
Binary files differ
diff --git a/ql2322_fw.bin b/ql2322_fw.bin
new file mode 100644
index 0000000..96f5304
--- /dev/null
+++ b/ql2322_fw.bin
Binary files differ
diff --git a/ql2400_fw.bin b/ql2400_fw.bin
new file mode 100644
index 0000000..5f1eb98
--- /dev/null
+++ b/ql2400_fw.bin
Binary files differ
diff --git a/ql2500_fw.bin b/ql2500_fw.bin
new file mode 100644
index 0000000..dd9f1ad
--- /dev/null
+++ b/ql2500_fw.bin
Binary files differ
diff --git a/qlogic/1040.bin b/qlogic/1040.bin
new file mode 100644
index 0000000..01366ea
--- /dev/null
+++ b/qlogic/1040.bin
Binary files differ
diff --git a/qlogic/12160.bin b/qlogic/12160.bin
new file mode 100644
index 0000000..7f7f255
--- /dev/null
+++ b/qlogic/12160.bin
Binary files differ
diff --git a/qlogic/1280.bin b/qlogic/1280.bin
new file mode 100644
index 0000000..62d2994
--- /dev/null
+++ b/qlogic/1280.bin
Binary files differ
diff --git a/qlogic/isp1000.bin b/qlogic/isp1000.bin
new file mode 100644
index 0000000..1f4c3c6
--- /dev/null
+++ b/qlogic/isp1000.bin
Binary files differ
diff --git a/qlogic/sd7220.fw b/qlogic/sd7220.fw
new file mode 100644
index 0000000..b9ca3cf
--- /dev/null
+++ b/qlogic/sd7220.fw
Binary files differ
diff --git a/r128/r128_cce.bin b/r128/r128_cce.bin
new file mode 100644
index 0000000..18b00b7
--- /dev/null
+++ b/r128/r128_cce.bin
Binary files differ
diff --git a/radeon/ARUBA_me.bin b/radeon/ARUBA_me.bin
new file mode 100644
index 0000000..6817fcb
--- /dev/null
+++ b/radeon/ARUBA_me.bin
Binary files differ
diff --git a/radeon/ARUBA_pfp.bin b/radeon/ARUBA_pfp.bin
new file mode 100644
index 0000000..541dc20
--- /dev/null
+++ b/radeon/ARUBA_pfp.bin
Binary files differ
diff --git a/radeon/ARUBA_rlc.bin b/radeon/ARUBA_rlc.bin
new file mode 100644
index 0000000..3582fe6
--- /dev/null
+++ b/radeon/ARUBA_rlc.bin
Binary files differ
diff --git a/radeon/BARTS_mc.bin b/radeon/BARTS_mc.bin
new file mode 100644
index 0000000..5ba9568
--- /dev/null
+++ b/radeon/BARTS_mc.bin
Binary files differ
diff --git a/radeon/BARTS_me.bin b/radeon/BARTS_me.bin
new file mode 100644
index 0000000..439cefc
--- /dev/null
+++ b/radeon/BARTS_me.bin
Binary files differ
diff --git a/radeon/BARTS_pfp.bin b/radeon/BARTS_pfp.bin
new file mode 100644
index 0000000..2377f17
--- /dev/null
+++ b/radeon/BARTS_pfp.bin
Binary files differ
diff --git a/radeon/BARTS_smc.bin b/radeon/BARTS_smc.bin
new file mode 100644
index 0000000..a4d1e08
--- /dev/null
+++ b/radeon/BARTS_smc.bin
Binary files differ
diff --git a/radeon/BONAIRE_ce.bin b/radeon/BONAIRE_ce.bin
new file mode 100644
index 0000000..7d40fbf
--- /dev/null
+++ b/radeon/BONAIRE_ce.bin
Binary files differ
diff --git a/radeon/BONAIRE_mc.bin b/radeon/BONAIRE_mc.bin
new file mode 100644
index 0000000..a3c7047
--- /dev/null
+++ b/radeon/BONAIRE_mc.bin
Binary files differ
diff --git a/radeon/BONAIRE_me.bin b/radeon/BONAIRE_me.bin
new file mode 100644
index 0000000..75bff89
--- /dev/null
+++ b/radeon/BONAIRE_me.bin
Binary files differ
diff --git a/radeon/BONAIRE_mec.bin b/radeon/BONAIRE_mec.bin
new file mode 100644
index 0000000..65fd6fb
--- /dev/null
+++ b/radeon/BONAIRE_mec.bin
Binary files differ
diff --git a/radeon/BONAIRE_pfp.bin b/radeon/BONAIRE_pfp.bin
new file mode 100644
index 0000000..e12a1af
--- /dev/null
+++ b/radeon/BONAIRE_pfp.bin
Binary files differ
diff --git a/radeon/BONAIRE_rlc.bin b/radeon/BONAIRE_rlc.bin
new file mode 100644
index 0000000..7e32235
--- /dev/null
+++ b/radeon/BONAIRE_rlc.bin
Binary files differ
diff --git a/radeon/BONAIRE_sdma.bin b/radeon/BONAIRE_sdma.bin
new file mode 100644
index 0000000..4766a2a
--- /dev/null
+++ b/radeon/BONAIRE_sdma.bin
Binary files differ
diff --git a/radeon/BONAIRE_smc.bin b/radeon/BONAIRE_smc.bin
new file mode 100644
index 0000000..c735c6f
--- /dev/null
+++ b/radeon/BONAIRE_smc.bin
Binary files differ
diff --git a/radeon/BONAIRE_uvd.bin b/radeon/BONAIRE_uvd.bin
new file mode 100644
index 0000000..0876de9
--- /dev/null
+++ b/radeon/BONAIRE_uvd.bin
Binary files differ
diff --git a/radeon/BTC_rlc.bin b/radeon/BTC_rlc.bin
new file mode 100644
index 0000000..e529a72
--- /dev/null
+++ b/radeon/BTC_rlc.bin
Binary files differ
diff --git a/radeon/CAICOS_mc.bin b/radeon/CAICOS_mc.bin
new file mode 100644
index 0000000..5ba9568
--- /dev/null
+++ b/radeon/CAICOS_mc.bin
Binary files differ
diff --git a/radeon/CAICOS_me.bin b/radeon/CAICOS_me.bin
new file mode 100644
index 0000000..439cefc
--- /dev/null
+++ b/radeon/CAICOS_me.bin
Binary files differ
diff --git a/radeon/CAICOS_pfp.bin b/radeon/CAICOS_pfp.bin
new file mode 100644
index 0000000..f417d5c
--- /dev/null
+++ b/radeon/CAICOS_pfp.bin
Binary files differ
diff --git a/radeon/CAICOS_smc.bin b/radeon/CAICOS_smc.bin
new file mode 100644
index 0000000..bc8840c
--- /dev/null
+++ b/radeon/CAICOS_smc.bin
Binary files differ
diff --git a/radeon/CAYMAN_mc.bin b/radeon/CAYMAN_mc.bin
new file mode 100644
index 0000000..f3839f0
--- /dev/null
+++ b/radeon/CAYMAN_mc.bin
Binary files differ
diff --git a/radeon/CAYMAN_me.bin b/radeon/CAYMAN_me.bin
new file mode 100644
index 0000000..07f8dc3
--- /dev/null
+++ b/radeon/CAYMAN_me.bin
Binary files differ
diff --git a/radeon/CAYMAN_pfp.bin b/radeon/CAYMAN_pfp.bin
new file mode 100644
index 0000000..2e49c4f
--- /dev/null
+++ b/radeon/CAYMAN_pfp.bin
Binary files differ
diff --git a/radeon/CAYMAN_rlc.bin b/radeon/CAYMAN_rlc.bin
new file mode 100644
index 0000000..d7f3ceb
--- /dev/null
+++ b/radeon/CAYMAN_rlc.bin
Binary files differ
diff --git a/radeon/CAYMAN_smc.bin b/radeon/CAYMAN_smc.bin
new file mode 100644
index 0000000..5e1c2e5
--- /dev/null
+++ b/radeon/CAYMAN_smc.bin
Binary files differ
diff --git a/radeon/CEDAR_me.bin b/radeon/CEDAR_me.bin
new file mode 100644
index 0000000..a526806
--- /dev/null
+++ b/radeon/CEDAR_me.bin
Binary files differ
diff --git a/radeon/CEDAR_pfp.bin b/radeon/CEDAR_pfp.bin
new file mode 100644
index 0000000..f9b8263
--- /dev/null
+++ b/radeon/CEDAR_pfp.bin
Binary files differ
diff --git a/radeon/CEDAR_rlc.bin b/radeon/CEDAR_rlc.bin
new file mode 100644
index 0000000..674e580
--- /dev/null
+++ b/radeon/CEDAR_rlc.bin
Binary files differ
diff --git a/radeon/CEDAR_smc.bin b/radeon/CEDAR_smc.bin
new file mode 100644
index 0000000..1ad1f4e
--- /dev/null
+++ b/radeon/CEDAR_smc.bin
Binary files differ
diff --git a/radeon/CYPRESS_me.bin b/radeon/CYPRESS_me.bin
new file mode 100644
index 0000000..fd6cc24
--- /dev/null
+++ b/radeon/CYPRESS_me.bin
Binary files differ
diff --git a/radeon/CYPRESS_pfp.bin b/radeon/CYPRESS_pfp.bin
new file mode 100644
index 0000000..b162957
--- /dev/null
+++ b/radeon/CYPRESS_pfp.bin
Binary files differ
diff --git a/radeon/CYPRESS_rlc.bin b/radeon/CYPRESS_rlc.bin
new file mode 100644
index 0000000..674e580
--- /dev/null
+++ b/radeon/CYPRESS_rlc.bin
Binary files differ
diff --git a/radeon/CYPRESS_smc.bin b/radeon/CYPRESS_smc.bin
new file mode 100644
index 0000000..69376fa
--- /dev/null
+++ b/radeon/CYPRESS_smc.bin
Binary files differ
diff --git a/radeon/CYPRESS_uvd.bin b/radeon/CYPRESS_uvd.bin
new file mode 100644
index 0000000..570b652
--- /dev/null
+++ b/radeon/CYPRESS_uvd.bin
Binary files differ
diff --git a/radeon/HAINAN_ce.bin b/radeon/HAINAN_ce.bin
new file mode 100644
index 0000000..497e132
--- /dev/null
+++ b/radeon/HAINAN_ce.bin
Binary files differ
diff --git a/radeon/HAINAN_mc.bin b/radeon/HAINAN_mc.bin
new file mode 100644
index 0000000..a7b80c3
--- /dev/null
+++ b/radeon/HAINAN_mc.bin
Binary files differ
diff --git a/radeon/HAINAN_me.bin b/radeon/HAINAN_me.bin
new file mode 100644
index 0000000..6dc895b
--- /dev/null
+++ b/radeon/HAINAN_me.bin
Binary files differ
diff --git a/radeon/HAINAN_pfp.bin b/radeon/HAINAN_pfp.bin
new file mode 100644
index 0000000..1918d64
--- /dev/null
+++ b/radeon/HAINAN_pfp.bin
Binary files differ
diff --git a/radeon/HAINAN_rlc.bin b/radeon/HAINAN_rlc.bin
new file mode 100644
index 0000000..df07678
--- /dev/null
+++ b/radeon/HAINAN_rlc.bin
Binary files differ
diff --git a/radeon/HAINAN_smc.bin b/radeon/HAINAN_smc.bin
new file mode 100644
index 0000000..6bf5b36
--- /dev/null
+++ b/radeon/HAINAN_smc.bin
Binary files differ
diff --git a/radeon/JUNIPER_me.bin b/radeon/JUNIPER_me.bin
new file mode 100644
index 0000000..fd6cc24
--- /dev/null
+++ b/radeon/JUNIPER_me.bin
Binary files differ
diff --git a/radeon/JUNIPER_pfp.bin b/radeon/JUNIPER_pfp.bin
new file mode 100644
index 0000000..b162957
--- /dev/null
+++ b/radeon/JUNIPER_pfp.bin
Binary files differ
diff --git a/radeon/JUNIPER_rlc.bin b/radeon/JUNIPER_rlc.bin
new file mode 100644
index 0000000..674e580
--- /dev/null
+++ b/radeon/JUNIPER_rlc.bin
Binary files differ
diff --git a/radeon/JUNIPER_smc.bin b/radeon/JUNIPER_smc.bin
new file mode 100644
index 0000000..7c2c06a
--- /dev/null
+++ b/radeon/JUNIPER_smc.bin
Binary files differ
diff --git a/radeon/KABINI_ce.bin b/radeon/KABINI_ce.bin
new file mode 100644
index 0000000..7d40fbf
--- /dev/null
+++ b/radeon/KABINI_ce.bin
Binary files differ
diff --git a/radeon/KABINI_me.bin b/radeon/KABINI_me.bin
new file mode 100644
index 0000000..d1da075
--- /dev/null
+++ b/radeon/KABINI_me.bin
Binary files differ
diff --git a/radeon/KABINI_mec.bin b/radeon/KABINI_mec.bin
new file mode 100644
index 0000000..719e457
--- /dev/null
+++ b/radeon/KABINI_mec.bin
Binary files differ
diff --git a/radeon/KABINI_pfp.bin b/radeon/KABINI_pfp.bin
new file mode 100644
index 0000000..6efa138
--- /dev/null
+++ b/radeon/KABINI_pfp.bin
Binary files differ
diff --git a/radeon/KABINI_rlc.bin b/radeon/KABINI_rlc.bin
new file mode 100644
index 0000000..b0cb2bd
--- /dev/null
+++ b/radeon/KABINI_rlc.bin
Binary files differ
diff --git a/radeon/KABINI_sdma.bin b/radeon/KABINI_sdma.bin
new file mode 100644
index 0000000..4766a2a
--- /dev/null
+++ b/radeon/KABINI_sdma.bin
Binary files differ
diff --git a/radeon/KAVERI_ce.bin b/radeon/KAVERI_ce.bin
new file mode 100644
index 0000000..06d92de
--- /dev/null
+++ b/radeon/KAVERI_ce.bin
Binary files differ
diff --git a/radeon/KAVERI_me.bin b/radeon/KAVERI_me.bin
new file mode 100644
index 0000000..543dc67
--- /dev/null
+++ b/radeon/KAVERI_me.bin
Binary files differ
diff --git a/radeon/KAVERI_mec.bin b/radeon/KAVERI_mec.bin
new file mode 100644
index 0000000..002ac5c
--- /dev/null
+++ b/radeon/KAVERI_mec.bin
Binary files differ
diff --git a/radeon/KAVERI_pfp.bin b/radeon/KAVERI_pfp.bin
new file mode 100644
index 0000000..77590a1
--- /dev/null
+++ b/radeon/KAVERI_pfp.bin
Binary files differ
diff --git a/radeon/KAVERI_rlc.bin b/radeon/KAVERI_rlc.bin
new file mode 100644
index 0000000..ba84d86
--- /dev/null
+++ b/radeon/KAVERI_rlc.bin
Binary files differ
diff --git a/radeon/KAVERI_sdma.bin b/radeon/KAVERI_sdma.bin
new file mode 100644
index 0000000..4766a2a
--- /dev/null
+++ b/radeon/KAVERI_sdma.bin
Binary files differ
diff --git a/radeon/OLAND_ce.bin b/radeon/OLAND_ce.bin
new file mode 100644
index 0000000..497e132
--- /dev/null
+++ b/radeon/OLAND_ce.bin
Binary files differ
diff --git a/radeon/OLAND_mc.bin b/radeon/OLAND_mc.bin
new file mode 100644
index 0000000..a7b80c3
--- /dev/null
+++ b/radeon/OLAND_mc.bin
Binary files differ
diff --git a/radeon/OLAND_me.bin b/radeon/OLAND_me.bin
new file mode 100644
index 0000000..6dc895b
--- /dev/null
+++ b/radeon/OLAND_me.bin
Binary files differ
diff --git a/radeon/OLAND_pfp.bin b/radeon/OLAND_pfp.bin
new file mode 100644
index 0000000..496a20b
--- /dev/null
+++ b/radeon/OLAND_pfp.bin
Binary files differ
diff --git a/radeon/OLAND_rlc.bin b/radeon/OLAND_rlc.bin
new file mode 100644
index 0000000..9e575ac
--- /dev/null
+++ b/radeon/OLAND_rlc.bin
Binary files differ
diff --git a/radeon/OLAND_smc.bin b/radeon/OLAND_smc.bin
new file mode 100644
index 0000000..44c07f9
--- /dev/null
+++ b/radeon/OLAND_smc.bin
Binary files differ
diff --git a/radeon/PALM_me.bin b/radeon/PALM_me.bin
new file mode 100644
index 0000000..a03030f
--- /dev/null
+++ b/radeon/PALM_me.bin
Binary files differ
diff --git a/radeon/PALM_pfp.bin b/radeon/PALM_pfp.bin
new file mode 100644
index 0000000..94d779f
--- /dev/null
+++ b/radeon/PALM_pfp.bin
Binary files differ
diff --git a/radeon/PITCAIRN_ce.bin b/radeon/PITCAIRN_ce.bin
new file mode 100644
index 0000000..497e132
--- /dev/null
+++ b/radeon/PITCAIRN_ce.bin
Binary files differ
diff --git a/radeon/PITCAIRN_mc.bin b/radeon/PITCAIRN_mc.bin
new file mode 100644
index 0000000..b14006b
--- /dev/null
+++ b/radeon/PITCAIRN_mc.bin
Binary files differ
diff --git a/radeon/PITCAIRN_me.bin b/radeon/PITCAIRN_me.bin
new file mode 100644
index 0000000..7806dcb
--- /dev/null
+++ b/radeon/PITCAIRN_me.bin
Binary files differ
diff --git a/radeon/PITCAIRN_pfp.bin b/radeon/PITCAIRN_pfp.bin
new file mode 100644
index 0000000..2f0813e
--- /dev/null
+++ b/radeon/PITCAIRN_pfp.bin
Binary files differ
diff --git a/radeon/PITCAIRN_rlc.bin b/radeon/PITCAIRN_rlc.bin
new file mode 100644
index 0000000..8070f9a
--- /dev/null
+++ b/radeon/PITCAIRN_rlc.bin
Binary files differ
diff --git a/radeon/PITCAIRN_smc.bin b/radeon/PITCAIRN_smc.bin
new file mode 100644
index 0000000..c918c88
--- /dev/null
+++ b/radeon/PITCAIRN_smc.bin
Binary files differ
diff --git a/radeon/R100_cp.bin b/radeon/R100_cp.bin
new file mode 100644
index 0000000..f1e8a11
--- /dev/null
+++ b/radeon/R100_cp.bin
Binary files differ
diff --git a/radeon/R200_cp.bin b/radeon/R200_cp.bin
new file mode 100644
index 0000000..8ac88c6
--- /dev/null
+++ b/radeon/R200_cp.bin
Binary files differ
diff --git a/radeon/R300_cp.bin b/radeon/R300_cp.bin
new file mode 100644
index 0000000..b1b1100
--- /dev/null
+++ b/radeon/R300_cp.bin
Binary files differ
diff --git a/radeon/R420_cp.bin b/radeon/R420_cp.bin
new file mode 100644
index 0000000..bfeff60
--- /dev/null
+++ b/radeon/R420_cp.bin
Binary files differ
diff --git a/radeon/R520_cp.bin b/radeon/R520_cp.bin
new file mode 100644
index 0000000..1c93ca9
--- /dev/null
+++ b/radeon/R520_cp.bin
Binary files differ
diff --git a/radeon/R600_me.bin b/radeon/R600_me.bin
new file mode 100644
index 0000000..3939685
--- /dev/null
+++ b/radeon/R600_me.bin
Binary files differ
diff --git a/radeon/R600_pfp.bin b/radeon/R600_pfp.bin
new file mode 100644
index 0000000..b1b2e95
--- /dev/null
+++ b/radeon/R600_pfp.bin
Binary files differ
diff --git a/radeon/R600_rlc.bin b/radeon/R600_rlc.bin
new file mode 100644
index 0000000..4b023f3
--- /dev/null
+++ b/radeon/R600_rlc.bin
Binary files differ
diff --git a/radeon/R700_rlc.bin b/radeon/R700_rlc.bin
new file mode 100644
index 0000000..bf028ae
--- /dev/null
+++ b/radeon/R700_rlc.bin
Binary files differ
diff --git a/radeon/REDWOOD_me.bin b/radeon/REDWOOD_me.bin
new file mode 100644
index 0000000..3208c8e
--- /dev/null
+++ b/radeon/REDWOOD_me.bin
Binary files differ
diff --git a/radeon/REDWOOD_pfp.bin b/radeon/REDWOOD_pfp.bin
new file mode 100644
index 0000000..f9b8263
--- /dev/null
+++ b/radeon/REDWOOD_pfp.bin
Binary files differ
diff --git a/radeon/REDWOOD_rlc.bin b/radeon/REDWOOD_rlc.bin
new file mode 100644
index 0000000..674e580
--- /dev/null
+++ b/radeon/REDWOOD_rlc.bin
Binary files differ
diff --git a/radeon/REDWOOD_smc.bin b/radeon/REDWOOD_smc.bin
new file mode 100644
index 0000000..5c835de
--- /dev/null
+++ b/radeon/REDWOOD_smc.bin
Binary files differ
diff --git a/radeon/RS600_cp.bin b/radeon/RS600_cp.bin
new file mode 100644
index 0000000..171ecac
--- /dev/null
+++ b/radeon/RS600_cp.bin
Binary files differ
diff --git a/radeon/RS690_cp.bin b/radeon/RS690_cp.bin
new file mode 100644
index 0000000..38f11b4
--- /dev/null
+++ b/radeon/RS690_cp.bin
Binary files differ
diff --git a/radeon/RS780_me.bin b/radeon/RS780_me.bin
new file mode 100644
index 0000000..67292bf
--- /dev/null
+++ b/radeon/RS780_me.bin
Binary files differ
diff --git a/radeon/RS780_pfp.bin b/radeon/RS780_pfp.bin
new file mode 100644
index 0000000..7d89878
--- /dev/null
+++ b/radeon/RS780_pfp.bin
Binary files differ
diff --git a/radeon/RV610_me.bin b/radeon/RV610_me.bin
new file mode 100644
index 0000000..66d265c
--- /dev/null
+++ b/radeon/RV610_me.bin
Binary files differ
diff --git a/radeon/RV610_pfp.bin b/radeon/RV610_pfp.bin
new file mode 100644
index 0000000..18c3546
--- /dev/null
+++ b/radeon/RV610_pfp.bin
Binary files differ
diff --git a/radeon/RV620_me.bin b/radeon/RV620_me.bin
new file mode 100644
index 0000000..66d265c
--- /dev/null
+++ b/radeon/RV620_me.bin
Binary files differ
diff --git a/radeon/RV620_pfp.bin b/radeon/RV620_pfp.bin
new file mode 100644
index 0000000..18c3546
--- /dev/null
+++ b/radeon/RV620_pfp.bin
Binary files differ
diff --git a/radeon/RV630_me.bin b/radeon/RV630_me.bin
new file mode 100644
index 0000000..9ded757
--- /dev/null
+++ b/radeon/RV630_me.bin
Binary files differ
diff --git a/radeon/RV630_pfp.bin b/radeon/RV630_pfp.bin
new file mode 100644
index 0000000..18c3546
--- /dev/null
+++ b/radeon/RV630_pfp.bin
Binary files differ
diff --git a/radeon/RV635_me.bin b/radeon/RV635_me.bin
new file mode 100644
index 0000000..9ded757
--- /dev/null
+++ b/radeon/RV635_me.bin
Binary files differ
diff --git a/radeon/RV635_pfp.bin b/radeon/RV635_pfp.bin
new file mode 100644
index 0000000..18c3546
--- /dev/null
+++ b/radeon/RV635_pfp.bin
Binary files differ
diff --git a/radeon/RV670_me.bin b/radeon/RV670_me.bin
new file mode 100644
index 0000000..109b675
--- /dev/null
+++ b/radeon/RV670_me.bin
Binary files differ
diff --git a/radeon/RV670_pfp.bin b/radeon/RV670_pfp.bin
new file mode 100644
index 0000000..18c3546
--- /dev/null
+++ b/radeon/RV670_pfp.bin
Binary files differ
diff --git a/radeon/RV710_me.bin b/radeon/RV710_me.bin
new file mode 100644
index 0000000..da259e0
--- /dev/null
+++ b/radeon/RV710_me.bin
Binary files differ
diff --git a/radeon/RV710_pfp.bin b/radeon/RV710_pfp.bin
new file mode 100644
index 0000000..925b36d
--- /dev/null
+++ b/radeon/RV710_pfp.bin
Binary files differ
diff --git a/radeon/RV710_smc.bin b/radeon/RV710_smc.bin
new file mode 100644
index 0000000..5679b82
--- /dev/null
+++ b/radeon/RV710_smc.bin
Binary files differ
diff --git a/radeon/RV710_uvd.bin b/radeon/RV710_uvd.bin
new file mode 100644
index 0000000..93a931c
--- /dev/null
+++ b/radeon/RV710_uvd.bin
Binary files differ
diff --git a/radeon/RV730_me.bin b/radeon/RV730_me.bin
new file mode 100644
index 0000000..09b8eae
--- /dev/null
+++ b/radeon/RV730_me.bin
Binary files differ
diff --git a/radeon/RV730_pfp.bin b/radeon/RV730_pfp.bin
new file mode 100644
index 0000000..925b36d
--- /dev/null
+++ b/radeon/RV730_pfp.bin
Binary files differ
diff --git a/radeon/RV730_smc.bin b/radeon/RV730_smc.bin
new file mode 100644
index 0000000..4daf985
--- /dev/null
+++ b/radeon/RV730_smc.bin
Binary files differ
diff --git a/radeon/RV740_smc.bin b/radeon/RV740_smc.bin
new file mode 100644
index 0000000..8f416d9
--- /dev/null
+++ b/radeon/RV740_smc.bin
Binary files differ
diff --git a/radeon/RV770_me.bin b/radeon/RV770_me.bin
new file mode 100644
index 0000000..ae8c8d9
--- /dev/null
+++ b/radeon/RV770_me.bin
Binary files differ
diff --git a/radeon/RV770_pfp.bin b/radeon/RV770_pfp.bin
new file mode 100644
index 0000000..e835372
--- /dev/null
+++ b/radeon/RV770_pfp.bin
Binary files differ
diff --git a/radeon/RV770_smc.bin b/radeon/RV770_smc.bin
new file mode 100644
index 0000000..50955ca
--- /dev/null
+++ b/radeon/RV770_smc.bin
Binary files differ
diff --git a/radeon/SUMO2_me.bin b/radeon/SUMO2_me.bin
new file mode 100644
index 0000000..0072308
--- /dev/null
+++ b/radeon/SUMO2_me.bin
Binary files differ
diff --git a/radeon/SUMO2_pfp.bin b/radeon/SUMO2_pfp.bin
new file mode 100644
index 0000000..73690ba
--- /dev/null
+++ b/radeon/SUMO2_pfp.bin
Binary files differ
diff --git a/radeon/SUMO_me.bin b/radeon/SUMO_me.bin
new file mode 100644
index 0000000..0072308
--- /dev/null
+++ b/radeon/SUMO_me.bin
Binary files differ
diff --git a/radeon/SUMO_pfp.bin b/radeon/SUMO_pfp.bin
new file mode 100644
index 0000000..b3bcb64
--- /dev/null
+++ b/radeon/SUMO_pfp.bin
Binary files differ
diff --git a/radeon/SUMO_rlc.bin b/radeon/SUMO_rlc.bin
new file mode 100644
index 0000000..61b509f
--- /dev/null
+++ b/radeon/SUMO_rlc.bin
Binary files differ
diff --git a/radeon/SUMO_uvd.bin b/radeon/SUMO_uvd.bin
new file mode 100644
index 0000000..4964c8a
--- /dev/null
+++ b/radeon/SUMO_uvd.bin
Binary files differ
diff --git a/radeon/TAHITI_ce.bin b/radeon/TAHITI_ce.bin
new file mode 100644
index 0000000..497e132
--- /dev/null
+++ b/radeon/TAHITI_ce.bin
Binary files differ
diff --git a/radeon/TAHITI_mc.bin b/radeon/TAHITI_mc.bin
new file mode 100644
index 0000000..b14006b
--- /dev/null
+++ b/radeon/TAHITI_mc.bin
Binary files differ
diff --git a/radeon/TAHITI_me.bin b/radeon/TAHITI_me.bin
new file mode 100644
index 0000000..7806dcb
--- /dev/null
+++ b/radeon/TAHITI_me.bin
Binary files differ
diff --git a/radeon/TAHITI_pfp.bin b/radeon/TAHITI_pfp.bin
new file mode 100644
index 0000000..2f0813e
--- /dev/null
+++ b/radeon/TAHITI_pfp.bin
Binary files differ
diff --git a/radeon/TAHITI_rlc.bin b/radeon/TAHITI_rlc.bin
new file mode 100644
index 0000000..cdb7437
--- /dev/null
+++ b/radeon/TAHITI_rlc.bin
Binary files differ
diff --git a/radeon/TAHITI_smc.bin b/radeon/TAHITI_smc.bin
new file mode 100644
index 0000000..a6ef51e
--- /dev/null
+++ b/radeon/TAHITI_smc.bin
Binary files differ
diff --git a/radeon/TAHITI_uvd.bin b/radeon/TAHITI_uvd.bin
new file mode 100644
index 0000000..a2dc918
--- /dev/null
+++ b/radeon/TAHITI_uvd.bin
Binary files differ
diff --git a/radeon/TURKS_mc.bin b/radeon/TURKS_mc.bin
new file mode 100644
index 0000000..5ba9568
--- /dev/null
+++ b/radeon/TURKS_mc.bin
Binary files differ
diff --git a/radeon/TURKS_me.bin b/radeon/TURKS_me.bin
new file mode 100644
index 0000000..439cefc
--- /dev/null
+++ b/radeon/TURKS_me.bin
Binary files differ
diff --git a/radeon/TURKS_pfp.bin b/radeon/TURKS_pfp.bin
new file mode 100644
index 0000000..5d9a63a
--- /dev/null
+++ b/radeon/TURKS_pfp.bin
Binary files differ
diff --git a/radeon/TURKS_smc.bin b/radeon/TURKS_smc.bin
new file mode 100644
index 0000000..d644ab6
--- /dev/null
+++ b/radeon/TURKS_smc.bin
Binary files differ
diff --git a/radeon/VERDE_ce.bin b/radeon/VERDE_ce.bin
new file mode 100644
index 0000000..497e132
--- /dev/null
+++ b/radeon/VERDE_ce.bin
Binary files differ
diff --git a/radeon/VERDE_mc.bin b/radeon/VERDE_mc.bin
new file mode 100644
index 0000000..b14006b
--- /dev/null
+++ b/radeon/VERDE_mc.bin
Binary files differ
diff --git a/radeon/VERDE_me.bin b/radeon/VERDE_me.bin
new file mode 100644
index 0000000..acb4ecd
--- /dev/null
+++ b/radeon/VERDE_me.bin
Binary files differ
diff --git a/radeon/VERDE_pfp.bin b/radeon/VERDE_pfp.bin
new file mode 100644
index 0000000..d4a2e00
--- /dev/null
+++ b/radeon/VERDE_pfp.bin
Binary files differ
diff --git a/radeon/VERDE_rlc.bin b/radeon/VERDE_rlc.bin
new file mode 100644
index 0000000..beb17b0
--- /dev/null
+++ b/radeon/VERDE_rlc.bin
Binary files differ
diff --git a/radeon/VERDE_smc.bin b/radeon/VERDE_smc.bin
new file mode 100644
index 0000000..78a154e
--- /dev/null
+++ b/radeon/VERDE_smc.bin
Binary files differ
diff --git a/rp2.fw b/rp2.fw
new file mode 100644
index 0000000..a571e77
--- /dev/null
+++ b/rp2.fw
Binary files differ
diff --git a/rt2561.bin b/rt2561.bin
new file mode 100644
index 0000000..b14bad3
--- /dev/null
+++ b/rt2561.bin
Binary files differ
diff --git a/rt2561s.bin b/rt2561s.bin
new file mode 100644
index 0000000..b0f7950
--- /dev/null
+++ b/rt2561s.bin
Binary files differ
diff --git a/rt2661.bin b/rt2661.bin
new file mode 100644
index 0000000..fe52a0b
--- /dev/null
+++ b/rt2661.bin
Binary files differ
diff --git a/rt2860.bin b/rt2860.bin
new file mode 100644
index 0000000..85030fc
--- /dev/null
+++ b/rt2860.bin
Binary files differ
diff --git a/rt2870.bin b/rt2870.bin
new file mode 100644
index 0000000..f1535d1
--- /dev/null
+++ b/rt2870.bin
Binary files differ
diff --git a/rt3070.bin b/rt3070.bin
new file mode 120000
index 0000000..d233a1d
--- /dev/null
+++ b/rt3070.bin
@@ -0,0 +1 @@
+rt2870.bin
\ No newline at end of file
diff --git a/rt3071.bin b/rt3071.bin
new file mode 100644
index 0000000..b1f44e0
--- /dev/null
+++ b/rt3071.bin
Binary files differ
diff --git a/rt3090.bin b/rt3090.bin
new file mode 120000
index 0000000..c5a9ab0
--- /dev/null
+++ b/rt3090.bin
@@ -0,0 +1 @@
+rt2860.bin
\ No newline at end of file
diff --git a/rt3290.bin b/rt3290.bin
new file mode 100644
index 0000000..6ca33a5
--- /dev/null
+++ b/rt3290.bin
Binary files differ
diff --git a/rt73.bin b/rt73.bin
new file mode 100644
index 0000000..1e395dd
--- /dev/null
+++ b/rt73.bin
Binary files differ
diff --git a/rtl_nic/rtl8105e-1.fw b/rtl_nic/rtl8105e-1.fw
new file mode 100644
index 0000000..4c2cbd0
--- /dev/null
+++ b/rtl_nic/rtl8105e-1.fw
Binary files differ
diff --git a/rtl_nic/rtl8106e-1.fw b/rtl_nic/rtl8106e-1.fw
new file mode 100644
index 0000000..85694cb
--- /dev/null
+++ b/rtl_nic/rtl8106e-1.fw
Binary files differ
diff --git a/rtl_nic/rtl8106e-2.fw b/rtl_nic/rtl8106e-2.fw
new file mode 100644
index 0000000..ac04275
--- /dev/null
+++ b/rtl_nic/rtl8106e-2.fw
Binary files differ
diff --git a/rtl_nic/rtl8168d-1.fw b/rtl_nic/rtl8168d-1.fw
new file mode 100644
index 0000000..99e002d
--- /dev/null
+++ b/rtl_nic/rtl8168d-1.fw
Binary files differ
diff --git a/rtl_nic/rtl8168d-2.fw b/rtl_nic/rtl8168d-2.fw
new file mode 100644
index 0000000..7022ab0
--- /dev/null
+++ b/rtl_nic/rtl8168d-2.fw
Binary files differ
diff --git a/rtl_nic/rtl8168e-1.fw b/rtl_nic/rtl8168e-1.fw
new file mode 100644
index 0000000..d203bd5
--- /dev/null
+++ b/rtl_nic/rtl8168e-1.fw
Binary files differ
diff --git a/rtl_nic/rtl8168e-2.fw b/rtl_nic/rtl8168e-2.fw
new file mode 100644
index 0000000..7ea5984
--- /dev/null
+++ b/rtl_nic/rtl8168e-2.fw
Binary files differ
diff --git a/rtl_nic/rtl8168e-3.fw b/rtl_nic/rtl8168e-3.fw
new file mode 100644
index 0000000..0f888a3
--- /dev/null
+++ b/rtl_nic/rtl8168e-3.fw
Binary files differ
diff --git a/rtl_nic/rtl8168f-1.fw b/rtl_nic/rtl8168f-1.fw
new file mode 100644
index 0000000..bf78831
--- /dev/null
+++ b/rtl_nic/rtl8168f-1.fw
Binary files differ
diff --git a/rtl_nic/rtl8168f-2.fw b/rtl_nic/rtl8168f-2.fw
new file mode 100644
index 0000000..c342492
--- /dev/null
+++ b/rtl_nic/rtl8168f-2.fw
Binary files differ
diff --git a/rtl_nic/rtl8168g-1.fw b/rtl_nic/rtl8168g-1.fw
new file mode 100644
index 0000000..2c628b0
--- /dev/null
+++ b/rtl_nic/rtl8168g-1.fw
Binary files differ
diff --git a/rtl_nic/rtl8168g-2.fw b/rtl_nic/rtl8168g-2.fw
new file mode 100644
index 0000000..944d44e
--- /dev/null
+++ b/rtl_nic/rtl8168g-2.fw
Binary files differ
diff --git a/rtl_nic/rtl8168g-3.fw b/rtl_nic/rtl8168g-3.fw
new file mode 100644
index 0000000..0c97d7e
--- /dev/null
+++ b/rtl_nic/rtl8168g-3.fw
Binary files differ
diff --git a/rtl_nic/rtl8402-1.fw b/rtl_nic/rtl8402-1.fw
new file mode 100644
index 0000000..82fa35d
--- /dev/null
+++ b/rtl_nic/rtl8402-1.fw
Binary files differ
diff --git a/rtl_nic/rtl8411-1.fw b/rtl_nic/rtl8411-1.fw
new file mode 100644
index 0000000..72772db
--- /dev/null
+++ b/rtl_nic/rtl8411-1.fw
Binary files differ
diff --git a/rtl_nic/rtl8411-2.fw b/rtl_nic/rtl8411-2.fw
new file mode 100644
index 0000000..e3789fe
--- /dev/null
+++ b/rtl_nic/rtl8411-2.fw
Binary files differ
diff --git a/rtlwifi/rtl8188efw.bin b/rtlwifi/rtl8188efw.bin
new file mode 100644
index 0000000..ac9a430
--- /dev/null
+++ b/rtlwifi/rtl8188efw.bin
Binary files differ
diff --git a/rtlwifi/rtl8188eufw.bin b/rtlwifi/rtl8188eufw.bin
new file mode 100644
index 0000000..4ae7e1c
--- /dev/null
+++ b/rtlwifi/rtl8188eufw.bin
Binary files differ
diff --git a/rtlwifi/rtl8192cfw.bin b/rtlwifi/rtl8192cfw.bin
new file mode 100644
index 0000000..af71968
--- /dev/null
+++ b/rtlwifi/rtl8192cfw.bin
Binary files differ
diff --git a/rtlwifi/rtl8192cfwU.bin b/rtlwifi/rtl8192cfwU.bin
new file mode 100644
index 0000000..b231e1d
--- /dev/null
+++ b/rtlwifi/rtl8192cfwU.bin
Binary files differ
diff --git a/rtlwifi/rtl8192cfwU_B.bin b/rtlwifi/rtl8192cfwU_B.bin
new file mode 100644
index 0000000..5af470c
--- /dev/null
+++ b/rtlwifi/rtl8192cfwU_B.bin
Binary files differ
diff --git a/rtlwifi/rtl8192cufw.bin b/rtlwifi/rtl8192cufw.bin
new file mode 100644
index 0000000..3aa7506
--- /dev/null
+++ b/rtlwifi/rtl8192cufw.bin
Binary files differ
diff --git a/rtlwifi/rtl8192cufw_A.bin b/rtlwifi/rtl8192cufw_A.bin
new file mode 100644
index 0000000..9569d0a
--- /dev/null
+++ b/rtlwifi/rtl8192cufw_A.bin
Binary files differ
diff --git a/rtlwifi/rtl8192cufw_B.bin b/rtlwifi/rtl8192cufw_B.bin
new file mode 100644
index 0000000..96089c4
--- /dev/null
+++ b/rtlwifi/rtl8192cufw_B.bin
Binary files differ
diff --git a/rtlwifi/rtl8192cufw_TMSC.bin b/rtlwifi/rtl8192cufw_TMSC.bin
new file mode 100644
index 0000000..d1b84d4
--- /dev/null
+++ b/rtlwifi/rtl8192cufw_TMSC.bin
Binary files differ
diff --git a/rtlwifi/rtl8192defw.bin b/rtlwifi/rtl8192defw.bin
new file mode 100644
index 0000000..98e2969
--- /dev/null
+++ b/rtlwifi/rtl8192defw.bin
Binary files differ
diff --git a/rtlwifi/rtl8192sefw.bin b/rtlwifi/rtl8192sefw.bin
new file mode 100644
index 0000000..ed4afe8
--- /dev/null
+++ b/rtlwifi/rtl8192sefw.bin
Binary files differ
diff --git a/rtlwifi/rtl8712u.bin b/rtlwifi/rtl8712u.bin
new file mode 100644
index 0000000..3f965a6
--- /dev/null
+++ b/rtlwifi/rtl8712u.bin
Binary files differ
diff --git a/rtlwifi/rtl8723fw.bin b/rtlwifi/rtl8723fw.bin
new file mode 100755
index 0000000..725f213
--- /dev/null
+++ b/rtlwifi/rtl8723fw.bin
Binary files differ
diff --git a/rtlwifi/rtl8723fw_B.bin b/rtlwifi/rtl8723fw_B.bin
new file mode 100755
index 0000000..993c7f6
--- /dev/null
+++ b/rtlwifi/rtl8723fw_B.bin
Binary files differ
diff --git a/s2250.fw b/s2250.fw
new file mode 120000
index 0000000..7db3807
--- /dev/null
+++ b/s2250.fw
@@ -0,0 +1 @@
+go7007/s2250-2.fw
\ No newline at end of file
diff --git a/s2250_loader.fw b/s2250_loader.fw
new file mode 120000
index 0000000..b57ac10
--- /dev/null
+++ b/s2250_loader.fw
@@ -0,0 +1 @@
+go7007/s2250-1.fw
\ No newline at end of file
diff --git a/s5p-mfc/s5p-mfc-v6.fw b/s5p-mfc/s5p-mfc-v6.fw
new file mode 100644
index 0000000..2e1179f
--- /dev/null
+++ b/s5p-mfc/s5p-mfc-v6.fw
Binary files differ
diff --git a/s5p-mfc/s5p-mfc.fw b/s5p-mfc/s5p-mfc.fw
new file mode 100644
index 0000000..f5c8060
--- /dev/null
+++ b/s5p-mfc/s5p-mfc.fw
Binary files differ
diff --git a/sb16/alaw_main.csp b/sb16/alaw_main.csp
new file mode 100644
index 0000000..6af6d7b
--- /dev/null
+++ b/sb16/alaw_main.csp
Binary files differ
diff --git a/sb16/ima_adpcm_capture.csp b/sb16/ima_adpcm_capture.csp
new file mode 100644
index 0000000..8a7b910
--- /dev/null
+++ b/sb16/ima_adpcm_capture.csp
Binary files differ
diff --git a/sb16/ima_adpcm_init.csp b/sb16/ima_adpcm_init.csp
new file mode 100644
index 0000000..81126fd
--- /dev/null
+++ b/sb16/ima_adpcm_init.csp
Binary files differ
diff --git a/sb16/ima_adpcm_playback.csp b/sb16/ima_adpcm_playback.csp
new file mode 100644
index 0000000..2c3acfa
--- /dev/null
+++ b/sb16/ima_adpcm_playback.csp
Binary files differ
diff --git a/sb16/mulaw_main.csp b/sb16/mulaw_main.csp
new file mode 100644
index 0000000..97b162b
--- /dev/null
+++ b/sb16/mulaw_main.csp
Binary files differ
diff --git a/sdd_sagrad_1091_1098.bin b/sdd_sagrad_1091_1098.bin
new file mode 100644
index 0000000..9538576
--- /dev/null
+++ b/sdd_sagrad_1091_1098.bin
Binary files differ
diff --git a/slicoss/gbdownload.sys b/slicoss/gbdownload.sys
new file mode 100644
index 0000000..60ab75b
--- /dev/null
+++ b/slicoss/gbdownload.sys
Binary files differ
diff --git a/slicoss/gbrcvucode.sys b/slicoss/gbrcvucode.sys
new file mode 100644
index 0000000..855b23e
--- /dev/null
+++ b/slicoss/gbrcvucode.sys
Binary files differ
diff --git a/slicoss/oasisdbgdownload.sys b/slicoss/oasisdbgdownload.sys
new file mode 100644
index 0000000..4ae5023
--- /dev/null
+++ b/slicoss/oasisdbgdownload.sys
Binary files differ
diff --git a/slicoss/oasisdownload.sys b/slicoss/oasisdownload.sys
new file mode 100644
index 0000000..cdc2cc1
--- /dev/null
+++ b/slicoss/oasisdownload.sys
Binary files differ
diff --git a/slicoss/oasisrcvucode.sys b/slicoss/oasisrcvucode.sys
new file mode 100644
index 0000000..a2b9bde
--- /dev/null
+++ b/slicoss/oasisrcvucode.sys
Binary files differ
diff --git a/sun/cassini.bin b/sun/cassini.bin
new file mode 100644
index 0000000..c8cdfad
--- /dev/null
+++ b/sun/cassini.bin
Binary files differ
diff --git a/sxg/saharadbgdownloadB.sys b/sxg/saharadbgdownloadB.sys
new file mode 100644
index 0000000..d3b3ed1
--- /dev/null
+++ b/sxg/saharadbgdownloadB.sys
Binary files differ
diff --git a/sxg/saharadownloadB.sys b/sxg/saharadownloadB.sys
new file mode 100644
index 0000000..c48cb92
--- /dev/null
+++ b/sxg/saharadownloadB.sys
Binary files differ
diff --git a/tehuti/bdx.bin b/tehuti/bdx.bin
new file mode 100644
index 0000000..b7d6e23
--- /dev/null
+++ b/tehuti/bdx.bin
Binary files differ
diff --git a/ti-connectivity/TIInit_7.2.31.bts b/ti-connectivity/TIInit_7.2.31.bts
new file mode 100644
index 0000000..60679f4
--- /dev/null
+++ b/ti-connectivity/TIInit_7.2.31.bts
Binary files differ
diff --git a/ti-connectivity/wl1251-fw.bin b/ti-connectivity/wl1251-fw.bin
new file mode 100644
index 0000000..f89c983
--- /dev/null
+++ b/ti-connectivity/wl1251-fw.bin
Binary files differ
diff --git a/ti-connectivity/wl1251-nvs.bin b/ti-connectivity/wl1251-nvs.bin
new file mode 100644
index 0000000..2bf9c50
--- /dev/null
+++ b/ti-connectivity/wl1251-nvs.bin
Binary files differ
diff --git a/ti-connectivity/wl1271-fw-2.bin b/ti-connectivity/wl1271-fw-2.bin
new file mode 100644
index 0000000..a01324e
--- /dev/null
+++ b/ti-connectivity/wl1271-fw-2.bin
Binary files differ
diff --git a/ti-connectivity/wl1271-fw-ap.bin b/ti-connectivity/wl1271-fw-ap.bin
new file mode 100644
index 0000000..3a8e570
--- /dev/null
+++ b/ti-connectivity/wl1271-fw-ap.bin
Binary files differ
diff --git a/ti-connectivity/wl1271-fw.bin b/ti-connectivity/wl1271-fw.bin
new file mode 100644
index 0000000..aaafe8d
--- /dev/null
+++ b/ti-connectivity/wl1271-fw.bin
Binary files differ
diff --git a/ti-connectivity/wl1271-nvs.bin b/ti-connectivity/wl1271-nvs.bin
new file mode 120000
index 0000000..a30a076
--- /dev/null
+++ b/ti-connectivity/wl1271-nvs.bin
@@ -0,0 +1 @@
+wl127x-nvs.bin
\ No newline at end of file
diff --git a/ti-connectivity/wl127x-fw-3.bin b/ti-connectivity/wl127x-fw-3.bin
new file mode 100644
index 0000000..d2bd1b5
--- /dev/null
+++ b/ti-connectivity/wl127x-fw-3.bin
Binary files differ
diff --git a/ti-connectivity/wl127x-fw-4-mr.bin b/ti-connectivity/wl127x-fw-4-mr.bin
new file mode 100644
index 0000000..6dd7f0e
--- /dev/null
+++ b/ti-connectivity/wl127x-fw-4-mr.bin
Binary files differ
diff --git a/ti-connectivity/wl127x-fw-4-plt.bin b/ti-connectivity/wl127x-fw-4-plt.bin
new file mode 100644
index 0000000..b3b7d78
--- /dev/null
+++ b/ti-connectivity/wl127x-fw-4-plt.bin
Binary files differ
diff --git a/ti-connectivity/wl127x-fw-4-sr.bin b/ti-connectivity/wl127x-fw-4-sr.bin
new file mode 100644
index 0000000..a9d8f96
--- /dev/null
+++ b/ti-connectivity/wl127x-fw-4-sr.bin
Binary files differ
diff --git a/ti-connectivity/wl127x-fw-5-mr.bin b/ti-connectivity/wl127x-fw-5-mr.bin
new file mode 100644
index 0000000..c953fef
--- /dev/null
+++ b/ti-connectivity/wl127x-fw-5-mr.bin
Binary files differ
diff --git a/ti-connectivity/wl127x-fw-5-plt.bin b/ti-connectivity/wl127x-fw-5-plt.bin
new file mode 100644
index 0000000..1f6249f
--- /dev/null
+++ b/ti-connectivity/wl127x-fw-5-plt.bin
Binary files differ
diff --git a/ti-connectivity/wl127x-fw-5-sr.bin b/ti-connectivity/wl127x-fw-5-sr.bin
new file mode 100644
index 0000000..c83d3eb
--- /dev/null
+++ b/ti-connectivity/wl127x-fw-5-sr.bin
Binary files differ
diff --git a/ti-connectivity/wl127x-fw-plt-3.bin b/ti-connectivity/wl127x-fw-plt-3.bin
new file mode 100644
index 0000000..76fc71a
--- /dev/null
+++ b/ti-connectivity/wl127x-fw-plt-3.bin
Binary files differ
diff --git a/ti-connectivity/wl127x-nvs.bin b/ti-connectivity/wl127x-nvs.bin
new file mode 100644
index 0000000..91978f9
--- /dev/null
+++ b/ti-connectivity/wl127x-nvs.bin
Binary files differ
diff --git a/ti-connectivity/wl128x-fw-3.bin b/ti-connectivity/wl128x-fw-3.bin
new file mode 100644
index 0000000..831acc7
--- /dev/null
+++ b/ti-connectivity/wl128x-fw-3.bin
Binary files differ
diff --git a/ti-connectivity/wl128x-fw-4-mr.bin b/ti-connectivity/wl128x-fw-4-mr.bin
new file mode 100644
index 0000000..64ca8fa
--- /dev/null
+++ b/ti-connectivity/wl128x-fw-4-mr.bin
Binary files differ
diff --git a/ti-connectivity/wl128x-fw-4-plt.bin b/ti-connectivity/wl128x-fw-4-plt.bin
new file mode 100644
index 0000000..05f1317
--- /dev/null
+++ b/ti-connectivity/wl128x-fw-4-plt.bin
Binary files differ
diff --git a/ti-connectivity/wl128x-fw-4-sr.bin b/ti-connectivity/wl128x-fw-4-sr.bin
new file mode 100644
index 0000000..e3e1000
--- /dev/null
+++ b/ti-connectivity/wl128x-fw-4-sr.bin
Binary files differ
diff --git a/ti-connectivity/wl128x-fw-5-mr.bin b/ti-connectivity/wl128x-fw-5-mr.bin
new file mode 100644
index 0000000..14931ed
--- /dev/null
+++ b/ti-connectivity/wl128x-fw-5-mr.bin
Binary files differ
diff --git a/ti-connectivity/wl128x-fw-5-plt.bin b/ti-connectivity/wl128x-fw-5-plt.bin
new file mode 100644
index 0000000..54232d0
--- /dev/null
+++ b/ti-connectivity/wl128x-fw-5-plt.bin
Binary files differ
diff --git a/ti-connectivity/wl128x-fw-5-sr.bin b/ti-connectivity/wl128x-fw-5-sr.bin
new file mode 100644
index 0000000..e10a1ba
--- /dev/null
+++ b/ti-connectivity/wl128x-fw-5-sr.bin
Binary files differ
diff --git a/ti-connectivity/wl128x-fw-ap.bin b/ti-connectivity/wl128x-fw-ap.bin
new file mode 100644
index 0000000..3795717
--- /dev/null
+++ b/ti-connectivity/wl128x-fw-ap.bin
Binary files differ
diff --git a/ti-connectivity/wl128x-fw-plt-3.bin b/ti-connectivity/wl128x-fw-plt-3.bin
new file mode 100644
index 0000000..e21b825
--- /dev/null
+++ b/ti-connectivity/wl128x-fw-plt-3.bin
Binary files differ
diff --git a/ti-connectivity/wl128x-fw.bin b/ti-connectivity/wl128x-fw.bin
new file mode 100644
index 0000000..0fbf626
--- /dev/null
+++ b/ti-connectivity/wl128x-fw.bin
Binary files differ
diff --git a/ti-connectivity/wl128x-nvs.bin b/ti-connectivity/wl128x-nvs.bin
new file mode 100644
index 0000000..157c936
--- /dev/null
+++ b/ti-connectivity/wl128x-nvs.bin
Binary files differ
diff --git a/ti-connectivity/wl12xx-nvs.bin b/ti-connectivity/wl12xx-nvs.bin
new file mode 120000
index 0000000..a30a076
--- /dev/null
+++ b/ti-connectivity/wl12xx-nvs.bin
@@ -0,0 +1 @@
+wl127x-nvs.bin
\ No newline at end of file
diff --git a/ti-connectivity/wl18xx-conf.bin b/ti-connectivity/wl18xx-conf.bin
new file mode 100644
index 0000000..d3d2473
--- /dev/null
+++ b/ti-connectivity/wl18xx-conf.bin
Binary files differ
diff --git a/ti-connectivity/wl18xx-fw-2.bin b/ti-connectivity/wl18xx-fw-2.bin
new file mode 100644
index 0000000..e2a56f5
--- /dev/null
+++ b/ti-connectivity/wl18xx-fw-2.bin
Binary files differ
diff --git a/ti-connectivity/wl18xx-fw.bin b/ti-connectivity/wl18xx-fw.bin
new file mode 100644
index 0000000..ac1e24e
--- /dev/null
+++ b/ti-connectivity/wl18xx-fw.bin
Binary files differ
diff --git a/ti_3410.fw b/ti_3410.fw
new file mode 100644
index 0000000..044bf35
--- /dev/null
+++ b/ti_3410.fw
Binary files differ
diff --git a/ti_5052.fw b/ti_5052.fw
new file mode 100644
index 0000000..f4dbf8e
--- /dev/null
+++ b/ti_5052.fw
Binary files differ
diff --git a/tigon/tg3.bin b/tigon/tg3.bin
new file mode 100644
index 0000000..0b8ae5a
--- /dev/null
+++ b/tigon/tg3.bin
Binary files differ
diff --git a/tigon/tg357766.bin b/tigon/tg357766.bin
new file mode 100644
index 0000000..b7816a0
--- /dev/null
+++ b/tigon/tg357766.bin
Binary files differ
diff --git a/tigon/tg3_tso.bin b/tigon/tg3_tso.bin
new file mode 100644
index 0000000..3c481c9
--- /dev/null
+++ b/tigon/tg3_tso.bin
Binary files differ
diff --git a/tigon/tg3_tso5.bin b/tigon/tg3_tso5.bin
new file mode 100644
index 0000000..fb77f0f
--- /dev/null
+++ b/tigon/tg3_tso5.bin
Binary files differ
diff --git a/tlg2300_firmware.bin b/tlg2300_firmware.bin
new file mode 100644
index 0000000..79bd2a5
--- /dev/null
+++ b/tlg2300_firmware.bin
Binary files differ
diff --git a/tr_smctr.bin b/tr_smctr.bin
new file mode 100644
index 0000000..23d843c
--- /dev/null
+++ b/tr_smctr.bin
Binary files differ
diff --git a/ttusb-budget/dspbootcode.bin b/ttusb-budget/dspbootcode.bin
new file mode 100644
index 0000000..f8ce544
--- /dev/null
+++ b/ttusb-budget/dspbootcode.bin
Binary files differ
diff --git a/ueagle-atm/930-fpga.bin b/ueagle-atm/930-fpga.bin
new file mode 100644
index 0000000..678ba13
--- /dev/null
+++ b/ueagle-atm/930-fpga.bin
Binary files differ
diff --git a/ueagle-atm/CMV4p.bin.v2 b/ueagle-atm/CMV4p.bin.v2
new file mode 100644
index 0000000..ad788ae
--- /dev/null
+++ b/ueagle-atm/CMV4p.bin.v2
Binary files differ
diff --git a/ueagle-atm/CMV9i.bin b/ueagle-atm/CMV9i.bin
new file mode 100644
index 0000000..a0e00a6
--- /dev/null
+++ b/ueagle-atm/CMV9i.bin
Binary files differ
diff --git a/ueagle-atm/CMV9p.bin b/ueagle-atm/CMV9p.bin
new file mode 100644
index 0000000..e90a7f6
--- /dev/null
+++ b/ueagle-atm/CMV9p.bin
Binary files differ
diff --git a/ueagle-atm/CMVei.bin b/ueagle-atm/CMVei.bin
new file mode 100644
index 0000000..0604472
--- /dev/null
+++ b/ueagle-atm/CMVei.bin
Binary files differ
diff --git a/ueagle-atm/CMVeiWO.bin b/ueagle-atm/CMVeiWO.bin
new file mode 100644
index 0000000..0604472
--- /dev/null
+++ b/ueagle-atm/CMVeiWO.bin
Binary files differ
diff --git a/ueagle-atm/CMVep.bin b/ueagle-atm/CMVep.bin
new file mode 100644
index 0000000..0e35011
--- /dev/null
+++ b/ueagle-atm/CMVep.bin
Binary files differ
diff --git a/ueagle-atm/CMVepES.bin b/ueagle-atm/CMVepES.bin
new file mode 100644
index 0000000..2971d90
--- /dev/null
+++ b/ueagle-atm/CMVepES.bin
Binary files differ
diff --git a/ueagle-atm/CMVepES03.bin b/ueagle-atm/CMVepES03.bin
new file mode 100644
index 0000000..ef79ab8
--- /dev/null
+++ b/ueagle-atm/CMVepES03.bin
Binary files differ
diff --git a/ueagle-atm/CMVepFR.bin b/ueagle-atm/CMVepFR.bin
new file mode 100644
index 0000000..45de784
--- /dev/null
+++ b/ueagle-atm/CMVepFR.bin
Binary files differ
diff --git a/ueagle-atm/CMVepFR04.bin b/ueagle-atm/CMVepFR04.bin
new file mode 100644
index 0000000..b616480
--- /dev/null
+++ b/ueagle-atm/CMVepFR04.bin
Binary files differ
diff --git a/ueagle-atm/CMVepFR10.bin b/ueagle-atm/CMVepFR10.bin
new file mode 100644
index 0000000..e11d955
--- /dev/null
+++ b/ueagle-atm/CMVepFR10.bin
Binary files differ
diff --git a/ueagle-atm/CMVepIT.bin b/ueagle-atm/CMVepIT.bin
new file mode 100644
index 0000000..02c70f0
--- /dev/null
+++ b/ueagle-atm/CMVepIT.bin
Binary files differ
diff --git a/ueagle-atm/CMVepWO.bin b/ueagle-atm/CMVepWO.bin
new file mode 100644
index 0000000..45de784
--- /dev/null
+++ b/ueagle-atm/CMVepWO.bin
Binary files differ
diff --git a/ueagle-atm/DSP4p.bin b/ueagle-atm/DSP4p.bin
new file mode 100644
index 0000000..29712c5
--- /dev/null
+++ b/ueagle-atm/DSP4p.bin
Binary files differ
diff --git a/ueagle-atm/DSP9i.bin b/ueagle-atm/DSP9i.bin
new file mode 100644
index 0000000..a4c2bc1
--- /dev/null
+++ b/ueagle-atm/DSP9i.bin
Binary files differ
diff --git a/ueagle-atm/DSP9p.bin b/ueagle-atm/DSP9p.bin
new file mode 100644
index 0000000..dc9bfcb
--- /dev/null
+++ b/ueagle-atm/DSP9p.bin
Binary files differ
diff --git a/ueagle-atm/DSPei.bin b/ueagle-atm/DSPei.bin
new file mode 100644
index 0000000..7cf16d1
--- /dev/null
+++ b/ueagle-atm/DSPei.bin
Binary files differ
diff --git a/ueagle-atm/DSPep.bin b/ueagle-atm/DSPep.bin
new file mode 100644
index 0000000..7ec918a
--- /dev/null
+++ b/ueagle-atm/DSPep.bin
Binary files differ
diff --git a/ueagle-atm/adi930.fw b/ueagle-atm/adi930.fw
new file mode 100644
index 0000000..4f5da61
--- /dev/null
+++ b/ueagle-atm/adi930.fw
Binary files differ
diff --git a/ueagle-atm/eagleI.fw b/ueagle-atm/eagleI.fw
new file mode 100644
index 0000000..6b1d4ff
--- /dev/null
+++ b/ueagle-atm/eagleI.fw
Binary files differ
diff --git a/ueagle-atm/eagleII.fw b/ueagle-atm/eagleII.fw
new file mode 100644
index 0000000..f2cf77f
--- /dev/null
+++ b/ueagle-atm/eagleII.fw
Binary files differ
diff --git a/ueagle-atm/eagleIII.fw b/ueagle-atm/eagleIII.fw
new file mode 100644
index 0000000..7f5f4d6
--- /dev/null
+++ b/ueagle-atm/eagleIII.fw
Binary files differ
diff --git a/ueagle-atm/eagleIV.fw b/ueagle-atm/eagleIV.fw
new file mode 100644
index 0000000..26517e5
--- /dev/null
+++ b/ueagle-atm/eagleIV.fw
Binary files differ
diff --git a/usbdux/Makefile_dux b/usbdux/Makefile_dux
new file mode 100644
index 0000000..1dc0939
--- /dev/null
+++ b/usbdux/Makefile_dux
@@ -0,0 +1,22 @@
+# (c) Bernd Porr
+# GNU public license
+# no warranty
+#
+
+all: as31 usbduxfast_firmware.bin usbdux_firmware.bin usbduxsigma_firmware.bin
+
+as31:
+	make -C as31-2.1
+
+usbduxfast_firmware.bin: fx2-include.asm usbduxfast_firmware.asm as31
+	as31-2.1/as31 -Fbin usbduxfast_firmware.asm
+
+usbdux_firmware.bin: fx2-include.asm usbdux_firmware.asm as31
+	as31-2.1/as31 -Fbin usbdux_firmware.asm
+
+usbduxsigma_firmware.bin: fx2-include.asm usbduxsigma_firmware.asm as31
+	as31-2.1/as31 -Fbin usbduxsigma_firmware.asm
+
+clean:
+	rm -f *.bin *~ *.lst *.bin
+	make -C as31-2.1 clean
diff --git a/usbdux/README.dux b/usbdux/README.dux
new file mode 100644
index 0000000..b3c8c05
--- /dev/null
+++ b/usbdux/README.dux
@@ -0,0 +1,15 @@
+To compile the firmware for the USBDUX,USBDUXfast and USBDUXsigma
+-----------------------------------------------------------------
+Download the as31 from:
+
+http://www.berndporr.me.uk/as31/
+
+(this is a patched version of as31 which supports an
+include directive).
+
+Install it in this directory.
+
+Then run "make -f Makefile_dux".
+
+Feedback:
+BerndPorr@f2s.com
diff --git a/usbdux/fx2-include.asm b/usbdux/fx2-include.asm
new file mode 100644
index 0000000..9877996
--- /dev/null
+++ b/usbdux/fx2-include.asm
@@ -0,0 +1,164 @@
+; rev 0.91
+; (c) Bernd Porr, BerndPorr@f2s.com
+; GPL, GNU public license
+;
+;   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; if not, write to the Free Software
+;   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+;
+; In conjunction with the as31.
+; Include-file for the FX2 by Cypress. The rest of the regs is defined
+; by the as31 itself.
+;
+; from the TRM of the FX2:
+;
+	;;  CPU control
+	.equ	CPUCS,0E600H
+	.equ	REVCTL,0E60BH
+	;; interface config
+	.equ	IFCONFIG,0E601H
+	.equ	FIFORESET,0E604H
+	;; Endpoint configs
+	.equ	EP1OUTCFG,0E610H
+	.equ	EP1INCFG,0E611H
+	.equ	EP2CFG,0E612H
+	.equ	EP4CFG,0E613H
+	.equ	EP6CFG,0E614H
+	.equ	EP8CFG,0E615H
+	;; packets per frame, always one for USB 1.1
+	.equ	EP2ISOINPKTS,0E640H
+	.equ	EP4ISOINPKTS,0E641H
+	.equ	EP6ISOINPKTS,0E642H
+	.equ	EP8ISOINPKTS,0E643H
+	;; endpoint byte counts
+	.equ	EP1OUTBC,0E68DH
+	.equ	EP2BCH,0E690H
+	.equ	EP2BCL,0E691H
+	.equ	EP4BCH,0E694H
+	.equ	EP4BCL,0E695H
+	.equ	EP6BCH,0E698H
+	.equ	EP6BCL,0E699H
+	.equ	EP8BCH,0E69CH
+	.equ	EP8BCL,0E69DH
+	;;
+	.equ	EP4AUTOINLENH,0E622H
+	.equ	EP4AUTOINLENL,0E623H
+	.equ	EP6AUTOINLENH,0E624H
+	.equ	EP6AUTOINLENL,0E625H
+	.equ	EP2FIFOCFG,0E618H
+	.equ	EP4FIFOCFG,0E619H
+	.equ	EP6FIFOCFG,0E61AH
+	.equ	EP8FIFOCFG,0E61BH
+	;; 
+	.equ	INPKTEND,0E648H
+	.equ	OUTPKTEND,0E649H
+	.equ	GPIFCTLCFG,0E6C3H
+	.equ	GPIFABORT,0E6F5H
+	.equ	GPIFIDLECTL,0E6C2H
+	.equ	GPIFWFSELECT,0E6C0H
+	.equ	GPIFREADYCFG,0E6F3H
+	.equ	GPIFIDLECS,0E6C1H
+	.equ	EP6GPIFFLGSEL,0E6E2H
+	.equ	EP6GPIFPDFSTOP,0E6E3H
+	.equ	EP6GPIFTRIG,0E6E4H
+	.equ	GPIFTCB3,0E6CEH
+	.equ	GPIFTCB2,0E6CFH
+	.equ	GPIFTCB1,0E6D0H
+	.equ	GPIFTCB0,0E6D1H
+	.equ	EP4GPIFFLGSEL,0E6DAH
+	.equ	EP4GPIFPFSTOP,0E6DBH
+	;; 
+	;; endpoint control
+	.equ	EP2CS,0E6A3H
+	.equ	EP4CS,0E6A4H
+	.equ	EP6CS,0E6A5H
+	.equ	EP8CS,0E6A6H
+	;; endpoint buffers
+	.equ	EP2FIFOBUF,0F000H
+	.equ	EP4FIFOBUF,0F400H
+	.equ	EP6FIFOBUF,0F800H
+	.equ	EP8FIFOBUF,0FC00H
+	;; IRQ enable for bulk NAK
+	.equ	IBNIE,0E658H
+	;; interrupt requ for NAK
+	.equ	IBNIRQ,0E659H
+	;; USB INT enables
+	.equ	USBIE,0E65CH
+	;; USB interrupt request
+	.equ	USBIRQ,0E65DH
+	;; endpoint IRQ enable
+	.equ	EPIE,0E65EH
+	;; endpoint IRQ requests
+	.equ	EPIRQ,0E65FH
+	;; USB error IRQ requests
+	.equ	USBERRIE,0E662H
+	;; USB error IRQ request
+	.equ	USBERRIRQ,0E663H
+	;; USB interrupt 2 autovector
+	.equ	INT2IVEC,0E666H
+	;; autovector enable
+	.equ	INTSETUP,0E668H
+	;; port cfg
+	.equ	PORTACFG,0E670H
+	.equ	PORTCCFG,0E671H
+	.equ	PORTECFG,0E672H
+	;; I2C bus
+	.equ	I2CS,0E678H
+	.equ	I2DAT,0E679H
+	.equ	I2CTL,0E67AH
+	;; auto pointers, read/write is directed to the pointed address
+	.equ	XAUTODAT1,0E67BH
+	.equ	XAUTODAT2,0E67CH
+	;; USB-control
+	.equ	USBCS,0E680H
+
+	.equ	IOA,80H
+	.equ	DPL0,82H
+	.equ	DPH0,83H
+	.equ	DPL1,84H
+	.equ	DPH1,85H
+	.equ	DPS,86H
+	.equ	CKCON,8Eh
+	.equ	IOB,90H
+	.equ	EXIF,91h
+	.equ	MPAGE,92h
+	.equ	AUTOPTRH1,9AH
+	.equ	AUTOPTRL1,9BH
+	.equ	AUTOPTRH2,9DH
+	.equ	AUTOPTRL2,9EH
+	.equ	IOC,0A0H
+	.equ	INT2CLR,0A1H
+	.equ	INT4CLR,0A2H
+	.equ	EP2468STAT,0AAH
+	.equ	EP24FIFOFLGS,0ABH
+	.equ	EP68FIFOFLGS,0ACH
+	.equ	AUTOPTRSETUP,0AFH
+	.equ	IOD,0B0H
+	.equ	IOE,0B1H
+	.equ	OEA,0B2H
+	.equ	OEB,0B3H
+	.equ	OEC,0B4H
+	.equ	OED,0B5H
+	.equ	OEE,0B6H
+	.equ	GPIFTRIG,0BBH
+	.equ	EIE,0E8h
+	.equ	EIP,0F8h
+	.equ	GPIFIE,0E660H
+
+;;; serial control
+	.equ	SCON0,098h
+	.equ	SBUF0,099h
+
+	;;; end of file
+	
+
diff --git a/usbdux/usbdux_firmware.asm b/usbdux/usbdux_firmware.asm
new file mode 100644
index 0000000..b93a895
--- /dev/null
+++ b/usbdux/usbdux_firmware.asm
@@ -0,0 +1,1184 @@
+;   usbdux_firmware.asm
+;   Copyright (C) 2004,2009 Bernd Porr, Bernd.Porr@f2s.com
+;   For usbdux.c
+;
+;   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; if not, write to the Free Software
+;   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+;
+;
+; Firmware: usbdux_firmware.asm for usbdux.c
+; Description: University of Stirling USB DAQ & INCITE Technology Limited
+; Devices: [ITL] USB-DUX (usbdux.o)
+; Author: Bernd Porr <Bernd.Porr@f2s.com>
+; Updated: 17 Apr 2009
+; Status: stable
+;
+;;;
+;;;
+;;;
+
+	.inc	fx2-include.asm
+
+	.equ	CHANNELLIST,80h	; channellist in indirect memory
+	
+	.equ	CMD_FLAG,90h	; flag if next IN transf is DIO
+	.equ	SGLCHANNEL,91h	; channel for INSN
+	.equ	PWMFLAG,92h	; PWM
+	
+	.equ	DIOSTAT0,98h	; last status of the digital port
+	.equ	DIOSTAT1,99h	; same for the second counter
+	
+	.equ	CTR0,0A0H	; counter 0
+	.equ	CTR1,0A2H	; counter 1
+			
+	.org	0000h		; after reset the processor starts here
+	ljmp	main		; jump to the main loop
+
+	.org	000bh		; timer 0 irq
+	ljmp	timer0_isr
+
+	.org	0043h		; the IRQ2-vector
+	ljmp	jmptbl		; irq service-routine
+	
+	.org	0100h		; start of the jump table
+
+jmptbl:	ljmp	sudav_isr
+	nop
+	ljmp	sof_isr
+	nop
+	ljmp	sutok_isr
+	nop
+	ljmp	suspend_isr
+	nop
+	ljmp	usbreset_isr
+	nop
+	ljmp	hispeed_isr
+	nop
+	ljmp	ep0ack_isr
+	nop
+	ljmp	spare_isr
+	nop
+	ljmp	ep0in_isr
+	nop
+	ljmp	ep0out_isr
+	nop
+	ljmp	ep1in_isr
+	nop
+	ljmp	ep1out_isr
+	nop
+	ljmp	ep2_isr
+	nop
+	ljmp	ep4_isr
+	nop
+	ljmp	ep6_isr
+	nop
+	ljmp	ep8_isr
+	nop
+	ljmp	ibn_isr
+	nop
+	ljmp	spare_isr
+	nop
+	ljmp	ep0ping_isr
+	nop
+	ljmp	ep1ping_isr
+	nop
+	ljmp	ep2ping_isr
+	nop
+	ljmp	ep4ping_isr
+	nop
+	ljmp	ep6ping_isr
+	nop
+	ljmp	ep8ping_isr
+	nop
+	ljmp	errlimit_isr
+	nop
+	ljmp	spare_isr
+	nop
+	ljmp	spare_isr
+	nop
+	ljmp	spare_isr
+	nop
+	ljmp	ep2isoerr_isr
+	nop
+	ljmp	ep4isoerr_isr
+	nop
+	ljmp	ep6isoerr_isr
+	nop
+	ljmp	ep8isoerr_isr
+
+	
+	;; dummy isr
+sudav_isr:	
+sutok_isr:	
+suspend_isr:	
+usbreset_isr:	
+hispeed_isr:	
+ep0ack_isr:	
+spare_isr:	
+ep0in_isr:	
+ep0out_isr:	
+ep1in_isr:	
+ibn_isr:	
+ep0ping_isr:	
+ep1ping_isr:	
+ep2ping_isr:	
+ep4ping_isr:	
+ep6ping_isr:	
+ep8ping_isr:	
+errlimit_isr:	
+ep2isoerr_isr:	
+ep4isoerr_isr:	
+ep6isoerr_isr:	
+ep8isoerr_isr:
+ep6_isr:
+ep2_isr:
+ep4_isr:	
+
+	push	dps
+	push	dpl
+	push	dph
+	push	dpl1
+	push	dph1
+	push	acc
+	push	psw
+
+	;; clear the USB2 irq bit and return
+	mov	a,EXIF
+	clr	acc.4
+	mov	EXIF,a
+
+	pop	psw
+	pop	acc 
+	pop	dph1 
+	pop	dpl1
+	pop	dph 
+	pop	dpl 
+	pop	dps
+	
+	reti
+
+		
+;;; main program
+;;; basically only initialises the processor and
+;;; then engages in an endless loop
+main:
+	mov	DPTR,#CPUCS	; CPU control register
+	mov	a,#00010000b	; 48Mhz
+	lcall	syncdelaywr
+
+        mov     dptr,#REVCTL
+        mov     a,#00000011b    ; allows skip
+        lcall   syncdelaywr
+
+	mov	IP,#0		; all std 8051 int have low priority
+	mov	EIP,#0FFH	; all FX2 interrupts have high priority
+	
+	mov	dptr,#INTSETUP	; IRQ setup register
+	mov	a,#08h		; enable autovector
+	lcall	syncdelaywr
+
+	lcall	initAD		; init the ports to the converters
+
+	lcall	initeps		; init the isochronous data-transfer
+
+	lcall	init_timer
+	
+mloop2:	nop
+
+;;; pwm
+	mov	r0,#PWMFLAG	; pwm on?
+	mov	a,@r0		; get info
+	jz	mloop2		; it's off
+
+	mov	a,GPIFTRIG	; GPIF status
+	anl	a,#80h		; done bit
+	jz	mloop2		; GPIF still busy
+
+        mov     a,#01h		; WR,EP4, 01 = EP4
+        mov     GPIFTRIG,a	; restart it
+
+	sjmp	mloop2		; loop for ever
+
+
+;;; GPIF waveform for PWM
+waveform:
+	;;      0     1     2     3     4     5     6     7(not used)
+	;; len (gives 50.007Hz)
+	.db	195,  195,  195,  195,  195,  195,  1,    1
+
+	;; opcode
+	.db	002H, 006H, 002H, 002H, 002H, 002H, 002H, 002H
+	
+	;; out
+	.db	0ffH, 0ffH, 0ffH, 0ffH, 0ffH, 0ffH, 0ffH, 0ffH
+
+	;; log
+	.db	000H, 000H, 000H, 000H, 000H, 000H, 000H, 000H
+
+
+stopPWM:
+	mov	r0,#PWMFLAG	; flag for PWM
+	mov	a,#0		; PWM (for the main loop)
+	mov	@r0,a		; set it
+
+	mov	dptr,#IFCONFIG	; switch off GPIF
+	mov	a,#10000000b	; gpif, 30MHz, internal IFCLK
+	lcall	syncdelaywr
+	ret
+	
+
+;;; init PWM
+startPWM:
+	mov	dptr,#IFCONFIG	; switch on IFCLK signal
+	mov	a,#10000010b	; gpif, 30MHz, internal IFCLK
+	lcall	syncdelaywr
+
+	mov	OEB,0FFH	; output to port B
+
+	mov	DPTR,#EP4CFG
+	mov	a,#10100000b	; valid, out, bulk
+	movx	@DPTR,a
+
+	;; reset the endpoint
+	mov	dptr,#FIFORESET
+	mov	a,#80h		; NAK
+	lcall	syncdelaywr
+	mov	a,#84h		; reset EP4 + NAK
+	lcall	syncdelaywr
+	mov	a,#0		; normal op
+	lcall	syncdelaywr
+
+	mov	dptr,#EP4BCL
+	mov	a,#0H		; discard packets
+	lcall	syncdelaywr	; empty FIFO buffer
+	lcall	syncdelaywr	; empty FIFO buffer
+
+	;; aborts all transfers by the GPIF
+	mov	dptr,#GPIFABORT
+	mov	a,#0ffh		; abort all transfers
+	lcall	syncdelaywr
+
+	;; wait for GPIF to finish
+wait_f_abort:
+	mov	a,GPIFTRIG	; GPIF status
+	anl	a,#80h		; done bit
+	jz	wait_f_abort	; GPIF busy
+
+        mov     dptr,#GPIFCTLCFG
+        mov     a,#10000000b    ; tri state for CTRL
+        lcall   syncdelaywr
+
+        mov     dptr,#GPIFIDLECTL
+        mov     a,#11110000b    ; all CTL outputs low
+        lcall   syncdelaywr
+
+	;; abort if FIFO is empty
+        mov     a,#00000001b    ; abort if empty
+        mov     dptr,#EP4GPIFFLGSEL
+        lcall   syncdelaywr
+
+	;; 
+        mov     a,#00000001b    ; stop if GPIF flg
+        mov     dptr,#EP4GPIFPFSTOP
+        lcall   syncdelaywr
+
+	;; transaction counter
+	mov	a,#0ffH
+	mov	dptr,#GPIFTCB3
+	lcall	syncdelaywr
+
+	;; transaction counter
+	mov	a,#0ffH
+	mov	dptr,#GPIFTCB2
+	lcall	syncdelaywr
+
+	;; transaction counter
+	mov	a,#0ffH		; 512 bytes
+	mov	dptr,#GPIFTCB1
+	lcall	syncdelaywr
+
+	;; transaction counter
+	mov	a,#0ffH
+	mov	dptr,#GPIFTCB0
+	lcall	syncdelaywr
+
+	;; RDY pins. Not used here.
+        mov     a,#0
+        mov     dptr,#GPIFREADYCFG
+        lcall   syncdelaywr
+
+	;; drives the output in the IDLE state
+        mov     a,#1
+        mov     dptr,#GPIFIDLECS
+        lcall   syncdelaywr
+
+	;; direct data transfer from the EP to the GPIF
+	mov	dptr,#EP4FIFOCFG
+	mov	a,#00010000b	; autoout=1, byte-wide
+	lcall	syncdelaywr
+
+	;; waveform 0 is used for FIFO out
+	mov	dptr,#GPIFWFSELECT
+	mov	a,#00000000b
+	movx	@dptr,a
+	lcall	syncdelay
+
+	;; transfer the delay byte from the EP to the waveform
+	mov	dptr,#0e781h	; EP1 buffer
+	movx	a,@dptr		; get the delay
+	mov	dptr,#waveform	; points to the waveform
+	mov	r2,#6		; fill 6 bytes
+timloop:
+	movx	@dptr,a		; save timing in a xxx
+	inc	dptr
+	djnz	r2,timloop	; fill the 6 delay bytes
+
+	;; load waveform
+        mov     AUTOPTRH2,#0E4H ; XDATA0H
+        lcall   syncdelay
+        mov     AUTOPTRL2,#00H  ; XDATA0L
+        lcall   syncdelay
+
+	mov	dptr,#waveform	; points to the waveform
+	
+        mov     AUTOPTRSETUP,#7 ; autoinc and enable
+        lcall   syncdelay
+
+        mov     r2,#20H         ; 32 bytes to transfer
+
+wavetr:
+        movx    a,@dptr
+	inc	dptr
+	push	dpl
+	push	dph
+	push	dpl1
+	push	dph1
+        mov     dptr,#XAUTODAT2
+        movx    @dptr,a
+        lcall   syncdelay
+	pop	dph1 
+	pop	dpl1
+	pop	dph 
+	pop	dpl
+        djnz    r2,wavetr
+
+	mov	dptr,#OUTPKTEND
+	mov	a,#084H
+	lcall	syncdelaywr
+	lcall	syncdelaywr
+
+	mov	r0,#PWMFLAG	; flag for PWM
+	mov	a,#1		; PWM (for the main loop)
+	mov	@r0,a		; set it
+
+	ret
+
+
+
+;;; initialise the ports for the AD-converter
+initAD:
+	mov	OEA,#27H	;PortA0,A1,A2,A5 Outputs
+	mov	IOA,#22H	;/CS = 1, disable transfers to the converters
+	ret
+
+
+;;; init the timer for the soft counters
+init_timer:
+	;; init the timer for 2ms sampling rate
+	mov	CKCON,#00000001b; CLKOUT/12 for timer
+	mov	TL0,#010H	; 16
+	mov	TH0,#0H		; 256
+	mov	IE,#82H		; switch on timer interrupt (80H for all IRQs)
+	mov	TMOD,#00000000b	; 13 bit counters
+	setb	TCON.4		; enable timer 0
+	ret
+
+
+;;; from here it's only IRQ handling...
+	
+;;; A/D-conversion:
+;;; control-byte in a,
+;;; result in r3(low) and r4(high)
+;;; this routine is optimised for speed
+readAD:				; mask the control byte
+	anl	a,#01111100b	; only the channel, gain+pol are left
+	orl	a,#10000001b	; start bit, external clock
+	;; set CS to low
+	clr	IOA.1		; set /CS to zero
+	;; send the control byte to the AD-converter
+	mov 	R2,#8		; bit-counter
+bitlp:	jnb     ACC.7,bitzero	; jump if Bit7 = 0?
+	setb	IOA.2		; set the DIN bit
+	sjmp	clock		; continue with the clock
+bitzero:clr	IOA.2		; clear the DIN bit
+clock:	setb	IOA.0		; SCLK = 1
+	clr	IOA.0		; SCLK = 0
+        rl      a               ; next Bit
+        djnz    R2,bitlp
+
+	;; continue the aquisition (already started)
+	clr	IOA.2		; clear the DIN bit
+	mov 	R2,#5		; five steps for the aquision
+clockaq:setb	IOA.0		; SCLK = 1
+	clr	IOA.0		; SCLK = 0
+        djnz    R2,clockaq	; loop
+	
+	;; read highbyte from the A/D-converter
+	;; and do the conversion
+	mov	r4,#0 		; Highbyte goes into R4
+	mov	R2,#4		; COUNTER 4 data bits in the MSB
+	mov	r5,#08h		; create bit-mask
+gethi:				; loop get the 8 highest bits from MSB downw
+	setb	IOA.0		; SCLK = 1
+	clr	IOA.0		; SCLK = 0
+	mov	a,IOA		; from port A
+	jnb	ACC.4,zerob	; the in-bit is zero
+	mov	a,r4		; get the byte
+	orl	a,r5		; or the bit to the result
+	mov	r4,a		; save it again in r4
+zerob:	mov	a,r5		; get r5 in order to shift the mask
+	rr	a		; rotate right
+	mov	r5,a		; back to r5
+	djnz	R2,gethi
+	;; read the lowbyte from the A/D-converter
+	mov	r3,#0 		; Lowbyte goes into R3
+	mov	r2,#8		; COUNTER 8 data-bits in the LSB
+	mov	r5,#80h		; create bit-mask
+getlo:				; loop get the 8 highest bits from MSB downw
+	setb	IOA.0		; SCLK = 1
+	clr	IOA.0		; SCLK = 0
+	mov	a,IOA		; from port A
+	jnb	ACC.4,zerob2	; the in-bit is zero
+	mov	a,r3		; get the result-byte
+	orl	a,r5		; or the bit to the result
+	mov	r3,a		; save it again in r4
+zerob2:	mov	a,r5		; get r5 in order to shift the mask
+	rr	a		; rotate right
+	mov	r5,a		; back to r5
+	djnz	R2,getlo
+	setb	IOA.1		; set /CS to one
+	;;
+	ret
+	
+
+	
+;;; aquires data from A/D channels and stores them in the EP6 buffer
+conv_ad:
+	mov	AUTOPTRH1,#0F8H	; auto pointer on EP6
+	mov	AUTOPTRL1,#00H
+	mov	AUTOPTRSETUP,#7
+	mov	r0,#CHANNELLIST	; points to the channellist
+
+	mov	a,@r0		; number of channels
+	mov	r1,a		; counter
+
+	mov 	DPTR,#XAUTODAT1	; auto pointer
+convloop:
+	inc	r0
+	mov 	a,@r0		; Channel
+	lcall 	readAD
+	mov 	a,R3		;
+	movx 	@DPTR,A
+	mov 	a,R4		;
+	movx 	@DPTR,A
+	djnz	r1,convloop
+
+	ret
+
+
+
+
+;;; initilise the transfer
+;;; It is assumed that the USB interface is in alternate setting 3
+initeps:
+	mov	dptr,#FIFORESET
+	mov	a,#80H		
+	movx	@dptr,a		; reset all fifos
+	mov	a,#2	
+	movx	@dptr,a		; 
+	mov	a,#4		
+	movx	@dptr,a		; 
+	mov	a,#6		
+	movx	@dptr,a		; 
+	mov	a,#8		
+	movx	@dptr,a		; 
+	mov	a,#0		
+	movx	@dptr,a		; normal operat
+	
+	mov	DPTR,#EP2CFG
+	mov	a,#10010010b	; valid, out, double buff, iso
+	movx	@DPTR,a
+
+	mov	dptr,#EP2FIFOCFG
+	mov	a,#00000000b	; manual
+	movx	@dptr,a
+
+	mov	dptr,#EP2BCL	; "arm" it
+	mov	a,#00h
+	movx	@DPTR,a		; can receive data
+	lcall	syncdelay	; wait to sync
+	movx	@DPTR,a		; can receive data
+	lcall	syncdelay	; wait to sync
+	movx	@DPTR,a		; can receive data
+	lcall	syncdelay	; wait to sync
+	
+	mov	DPTR,#EP1OUTCFG
+	mov	a,#10100000b	; valid
+	movx	@dptr,a
+
+	mov	dptr,#EP1OUTBC	; "arm" it
+	mov	a,#00h
+	movx	@DPTR,a		; can receive data
+	lcall	syncdelay	; wait until we can write again
+	movx	@dptr,a		; make shure its really empty
+	lcall	syncdelay	; wait
+
+	mov	DPTR,#EP6CFG	; ISO data from here to the host
+	mov	a,#11010010b	; Valid
+	movx	@DPTR,a		; ISO transfer, double buffering
+
+	mov	DPTR,#EP8CFG	; EP8
+	mov	a,#11100000b	; BULK data from here to the host
+	movx	@DPTR,a		;
+
+	mov	dptr,#EPIE	; interrupt enable
+	mov	a,#10001000b	; enable irq for ep1out,8
+	movx	@dptr,a		; do it
+
+	mov	dptr,#EPIRQ	; clear IRQs
+	mov	a,#10100000b
+	movx	@dptr,a
+
+	;; enable interrups
+        mov     DPTR,#USBIE	; USB int enables register
+        mov     a,#2            ; enables SOF (1ms/125us interrupt)
+        movx    @DPTR,a         ; 
+
+	mov	EIE,#00000001b	; enable INT2 in the 8051's SFR
+	mov	IE,#80h		; IE, enable all interrupts
+
+	ret
+
+
+;;; counter
+;;; r0: DIOSTAT
+;;; r1:	counter address
+;;; r2:	up/down-mask
+;;; r3:	reset-mask
+;;; r4:	clock-mask
+counter:	
+	mov	a,IOB		; actual IOB input state
+	mov	r5,a		; save in r5
+	anl	a,r3		; bit mask for reset
+	jz	no_reset	; reset if one
+	clr	a		; set counter to zero
+	mov	@r1,a
+	inc	r4
+	mov	@r1,a
+	sjmp	ctr_end
+no_reset:	
+	mov	a,@r0		; get last state
+	xrl	a,r5		; has it changed?
+	anl	a,r5		; is it now on?
+	anl	a,r4		; mask out the port
+	jz	ctr_end		; no rising edge
+	mov	a,r5		; get port B again
+	anl	a,r2		; test if up or down
+	jnz	ctr_up		; count up
+	mov	a,@r1
+	dec	a
+	mov	@r1,a
+	cjne	a,#0ffh,ctr_end	; underflow?
+	inc	r1		; high byte
+	mov	a,@r1
+	dec	a
+	mov	@r1,a
+	sjmp	ctr_end
+ctr_up:				; count up
+	mov	a,@r1
+	inc	a
+	mov	@r1,a
+	jnz	ctr_end
+	inc	r1		; high byte
+	mov	a,@r1
+	inc	a
+	mov	@r1,a
+ctr_end:
+	mov	a,r5
+	mov	@r0,a
+	ret
+
+;;; implements two soft counters with up/down and reset
+timer0_isr:
+	push	dps
+	push	acc
+	push	psw
+	push	00h		; R0
+	push	01h		; R1
+	push	02h		; R2
+	push	03h		; R3
+	push	04h		; R4
+	push	05h		; R5
+		
+	mov	r0,#DIOSTAT0	; status of port
+	mov	r1,#CTR0	; address of counter0
+	mov	a,#00000001b	; bit 0
+	mov	r4,a		; clock
+	rl	a		; bit 1
+	mov	r2,a		; up/down
+	rl	a		; bit 2
+	mov	r3,a		; reset mask
+	lcall	counter
+	inc	r0		; to DISTAT1
+	inc	r1		; to CTR1
+	inc	r1
+	mov	a,r3
+	rl	a		; bit 3
+	rl	a		; bit 4
+	mov	r4,a		; clock
+	rl	a		; bit 5
+	mov	r2,a		; up/down
+	rl	a		; bit 6
+	mov	r3,a		; reset
+	lcall	counter
+	
+	pop	05h		; R5
+	pop	04h		; R4
+	pop	03h		; R3
+	pop	02h		; R2
+	pop	01h		; R1
+	pop	00h		; R0
+	pop	psw
+	pop	acc 
+	pop	dps
+
+	reti
+
+;;; interrupt-routine for SOF
+;;; is for full speed
+sof_isr:
+	push	dps
+	push	dpl
+	push	dph
+	push	dpl1
+	push	dph1
+	push	acc
+	push	psw
+	push	00h		; R0
+	push	01h		; R1
+	push	02h		; R2
+	push	03h		; R3
+	push	04h		; R4
+	push	05h		; R5
+	push	06h		; R6
+	push	07h		; R7
+		
+	mov	a,EP2468STAT
+	anl	a,#20H		; full?
+	jnz	epfull		; EP6-buffer is full
+
+	lcall	conv_ad		; conversion
+
+	mov	DPTR,#EP6BCH	; byte count H
+	mov	a,#0		; is zero
+	lcall	syncdelaywr	; wait until we can write again
+	
+	mov	DPTR,#EP6BCL	; byte count L
+	mov	a,#10H		; is 8x word = 16 bytes
+	lcall	syncdelaywr	; wait until we can write again
+	
+epfull:
+	;; do the D/A conversion
+	mov	a,EP2468STAT
+	anl	a,#01H		; empty
+	jnz	epempty		; nothing to get
+
+	mov	dptr,#0F000H	; EP2 fifo buffer
+	lcall	dalo		; conversion
+
+	mov	dptr,#EP2BCL	; "arm" it
+	mov	a,#00h
+	lcall	syncdelaywr	; wait for the rec to sync
+	lcall	syncdelaywr	; wait for the rec to sync
+
+epempty:	
+	;; clear INT2
+	mov	a,EXIF		; FIRST clear the USB (INT2) interrupt request
+	clr	acc.4
+	mov	EXIF,a		; Note: EXIF reg is not 8051 bit-addressable
+	
+	mov	DPTR,#USBIRQ	; points to the SOF
+	mov	a,#2		; clear the SOF
+	movx	@DPTR,a
+
+nosof:	
+	pop	07h
+	pop	06h
+	pop	05h
+	pop	04h		; R4
+	pop	03h		; R3
+	pop	02h		; R2
+	pop	01h		; R1
+	pop	00h		; R0
+	pop	psw
+	pop	acc 
+	pop	dph1 
+	pop	dpl1
+	pop	dph 
+	pop	dpl 
+	pop	dps
+	reti
+
+
+reset_ep8:
+	;; erase all data in ep8
+	mov	dptr,#FIFORESET
+	mov	a,#80H		; NAK
+	lcall	syncdelaywr
+	mov	dptr,#FIFORESET
+	mov	a,#8		; reset EP8
+	lcall	syncdelaywr
+	mov	dptr,#FIFORESET
+	mov	a,#0		; normal operation
+	lcall	syncdelaywr
+	ret
+
+
+reset_ep6:
+	;; throw out old data
+	mov	dptr,#FIFORESET
+	mov	a,#80H		; NAK
+	lcall	syncdelaywr
+	mov	dptr,#FIFORESET
+	mov	a,#6		; reset EP6
+	lcall	syncdelaywr
+	mov	dptr,#FIFORESET
+	mov	a,#0		; normal operation
+	lcall	syncdelaywr
+	ret
+
+;;; interrupt-routine for ep1out
+;;; receives the channel list and other commands
+ep1out_isr:
+	push	dps
+	push	dpl
+	push	dph
+	push	dpl1
+	push	dph1
+	push	acc
+	push	psw
+	push	00h		; R0
+	push	01h		; R1
+	push	02h		; R2
+	push	03h		; R3
+	push	04h		; R4
+	push	05h		; R5
+	push	06h		; R6
+	push	07h		; R7
+		
+	mov	dptr,#0E780h	; FIFO buffer of EP1OUT
+	movx	a,@dptr		; get the first byte
+	mov	r0,#CMD_FLAG	; pointer to the command byte
+	mov 	@r0,a		; store the command byte for ep8
+
+	mov	dptr,#ep1out_jmp; jump table for the different functions
+	rl	a		; multiply by 2: sizeof sjmp
+	jmp	@a+dptr		; jump to the jump table
+	;; jump table, corresponds to the command bytes defined
+	;; in usbdux.c
+ep1out_jmp:
+	sjmp	storechannellist; a=0
+	sjmp	single_da	; a=1
+	sjmp	config_digital_b; a=2
+	sjmp	write_digital_b	; a=3
+	sjmp	storesglchannel	; a=4
+	sjmp	readcounter	; a=5
+	sjmp	writecounter	; a=6
+	sjmp	pwm_on		; a=7
+	sjmp	pwm_off		; a=8
+
+pwm_on:
+	lcall	startPWM
+	sjmp	over_da
+
+pwm_off:
+	lcall	stopPWM
+	sjmp	over_da
+
+	;; read the counter
+readcounter:
+	lcall	reset_ep8	; reset ep8
+	lcall	ep8_ops		; fill the counter data in there
+	sjmp	over_da		; jump to the end
+
+	;; write zeroes to the counters
+writecounter:
+	mov	dptr,#0e781h	; buffer
+	mov	r0,#CTR0	; r0 points to counter 0
+	movx	a,@dptr		; channel number
+	jz	wrctr0		; first channel
+	mov	r1,a		; counter
+wrctrl:
+	inc	r0		; next counter
+	inc	r0		; next counter
+	djnz	r1,wrctrl	; advance to the right counter
+wrctr0:
+	inc	dptr		; get to the value
+	movx	a,@dptr		; get value
+	mov	@r0,a		; save in ctr
+	inc	r0		; next byte
+	inc	dptr
+	movx	a,@dptr		; get value
+	mov	@r0,a		; save in ctr
+	sjmp	over_da		; jump to the end
+
+storesglchannel:
+	mov	r0,#SGLCHANNEL	; the conversion bytes are now stored in 80h
+	mov	dptr,#0e781h	; FIFO buffer of EP1OUT
+	movx	a,@dptr		; 
+	mov	@r0,a
+
+	lcall	reset_ep8	; reset FIFO
+	;; Save new A/D data in EP8. This is the first byte
+	;; the host will read during an INSN. If there are
+	;; more to come they will be handled by the ISR of
+	;; ep8.
+	lcall	ep8_ops		; get A/D data
+		
+	sjmp	over_da
+
+	
+;;; Channellist:
+;;; the first byte is zero:
+;;; we've just received the channel list
+;;; the channel list is stored in the addresses from CHANNELLIST which
+;;; are _only_ reachable by indirect addressing
+storechannellist:
+	mov	r0,#CHANNELLIST	; the conversion bytes are now stored in 80h
+	mov	r2,#9		; counter
+	mov	dptr,#0e781h	; FIFO buffer of EP1OUT
+chanlloop:	
+	movx	a,@dptr		; 
+	mov	@r0,a
+	inc	dptr
+	inc	r0
+	djnz	r2,chanlloop
+
+	lcall	reset_ep6	; reset FIFO
+	
+	;; load new A/D data into EP6
+	;; This must be done. Otherwise the ISR is never called.
+	;; The ISR is only called when data has _left_ the
+	;; ep buffer here it has to be refilled.
+	lcall	ep6_arm		; fill with the first data byte
+	
+	sjmp	over_da
+
+;;; Single DA conversion. The 2 bytes are in the FIFO buffer
+single_da:
+	mov	dptr,#0e781h	; FIFO buffer of EP1OUT
+	lcall	dalo		; conversion
+	sjmp	over_da
+
+;;; configure the port B as input or output (bitwise)
+config_digital_b:
+	mov	dptr,#0e781h	; FIFO buffer of EP1OUT
+	movx	a,@dptr		; get the second byte
+	mov	OEB,a		; set the output enable bits
+	sjmp	over_da
+	
+;;; Write one byte to the external digital port B
+;;; and prepare for digital read
+write_digital_b:
+	mov	dptr,#0e781h	; FIFO buffer of EP1OUT
+	movx	a,@dptr		; get the second byte
+	mov	OEB,a		; output enable
+	inc	dptr		; next byte
+	movx	a,@dptr		; bits
+	mov	IOB,a		; send the byte to the I/O port
+
+	lcall	reset_ep8	; reset FIFO of ep 8
+
+	;; fill ep8 with new data from port B
+	;; When the host requests the data it's already there.
+	;; This must be so. Otherwise the ISR is not called.
+	;; The ISR is only called when a packet has been delivered
+	;; to the host. Thus, we need a packet here in the
+	;; first instance.
+	lcall	ep8_ops		; get digital data
+
+	;; 
+	;; for all commands the same
+over_da:	
+	mov	dptr,#EP1OUTBC
+	mov	a,#00h
+	lcall	syncdelaywr	; arm
+	lcall	syncdelaywr	; arm
+	lcall	syncdelaywr	; arm
+
+	;; clear INT2
+	mov	a,EXIF		; FIRST clear the USB (INT2) interrupt request
+	clr	acc.4
+	mov	EXIF,a		; Note: EXIF reg is not 8051 bit-addressable
+
+	mov	DPTR,#EPIRQ	; 
+	mov	a,#00001000b	; clear the ep1outirq
+	movx	@DPTR,a
+
+	pop	07h
+	pop	06h
+	pop	05h
+	pop	04h		; R4
+	pop	03h		; R3
+	pop	02h		; R2
+	pop	01h		; R1
+	pop	00h		; R0
+	pop	psw
+	pop	acc 
+	pop	dph1 
+	pop	dpl1
+	pop	dph 
+	pop	dpl 
+	pop	dps
+	reti
+
+
+	
+;;; all channels
+dalo:
+	movx	a,@dptr		; number of channels
+	inc	dptr		; pointer to the first channel
+	mov	r0,a		; 4 channels
+nextDA:	
+	movx	a,@dptr		; get the first low byte
+	mov	r3,a		; store in r3 (see below)
+	inc	dptr		; point to the high byte
+	movx	a,@dptr		; get the high byte
+	mov	r4,a		; store in r4 (for writeDA)
+	inc	dptr		; point to the channel number
+	movx	a,@dptr		; get the channel number
+	inc	dptr		; get ready for the next channel
+	lcall	writeDA		; write value to the DAC
+	djnz	r0,nextDA	; next channel
+	ret
+
+
+
+;;; D/A-conversion:
+;;; control-byte in a,
+;;; value in r3(low) and r4(high)
+writeDA:			; mask the control byte
+	anl	a,#11000000b	; only the channel is left
+	orl	a,#00110000b	; internal clock, bipolar mode, +/-5V
+	orl	a,r4		; or the value of R4 to it
+	;; set CS to low
+	clr	IOA.5		; set /CS to zero
+	;; send the first byte to the DA-converter
+	mov 	R2,#8		; bit-counter
+DA1:    jnb     ACC.7,zeroda	; jump if Bit7 = 0?
+	setb	IOA.2		; set the DIN bit
+	sjmp	clkda		; continue with the clock
+zeroda: clr	IOA.2		; clear the DIN bit
+clkda:	setb	IOA.0		; SCLK = 1
+	clr	IOA.0		; SCLK = 0
+        rl      a               ; next Bit
+        djnz    R2,DA1
+
+	
+	;; send the second byte to the DA-converter
+	mov	a,r3		; low byte
+	mov 	R2,#8		; bit-counter
+DA2:    jnb     ACC.7,zeroda2	; jump if Bit7 = 0?
+	setb	IOA.2		; set the DIN bit
+	sjmp	clkda2		; continue with the clock
+zeroda2:clr	IOA.2		; clear the DIN bit
+clkda2:	setb	IOA.0		; SCLK = 1
+	clr	IOA.0		; SCLK = 0
+        rl      a               ; next Bit
+        djnz    R2,DA2
+	;; 
+	setb	IOA.5		; set /CS to one
+	;; 
+noDA:	ret
+	
+
+
+;;; arm ep6
+ep6_arm:
+	lcall	conv_ad
+	
+	mov	DPTR,#EP6BCH	; byte count H
+	mov	a,#0		; is zero
+	lcall	syncdelaywr	; wait until the length has arrived
+	
+	mov	DPTR,#EP6BCL	; byte count L
+	mov	a,#10H		; is one
+	lcall	syncdelaywr	; wait until the length has been proc
+	ret
+	
+
+
+;;; converts one analog/digital channel and stores it in EP8
+;;; also gets the content of the digital ports B and D depending on
+;;; the COMMAND flag
+ep8_ops:
+	mov	dptr,#0fc01h	; ep8 fifo buffer
+	clr	a		; high byte
+	movx	@dptr,a		; set H=0
+	mov	dptr,#0fc00h	; low byte
+	mov	r0,#CMD_FLAG
+	mov	a,@r0
+	movx	@dptr,a		; save command byte
+
+	mov	dptr,#ep8_jmp	; jump table for the different functions
+	rl	a		; multiply by 2: sizeof sjmp
+	jmp	@a+dptr		; jump to the jump table
+	;; jump table, corresponds to the command bytes defined
+	;; in usbdux.c
+ep8_jmp:
+	sjmp	ep8_err		; a=0, err
+	sjmp	ep8_err		; a=1, err
+	sjmp	ep8_err		; a=2, err
+	sjmp	ep8_dio		; a=3, digital read
+	sjmp	ep8_sglchannel	; a=4, analog A/D
+	sjmp	ep8_readctr	; a=5, read counter
+	sjmp	ep8_err		; a=6, write counter
+
+	;; reads all counters
+ep8_readctr:
+	mov	r0,#CTR0	; points to counter0
+	mov	dptr,#0fc02h	; ep8 fifo buffer
+	mov	r1,#8		; transfer 4 16bit counters
+ep8_ctrlp:
+	mov	a,@r0		; get the counter
+	movx	@dptr,a		; save in the fifo buffer
+	inc	r0		; inc pointer to the counters
+	inc	dptr		; inc pointer to the fifo buffer
+	djnz	r1,ep8_ctrlp	; loop until ready
+	
+	sjmp	ep8_send	; send the data
+	
+	;; read one A/D channel
+ep8_sglchannel:		
+	mov	r0,#SGLCHANNEL	; points to the channel
+	mov 	a,@r0		; Ch0
+	
+	lcall 	readAD		; start the conversion
+		
+	mov 	DPTR,#0fc02h	; EP8 FIFO 
+	mov 	a,R3		; get low byte
+	movx 	@DPTR,A		; store in FIFO
+	inc	dptr		; next fifo entry
+	mov 	a,R4		; get high byte
+	movx 	@DPTR,A		; store in FIFO
+
+	sjmp	ep8_send	; send the data
+
+	;; read the digital lines
+ep8_dio:	
+	mov 	DPTR,#0fc02h	; store the contents of port B
+	mov	a,IOB		; in the next
+	movx	@dptr,a		; entry of the buffer
+
+	inc	dptr
+	clr	a		; high byte is zero
+	movx	@dptr,a		; next byte of the EP
+	
+ep8_send:	
+	mov	DPTR,#EP8BCH	; byte count H
+	mov	a,#0		; is zero
+	lcall	syncdelaywr
+	
+	mov	DPTR,#EP8BCL	; byte count L
+	mov	a,#10H		; 16 bytes
+	lcall	syncdelaywr	; send the data over to the host
+
+ep8_err:	
+	ret
+
+
+
+;;; EP8 interrupt: gets one measurement from the AD converter and
+;;; sends it via EP8. The channel # is stored in address 80H.
+;;; It also gets the state of the digital registers B and D.
+ep8_isr:	
+	push	dps
+	push	dpl
+	push	dph
+	push	dpl1
+	push	dph1
+	push	acc
+	push	psw
+	push	00h		; R0
+	push	01h		; R1
+	push	02h		; R2
+	push	03h		; R3
+	push	04h		; R4
+	push	05h		; R5
+	push	06h		; R6
+	push	07h		; R7
+		
+	lcall	ep8_ops
+	
+	;; clear INT2
+	mov	a,EXIF		; FIRST clear the USB (INT2) interrupt request
+	clr	acc.4
+	mov	EXIF,a		; Note: EXIF reg is not 8051 bit-addressable
+
+	mov	DPTR,#EPIRQ	; 
+	mov	a,#10000000b	; clear the ep8irq
+	movx	@DPTR,a
+
+	pop	07h
+	pop	06h
+	pop	05h
+	pop	04h		; R4
+	pop	03h		; R3
+	pop	02h		; R2
+	pop	01h		; R1
+	pop	00h		; R0
+	pop	psw
+	pop	acc 
+	pop	dph1 
+	pop	dpl1
+	pop	dph 
+	pop	dpl 
+	pop	dps
+	reti
+
+
+;; need to delay every time the byte counters
+;; for the EPs have been changed.
+
+syncdelay:
+	nop
+	nop
+	nop
+	nop
+	nop
+	nop
+	nop
+	nop
+	nop
+	ret
+
+syncdelaywr:
+	movx	@dptr,a
+	lcall	syncdelay
+	ret
+
+
+.End
+
+
diff --git a/usbdux/usbduxfast_firmware.asm b/usbdux/usbduxfast_firmware.asm
new file mode 100644
index 0000000..0d8e7f8
--- /dev/null
+++ b/usbdux/usbduxfast_firmware.asm
@@ -0,0 +1,547 @@
+;   usbduxfast_firmware.asm
+;   Copyright (C) 2004,2009 Bernd Porr, Bernd.Porr@f2s.com
+;
+;   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; if not, write to the Free Software
+;   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+;
+;
+; Firmware: usbduxfast_firmware.asm for usbdux.c
+; Description: Firmware for usbduxfast
+; Devices: [ITL] USB-DUX (usbdux.o)
+; Author: Bernd Porr <Bernd.Porr@f2s.com>
+; Updated: 17 Apr 2009
+; Status: stable
+;
+;;;
+;;;
+;;;
+
+	.inc	fx2-include.asm
+
+	.equ	WFLOADED,70H	; waveform is loaded
+
+	.org	0000h		; after reset the processor starts here
+	ljmp	main		; jump to the main loop
+
+	.org	0043h		; the IRQ2-vector
+	ljmp	jmptbl		; irq service-routine
+
+	.org	0100h		; start of the jump table
+
+jmptbl:	ljmp	sudav_isr
+	nop
+	ljmp	sof_isr
+	nop
+	ljmp	sutok_isr
+	nop
+	ljmp	suspend_isr
+	nop
+	ljmp	usbreset_isr
+	nop
+	ljmp	hispeed_isr
+	nop
+	ljmp	ep0ack_isr
+	nop
+	ljmp	spare_isr
+	nop
+	ljmp	ep0in_isr
+	nop
+	ljmp	ep0out_isr
+	nop
+	ljmp	ep1in_isr
+	nop
+	ljmp	ep1out_isr
+	nop
+	ljmp	ep2_isr
+	nop
+	ljmp	ep4_isr
+	nop
+	ljmp	ep6_isr
+	nop
+	ljmp	ep8_isr
+	nop
+	ljmp	ibn_isr
+	nop
+	ljmp	spare_isr
+	nop
+	ljmp	ep0ping_isr
+	nop
+	ljmp	ep1ping_isr
+	nop
+	ljmp	ep2ping_isr
+	nop
+	ljmp	ep4ping_isr
+	nop
+	ljmp	ep6ping_isr
+	nop
+	ljmp	ep8ping_isr
+	nop
+	ljmp	errlimit_isr
+	nop
+	ljmp	spare_isr
+	nop
+	ljmp	spare_isr
+	nop
+	ljmp	spare_isr
+	nop
+	ljmp	ep2isoerr_isr
+	nop
+	ljmp	ep4isoerr_isr
+	nop
+	ljmp	ep6isoerr_isr
+	nop
+	ljmp	ep8isoerr_isr
+
+	
+	;; dummy isr
+sof_isr:
+sudav_isr:	
+sutok_isr:	
+suspend_isr:	
+usbreset_isr:	
+hispeed_isr:	
+ep0ack_isr:	
+spare_isr:	
+ep0in_isr:	
+ep0out_isr:	
+ep1out_isr:
+ep1in_isr:	
+ibn_isr:	
+ep0ping_isr:	
+ep1ping_isr:	
+ep2ping_isr:	
+ep4ping_isr:	
+ep6ping_isr:	
+ep8ping_isr:	
+errlimit_isr:	
+ep2isoerr_isr:	
+ep4isoerr_isr:	
+ep6isoerr_isr:	
+ep8isoerr_isr:
+ep6_isr:
+ep2_isr:
+ep8_isr:
+
+	push	dps
+	push	dpl
+	push	dph
+	push	dpl1
+	push	dph1
+	push	acc
+	push	psw
+
+	;; clear the USB2 irq bit and return
+	mov	a,EXIF
+	clr	acc.4
+	mov	EXIF,a
+
+	pop	psw
+	pop	acc 
+	pop	dph1 
+	pop	dpl1
+	pop	dph 
+	pop	dpl 
+	pop	dps
+	
+	reti
+
+		
+;;; main program
+;;; basically only initialises the processor and
+;;; then engages in an endless loop
+main:
+	mov	dptr,#REVCTL
+	mov	a,#00000011b	; allows skip
+	lcall	syncdelaywr
+
+	mov	DPTR,#CPUCS	; CPU control register
+	mov	a,#00010000b	; 48Mhz
+	lcall	syncdelaywr
+
+	mov	dptr,#IFCONFIG	; switch on IFCLK signal
+	mov	a,#10100010b	; gpif, 30MHz
+	lcall	syncdelaywr
+
+	mov	dptr,#FIFORESET
+	mov	a,#80h
+	lcall	syncdelaywr
+	mov	a,#8
+	lcall	syncdelaywr
+	mov	a,#2		
+	lcall	syncdelaywr
+	mov	a,#4		
+	lcall	syncdelaywr
+	mov	a,#6		
+	lcall	syncdelaywr
+	mov	a,#0		
+	lcall	syncdelaywr
+
+	mov	dptr,#INTSETUP	; IRQ setup register
+	mov	a,#08h		; enable autovector
+	lcall	syncdelaywr
+
+	lcall	initeps		; init the isochronous data-transfer
+
+	lcall	initGPIF
+
+;;; main loop
+
+mloop2:
+	lcall	gpif_run
+	sjmp	mloop2		; do nothing. The rest is done by the IRQs
+
+
+gpif_run:
+	mov	a,WFLOADED
+	jz	no_trig		; do not trigger
+	mov	a,GPIFTRIG	; GPIF status
+	anl	a,#80h		; done bit
+	jz	no_trig		; GPIF busy
+
+;;; gpif has stopped
+	mov	a,#06h		; RD,EP6
+	mov	GPIFTRIG,a
+no_trig:
+	ret
+
+	
+
+initGPIF:
+	mov	DPTR,#EP6CFG	; BLK data from here to the host
+	mov	a,#11100000b	; Valid, quad buffering
+	lcall	syncdelaywr	; write
+
+	mov	dptr,#EP6FIFOCFG
+	mov	a,#00001001b	; autoin, wordwide
+	lcall	syncdelaywr
+
+	mov	dptr,#EP6AUTOINLENH
+	mov	a,#00000010b	; 512 bytes
+	lcall	syncdelaywr	; write
+
+	mov	dptr,#EP6AUTOINLENL
+	mov	a,#00000000b	; 0
+	lcall	syncdelaywr	; write
+
+	mov	dptr,#GPIFWFSELECT
+	mov	a,#11111100b	; waveform 0 for FIFO RD
+	lcall	syncdelaywr
+
+	mov	dptr,#GPIFCTLCFG
+	mov	a,#10000000b	; tri state for CTRL
+	lcall	syncdelaywr
+
+	mov	dptr,#GPIFIDLECTL
+	mov	a,#11111111b	; all CTL outputs high
+	lcall	syncdelaywr
+	mov	a,#11111101b	; reset counter
+	lcall	syncdelaywr
+	mov	a,#11111111b	; reset to high again
+	lcall	syncdelaywr
+
+	mov	a,#00000010b	; abort when full
+	mov	dptr,#EP6GPIFFLGSEL
+	lcall	syncdelaywr
+
+	mov	a,#00000001b	; stop when buffer overfl
+	mov	dptr,#EP6GPIFPDFSTOP
+	lcall	syncdelaywr
+
+	mov	a,#0
+	mov	dptr,#GPIFREADYCFG
+	lcall	syncdelaywr
+
+	mov	a,#0
+	mov	dptr,#GPIFIDLECS
+	lcall	syncdelaywr
+
+; waveform 1
+; this is a dummy waveform which is used
+; during the upload of another waveform into
+; wavefrom 0
+; it branches directly into the IDLE state
+	mov	dptr,#0E420H
+	mov	a,#00111111b	; branch to IDLE
+	lcall	syncdelaywr
+
+	mov	dptr,#0E428H	; opcode
+	mov	a,#00000001b	; deceision point
+	lcall	syncdelaywr
+
+	mov	dptr,#0E430H
+	mov	a,#0FFH		; output is high
+	lcall	syncdelaywr
+
+	mov	dptr,#0E438H
+	mov	a,#0FFH		; logic function
+	lcall	syncdelaywr
+
+; signals that no waveform 0 is loaded so far
+	mov	WFLOADED,#0	; waveform flag
+
+	ret
+
+
+
+;;; initilise the transfer
+;;; It is assumed that the USB interface is in alternate setting 1
+initeps:
+	mov	DPTR,#EP4CFG
+	mov	a,#10100000b	; valid, bulk, out
+	lcall	syncdelaywr
+
+	mov	dptr,#EP4BCL	; "arm" it
+	mov	a,#00h
+	lcall	syncdelaywr	; wait until we can write again
+	lcall	syncdelaywr	; wait
+	lcall	syncdelaywr	; wait
+
+	mov	DPTR,#EP8CFG
+	mov	a,#0		; disable EP8, it overlaps with EP6!!
+	lcall	syncdelaywr
+
+	mov	dptr,#EPIE	; interrupt enable
+	mov	a,#00100000b	; enable irq for ep4
+	lcall	syncdelaywr	; do it
+
+	mov	dptr,#EPIRQ	; clear IRQs
+	mov	a,#00100100b
+	movx	@dptr,a
+
+        mov     DPTR,#USBIE	; USB int enable register
+        mov     a,#0            ; SOF etc
+        movx    @DPTR,a         ;
+
+        mov     DPTR,#GPIFIE	; GPIF int enable register
+        mov     a,#0            ; done IRQ
+        movx    @DPTR,a         ;
+
+	mov	EIE,#00000001b	; enable INT2 in the 8051's SFR
+	mov	IE,#80h		; IE, enable all interrupts
+
+	ret
+
+
+;;; interrupt-routine for ep4
+;;; receives the channel list and other commands
+ep4_isr:
+	push	dps
+	push	dpl
+	push	dph
+	push	dpl1
+	push	dph1
+	push	acc
+	push	psw
+	push	00h		; R0
+	push	01h		; R1
+	push	02h		; R2
+	push	03h		; R3
+	push	04h		; R4
+	push	05h		; R5
+	push	06h		; R6
+	push	07h		; R7
+		
+	mov	dptr,#0f400h	; FIFO buffer of EP4
+	movx	a,@dptr		; get the first byte
+
+	mov	dptr,#ep4_jmp	; jump table for the different functions
+	rl	a		; multiply by 2: sizeof sjmp
+	jmp	@a+dptr		; jump to the jump table
+
+ep4_jmp:
+	sjmp	storewaveform	; a=0
+	sjmp	init_ep6	; a=1
+	
+init_ep6:
+	; stop ep6
+	; just now do nothing
+
+	ljmp	over_wf
+
+
+storewaveform:
+	mov	WFLOADED,#0	; waveform flag
+
+	mov	dptr,#EP6FIFOCFG
+	mov	a,#00000000b	;
+	lcall	syncdelaywr
+
+	mov	dptr,#GPIFABORT
+	mov	a,#0ffh		; abort all transfers
+	lcall	syncdelaywr
+
+wait_f_abort:
+	mov	a,GPIFTRIG	; GPIF status
+	anl	a,#80h		; done bit
+	jz	wait_f_abort	; GPIF busy
+
+	mov	dptr,#GPIFWFSELECT
+	mov	a,#11111101b	; select dummy waveform
+	movx	@dptr,a
+	lcall	syncdelay
+
+	mov	dptr,#FIFORESET
+	mov	a,#80h		; NAK
+	lcall	syncdelaywr
+	mov	a,#6		; reset EP6
+	lcall	syncdelaywr
+	mov	a,#0		; normal op
+	lcall	syncdelaywr
+
+; change to dummy waveform 1
+	mov	a,#06h		; RD,EP6
+	mov	GPIFTRIG,a
+
+; wait a bit
+	mov	r2,255
+loopx:
+	djnz	r2,loopx
+
+; abort waveform if not already so
+	mov	dptr,#GPIFABORT
+	mov	a,#0ffh		; abort all transfers
+	lcall	syncdelaywr
+
+; wait again
+	mov	r2,255
+loopx2:
+	djnz	r2,loopx2
+
+; check for DONE
+wait_f_abort2:
+	mov	a,GPIFTRIG	; GPIF status
+	anl	a,#80h		; done bit
+	jz	wait_f_abort2	; GPIF busy
+
+; upload the new waveform into waveform 0
+	mov	AUTOPTRH2,#0E4H	; XDATA0H
+	lcall	syncdelay
+	mov	AUTOPTRL2,#00H	; XDATA0L
+	lcall	syncdelay
+
+	mov	AUTOPTRH1,#0F4H	; EP4 high
+	lcall	syncdelay
+	mov	AUTOPTRL1,#01H	; EP4 low
+	lcall	syncdelay
+
+	mov	AUTOPTRSETUP,#7	; autoinc and enable
+	lcall	syncdelay
+
+	mov 	r2,#20H		; 32 bytes to transfer
+
+wavetr:
+	mov 	dptr,#XAUTODAT1
+	movx	a,@dptr
+	lcall	syncdelay
+	mov	dptr,#XAUTODAT2
+	movx	@dptr,a
+	lcall	syncdelay
+	djnz	r2,wavetr
+
+	mov	dptr,#EP6FIFOCFG
+	mov	a,#00001001b	; autoin, wordwide
+	lcall	syncdelaywr
+
+	mov	dptr,#GPIFWFSELECT
+	mov	a,#11111100b
+	movx	@dptr,a
+	lcall	syncdelay
+
+	mov	dptr,#FIFORESET
+	mov	a,#80h		; NAK
+	lcall	syncdelaywr
+	mov	a,#6		; reset EP6
+	lcall	syncdelaywr
+	mov	a,#0		; normal op
+	lcall	syncdelaywr
+
+	mov	dptr,#0E400H+10H; waveform 0: first CTL byte
+	movx	a,@dptr		; get it
+	orl	a,#11111011b	; force all bits to one except the range bit
+	mov	dptr,#GPIFIDLECTL
+	lcall	syncdelaywr
+
+	mov	WFLOADED,#1	; waveform flag
+
+; do the common things here	
+over_wf:	
+	mov	dptr,#EP4BCL
+	mov	a,#00h
+	movx	@DPTR,a		; arm it
+	lcall	syncdelay	; wait
+	movx	@DPTR,a		; arm it
+	lcall	syncdelay	; wait
+
+	;; clear INT2
+	mov	a,EXIF		; FIRST clear the USB (INT2) interrupt request
+	clr	acc.4
+	mov	EXIF,a		; Note: EXIF reg is not 8051 bit-addressable
+
+	mov	DPTR,#EPIRQ	; 
+	mov	a,#00100000b	; clear the ep4irq
+	movx	@DPTR,a
+
+	pop	07h
+	pop	06h
+	pop	05h
+	pop	04h		; R4
+	pop	03h		; R3
+	pop	02h		; R2
+	pop	01h		; R1
+	pop	00h		; R0
+	pop	psw
+	pop	acc 
+	pop	dph1 
+	pop	dpl1
+	pop	dph 
+	pop	dpl 
+	pop	dps
+	reti
+
+
+;; need to delay every time the byte counters
+;; for the EPs have been changed.
+
+syncdelay:
+	nop
+	nop
+	nop
+	nop
+	nop
+	nop
+	nop
+	nop
+	nop
+	ret
+
+
+syncdelaywr:
+	lcall	syncdelay
+	movx	@dptr,a
+	ret
+
+
+.End
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/usbdux/usbduxsigma_firmware.asm b/usbdux/usbduxsigma_firmware.asm
new file mode 100644
index 0000000..a2305e5
--- /dev/null
+++ b/usbdux/usbduxsigma_firmware.asm
@@ -0,0 +1,1220 @@
+;   usbdux_firmware.asm
+;   Copyright (C) 2010,2011 Bernd Porr, Bernd.Porr@f2s.com
+;   For usbduxsigma.c 0.5+
+;
+;   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; if not, write to the Free Software
+;   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+;
+;
+; Firmware: usbduxsigma_firmware.asm for usbduxsigma.c
+; Description: University of Stirling USB DAQ & INCITE Technology Limited
+; Devices: [ITL] USB-DUX-SIGMA (usbduxsigma.ko)
+; Author: Bernd Porr <Bernd.Porr@f2s.com>
+; Updated: 24 Jul 2011
+; Status: testing
+;
+;;;
+;;;
+;;;
+	
+	.inc	fx2-include.asm
+
+;;; a couple of flags
+	.equ	CMD_FLAG,80h	; flag for the next in transfer
+	.equ	PWMFLAG,81h	; PWM on or off?
+	.equ	MAXSMPL,82H	; maximum number of samples, n channellist
+	.equ	MUXSG0,83H	; content of the MUXSG0 register
+
+;;; actual code
+	.org	0000h		; after reset the processor starts here
+	ljmp	main		; jump to the main loop
+
+	.org	0043h		; the IRQ2-vector
+	ljmp	jmptbl		; irq service-routine
+	
+	.org	0100h		; start of the jump table
+
+jmptbl:	ljmp	sudav_isr
+	nop
+	ljmp	sof_isr
+	nop
+	ljmp	sutok_isr
+	nop
+	ljmp	suspend_isr
+	nop
+	ljmp	usbreset_isr
+	nop
+	ljmp	hispeed_isr
+	nop
+	ljmp	ep0ack_isr
+	nop
+	ljmp	spare_isr
+	nop
+	ljmp	ep0in_isr
+	nop
+	ljmp	ep0out_isr
+	nop
+	ljmp	ep1in_isr
+	nop
+	ljmp	ep1out_isr
+	nop
+	ljmp	ep2_isr
+	nop
+	ljmp	ep4_isr
+	nop
+	ljmp	ep6_isr
+	nop
+	ljmp	ep8_isr
+	nop
+	ljmp	ibn_isr
+	nop
+	ljmp	spare_isr
+	nop
+	ljmp	ep0ping_isr
+	nop
+	ljmp	ep1ping_isr
+	nop
+	ljmp	ep2ping_isr
+	nop
+	ljmp	ep4ping_isr
+	nop
+	ljmp	ep6ping_isr
+	nop
+	ljmp	ep8ping_isr
+	nop
+	ljmp	errlimit_isr
+	nop
+	ljmp	spare_isr
+	nop
+	ljmp	spare_isr
+	nop
+	ljmp	spare_isr
+	nop
+	ljmp	ep2isoerr_isr
+	nop
+	ljmp	ep4isoerr_isr
+	nop
+	ljmp	ep6isoerr_isr
+	nop
+	ljmp	ep8isoerr_isr
+
+	
+	;; dummy isr
+sudav_isr:	
+sutok_isr:	
+suspend_isr:	
+usbreset_isr:	
+hispeed_isr:	
+ep0ack_isr:	
+spare_isr:	
+ep0in_isr:	
+ep0out_isr:	
+ep1in_isr:	
+ibn_isr:	
+ep0ping_isr:	
+ep1ping_isr:	
+ep2ping_isr:	
+ep4ping_isr:	
+ep6ping_isr:	
+ep8ping_isr:	
+errlimit_isr:	
+ep2isoerr_isr:	
+ep4isoerr_isr:	
+ep6isoerr_isr:	
+ep8isoerr_isr:
+ep6_isr:
+ep2_isr:
+ep4_isr:	
+
+	push	dps
+	push	dpl
+	push	dph
+	push	dpl1
+	push	dph1
+	push	acc
+	push	psw
+
+	;; clear the USB2 irq bit and return
+	mov	a,EXIF
+	clr	acc.4
+	mov	EXIF,a
+
+	pop	psw
+	pop	acc 
+	pop	dph1 
+	pop	dpl1
+	pop	dph 
+	pop	dpl 
+	pop	dps
+	
+	reti
+
+		
+;;; main program
+;;; basically only initialises the processor and
+;;; then engages in an endless loop
+main:
+	mov	DPTR,#CPUCS	; CPU control register
+	mov	a,#00010000b	; 48Mhz
+	lcall	syncdelaywr
+
+        mov     dptr,#REVCTL
+        mov     a,#00000011b    ; allows skip
+        lcall   syncdelaywr
+
+	mov	IP,#0		; all std 8051 int have low priority
+	mov	EIP,#0FFH	; all FX2 interrupts have high priority
+	
+	mov	dptr,#INTSETUP	; IRQ setup register
+	mov	a,#08h		; enable autovector
+	lcall	syncdelaywr
+
+	mov	dptr,#PORTCCFG
+	mov	a,#0
+	lcall	syncdelaywr
+
+	lcall	initAD		; init the ports to the converters
+
+	lcall	initeps		; init the isochronous data-transfer
+
+;;; main loop, rest is done as interrupts
+mloop2:	nop
+
+;;; pwm
+	mov	r0,#PWMFLAG	; pwm on?
+	mov	a,@r0		; get info
+	jz	mloop2		; it's off
+
+	mov	a,GPIFTRIG	; GPIF status
+	anl	a,#80h		; done bit
+	jz	mloop2		; GPIF still busy
+
+        mov     a,#01h		; WR,EP4, 01 = EP4
+        mov     GPIFTRIG,a	; restart it
+
+	sjmp	mloop2		; loop for ever
+
+
+;;; initialise the ports for the AD-converter
+initAD:
+	mov	r0,#MAXSMPL	; length of channellist
+	mov	@r0,#0		; we don't want to accumlate samples
+
+	mov	OEA,#11100000b	; PortA7,A6,A5 Outputs
+	mov	IOA,#01100000b	; /CS = 1 and START = 0
+	mov	dptr,#IFCONFIG	; switch on clock on IFCLK pin
+	mov	a,#10100000b	; gpif, 30MHz, internal IFCLK -> 15MHz for AD
+	lcall	syncdelaywr
+
+	mov	SCON0,#013H	; ser rec en, TX/RX: stop, 48/12MHz=4MHz clock
+	
+	mov	dptr,#PORTECFG
+	mov	a,#00001000b	; special function for port E: RXD0OUT
+	lcall	syncdelaywr
+
+	ret
+
+
+;;; send a byte via SPI
+;;; content in a, dptr1 is changed
+;;; the lookup is done in dptr1 so that the normal dptr is not affected
+;;; important: /cs needs to be reset to 1 by the caller: IOA.5
+sendSPI:
+	inc	DPS
+	
+	;; bit reverse
+	mov	dptr,#swap_lut	; lookup table
+	movc 	a,@a+dptr	; reverse bits
+
+	;; clear interrupt flag, is used to detect
+	;; successful transmission
+	clr	SCON0.1		; clear interrupt flag
+
+	;; start transmission by writing the byte
+	;; in the transmit buffer
+	mov	SBUF0,a		; start transmission
+
+	;; wait for the end of the transmission
+sendSPIwait:
+	mov	a,SCON0		; get transmission status
+	jnb     ACC.1,sendSPIwait	; loop until transmitted
+
+	inc	DPS
+	
+	ret
+
+
+
+	
+;;; receive a byte via SPI
+;;; content in a, dptr is changed
+;;; the lookup is done in dptr1 so that the normal dptr is not affected
+;;; important: the /CS needs to be set to 1 by the caller via "setb IOA.5"
+recSPI:
+	inc	DPS
+	
+	clr	IOA.5		; /cs to 0	
+
+	;; clearning the RI bit starts reception of data
+	clr	SCON0.0
+
+recSPIwait:
+	;; RI goes back to 1 after the reception of the 8 bits
+	mov	a,SCON0		; get receive status
+	jnb	ACC.0,recSPIwait; loop until all bits received
+
+	;; read the byte from the buffer
+	mov	a,SBUF0		; get byte
+	
+	;; lookup: reverse the bits
+	mov	dptr,#swap_lut	; lookup table
+	movc 	a,@a+dptr	; reverse the bits
+
+	inc	DPS
+	
+	ret
+
+
+
+	
+;;; reads a register
+;;; register address in a
+;;; returns value in a
+registerRead:
+	anl	a,#00001111b	; mask out the index to the register
+	orl	a,#01000000b	; 010xxxxx indicates register read
+	clr	IOA.5		; ADC /cs to 0
+	lcall	sendSPI		; send the command over
+	lcall	recSPI		; read the contents back
+	setb	IOA.5		; ADC /cs to 1
+	ret
+
+
+
+;;; writes to a register
+;;; register address in a
+;;; value in r0
+registerWrite:
+	push	acc
+	anl	a,#00001111b	; mask out the index to the register
+	orl	a,#01100000b	; 011xxxxx indicates register write
+
+	clr	IOA.5		; ADC /cs to 0	
+
+	lcall	sendSPI		;
+	mov	a,r0
+	lcall	sendSPI
+
+	setb	IOA.5		; ADC /cs to 1
+	pop	acc
+
+	lcall	registerRead	; check if the data has arrived in the ADC
+	mov	0f0h,r0		; register B
+	cjne	a,0f0h,registerWrite ; something went wrong, try again
+	
+	ret
+
+
+
+;;; initilise the endpoints
+initeps:
+	mov	dptr,#FIFORESET
+	mov	a,#80H		
+	movx	@dptr,a		; reset all fifos
+	mov	a,#2	
+	movx	@dptr,a		; 
+	mov	a,#4		
+	movx	@dptr,a		; 
+	mov	a,#6		
+	movx	@dptr,a		; 
+	mov	a,#8		
+	movx	@dptr,a		; 
+	mov	a,#0		
+	movx	@dptr,a		; normal operat
+	
+	mov	DPTR,#EP2CFG
+	mov	a,#10010010b	; valid, out, double buff, iso
+	movx	@DPTR,a
+
+	mov	dptr,#EP2FIFOCFG
+	mov	a,#00000000b	; manual
+	movx	@dptr,a
+
+	mov	dptr,#EP2BCL	; "arm" it
+	mov	a,#00h
+	movx	@DPTR,a		; can receive data
+	lcall	syncdelay	; wait to sync
+	movx	@DPTR,a		; can receive data
+	lcall	syncdelay	; wait to sync
+	movx	@DPTR,a		; can receive data
+	lcall	syncdelay	; wait to sync
+	
+	mov	DPTR,#EP1OUTCFG
+	mov	a,#10100000b	; valid
+	movx	@dptr,a
+
+	mov	dptr,#EP1OUTBC	; "arm" it
+	mov	a,#00h
+	movx	@DPTR,a		; can receive data
+	lcall	syncdelay	; wait until we can write again
+	movx	@dptr,a		; make shure its really empty
+	lcall	syncdelay	; wait
+
+	mov	DPTR,#EP6CFG	; ISO data from here to the host
+	mov	a,#11010010b	; Valid
+	movx	@DPTR,a		; ISO transfer, double buffering
+
+	mov	DPTR,#EP8CFG	; EP8
+	mov	a,#11100000b	; BULK data from here to the host
+	movx	@DPTR,a		;
+
+	;; enable interrupts
+	mov	dptr,#EPIE	; interrupt enable
+	mov	a,#10001000b	; enable irq for ep1out,8
+	movx	@dptr,a		; do it
+
+	mov	dptr,#EPIRQ	; clear IRQs
+	mov	a,#10001000b
+	movx	@dptr,a
+	
+        mov     DPTR,#USBIE	; USB int enables register
+        mov     a,#2            ; enables SOF (1ms/125us interrupt)
+        movx    @DPTR,a         ; 
+
+	mov	EIE,#00000001b	; enable INT2/USBINT in the 8051's SFR
+	mov	IE,#80h		; IE, enable all interrupts
+
+	ret
+
+
+;;; Reads one ADC channel from the converter and stores
+;;; the result at dptr
+readADCch:
+	;; we do polling: we wait until DATA READY is zero
+	mov	a,IOA		; get /DRDY
+	jb	ACC.0,readADCch	; wait until data ready (DRDY=0)
+	
+	;; reading data is done by just dropping /CS and start reading and
+	;; while keeping the IN signal to the ADC inactive
+	clr	IOA.5		; /cs to 0
+	
+	;; 1st byte: STATUS
+	lcall	recSPI		; index
+	movx	@dptr,a		; store the byte
+	inc	dptr		; increment pointer
+
+	;; 2nd byte: MSB
+	lcall	recSPI		; data
+	movx	@dptr,a
+	inc	dptr
+
+	;; 3rd byte: MSB-1
+	lcall	recSPI		; data
+	movx	@dptr,a
+	inc	dptr
+
+	;; 4th byte: LSB
+	lcall	recSPI		; data
+	movx	@dptr,a
+	inc	dptr
+	
+	;; got all bytes
+	setb	IOA.5		; /cs to 1
+	
+	ret
+
+	
+
+;;; interrupt-routine for SOF
+sof_isr:
+	push	dps
+	push	dpl
+	push	dph
+	push	dpl1
+	push	dph1
+	push	acc
+	push	psw
+	push	00h		; R0
+	push	01h		; R1
+	push	02h		; R2
+	push	03h		; R3
+	push	04h		; R4
+	push	05h		; R5
+	push	06h		; R6
+	push	07h		; R7
+
+	clr	IE.7		; make sure that no other int's disturbe us
+	
+	mov	a,EP2468STAT
+	anl	a,#20H		; full?
+	jnz	epfull		; EP6-buffer is full
+
+	clr	IOA.7		; stop converter, START = 0
+
+	;; make sure that we are starting with the first channel
+	mov	r0,#MUXSG0	;
+	mov	a,@r0		; get config of MUXSG0
+	mov	r0,a
+	mov	a,#04H		; MUXSG0
+	lcall	registerWrite	; this resets the channel sequence
+
+	setb	IOA.7		; start converter, START = 1
+	
+	;; get the data from the ADC as fast as possible and transfer it
+	;; to the EP buffer
+	mov	dptr,#0f800h	; EP6 buffer
+	mov	a,IOD		; get DIO D
+	movx	@dptr,a		; store it
+	inc	dptr		; next byte
+	mov	a,IOC		; get DIO C
+	movx	@dptr,a		; store it
+	inc	dptr		; next byte
+	mov	a,IOB		; get DIO B
+	movx	@dptr,a		; store it
+	inc	dptr		; next byte
+	mov	a,#0		; just zero
+	movx	@dptr,a		; pad it up
+	inc	dptr		; algin along a 32 bit word
+
+	mov	r0,#MAXSMPL	; number of samples to transmit
+	mov	a,@r0		; get them
+	mov	r1,a		; counter
+
+	;; main loop, get all the data
+eptrans:	
+	lcall	readADCch	; get one reading
+	djnz	r1,eptrans	; do until we have all content transf'd
+
+	clr	IOA.7		; stop converter, START = 0
+
+	;; arm the endpoint and send off the data
+	mov	DPTR,#EP6BCH	; byte count H
+	mov	a,#0		; is zero
+	lcall	syncdelaywr	; wait until we can write again
+	
+	mov	r0,#MAXSMPL	; number of samples to transmit
+	mov	a,@r0		; get them
+	rl	a		; a=a*2
+	rl	a		; a=a*2
+	add	a,#4		; four bytes for DIO
+	mov	DPTR,#EP6BCL	; byte count L
+	lcall	syncdelaywr	; wait until we can write again
+
+epfull:
+	;; do the D/A conversion
+	mov	a,EP2468STAT
+	anl	a,#01H		; empty
+	jnz	epempty		; nothing to get
+
+	mov	dptr,#0F000H	; EP2 fifo buffer
+	lcall	dalo		; conversion
+
+	mov	dptr,#EP2BCL	; "arm" it
+	mov	a,#00h
+	lcall	syncdelaywr	; wait for the rec to sync
+	lcall	syncdelaywr	; wait for the rec to sync
+
+epempty:	
+	;; clear INT2
+	mov	a,EXIF		; FIRST clear the USB (INT2) interrupt request
+	clr	acc.4
+	mov	EXIF,a		; Note: EXIF reg is not 8051 bit-addressable
+	
+	mov	DPTR,#USBIRQ	; points to the SOF
+	mov	a,#2		; clear the SOF
+	movx	@DPTR,a
+
+nosof:
+	setb	IE.7		; re-enable global interrupts
+	
+	pop	07h
+	pop	06h
+	pop	05h
+	pop	04h		; R4
+	pop	03h		; R3
+	pop	02h		; R2
+	pop	01h		; R1
+	pop	00h		; R0
+	pop	psw
+	pop	acc 
+	pop	dph1 
+	pop	dpl1
+	pop	dph 
+	pop	dpl 
+	pop	dps
+	reti
+
+
+reset_ep8:
+	;; erase all data in ep8
+	mov	dptr,#FIFORESET
+	mov	a,#80H		; NAK
+	lcall	syncdelaywr
+	mov	dptr,#FIFORESET
+	mov	a,#8		; reset EP8
+	lcall	syncdelaywr
+	mov	dptr,#FIFORESET
+	mov	a,#0		; normal operation
+	lcall	syncdelaywr
+	ret
+
+
+reset_ep6:
+	;; throw out old data
+	mov	dptr,#FIFORESET
+	mov	a,#80H		; NAK
+	lcall	syncdelaywr
+	mov	dptr,#FIFORESET
+	mov	a,#6		; reset EP6
+	lcall	syncdelaywr
+	mov	dptr,#FIFORESET
+	mov	a,#0		; normal operation
+	lcall	syncdelaywr
+	ret
+
+
+;;; configure the ADC converter
+;;; the dptr points to the init data:
+;;; CONFIG 0,1,3,4,5,6
+;;; note that CONFIG2 is omitted
+configADC:	
+	clr	IOA.7		; stops ADC: START line of ADC = L
+	setb	IOA.5		; ADC /cs to 1
+
+	;; just in case something has gone wrong
+	nop
+	nop
+	nop
+
+	mov	a,#11000000b	; reset	the ADC
+	clr	IOA.5		; ADC /cs to 0	
+	lcall	sendSPI
+	setb	IOA.5		; ADC /cs to 1	
+
+	movx	a,@dptr		;
+	inc	dptr
+	mov	r0,a
+	mov	a,#00H		; CONFIG0
+	lcall	registerWrite
+
+	movx	a,@dptr		;
+	inc	dptr
+	mov	r0,a
+	mov	a,#01H		; CONFIG1
+	lcall	registerWrite
+
+	movx	a,@dptr		;
+	inc	dptr
+	mov	r0,a
+	mov	a,#03H		; MUXDIF
+	lcall	registerWrite
+
+	movx	a,@dptr		;
+	inc	dptr
+	mov	r0,#MUXSG0
+	mov	@r0,a		; store it for reset purposes
+	mov	r0,a
+	mov	a,#04H		; MUXSG0
+	lcall	registerWrite
+	
+	movx	a,@dptr		;
+	inc	dptr
+	mov	r0,a
+	mov	a,#05H		; MUXSG1
+	lcall	registerWrite
+	
+	movx	a,@dptr		;
+	inc	dptr
+	mov	r0,a
+	mov	a,#06H		; SYSRED
+	lcall	registerWrite
+
+	ret
+
+	
+;;; interrupt-routine for ep1out
+;;; receives the channel list and other commands
+ep1out_isr:
+	push	dps
+	push	dpl
+	push	dph
+	push	dpl1
+	push	dph1
+	push	acc
+	push	psw
+	push	00h		; R0
+	push	01h		; R1
+	push	02h		; R2
+	push	03h		; R3
+	push	04h		; R4
+	push	05h		; R5
+	push	06h		; R6
+	push	07h		; R7
+
+	clr	IE.7		; block other interrupts
+		
+	mov	dptr,#0E780h	; FIFO buffer of EP1OUT
+	movx	a,@dptr		; get the first byte
+	mov	r0,#CMD_FLAG	; pointer to the command byte
+	mov 	@r0,a		; store the command byte for ep8
+
+	mov	dptr,#ep1out_jmp; jump table for the different functions
+	rl	a		; multiply by 2: sizeof sjmp
+	jmp	@a+dptr		; jump to the jump table
+	;; jump table, corresponds to the command bytes defined
+	;; in usbdux.c
+ep1out_jmp:
+	sjmp	startadc	; a=0
+	sjmp	single_da	; a=1
+	sjmp	config_digital_b; a=2
+	sjmp	write_digital_b	; a=3
+	sjmp	initsgADchannel	; a=4
+	sjmp	nothing		; a=5
+	sjmp	nothing		; a=6
+	sjmp	pwm_on		; a=7
+	sjmp	pwm_off		; a=8
+
+nothing:
+	ljmp	over_da
+
+pwm_on:
+	lcall	startPWM
+	sjmp	over_da
+
+pwm_off:
+	lcall	stopPWM
+	sjmp	over_da
+
+initsgADchannel:
+	mov	dptr,#0e781h	; FIFO buffer of EP1OUT
+	lcall	configADC	; configures the ADC esp sel the channel
+
+	lcall	reset_ep8	; reset FIFO: get rid of old bytes
+	;; Save new A/D data in EP8. This is the first byte
+	;; the host will read during an INSN. If there are
+	;; more to come they will be handled by the ISR of
+	;; ep8.
+	lcall	ep8_ops		; get A/D data
+		
+	sjmp	over_da
+
+	
+;;; config AD:
+;;; we write to the registers of the A/D converter
+startadc:
+	mov	dptr,#0e781h	; FIFO buffer of EP1OUT from 2nd byte
+
+	movx	a,@dptr		; get length of channel list
+	inc	dptr
+	mov	r0,#MAXSMPL
+	mov	@r0,a 		; length of the channel list
+
+	lcall	configADC	; configures all registers
+
+	lcall	reset_ep6	; reset FIFO
+	
+	;; load new A/D data into EP6
+	;; This must be done. Otherwise the ISR is never called.
+	;; The ISR is only called when data has _left_ the
+	;; ep buffer here it has to be refilled.
+	lcall	ep6_arm		; fill with dummy data
+	
+	sjmp	over_da
+
+;;; Single DA conversion. The 2 bytes are in the FIFO buffer
+single_da:
+	mov	dptr,#0e781h	; FIFO buffer of EP1OUT
+	lcall	dalo		; conversion
+	sjmp	over_da
+
+;;; configure the port B as input or output (bitwise)
+config_digital_b:
+	mov	dptr,#0e781h	; FIFO buffer of EP1OUT
+	movx	a,@dptr		; get the second byte
+	inc	dptr
+	mov	OEB,a		; set the output enable bits
+	movx	a,@dptr		; get the second byte
+	inc	dptr
+	mov	OEC,a
+	movx	a,@dptr		; get the second byte
+	inc	dptr
+	mov	OED,a
+	sjmp	over_da
+	
+;;; Write one byte to the external digital port B
+;;; and prepare for digital read
+write_digital_b:
+	mov	dptr,#0e781h	; FIFO buffer of EP1OUT
+	movx	a,@dptr		; command[1]
+	inc	dptr
+	mov	OEB,a		; output enable
+	movx	a,@dptr		; command[2]
+	inc	dptr
+	mov	OEC,a
+	movx	a,@dptr		; command[3]
+	inc	dptr
+	mov	OED,a 
+	movx	a,@dptr		; command[4]
+	inc	dptr
+	mov	IOB,a		;
+	movx	a,@dptr		; command[5]
+	inc	dptr
+	mov	IOC,a
+	movx	a,@dptr		; command[6]
+	inc	dptr
+	mov	IOD,a
+
+	lcall	reset_ep8	; reset FIFO of ep 8
+
+	;; fill ep8 with new data from port B
+	;; When the host requests the data it's already there.
+	;; This must be so. Otherwise the ISR is not called.
+	;; The ISR is only called when a packet has been delivered
+	;; to the host. Thus, we need a packet here in the
+	;; first instance.
+	lcall	ep8_ops		; get digital data
+
+	;; 
+	;; for all commands the same
+over_da:	
+	mov	dptr,#EP1OUTBC
+	mov	a,#00h
+	lcall	syncdelaywr	; arm
+	lcall	syncdelaywr	; arm
+	lcall	syncdelaywr	; arm
+
+	;; clear INT2
+	mov	a,EXIF		; FIRST clear the USB (INT2) interrupt request
+	clr	acc.4
+	mov	EXIF,a		; Note: EXIF reg is not 8051 bit-addressable
+
+	mov	DPTR,#EPIRQ	; 
+	mov	a,#00001000b	; clear the ep1outirq
+	movx	@DPTR,a
+
+	setb	IE.7		; re-enable interrupts
+
+	pop	07h
+	pop	06h
+	pop	05h
+	pop	04h		; R4
+	pop	03h		; R3
+	pop	02h		; R2
+	pop	01h		; R1
+	pop	00h		; R0
+	pop	psw
+	pop	acc 
+	pop	dph1 
+	pop	dpl1
+	pop	dph 
+	pop	dpl 
+	pop	dps
+	reti
+
+
+	
+;;; all channels
+dalo:
+	movx	a,@dptr		; number of bytes to send out
+	inc	dptr		; pointer to the first byte
+	mov	r0,a		; counter
+nextDA:	
+	movx	a,@dptr		; get the byte
+	inc	dptr		; point to the high byte
+	mov	r3,a		; store in r3 for writeDA
+	movx	a,@dptr		; get the channel number
+	inc	dptr		; get ready for the next channel
+	lcall	writeDA		; write value to the DAC
+	djnz	r0,nextDA	; next channel
+	ret
+
+
+
+;;; D/A-conversion:
+;;; channel number in a
+;;; value in r3
+writeDA:
+	anl	a,#00000011b	; 4 channels
+	mov	r1,#6		; the channel number needs to be shifted up
+writeDA2:
+	rl	a		; bit shift to the left
+	djnz	r1,writeDA2	; do it 6 times
+	orl	a,#00010000b	; update outputs after write
+	mov	r2,a		; backup
+	mov	a,r3		; get byte
+	anl	a,#11110000b	; get the upper nibble
+	mov	r1,#4		; shift it up to the upper nibble
+writeDA3:
+	rr	a		; shift to the upper to the lower
+	djnz	r1,writeDA3
+	orl	a,r2		; merge with the channel info
+	clr	IOA.6		; /SYNC of the DA to 0
+	lcall	sendSPI		; send it out to the SPI
+	mov	a,r3		; get data again
+	anl	a,#00001111b	; get the lower nibble
+	mov	r1,#4		; shift that to the upper
+writeDA4:
+	rl	a
+	djnz	r1,writeDA4
+	anl	a,#11110000b	; make sure that's empty
+	lcall	sendSPI
+	setb	IOA.6		; /SYNC of the DA to 1
+noDA:	ret
+	
+
+
+;;; arm ep6: this is just a dummy arm to get things going
+ep6_arm:
+	mov	DPTR,#EP6BCH	; byte count H
+	mov	a,#0		; is zero
+	lcall	syncdelaywr	; wait until the length has arrived
+	
+	mov	DPTR,#EP6BCL	; byte count L
+	mov	a,#1		; is one
+	lcall	syncdelaywr	; wait until the length has been proc
+	ret
+	
+
+
+;;; converts one analog/digital channel and stores it in EP8
+;;; also gets the content of the digital ports B,C and D depending on
+;;; the COMMAND flag
+ep8_ops:
+	mov	dptr,#0fc01h	; ep8 fifo buffer
+	clr	a		; high byte
+	movx	@dptr,a		; set H=0
+	mov	dptr,#0fc00h	; low byte
+	mov	r0,#CMD_FLAG
+	mov	a,@r0
+	movx	@dptr,a		; save command byte
+
+	mov	dptr,#ep8_jmp	; jump table for the different functions
+	rl	a		; multiply by 2: sizeof sjmp
+	jmp	@a+dptr		; jump to the jump table
+	;; jump table, corresponds to the command bytes defined
+	;; in usbdux.c
+ep8_jmp:
+	sjmp	ep8_err		; a=0, err
+	sjmp	ep8_err		; a=1, err
+	sjmp	ep8_err		; a=2, err
+	sjmp	ep8_dio		; a=3, digital read
+	sjmp	ep8_sglchannel	; a=4, analog A/D
+	sjmp	ep8_err		; a=5, err
+	sjmp	ep8_err		; a=6, err
+
+	;; read one A/D channel
+ep8_sglchannel:
+	mov 	DPTR,#0fc01h	; EP8 FIFO
+	setb	IOA.7		; start converter, START = 1
+	lcall	readADCch	; get one reading
+	clr	IOA.7		; stop the converter, START = 0
+
+	sjmp	ep8_send	; send the data
+
+	;; read the digital lines
+ep8_dio:	
+	mov 	DPTR,#0fc01h	; store the contents of port B
+	mov	a,IOB		; in the next
+	movx	@dptr,a		; entry of the buffer
+	inc	dptr
+	mov	a,IOC		; port C
+	movx	@dptr,a		; next byte of the EP
+	inc	dptr
+	mov	a,IOD
+	movx	@dptr,a		; port D
+	
+ep8_send:	
+	mov	DPTR,#EP8BCH	; byte count H
+	mov	a,#0		; is zero
+	lcall	syncdelaywr
+	
+	mov	DPTR,#EP8BCL	; byte count L
+	mov	a,#10H		; 16 bytes, bec it's such a great number...
+	lcall	syncdelaywr	; send the data over to the host
+
+ep8_err:	
+	ret
+
+
+
+;;; EP8 interrupt is the endpoint which sends data back after a command
+;;; The actual command fills the EP buffer already
+;;; but for INSNs we need to deliver more data if the count > 1
+ep8_isr:	
+	push	dps
+	push	dpl
+	push	dph
+	push	dpl1
+	push	dph1
+	push	acc
+	push	psw
+	push	00h		; R0
+	push	01h		; R1
+	push	02h		; R2
+	push	03h		; R3
+	push	04h		; R4
+	push	05h		; R5
+	push	06h		; R6
+	push	07h		; R7
+		
+	lcall	ep8_ops
+	
+	;; clear INT2
+	mov	a,EXIF		; FIRST clear the USB (INT2) interrupt request
+	clr	acc.4
+	mov	EXIF,a		; Note: EXIF reg is not 8051 bit-addressable
+
+	mov	DPTR,#EPIRQ	; 
+	mov	a,#10000000b	; clear the ep8irq
+	movx	@DPTR,a
+
+	pop	07h
+	pop	06h
+	pop	05h
+	pop	04h		; R4
+	pop	03h		; R3
+	pop	02h		; R2
+	pop	01h		; R1
+	pop	00h		; R0
+	pop	psw
+	pop	acc 
+	pop	dph1 
+	pop	dpl1
+	pop	dph 
+	pop	dpl 
+	pop	dps
+	reti
+
+
+
+;;; GPIF waveform for PWM
+waveform:
+	;;      0     1     2     3     4     5     6     7(not used)
+	;; len (gives 50.007Hz)
+	.db	195,  195,  195,  195,  195,  195,  1,    1
+
+	;; opcode
+	.db	002H, 006H, 002H, 002H, 002H, 002H, 002H, 002H
+	
+	;; out
+	.db	0ffH, 0ffH, 0ffH, 0ffH, 0ffH, 0ffH, 0ffH, 0ffH
+
+	;; log
+	.db	000H, 000H, 000H, 000H, 000H, 000H, 000H, 000H
+
+
+stopPWM:
+	mov	r0,#PWMFLAG	; flag for PWM
+	mov	a,#0		; PWM (for the main loop)
+	mov	@r0,a		; set it
+
+	mov	dptr,#IFCONFIG	; switch off GPIF
+	mov	a,#10100000b	; gpif, 30MHz, internal IFCLK
+	lcall	syncdelaywr
+	ret
+	
+
+;;; init PWM
+startPWM:
+	mov	dptr,#IFCONFIG	; switch on IFCLK signal
+	mov	a,#10100010b	; gpif, 30MHz, internal IFCLK
+	lcall	syncdelaywr
+
+	mov	OEB,0FFH	; output to port B
+
+	mov	DPTR,#EP4CFG
+	mov	a,#10100000b	; valid, out, bulk
+	movx	@DPTR,a
+
+	;; reset the endpoint
+	mov	dptr,#FIFORESET
+	mov	a,#80h		; NAK
+	lcall	syncdelaywr
+	mov	a,#84h		; reset EP4 + NAK
+	lcall	syncdelaywr
+	mov	a,#0		; normal op
+	lcall	syncdelaywr
+
+	mov	dptr,#EP4BCL
+	mov	a,#0H		; discard packets
+	lcall	syncdelaywr	; empty FIFO buffer
+	lcall	syncdelaywr	; empty FIFO buffer
+
+	;; aborts all transfers by the GPIF
+	mov	dptr,#GPIFABORT
+	mov	a,#0ffh		; abort all transfers
+	lcall	syncdelaywr
+
+	;; wait for GPIF to finish
+wait_f_abort:
+	mov	a,GPIFTRIG	; GPIF status
+	anl	a,#80h		; done bit
+	jz	wait_f_abort	; GPIF busy
+
+        mov     dptr,#GPIFCTLCFG
+        mov     a,#10000000b    ; tri state for CTRL
+        lcall   syncdelaywr
+
+        mov     dptr,#GPIFIDLECTL
+        mov     a,#11110000b    ; all CTL outputs low
+        lcall   syncdelaywr
+
+	;; abort if FIFO is empty
+        mov     a,#00000001b    ; abort if empty
+        mov     dptr,#EP4GPIFFLGSEL
+        lcall   syncdelaywr
+
+	;; 
+        mov     a,#00000001b    ; stop if GPIF flg
+        mov     dptr,#EP4GPIFPFSTOP
+        lcall   syncdelaywr
+
+	;; transaction counter
+	mov	a,#0ffH
+	mov	dptr,#GPIFTCB3
+	lcall	syncdelaywr
+
+	;; transaction counter
+	mov	a,#0ffH
+	mov	dptr,#GPIFTCB2
+	lcall	syncdelaywr
+
+	;; transaction counter
+	mov	a,#0ffH		; 512 bytes
+	mov	dptr,#GPIFTCB1
+	lcall	syncdelaywr
+
+	;; transaction counter
+	mov	a,#0ffH
+	mov	dptr,#GPIFTCB0
+	lcall	syncdelaywr
+
+	;; RDY pins. Not used here.
+        mov     a,#0
+        mov     dptr,#GPIFREADYCFG
+        lcall   syncdelaywr
+
+	;; drives the output in the IDLE state
+        mov     a,#1
+        mov     dptr,#GPIFIDLECS
+        lcall   syncdelaywr
+
+	;; direct data transfer from the EP to the GPIF
+	mov	dptr,#EP4FIFOCFG
+	mov	a,#00010000b	; autoout=1, byte-wide
+	lcall	syncdelaywr
+
+	;; waveform 0 is used for FIFO out
+	mov	dptr,#GPIFWFSELECT
+	mov	a,#00000000b
+	movx	@dptr,a
+	lcall	syncdelay
+
+	;; transfer the delay byte from the EP to the waveform
+	mov	dptr,#0e781h	; EP1 buffer
+	movx	a,@dptr		; get the delay
+	mov	dptr,#waveform	; points to the waveform
+	mov	r2,#6		; fill 6 bytes
+timloop:
+	movx	@dptr,a		; save timing in a xxx
+	inc	dptr
+	djnz	r2,timloop	; fill the 6 delay bytes
+
+	;; load waveform
+        mov     AUTOPTRH2,#0E4H ; XDATA0H
+        lcall   syncdelay
+        mov     AUTOPTRL2,#00H  ; XDATA0L
+        lcall   syncdelay
+
+	mov	dptr,#waveform	; points to the waveform
+	
+        mov     AUTOPTRSETUP,#7 ; autoinc and enable
+        lcall   syncdelay
+
+        mov     r2,#20H         ; 32 bytes to transfer
+
+wavetr:
+        movx    a,@dptr
+	inc	dptr
+	push	dpl
+	push	dph
+	push	dpl1
+	push	dph1
+        mov     dptr,#XAUTODAT2
+        movx    @dptr,a
+        lcall   syncdelay
+	pop	dph1 
+	pop	dpl1
+	pop	dph 
+	pop	dpl
+        djnz    r2,wavetr
+
+	mov	dptr,#OUTPKTEND
+	mov	a,#084H
+	lcall	syncdelaywr
+	lcall	syncdelaywr
+
+	mov	r0,#PWMFLAG	; flag for PWM
+	mov	a,#1		; PWM (for the main loop)
+	mov	@r0,a		; set it
+
+	ret
+
+	
+
+;; need to delay every time the byte counters
+;; for the EPs have been changed.
+
+syncdelay:
+	nop
+	nop
+	nop
+	nop
+	nop
+	nop
+	nop
+	nop
+	nop
+	ret
+
+syncdelaywr:
+	movx	@dptr,a
+	lcall	syncdelay
+	ret
+
+
+
+	.org	1F00h		; lookup table at the end of memory
+
+swap_lut:
+.db 0,128,64,192,32,160,96,224,16,144,80,208,48,176,112,240,8,136
+.db 72,200,40,168,104,232,24,152,88,216,56,184,120,248,4,132,68,196,36,164,100
+.db 228,20,148,84,212,52,180,116,244,12,140,76,204,44,172,108,236,28,156,92,220
+.db 60,188,124,252,2,130,66,194,34,162,98,226,18,146,82,210,50,178,114,242,10
+.db 138,74,202,42,170,106,234,26,154,90,218,58,186,122,250,6,134,70,198,38,166
+.db 102,230,22,150,86,214,54,182,118,246,14,142,78,206,46,174,110,238,30,158,94
+.db 222,62,190,126,254,1,129,65,193,33,161,97,225,17,145,81,209,49,177,113,241,9
+.db 137,73,201,41,169,105,233,25,153,89,217,57,185,121,249,5,133,69,197,37,165
+.db 101,229,21,149,85,213,53,181,117,245,13,141,77,205,45,173,109,237,29,157,93
+.db 221,61,189,125,253,3,131,67,195,35,163,99,227,19,147,83,211,51,179,115,243,11
+.db 139,75,203,43,171,107,235,27,155,91,219,59,187,123,251,7,135,71,199,39,167
+.db 103,231,23,151,87,215,55,183,119,247,15,143,79,207,47,175,111,239,31,159,95
+.db 223,63,191,127,255
+
+
+
+	
+.End
+
+
diff --git a/usbdux_firmware.bin b/usbdux_firmware.bin
new file mode 100644
index 0000000..7f537fc
--- /dev/null
+++ b/usbdux_firmware.bin
Binary files differ
diff --git a/usbduxfast_firmware.bin b/usbduxfast_firmware.bin
new file mode 100644
index 0000000..3a6441d
--- /dev/null
+++ b/usbduxfast_firmware.bin
Binary files differ
diff --git a/usbduxsigma_firmware.bin b/usbduxsigma_firmware.bin
new file mode 100644
index 0000000..8ed1261
--- /dev/null
+++ b/usbduxsigma_firmware.bin
Binary files differ
diff --git a/v4l-cx231xx-avcore-01.fw b/v4l-cx231xx-avcore-01.fw
new file mode 100644
index 0000000..78c5e9e
--- /dev/null
+++ b/v4l-cx231xx-avcore-01.fw
Binary files differ
diff --git a/v4l-cx23418-apu.fw b/v4l-cx23418-apu.fw
new file mode 100644
index 0000000..04351f1
--- /dev/null
+++ b/v4l-cx23418-apu.fw
Binary files differ
diff --git a/v4l-cx23418-cpu.fw b/v4l-cx23418-cpu.fw
new file mode 100644
index 0000000..22227b6
--- /dev/null
+++ b/v4l-cx23418-cpu.fw
Binary files differ
diff --git a/v4l-cx23418-dig.fw b/v4l-cx23418-dig.fw
new file mode 100644
index 0000000..cfd6e84
--- /dev/null
+++ b/v4l-cx23418-dig.fw
Binary files differ
diff --git a/v4l-cx23885-avcore-01.fw b/v4l-cx23885-avcore-01.fw
new file mode 100644
index 0000000..5efd51c
--- /dev/null
+++ b/v4l-cx23885-avcore-01.fw
Binary files differ
diff --git a/v4l-cx25840.fw b/v4l-cx25840.fw
new file mode 100644
index 0000000..baa89ff
--- /dev/null
+++ b/v4l-cx25840.fw
Binary files differ
diff --git a/vicam/firmware.fw b/vicam/firmware.fw
new file mode 100644
index 0000000..048a738
--- /dev/null
+++ b/vicam/firmware.fw
Binary files differ
diff --git a/vntwusb.fw b/vntwusb.fw
new file mode 100644
index 0000000..2b5c353
--- /dev/null
+++ b/vntwusb.fw
Binary files differ
diff --git a/vxge/X3fw-pxe.ncf b/vxge/X3fw-pxe.ncf
new file mode 100644
index 0000000..2ad4f52
--- /dev/null
+++ b/vxge/X3fw-pxe.ncf
Binary files differ
diff --git a/vxge/X3fw.ncf b/vxge/X3fw.ncf
new file mode 100644
index 0000000..f127d70
--- /dev/null
+++ b/vxge/X3fw.ncf
Binary files differ
diff --git a/whiteheat.fw b/whiteheat.fw
new file mode 100644
index 0000000..49e7f3b
--- /dev/null
+++ b/whiteheat.fw
Binary files differ
diff --git a/whiteheat_loader.fw b/whiteheat_loader.fw
new file mode 100644
index 0000000..c3392e2
--- /dev/null
+++ b/whiteheat_loader.fw
Binary files differ
diff --git a/yam/1200.bin b/yam/1200.bin
new file mode 100644
index 0000000..3efa52a
--- /dev/null
+++ b/yam/1200.bin
Binary files differ
diff --git a/yam/9600.bin b/yam/9600.bin
new file mode 100644
index 0000000..b16d281
--- /dev/null
+++ b/yam/9600.bin
Binary files differ
diff --git a/yamaha/ds1_ctrl.fw b/yamaha/ds1_ctrl.fw
new file mode 100644
index 0000000..522e41e
--- /dev/null
+++ b/yamaha/ds1_ctrl.fw
Binary files differ
diff --git a/yamaha/ds1_dsp.fw b/yamaha/ds1_dsp.fw
new file mode 100644
index 0000000..8813620
--- /dev/null
+++ b/yamaha/ds1_dsp.fw
Binary files differ
diff --git a/yamaha/ds1e_ctrl.fw b/yamaha/ds1e_ctrl.fw
new file mode 100644
index 0000000..4e1b452
--- /dev/null
+++ b/yamaha/ds1e_ctrl.fw
Binary files differ
diff --git a/yamaha/yss225_registers.bin b/yamaha/yss225_registers.bin
new file mode 100644
index 0000000..99e9790
--- /dev/null
+++ b/yamaha/yss225_registers.bin
Binary files differ