diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d5357198..824362d7 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -6,8 +6,8 @@ different communities with different expectations and requirements, it is both essential and difficult to have contributions from the communities. While they are sometimes necessary to adapt Gluon to the needs of the communities, they also have to be adaptable enough to fit as many needs as possible. On the other -hands, very special needs are better addressed in packages in [community -repositories], because the Gluon maintainers would not use or test them and +hands, very special needs are better addressed in [packages] in community +repositories, because the Gluon maintainers would not use or test them and thus couldn't do their "job" of maintaining them. To ease the work for the maintainers and to reduce the frustration of @@ -25,10 +25,9 @@ after merging the changes, too. The preferred way to discuss in the IRC channel ([#gluon] on irc.hackint.org) or on the [mailing list], however, you can also open a new issue on Github to -discuss there. We maintain a [list of rejected -features](https://github.com/freifunk-gluon/gluon/issues?q=label%3Arejected) -and we'd like to kindly ask you to review it first. In general, looking for -duplicates may save you some time. +discuss there. We maintain a [list of rejected features] and we'd like to +kindly ask you to review it first. In general, looking for duplicates may save +you some time. Develop on top of master ------------------------ @@ -53,7 +52,7 @@ Most changes are trivial enough to fit in one single commit in order to not clutter the history. While developing a new feature, you are free to use multiple commits, but if your feature is to be merged, reduce the number of commits to a minimum. Even huge feature introductions like the 802.11s mesh -(commit 2a93c58) fit into a single commit. +(commit [2a93c58]) fit into a single commit. If you developed your change in multiple smaller commits, you can easily [squash] those before opening the pull request. While discussing, it is okay to @@ -62,7 +61,9 @@ the pull request. This way, your change always consists of only one commit and can be merged in the instant everybody is content with the whole thing. -[community repositories]: http://gluon.readthedocs.org/en/latest/user/site.html#packages -[#gluon]: irc://irc.hackint.org/gluon +[packages]: http://gluon.readthedocs.org/en/latest/user/site.html#packages +[#gluon]: https://webirc.hackint.org/#gluon [mailing list]: mailto:gluon@luebeck.freifunk.net +[list of rejected features]: https://github.com/freifunk-gluon/gluon/issues?q=label%3Arejected +[2a93c58]: https://github.com/freifunk-gluon/gluon/commit/2a93c580428d10724116b0d2d1238e2745715a14 [squash]: https://www.git-scm.com/book/en/v2/Git-Tools-Rewriting-History#Squashing-Commits diff --git a/Makefile b/Makefile index dfc0f001..90ea36f3 100644 --- a/Makefile +++ b/Makefile @@ -4,11 +4,16 @@ LC_ALL:=C LANG:=C export LC_ALL LANG +export SHELL:=/usr/bin/env bash + +GLUONPATH ?= $(PATH) +export GLUONPATH := $(GLUONPATH) + empty:= space:= $(empty) $(empty) -GLUONMAKE_EARLY = $(SUBMAKE) -C $(GLUON_ORIGOPENWRTDIR) -f $(GLUONDIR)/Makefile GLUON_TOOLS=0 QUILT= -GLUONMAKE = $(SUBMAKE) -C $(GLUON_OPENWRTDIR) -f $(GLUONDIR)/Makefile +GLUONMAKE_EARLY = PATH=$(GLUONPATH) $(SUBMAKE) -C $(GLUON_ORIGOPENWRTDIR) -f $(GLUONDIR)/Makefile GLUON_TOOLS=0 QUILT= +GLUONMAKE = PATH=$(GLUONPATH) $(SUBMAKE) -C $(GLUON_OPENWRTDIR) -f $(GLUONDIR)/Makefile ifneq ($(OPENWRT_BUILD),1) @@ -24,12 +29,6 @@ update: FORCE $(GLUONDIR)/scripts/update.sh $(GLUONDIR)/scripts/patch.sh -patch: FORCE - $(GLUONDIR)/scripts/patch.sh - -unpatch: FORCE - $(GLUONDIR)/scripts/unpatch.sh - update-patches: FORCE $(GLUONDIR)/scripts/update.sh $(GLUONDIR)/scripts/update-patches.sh @@ -299,7 +298,8 @@ prepare-target: $(GLUON_OPKG_KEY).pub $(target_prepared_stamp): +$(GLUONMAKE_EARLY) prepare-target -maybe-prepare-target: $(GLUON_OPKG_KEY).pub $(target_prepared_stamp) +maybe-prepare-target: $(target_prepared_stamp) + +$(GLUONMAKE_EARLY) $(GLUON_OPKG_KEY).pub $(BUILD_DIR)/.prepared: Makefile @mkdir -p $$(dirname $@) diff --git a/README.md b/README.md index 51dec098..3ef1f420 100644 --- a/README.md +++ b/README.md @@ -12,11 +12,14 @@ Before opening an issue, make sure to check whether any existing issues (open or closed) match. If you're suggesting a new feature, drop by on IRC or our mailinglist to discuss it first. +We maintain a [Roadmap](https://github.com/freifunk-gluon/gluon/wiki/Roadmap) for +the future development of Gluon. + ## Use a release! Please refrain from using the `master` branch for anything else but development purposes! Use the most recent release instead. You can list all relaseses by running `git branch -a` -and switch to one by running `git checkout v2016.1.2 && make update`. +and switch to one by running `git checkout v2016.1.5 && make update`. If you're using the autoupdater, do not autoupdate nodes with anything but releases. If you upgrade using random master commits the nodes *will break* eventually. diff --git a/docs/conf.py b/docs/conf.py index 1f634eb2..fd329bda 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -47,7 +47,7 @@ master_doc = 'index' # General information about the project. project = 'Gluon' -copyright = '2015, Project Gluon' +copyright = '2015-2016, Project Gluon' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the diff --git a/docs/dev/hardware.rst b/docs/dev/hardware.rst index 3bd62a3d..7f04d93d 100644 --- a/docs/dev/hardware.rst +++ b/docs/dev/hardware.rst @@ -51,7 +51,7 @@ may be defined arbitrarily. On devices with multiple WLAN adapters, care must also be taken that the primary MAC address is configured correctly. ``/lib/gluon/core/sysconfig/primary_mac`` should contain the MAC address which -can be found on a label on most hardware; if it does not, ``/lib/gluon/upgrade/core/initial/001-sysconfig`` +can be found on a label on most hardware; if it does not, ``/lib/gluon/upgrade/010-primary-mac`` in ``gluon-core`` might need a fix. (There have also been cases in which the address was incorrect even on devices with only one WLAN adapter, in these cases an OpenWrt bug was the cause). diff --git a/docs/features/autoupdater.rst b/docs/features/autoupdater.rst index 873f6097..8c4ca73f 100644 --- a/docs/features/autoupdater.rst +++ b/docs/features/autoupdater.rst @@ -70,5 +70,11 @@ These commands can be used on a node: # Force update check, even when the updater is disabled autoupdater -f + +:: + + # If fallback is true the updater will perform an update only if + # the timespan given by the priority and another 24h have passed + autoupdater --fallback diff --git a/docs/index.rst b/docs/index.rst index 2c0a50e2..242e96bc 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -51,6 +51,7 @@ Packages :maxdepth: 1 package/gluon-client-bridge + package/gluon-config-mode-geo-location package/gluon-ebtables-filter-multicast package/gluon-ebtables-filter-ra-dhcp @@ -60,6 +61,9 @@ Releases .. toctree:: :maxdepth: 1 + releases/v2016.1.5 + releases/v2016.1.4 + releases/v2016.1.3 releases/v2016.1.2 releases/v2016.1.1 releases/v2016.1 @@ -77,6 +81,16 @@ Supported Devices & Architectures ar71xx-generic ^^^^^^^^^^^^^^ +* 8devices + + - Carambola 2 + +* ALFA Network + + - AP121 + - AP121U + - Hornet-UB + * Allnet - ALL0315N @@ -87,6 +101,11 @@ ar71xx-generic - WZR-HP-G300NH - WZR-HP-G450H +* Cisco Meraki + + - MR12 / MR62 + - MR16 / MR66 + * D-Link - DIR-505 (A1) @@ -112,6 +131,18 @@ ar71xx-generic - Omega +* OpenMesh + + - MR1750 + - MR600 (v1, v2) + - MR900 (v1, v2) + - OM2P (v1, v2) + - OM2P-HS (v1, v2) + - OM2P-LC + - OM5P + - OM5P-AC (v1, v2) + - OM5P-AN + * TP-Link - CPE210 (v1.0, v1.1) @@ -140,7 +171,7 @@ ar71xx-generic - TL-WR741N/ND (v1, v2, v4, v5) - TL-WR743N/ND (v1, v2) - TL-WR801N/ND (v1, v2) - - TL-WR841N/ND (v3, v5, v7, v8, v9, v10) + - TL-WR841N/ND (v3, v5, v7, v8, v9, v10, v11) - TL-WR842N/ND (v1, v2) - TL-WR843N/ND (v1) - TL-WR940N (v1, v2, v3) @@ -153,11 +184,13 @@ ar71xx-generic - Air Gateway - Air Router - Bullet M + - Loco M + - Loco M XW - Nanostation M - Nanostation M XW - - Loco M XW - Picostation M - Rocket M + - Rocket M XW - UniFi AP - UniFi AP Pro - UniFi AP Outdoor diff --git a/docs/package/gluon-config-mode-geo-location.rst b/docs/package/gluon-config-mode-geo-location.rst new file mode 100644 index 00000000..83ca238b --- /dev/null +++ b/docs/package/gluon-config-mode-geo-location.rst @@ -0,0 +1,14 @@ +gluon-config-mode-geo-location +============================== + +This package enables the user to set latitude, longitude and altitude of their +node within config mode. As the usage of the altitude is not well defined the +corresponding field can be disabled. + +site.conf +--------- + +config_mode.geo_location.show_altitude : optional + - ``true`` enables the altitude field + - ``false`` disables the altitude field if altitude has not yet been set + - defaults to ``true`` diff --git a/docs/releases/v2016.1.3.rst b/docs/releases/v2016.1.3.rst new file mode 100644 index 00000000..ba5b9672 --- /dev/null +++ b/docs/releases/v2016.1.3.rst @@ -0,0 +1,43 @@ +Gluon 2016.1.3 +============== + +Added hardware support +~~~~~~~~~~~~~~~~~~~~~~ + +ar71xx-generic +^^^^^^^^^^^^^^ + +* ALFA Hornet UB / AP121 / AP121U +* TP-Link TL-WA7510N + +Bugfixes +~~~~~~~~ + +* The nondeterministic boot hang (`#669 `_) that was thought to + be fixed in Gluon v2016.1.2 has resurfaced on other hardware. We believe it is now fixed properly. +* Sysupgrades on the Xen DomU have been fixed. +* Gluon can now be built on systems that use LibreSSL instead of OpenSSL. + +Known Issues +~~~~~~~~~~~~ + +* Default TX power on many Ubiquiti devices is too high, correct offsets are unknown (`#94 `_) + + Reducing the TX power in the Expert Mode is recommended. + +* The MAC address of the WAN interface is modified even when Mesh-on-WAN is disabled (`#496 `_) + + This may lead to issues in environments where a fixed MAC address is expected (like VMware when promicious mode is disallowed). + +* Inconsistent respondd API (`#522 `_) + + The current API is inconsistent and will be replaced eventually. The old API will still be supported for a while. + +* Unwritable flash on some Ubiquiti PicoStations (`#687 `_) + + Gluon v2016.1.1 added support for Ubiquiti AirMAX devices with AirOS 5.6.x without downgrading AirOS first before + flashing Gluon. It was discovered that on Ubiquiti PicoStations, this downgrade is still necessary, as the + flash is not correctly unlocked, leaving the device unable to leave Config Mode and making regular sysupgrades + impossible. + + TFTP recovery can be used in this state to flash a new firmware. diff --git a/docs/releases/v2016.1.4.rst b/docs/releases/v2016.1.4.rst new file mode 100644 index 00000000..0d8d2019 --- /dev/null +++ b/docs/releases/v2016.1.4.rst @@ -0,0 +1,46 @@ +Gluon 2016.1.4 +============== + +Added hardware support +~~~~~~~~~~~~~~~~~~~~~~ + +ar71xx-generic +^^^^^^^^^^^^^^ + +* 8devices Carambola 2 +* Meraki MR12/MR62/MR16/MR66 + +Bugfixes +~~~~~~~~ + +* Major update of all WLAN drivers + + We've taken the unusual step of updating the WLAN drivers ("wireless-backports") to a much newer version, as + it was reported that the new version fixes unstable WLAN seen in many setups +* Build fix: a race condition causing parallel builds to fail has been fixed +* Build fix: the Gluon tree could get into a state in which all commands fail with "Too many levels of symbolic links" +* Build fix: allow building Gluon on systems with certain versions of *dash* as */bin/sh* + +Known Issues +~~~~~~~~~~~~ + +* Default TX power on many Ubiquiti devices is too high, correct offsets are unknown (`#94 `_) + + Reducing the TX power in the Expert Mode is recommended. + +* The MAC address of the WAN interface is modified even when Mesh-on-WAN is disabled (`#496 `_) + + This may lead to issues in environments where a fixed MAC address is expected (like VMware when promicious mode is disallowed). + +* Inconsistent respondd API (`#522 `_) + + The current API is inconsistent and will be replaced eventually. The old API will still be supported for a while. + +* Unwritable flash on some Ubiquiti PicoStations (`#687 `_) + + Gluon v2016.1.1 added support for Ubiquiti AirMAX devices with AirOS 5.6.x without downgrading AirOS first before + flashing Gluon. It was discovered that on Ubiquiti PicoStations, this downgrade is still necessary, as the + flash is not correctly unlocked, leaving the device unable to leave Config Mode and making regular sysupgrades + impossible. + + TFTP recovery can be used in this state to flash a new firmware. diff --git a/docs/releases/v2016.1.5.rst b/docs/releases/v2016.1.5.rst new file mode 100644 index 00000000..e5ee1a00 --- /dev/null +++ b/docs/releases/v2016.1.5.rst @@ -0,0 +1,66 @@ +Gluon 2016.1.5 +============== + +Added hardware support +~~~~~~~~~~~~~~~~~~~~~~ + +ar71xx-generic +^^^^^^^^^^^^^^ + +* OpenMesh + + - MR600 (v1, v2) + - MR900 (v1, v2) + - OM2P (v1, v2) + - OM2P-HS (v1, v2) + - OM2P-LC + - OM5P + - OM5P-AN + +* Ubiquiti + + - Rocket M XW + +* TP-LINK + + - TL-WR841N/ND v11 + +Bugfixes +~~~~~~~~ + +* build: fix race condition caused by using certain make targets (like *clean*, *images* or *package/\**) + with parallel build options without doing a full build before +* build: fix package dependency issue causing "recursive dependency" warning + + This dependency issue could lead to broken configurations and reportedly caused failed builds in some cases + when additional (site-specific) packages were used. +* build: Gluon will now build correctly with GCC 6 as host compiler +* Fix configuration of batman-adv when VLANs are used on top of IBSS interfaces (regression due to netifd update in :doc:`v2016.1.4`) +* Add back missing ath10k firmware (regression due to mac80211 update in :doc:`v2016.1.4`) +* Gluon can now be used on all supported Ubiquiti AirMAX devices without downgrading to AirOS 5.5.x before + + :doc:`v2016.1.1` added support for most Ubiquiti AirMAX devices with AirOS 5.6.x without downgrading AirOS, + but left some devices (at least some PicoStations and Bullets) with unwritable flash. This issue has been + resolved (`#687 `_). +* Add upgrade script to automatically remove whitespace from configured geolocation + + The new respondd implementation included in :doc:`v2016.1` is stricter about the number format than the + old one and doesn't accept trailing whitespace (so one or both coordinates are missing from the output). + + The Config Mode has been fixed to strip whitespace from numeric fields in new configurations since :doc:`v2016.1.1`. + This still left old configurations, which are now fixed by this script. + +Known Issues +~~~~~~~~~~~~ + +* Default TX power on many Ubiquiti devices is too high, correct offsets are unknown (`#94 `_) + + Reducing the TX power in the Expert Mode is recommended. + +* The MAC address of the WAN interface is modified even when Mesh-on-WAN is disabled (`#496 `_) + + This may lead to issues in environments where a fixed MAC address is expected (like VMware when promicious mode is disallowed). + +* Inconsistent respondd API (`#522 `_) + + The current API is inconsistent and will be replaced eventually. The old API will still be supported for a while. diff --git a/docs/site-example/site.conf b/docs/site-example/site.conf index acabadb2..45719b94 100644 --- a/docs/site-example/site.conf +++ b/docs/site-example/site.conf @@ -183,4 +183,11 @@ -- setup_mode = { -- skip = true, -- }, + + -- Show/hide the altitude field + -- config_mode = { + -- geo_location = { + -- show_altitude = false, + -- }, + -- }, } diff --git a/docs/user/faq.rst b/docs/user/faq.rst index 9da15270..40a4e521 100644 --- a/docs/user/faq.rst +++ b/docs/user/faq.rst @@ -1,3 +1,17 @@ Frequently Asked Questions ========================== +.. _faq-dns: + +DNS does not work on the nodes +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Gluon nodes will ignore the DNS server on the WAN port for everything except +the mesh VPN, which can lead to confusion. + +All normal services on the nodes exclusively use the DNS server on the mesh +interface. This DNS server must be announced in router advertisements (using +*radvd* or a similar software) from one or more central servers in meshes based +on *batman-adv*. If your mesh does not have global IPv6 connectivity, you can setup +your *radvd* not to announce a default route by setting the *default lifetime* to 0; +in this case, the *radvd* is only used to announce the DNS server. diff --git a/docs/user/getting_started.rst b/docs/user/getting_started.rst index 544ee2a3..c7519cf0 100644 --- a/docs/user/getting_started.rst +++ b/docs/user/getting_started.rst @@ -8,7 +8,7 @@ Gluon's releases are managed using `Git tags`_. If you are just getting started with Gluon we recommend to use the latest stable release of Gluon. Take a look at the `list of gluon releases`_ and notice the latest release, -e.g. *v2016.1.2*. Always get Gluon using git and don't try to download it +e.g. *v2016.1.5*. Always get Gluon using git and don't try to download it as a Zip archive as the archive will be missing version information. Please keep in mind that there is no "default Gluon" build; a site configuration @@ -42,7 +42,7 @@ Building the images ------------------- To build Gluon, first check out the repository. Replace *RELEASE* with the -version you'd like to checkout, e.g. *v2016.1.2*. +version you'd like to checkout, e.g. *v2016.1.5*. :: @@ -130,7 +130,7 @@ not support IPv6. This is not true for kernel modules; the Gluon kernel is incompatible with the kernel of the default OpenWrt images. Therefore, Gluon will not only generate images, -but also an opkg repositoy containing all kernel modules provided by OpenWrt/Gluon +but also an opkg repository containing all kernel modules provided by OpenWrt/Gluon for the kernel of the generated images. Signing keys diff --git a/docs/user/site.rst b/docs/user/site.rst index b26a28a1..4a702b3e 100644 --- a/docs/user/site.rst +++ b/docs/user/site.rst @@ -44,9 +44,12 @@ ntp_server List of NTP servers available in your community or used by your community, e.g.: :: - ntp_servers = {'1.ntp.services.ffeh','2.tnp.services.ffeh'} + ntp_servers = {'1.ntp.services.ffeh','2.ntp.services.ffeh'} -opkg : optional + This NTP servers must be reachable via IPv6 from the nodes. If you don't want to set an IPv6 address + explicitly, but use a hostname (which is recommended), see also the :ref:`FAQ `. + +opkg \: optional ``opkg`` package manager configuration. There are two optional fields in the ``opkg`` section: @@ -72,7 +75,7 @@ opkg : optional - ``%GV`` is replaced by the Gluon version - ``%GR`` is replaced by the Gluon release (as specified in ``site.mk``) -regdom : optional +regdom \: optional The wireless regulatory domain responsible for your area, e.g.: :: @@ -80,7 +83,7 @@ regdom : optional Setting ``regdom`` in mandatory if ``wifi24`` or ``wifi5`` is defined. -wifi24 : optional +wifi24 \: optional WLAN configuration for 2.4 GHz devices. ``channel`` must be set to a valid wireless channel for your radio. @@ -123,10 +126,10 @@ wifi24 : optional }, }, -wifi5 : optional +wifi5 \: optional Same as `wifi24` but for the 5Ghz radio. -next_node : package +next_node \: package Configuration of the local node feature of Gluon :: @@ -136,7 +139,7 @@ next_node : package mac = 'ca:ff:ee:ba:be:00' } -mesh : optional +mesh \: optional Options specific to routing protocols. At the moment, only the ``batman_adv`` routing protocol has such options: @@ -220,13 +223,13 @@ fastd_mesh_vpn }, } -mesh_on_wan : optional +mesh_on_wan \: optional Enables the mesh on the WAN port (``true`` or ``false``). -mesh_on_lan : optional +mesh_on_lan \: optional Enables the mesh on the LAN port (``true`` or ``false``). -autoupdater : package +autoupdater \: package Configuration for the autoupdater feature of Gluon. :: @@ -249,7 +252,10 @@ autoupdater : package } } -roles : optional + All configured mirrors must be reachable from the nodes via IPv6. If you don't want to set an IPv6 address + explicitly, but use a hostname (which is recommended), see also the :ref:`FAQ `. + +roles \: optional Optional role definitions. Nodes will announce their role inside the mesh. This will allow in the backend to distinguish between normal, backbone and service nodes or even gateways (if they advertise that role). It is up to @@ -273,7 +279,7 @@ roles : optional }, }, -setup_mode : package +setup_mode \: package Allows skipping setup mode (config mode) at first boot when attribute ``skip`` is set to ``true``. This is optional and may be left out. :: @@ -282,7 +288,7 @@ setup_mode : package skip = true, }, -legacy : package +legacy \: package Configuration for the legacy upgrade path. This is only required in communities upgrading from Lübeck's LFF-0.3.x. :: @@ -393,15 +399,16 @@ This is a non-exhaustive list of site-repos from various communities: * `site-ffda `_ (Darmstadt) * `site-ffgoe `_ (Göttingen) * `site-ffhh `_ (Hamburg) +* `site-ffho `_ (Hochstift) * `site-ffhgw `_ (Greifswald) +* `site-ffl `_ (Leipzig) * `site-ffhl `_ (Lübeck) * `site-ffmd `_ (Magdeburg) * `site-ffmwu `_ (Mainz, Wiesbaden & Umgebung) * `site-ffmyk `_ (Mayen-Koblenz) * `site-ffm `_ (München) * `site-ffms `_ (Münsterland) -* `site-ffnw `_ (Nordwest) -* `site-ffpb `_ (Paderborn) +* `site-ffnw `_ (Nordwest) * `site-ffka `_ (Karlsruhe) * `site-ffrl `_ (Rheinland) * `site-ffrg `_ (Ruhrgebiet) diff --git a/modules b/modules index 40ce211c..1336e245 100644 --- a/modules +++ b/modules @@ -1,14 +1,14 @@ GLUON_FEEDS='openwrt gluon routing luci' OPENWRT_REPO=git://git.openwrt.org/15.05/openwrt.git -OPENWRT_COMMIT=efc26cc8e0513b3ec703ba540a554fde2c717cf6 +OPENWRT_COMMIT=eadf19c0b43d2f75f196ea8d875a08c7c348530c PACKAGES_OPENWRT_REPO=git://github.com/openwrt/packages.git PACKAGES_OPENWRT_COMMIT=9622fe984bba3a4547f48bc507ebaba7637eb2b0 PACKAGES_OPENWRT_BRANCH=for-15.05 PACKAGES_GLUON_REPO=git://github.com/freifunk-gluon/packages.git -PACKAGES_GLUON_COMMIT=fea8f67d5d5cccac39b5020a69106f8665d41e58 +PACKAGES_GLUON_COMMIT=63376e23c81e53c21d3c5250c3fb7444a90dc019 PACKAGES_ROUTING_REPO=git://github.com/openwrt-routing/packages.git PACKAGES_ROUTING_COMMIT=2a8338559de5c4b077cde7a83f43f4700a17d5cc diff --git a/package/gluon-alfred/files/lib/gluon/upgrade/500-enable-alfred b/package/gluon-alfred/files/lib/gluon/upgrade/500-enable-alfred index 8c52d8a6..d3802d8a 100755 --- a/package/gluon-alfred/files/lib/gluon/upgrade/500-enable-alfred +++ b/package/gluon-alfred/files/lib/gluon/upgrade/500-enable-alfred @@ -16,4 +16,3 @@ c:section('alfred', 'alfred', 'alfred', ) c:save('alfred') -c:commit('alfred') diff --git a/package/gluon-autoupdater/files/lib/gluon/upgrade/500-autoupdater b/package/gluon-autoupdater/files/lib/gluon/upgrade/500-autoupdater index b569f24e..17006b70 100755 --- a/package/gluon-autoupdater/files/lib/gluon/upgrade/500-autoupdater +++ b/package/gluon-autoupdater/files/lib/gluon/upgrade/500-autoupdater @@ -40,7 +40,6 @@ end c:set('autoupdater', 'settings', 'version_file', '/lib/gluon/release') c:save('autoupdater') -c:commit('autoupdater') local autoupdater_util = require 'autoupdater.util' diff --git a/package/gluon-client-bridge/files/lib/gluon/upgrade/300-gluon-client-bridge-network b/package/gluon-client-bridge/files/lib/gluon/upgrade/300-gluon-client-bridge-network index 5ee558cf..4a897f74 100755 --- a/package/gluon-client-bridge/files/lib/gluon/upgrade/300-gluon-client-bridge-network +++ b/package/gluon-client-bridge/files/lib/gluon/upgrade/300-gluon-client-bridge-network @@ -24,4 +24,3 @@ end uci:set('network', 'client', 'macaddr', sysconfig.primary_mac) uci:save('network') -uci:commit('network') diff --git a/package/gluon-client-bridge/files/lib/gluon/upgrade/320-gluon-client-bridge-wireless b/package/gluon-client-bridge/files/lib/gluon/upgrade/320-gluon-client-bridge-wireless index 4eaccacb..3edb39d8 100755 --- a/package/gluon-client-bridge/files/lib/gluon/upgrade/320-gluon-client-bridge-wireless +++ b/package/gluon-client-bridge/files/lib/gluon/upgrade/320-gluon-client-bridge-wireless @@ -21,14 +21,16 @@ local function configure_client(config, radio, index, suffix) uci:delete('wireless', name) - if config then + macaddr = util.generate_mac(3*(index-1)) + + if config and macaddr then uci:section('wireless', 'wifi-iface', name, { device = radio, network = 'client', mode = 'ap', ssid = config.ssid, - macaddr = util.generate_mac(2, index), + macaddr = macaddr, ifname = suffix and 'client' .. suffix, disabled = disabled, } @@ -45,4 +47,3 @@ end util.iterate_radios(configure_radio) uci:save('wireless') -uci:commit('wireless') diff --git a/package/gluon-config-mode-core/files/usr/lib/lua/luci/controller/gluon-config-mode/index.lua b/package/gluon-config-mode-core/files/usr/lib/lua/luci/controller/gluon-config-mode/index.lua index 39ba00a9..68c14746 100644 --- a/package/gluon-config-mode-core/files/usr/lib/lua/luci/controller/gluon-config-mode/index.lua +++ b/package/gluon-config-mode-core/files/usr/lib/lua/luci/controller/gluon-config-mode/index.lua @@ -48,43 +48,42 @@ function action_reboot() uci:save("gluon-setup-mode") uci:commit("gluon-setup-mode") - if nixio.fork() ~= 0 then - local fs = require "nixio.fs" - local util = require "nixio.util" + local fs = require "nixio.fs" + local util = require "nixio.util" - local parts_dir = "/lib/gluon/config-mode/reboot/" - local files = util.consume(fs.dir(parts_dir)) + local parts_dir = "/lib/gluon/config-mode/reboot/" + local files = util.consume(fs.dir(parts_dir)) - table.sort(files) + table.sort(files) - local parts = {} + local parts = {} - for _, entry in ipairs(files) do - if entry:sub(1, 1) ~= '.' then - local f = dofile(parts_dir .. '/' .. entry) - if f ~= nil then - table.insert(parts, f) - end + for _, entry in ipairs(files) do + if entry:sub(1, 1) ~= '.' then + local f = dofile(parts_dir .. '/' .. entry) + if f ~= nil then + table.insert(parts, f) end end + end - local hostname = uci:get_first("system", "system", "hostname") + local hostname = uci:get_first("system", "system", "hostname") - luci.template.render("gluon/config-mode/reboot", { parts=parts - , hostname=hostname - }) - else - debug.setfenv(io.stdout, debug.getfenv(io.open '/dev/null')) - io.stdout:close() + luci.template.render("gluon/config-mode/reboot", + { + parts = parts, + hostname = hostname, + } + ) + + if nixio.fork() == 0 then + -- Replace stdout with /dev/null + nixio.dup(nixio.open('/dev/null', 'w'), nixio.stdout) -- Sleep a little so the browser can fetch everything required to -- display the reboot page, then reboot the device. - nixio.nanosleep(2) + nixio.nanosleep(1) - -- Run reboot with popen so it gets its own std filehandles. - io.popen("reboot") - - -- Prevent any further execution in this child. - os.exit() + nixio.execp("reboot") end end diff --git a/package/gluon-config-mode-geo-location/Makefile b/package/gluon-config-mode-geo-location/Makefile index 28d34764..03812e54 100644 --- a/package/gluon-config-mode-geo-location/Makefile +++ b/package/gluon-config-mode-geo-location/Makefile @@ -33,4 +33,9 @@ define Package/gluon-config-mode-geo-location/install $(call GluonInstallI18N,gluon-config-mode-geo-location,$(1)) endef +define Package/gluon-config-mode-geo-location/postinst +#!/bin/sh +$(call GluonCheckSite,check_site.lua) +endef + $(eval $(call BuildPackage,gluon-config-mode-geo-location)) diff --git a/package/gluon-config-mode-geo-location/check_site.lua b/package/gluon-config-mode-geo-location/check_site.lua new file mode 100644 index 00000000..509226fe --- /dev/null +++ b/package/gluon-config-mode-geo-location/check_site.lua @@ -0,0 +1,3 @@ +if need_table('config_mode', nil, false) and need_table('config_mode.geo_location', nil, false) then + need_boolean('config_mode.geo_location.show_altitude', false) +end diff --git a/package/gluon-config-mode-geo-location/files/lib/gluon/config-mode/wizard/0400-geo-location.lua b/package/gluon-config-mode-geo-location/files/lib/gluon/config-mode/wizard/0400-geo-location.lua index e8c9976d..9bc70301 100644 --- a/package/gluon-config-mode-geo-location/files/lib/gluon/config-mode/wizard/0400-geo-location.lua +++ b/package/gluon-config-mode-geo-location/files/lib/gluon/config-mode/wizard/0400-geo-location.lua @@ -1,14 +1,28 @@ local cbi = require "luci.cbi" local i18n = require "luci.i18n" local uci = luci.model.uci.cursor() +local site = require 'gluon.site_config' local M = {} +local function show_altitude() + if ((site.config_mode or {}).geo_location or {}).show_altitude ~= false then + return true + end + if uci:get_first("gluon-node-info", "location", "altitude") then + return true + end + return false +end + function M.section(form) - local s = form:section(cbi.SimpleSection, nil, i18n.translate( - 'If you want the location of your node to be displayed on the map, ' - .. 'you can enter its coordinates here. Specifying the altitude ' - .. 'is optional and should only be done if a proper value is known.')) + local text = i18n.translate('If you want the location of your node to ' + .. 'be displayed on the map, you can enter its coordinates here.') + if show_altitude() then + text = text .. ' ' .. i18n.translate('Specifying the altitude is ' + .. 'optional and should only be done if a proper value is known.') + end + local s = form:section(cbi.SimpleSection, nil, text) local o @@ -31,12 +45,14 @@ function M.section(form) o.datatype = "float" o.description = i18n.translatef("e.g. %s", "10.689901") - o = s:option(cbi.Value, "_altitude", i18n.translate("Altitude")) - o.default = uci:get_first("gluon-node-info", "location", "altitude") - o:depends("_location", "1") - o.rmempty = true - o.datatype = "float" - o.description = i18n.translatef("e.g. %s", "11.51") + if show_altitude() then + o = s:option(cbi.Value, "_altitude", i18n.translate("Altitude")) + o.default = uci:get_first("gluon-node-info", "location", "altitude") + o:depends("_location", "1") + o.rmempty = true + o.datatype = "float" + o.description = i18n.translatef("e.g. %s", "11.51") + end end diff --git a/package/gluon-config-mode-geo-location/i18n/de.po b/package/gluon-config-mode-geo-location/i18n/de.po index a2850d5b..3580732b 100644 --- a/package/gluon-config-mode-geo-location/i18n/de.po +++ b/package/gluon-config-mode-geo-location/i18n/de.po @@ -12,13 +12,17 @@ msgstr "" msgid "" "If you want the location of your node to be displayed on the map, you can " -"enter its coordinates here. Specifying the altitude is optional and should " -"only be done if a proper value is known." +"enter its coordinates here." msgstr "" "Um deinen Knoten auf der Karte anzeigen zu können, benötigen wir seine " -"Koordinaten. Hier hast du die Möglichkeit, diese zu hinterlegen. Die " -"Höhenangabe ist optional und sollte nur gesetzt werden, wenn ein exakter " -"Wert bekannt ist." +"Koordinaten. Hier hast du die Möglichkeit, diese zu hinterlegen." + +msgid "" +"Specifying the altitude is optional and should only be done if a proper " +"value is known." +msgstr "" +"Die Höhenangabe ist optional und sollte nur gesetzt werden, wenn ein " +"exakter Wert bekannt ist." msgid "Latitude" msgstr "Breitengrad" diff --git a/package/gluon-config-mode-geo-location/i18n/fr.po b/package/gluon-config-mode-geo-location/i18n/fr.po index 15d79e2b..b239c84c 100644 --- a/package/gluon-config-mode-geo-location/i18n/fr.po +++ b/package/gluon-config-mode-geo-location/i18n/fr.po @@ -12,12 +12,17 @@ msgstr "" msgid "" "If you want the location of your node to be displayed on the map, you can " -"enter its coordinates here. Specifying the altitude is optional and should " -"only be done if a proper value is known." +"enter its coordinates here." msgstr "" "Pour Afficher votre nœud sur la Carte nous avons besoin de ses coordonnées. " -"Ici vous pouvez entrer sa position. La altitude est optionelle " -"et ne devrait que être ajoutée si la valeur exacte est connue. " +"Ici vous pouvez entrer sa position." + +msgid "" +"Specifying the altitude is optional and should only be done if a proper " +"value is known." +msgstr "" +"La altitude est optionelle et ne devrait que être ajoutée si la valeur " +"exacte est connue." msgid "Latitude" msgstr "Latitude" diff --git a/package/gluon-config-mode-geo-location/i18n/gluon-config-mode-geo-location.pot b/package/gluon-config-mode-geo-location/i18n/gluon-config-mode-geo-location.pot index a2be4fdf..48f26f70 100644 --- a/package/gluon-config-mode-geo-location/i18n/gluon-config-mode-geo-location.pot +++ b/package/gluon-config-mode-geo-location/i18n/gluon-config-mode-geo-location.pot @@ -3,8 +3,12 @@ msgstr "Content-Type: text/plain; charset=UTF-8" msgid "" "If you want the location of your node to be displayed on the map, you can " -"enter its coordinates here. Specifying the altitude is optional and should " -"only be done if a proper value is known." +"enter its coordinates here." +msgstr "" + +msgid "" +"Specifying the altitude is optional and should only be done if a proper " +"value is known." msgstr "" msgid "Latitude" diff --git a/package/gluon-config-mode-mesh-vpn/files/lib/gluon/config-mode/reboot/0100-mesh-vpn.lua b/package/gluon-config-mode-mesh-vpn/files/lib/gluon/config-mode/reboot/0100-mesh-vpn.lua index 9bd31486..c6e06975 100644 --- a/package/gluon-config-mode-mesh-vpn/files/lib/gluon/config-mode/reboot/0100-mesh-vpn.lua +++ b/package/gluon-config-mode-mesh-vpn/files/lib/gluon/config-mode/reboot/0100-mesh-vpn.lua @@ -11,6 +11,7 @@ else local pubkey = util.trim(util.exec("/etc/init.d/fastd show_key " .. "mesh_vpn")) local hostname = uci:get_first("system", "system", "hostname") + local contact = uci:get_first("gluon-node-info", "owner", "contact") local msg = i18n.translate('gluon-config-mode:pubkey') @@ -19,6 +20,7 @@ else , hostname=hostname , site=site , sysconfig=sysconfig + , contact=contact }) end end diff --git a/package/gluon-config-mode-mesh-vpn/files/lib/gluon/config-mode/wizard/0300-mesh-vpn.lua b/package/gluon-config-mode-mesh-vpn/files/lib/gluon/config-mode/wizard/0300-mesh-vpn.lua index 104e2437..f0172421 100644 --- a/package/gluon-config-mode-mesh-vpn/files/lib/gluon/config-mode/wizard/0300-mesh-vpn.lua +++ b/package/gluon-config-mode-mesh-vpn/files/lib/gluon/config-mode/wizard/0300-mesh-vpn.lua @@ -56,7 +56,7 @@ function M.handle(data) uci:set("simple-tc", "mesh_vpn", "limit_egress", data._limit_egress:trim()) end - uci:commit("simple-tc") + uci:save("simple-tc") uci:commit("simple-tc") end end diff --git a/package/gluon-core/Makefile b/package/gluon-core/Makefile index de54283b..725fb737 100644 --- a/package/gluon-core/Makefile +++ b/package/gluon-core/Makefile @@ -12,7 +12,7 @@ define Package/gluon-core SECTION:=gluon CATEGORY:=Gluon TITLE:=Base files of Gluon - DEPENDS:=+gluon-site +libgluonutil +lua-platform-info +luci-base +luci-lib-jsonc +odhcp6c +firewall + DEPENDS:=+gluon-site +libgluonutil +lua-platform-info +lua-hash +luci-base +luci-lib-jsonc +odhcp6c +firewall endef diff --git a/package/gluon-core/files/lib/gluon/upgrade/010-primary-mac b/package/gluon-core/files/lib/gluon/upgrade/010-primary-mac index 25c13bac..144ee700 100755 --- a/package/gluon-core/files/lib/gluon/upgrade/010-primary-mac +++ b/package/gluon-core/files/lib/gluon/upgrade/010-primary-mac @@ -24,7 +24,15 @@ end if platform.match('ar71xx', 'generic', {'tl-wdr3600', 'tl-wdr4300'}) then table.insert(try_files, 1, '/sys/class/ieee80211/phy1/macaddress') -elseif platform.match('ar71xx', 'generic', {'unifi-outdoor-plus'}) then +elseif platform.match('ar71xx', 'generic', {'unifi-outdoor-plus', 'carambola2', + 'mr600', 'mr600v2', + 'mr900', 'mr900v2', + 'mr1750', + 'om2p', 'om2pv2', + 'om2p-hs', 'om2p-hsv2', + 'om2p-lc', + 'om5p', 'om5p-an', + 'om5p-ac', 'om5p-acv2'}) then table.insert(try_files, 1, '/sys/class/net/eth0/address') elseif platform.match('ar71xx', 'generic', {'archer-c5', 'archer-c7'}) then table.insert(try_files, 1, '/sys/class/net/eth1/address') diff --git a/package/gluon-core/files/lib/gluon/upgrade/020-interfaces b/package/gluon-core/files/lib/gluon/upgrade/020-interfaces index a051c738..34e1c8bb 100755 --- a/package/gluon-core/files/lib/gluon/upgrade/020-interfaces +++ b/package/gluon-core/files/lib/gluon/upgrade/020-interfaces @@ -16,7 +16,7 @@ if not (sysconfig.lan_ifname or sysconfig.wan_ifname) then local lan_ifname = uci:get('network', 'lan', 'ifname') local wan_ifname = uci:get('network', 'wan', 'ifname') - if platform.match('ar71xx', 'generic', {'cpe510', 'nanostation-m', 'nanostation-m-xw', 'unifi-outdoor-plus'}) then + if platform.match('ar71xx', 'generic', {'cpe510', 'nanostation-m', 'nanostation-m-xw', 'unifi-outdoor-plus', 'uap-pro', 'unifiac-pro'}) then lan_ifname, wan_ifname = wan_ifname, lan_ifname end @@ -32,5 +32,4 @@ if not (sysconfig.lan_ifname or sysconfig.wan_ifname) then uci:delete('network', 'wan') uci:save('network') - uci:commit('network') end diff --git a/package/gluon-core/files/lib/gluon/upgrade/030-system b/package/gluon-core/files/lib/gluon/upgrade/030-system index d7a66605..0086a5dc 100755 --- a/package/gluon-core/files/lib/gluon/upgrade/030-system +++ b/package/gluon-core/files/lib/gluon/upgrade/030-system @@ -14,5 +14,4 @@ if not sysconfig.gluon_version then uci:set('system', system, 'timezone', site.timezone) uci:save('system') - uci:commit('system') end diff --git a/package/gluon-core/files/lib/gluon/upgrade/110-network b/package/gluon-core/files/lib/gluon/upgrade/110-network index d83f6d65..bf87d47f 100755 --- a/package/gluon-core/files/lib/gluon/upgrade/110-network +++ b/package/gluon-core/files/lib/gluon/upgrade/110-network @@ -53,7 +53,31 @@ uci:section('network', 'route6', 'wan6_unreachable', ) uci:save('network') -uci:commit('network') + + +uci:section('firewall', 'rule', 'wan_igmp', + { + name = 'Allow-IGMP', + src = 'wan', + proto = 'igmp', + family = 'ipv4', + target = 'ACCEPT', + } +) + +uci:section('firewall', 'rule', 'wan_mld', + { + name = 'Allow-MLD', + src = 'wan', + proto = 'icmp', + src_ip = 'fe80::/10', + icmp_type = { '130/0', '131/0', '132/0', '143/0', }, + family = 'ipv6', + target = 'ACCEPT', + } +) + +uci:save('firewall') sysctl.set('net.ipv6.conf.all.accept_ra', 0) diff --git a/package/gluon-core/files/lib/gluon/upgrade/120-ntp-servers b/package/gluon-core/files/lib/gluon/upgrade/120-ntp-servers index 2b3a2df6..f38c1f5d 100755 --- a/package/gluon-core/files/lib/gluon/upgrade/120-ntp-servers +++ b/package/gluon-core/files/lib/gluon/upgrade/120-ntp-servers @@ -11,4 +11,3 @@ local c = uci.cursor() c:delete('system', 'ntp', 'server') c:set_list('system', 'ntp', 'server', site.ntp_servers) c:save('system') -c:commit('system') diff --git a/package/gluon-core/files/lib/gluon/upgrade/140-firewall-rules b/package/gluon-core/files/lib/gluon/upgrade/140-firewall-rules index 792e06a2..abd45381 100755 --- a/package/gluon-core/files/lib/gluon/upgrade/140-firewall-rules +++ b/package/gluon-core/files/lib/gluon/upgrade/140-firewall-rules @@ -27,4 +27,3 @@ c:section('firewall', 'rule', 'wan_ssh', ) c:save('firewall') -c:commit('firewall') diff --git a/package/gluon-core/files/lib/gluon/upgrade/200-wireless b/package/gluon-core/files/lib/gluon/upgrade/200-wireless index 2ada9b3c..5a4ec0a4 100755 --- a/package/gluon-core/files/lib/gluon/upgrade/200-wireless +++ b/package/gluon-core/files/lib/gluon/upgrade/200-wireless @@ -33,4 +33,3 @@ end util.iterate_radios(configure_radio) uci:save('wireless') -uci:commit('wireless') diff --git a/package/gluon-core/files/lib/gluon/upgrade/998-commit b/package/gluon-core/files/lib/gluon/upgrade/998-commit new file mode 100755 index 00000000..db578a78 --- /dev/null +++ b/package/gluon-core/files/lib/gluon/upgrade/998-commit @@ -0,0 +1,3 @@ +#!/bin/sh + +exec uci commit diff --git a/package/gluon-core/files/usr/lib/lua/gluon/site_config.lua b/package/gluon-core/files/usr/lib/lua/gluon/site_config.lua index 6f01b066..4c0a2d22 100644 --- a/package/gluon-core/files/usr/lib/lua/gluon/site_config.lua +++ b/package/gluon-core/files/usr/lib/lua/gluon/site_config.lua @@ -7,7 +7,7 @@ local function get_site_config() local file = assert(io.open(config)) local decoder = json.new() - ltn12.pump.all(ltn12.source.file(io.open(config)), decoder:sink()) + ltn12.pump.all(ltn12.source.file(file), decoder:sink()) file:close() diff --git a/package/gluon-core/files/usr/lib/lua/gluon/util.lua b/package/gluon-core/files/usr/lib/lua/gluon/util.lua index d9df636f..72b6220d 100644 --- a/package/gluon-core/files/usr/lib/lua/gluon/util.lua +++ b/package/gluon-core/files/usr/lib/lua/gluon/util.lua @@ -30,6 +30,7 @@ local ipairs = ipairs local table = table local nixio = require 'nixio' +local hash = require 'hash' local sysconfig = require 'gluon.sysconfig' local site = require 'gluon.site_config' local uci = require('luci.model.uci').cursor() @@ -71,22 +72,37 @@ function node_id() end -- Generates a (hopefully) unique MAC address --- The first parameter defines the function and the second --- parameter an ID to add to the MAC address --- Functions and IDs defined so far: --- (1, 0): WAN (for mesh-on-WAN) --- (1, 1): LAN (for mesh-on-LAN) --- (2, n): client interface for the n'th radio --- (3, n): adhoc interface for n'th radio --- (4, 0): mesh VPN --- (5, n): mesh interface for n'th radio (802.11s) -function generate_mac(f, i) - local m1, m2, m3, m4, m5, m6 = string.match(sysconfig.primary_mac, '(%x%x):(%x%x):(%x%x):(%x%x):(%x%x):(%x%x)') - m1 = nixio.bit.bor(tonumber(m1, 16), 0x02) - m2 = (tonumber(m2, 16)+f) % 0x100 - m3 = (tonumber(m3, 16)+i) % 0x100 +-- The parameter defines the ID to add to the mac addr +-- +-- IDs defined so far: +-- 0: client0; mesh-vpn +-- 1: mesh0 +-- 2: ibss0 +-- 3: client1; mesh-on-wan +-- 4: mesh1 +-- 5: ibss1 +-- 6: mesh-on-lan +-- 7: unused +function generate_mac(i) + if i > 7 or i < 0 then return nil end -- max allowed id (0b111) - return string.format('%02x:%02x:%02x:%s:%s:%s', m1, m2, m3, m4, m5, m6) + local hashed = string.sub(hash.md5(sysconfig.primary_mac), 0, 12) + local m1, m2, m3, m4, m5, m6 = string.match(hashed, '(%x%x)(%x%x)(%x%x)(%x%x)(%x%x)(%x%x)') + + m1 = tonumber(m1, 16) + m6 = tonumber(m6, 16) + + m1 = nixio.bit.bor(m1, 0x02) -- set locally administered bit + m1 = nixio.bit.band(m1, 0xFE) -- unset the multicast bit + + -- It's necessary that the first 45 bits of the mac do + -- not vary on a single hardware interface, since some chips are using + -- a hardware mac filter. (e.g 'ramips-rt305x') + + m6 = nixio.bit.band(m6, 0xF8) -- zero the last three bits (space needed for counting) + m6 = m6 + i -- add virtual interface id + + return string.format('%02x:%s:%s:%s:%s:%02x', m1, m2, m3, m4, m5, m6) end -- Iterate over all radios defined in UCI calling diff --git a/package/gluon-legacy/files/lib/gluon/upgrade/019-legacy-interfaces b/package/gluon-legacy/files/lib/gluon/upgrade/019-legacy-interfaces index b48e42b8..691e4ad7 100755 --- a/package/gluon-legacy/files/lib/gluon/upgrade/019-legacy-interfaces +++ b/package/gluon-legacy/files/lib/gluon/upgrade/019-legacy-interfaces @@ -34,7 +34,6 @@ if sysconfig.gluon_version == 'legacy' then uci:delete('network', 'wan') uci:save('network') - uci:commit('network') end diff --git a/package/gluon-legacy/files/lib/gluon/upgrade/210-legacy-wireless b/package/gluon-legacy/files/lib/gluon/upgrade/210-legacy-wireless index 36da0632..d8fd1720 100755 --- a/package/gluon-legacy/files/lib/gluon/upgrade/210-legacy-wireless +++ b/package/gluon-legacy/files/lib/gluon/upgrade/210-legacy-wireless @@ -20,5 +20,4 @@ if sysconfig.gluon_version == 'legacy' then uci:delete_all('wireless', 'wifi-iface', delete_legacy_iface) uci:save('wireless') - uci:commit('wireless') end diff --git a/package/gluon-legacy/files/lib/gluon/upgrade/290-legacy-setup-mode b/package/gluon-legacy/files/lib/gluon/upgrade/290-legacy-setup-mode index 0b97e120..d2a67484 100755 --- a/package/gluon-legacy/files/lib/gluon/upgrade/290-legacy-setup-mode +++ b/package/gluon-legacy/files/lib/gluon/upgrade/290-legacy-setup-mode @@ -12,9 +12,7 @@ if sysconfig.gluon_version == 'legacy' then if old == '1' then local setup_mode = uci:get_first('gluon-setup-mode', 'setup_mode') uci:set('gluon-setup-mode', setup_mode, 'configured', '1') - uci:save('gluon-setup-mode') - uci:commit('gluon-setup-mode') break end diff --git a/package/gluon-legacy/files/lib/gluon/upgrade/290-legacy-simple-tc b/package/gluon-legacy/files/lib/gluon/upgrade/290-legacy-simple-tc index 56621887..652c53c9 100755 --- a/package/gluon-legacy/files/lib/gluon/upgrade/290-legacy-simple-tc +++ b/package/gluon-legacy/files/lib/gluon/upgrade/290-legacy-simple-tc @@ -21,7 +21,6 @@ if sysconfig.gluon_version == 'legacy' then ) uci:save('simple-tc') - uci:commit('simple-tc') break end diff --git a/package/gluon-legacy/files/lib/gluon/upgrade/390-legacy-mesh-vpn-fastd b/package/gluon-legacy/files/lib/gluon/upgrade/390-legacy-mesh-vpn-fastd index 468a35a6..21f95e07 100755 --- a/package/gluon-legacy/files/lib/gluon/upgrade/390-legacy-mesh-vpn-fastd +++ b/package/gluon-legacy/files/lib/gluon/upgrade/390-legacy-mesh-vpn-fastd @@ -33,5 +33,4 @@ if sysconfig.gluon_version == 'legacy' then end uci:save('fastd') - uci:commit('fastd') end diff --git a/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/upgrade.lua b/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/upgrade.lua index 29aecb95..2365f02c 100644 --- a/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/upgrade.lua +++ b/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/upgrade.lua @@ -101,9 +101,7 @@ end function image_supported(tmpfile) -- XXX: yay... return ( 0 == os.execute( - ". /lib/functions.sh; " .. - "include /lib/upgrade; " .. - "platform_check_image %q >/dev/null" + "/sbin/sysupgrade -T %q >/dev/null" % tmpfile ) ) end diff --git a/package/gluon-mesh-batman-adv-14/files/lib/gluon/upgrade/350-gluon-mesh-batman-adv-14 b/package/gluon-mesh-batman-adv-14/files/lib/gluon/upgrade/350-gluon-mesh-batman-adv-14 index 05776c30..30e2682b 100755 --- a/package/gluon-mesh-batman-adv-14/files/lib/gluon/upgrade/350-gluon-mesh-batman-adv-14 +++ b/package/gluon-mesh-batman-adv-14/files/lib/gluon/upgrade/350-gluon-mesh-batman-adv-14 @@ -45,4 +45,3 @@ end uci:save('network') -uci:commit('network') diff --git a/package/gluon-mesh-batman-adv-15/files/lib/gluon/upgrade/350-gluon-mesh-batman-adv-15 b/package/gluon-mesh-batman-adv-15/files/lib/gluon/upgrade/350-gluon-mesh-batman-adv-15 index f9f54003..7148d42c 100755 --- a/package/gluon-mesh-batman-adv-15/files/lib/gluon/upgrade/350-gluon-mesh-batman-adv-15 +++ b/package/gluon-mesh-batman-adv-15/files/lib/gluon/upgrade/350-gluon-mesh-batman-adv-15 @@ -45,4 +45,3 @@ end uci:save('network') -uci:commit('network') diff --git a/package/gluon-mesh-batman-adv-core/files/lib/gluon/upgrade/300-gluon-mesh-batman-adv-core-wan b/package/gluon-mesh-batman-adv-core/files/lib/gluon/upgrade/300-gluon-mesh-batman-adv-core-wan index c9084ea6..be96c012 100755 --- a/package/gluon-mesh-batman-adv-core/files/lib/gluon/upgrade/300-gluon-mesh-batman-adv-core-wan +++ b/package/gluon-mesh-batman-adv-core/files/lib/gluon/upgrade/300-gluon-mesh-batman-adv-core-wan @@ -5,7 +5,6 @@ local uci = require('luci.model.uci').cursor() -- fix up duplicate mac addresses (for mesh-on-WAN) -uci:set('network', 'wan', 'macaddr', util.generate_mac(1, 0)) +uci:set('network', 'wan', 'macaddr', util.generate_mac(3)) uci:save('network') -uci:commit('network') diff --git a/package/gluon-mesh-batman-adv-core/files/lib/gluon/upgrade/310-gluon-mesh-batman-adv-core-mesh b/package/gluon-mesh-batman-adv-core/files/lib/gluon/upgrade/310-gluon-mesh-batman-adv-core-mesh index 160b96ea..ade6af57 100755 --- a/package/gluon-mesh-batman-adv-core/files/lib/gluon/upgrade/310-gluon-mesh-batman-adv-core-mesh +++ b/package/gluon-mesh-batman-adv-core/files/lib/gluon/upgrade/310-gluon-mesh-batman-adv-core-mesh @@ -24,7 +24,6 @@ uci:section('batman-adv', 'mesh', 'bat0', } ) uci:save('batman-adv') -uci:commit('batman-adv') if not uci:get('network', 'client', 'ifname') then uci:add_to_set('network', 'client', 'ifname', 'bat0') @@ -39,6 +38,9 @@ end uci:set('network', 'client', 'proto', 'dhcpv6') uci:set('network', 'client', 'reqprefix', 'no') uci:set('network', 'client', 'igmp_snooping', 0) +uci:set('network', 'client', 'robustness', 3) +uci:set('network', 'client', 'query_interval', 2000) +uci:set('network', 'client', 'query_response_interval', 500) uci:set('network', 'client', 'peerdns', 1) uci:set('network', 'client', 'sourcefilter', 0) @@ -48,11 +50,11 @@ uci:section('network', 'interface', 'bat0', ifname = 'bat0', proto = 'none', macaddr = sysconfig.primary_mac, + multicast_router = 2, } ) uci:save('network') -uci:commit('network') uci:delete('firewall', 'client') @@ -76,7 +78,6 @@ uci:section('firewall', 'rule', 'client_dns', ) uci:save('firewall') -uci:commit('firewall') local dnsmasq = uci:get_first('dhcp', 'dnsmasq') @@ -93,7 +94,6 @@ uci:section('dhcp', 'dhcp', 'client', ) uci:save('dhcp') -uci:commit('dhcp') sysctl.set('net.ipv6.conf.br-client.forwarding', 0) diff --git a/package/gluon-mesh-batman-adv-core/files/lib/gluon/upgrade/320-gluon-mesh-batman-adv-core-wireless b/package/gluon-mesh-batman-adv-core/files/lib/gluon/upgrade/320-gluon-mesh-batman-adv-core-wireless index 8835c997..dd3354de 100755 --- a/package/gluon-mesh-batman-adv-core/files/lib/gluon/upgrade/320-gluon-mesh-batman-adv-core-wireless +++ b/package/gluon-mesh-batman-adv-core/files/lib/gluon/upgrade/320-gluon-mesh-batman-adv-core-wireless @@ -29,7 +29,9 @@ local function configure_ibss(config, radio, index, suffix, disabled) uci:delete('network', name .. '_vlan') uci:delete('wireless', name) - if config then + macaddr = util.generate_mac(3*(index-1)+2) + + if config and macaddr then if config.vlan then uci:section('network', 'interface', name, { @@ -60,7 +62,7 @@ local function configure_ibss(config, radio, index, suffix, disabled) mode = 'adhoc', ssid = config.ssid, bssid = config.bssid, - macaddr = util.generate_mac(3, index), + macaddr = macaddr, mcast_rate = config.mcast_rate, ifname = suffix and 'ibss' .. suffix, disabled = disabled and 1 or 0, @@ -77,7 +79,9 @@ local function configure_mesh(config, radio, index, suffix, disabled) uci:delete('network', name) uci:delete('wireless', name) - if config then + macaddr = util.generate_mac(3*(index-1)+1) + + if config and macaddr then uci:section('network', 'interface', name, { proto = 'batadv', @@ -92,7 +96,7 @@ local function configure_mesh(config, radio, index, suffix, disabled) mode = 'mesh', mesh_id = config.id, mesh_fwding = 0, - macaddr = util.generate_mac(5, index), + macaddr = macaddr, mcast_rate = config.mcast_rate, ifname = suffix and 'mesh' .. suffix, disabled = disabled and 1 or 0, @@ -131,5 +135,3 @@ util.iterate_radios(configure_radio) uci:save('wireless') uci:save('network') -uci:commit('wireless') -uci:commit('network') diff --git a/package/gluon-mesh-batman-adv-core/files/lib/gluon/upgrade/330-gluon-mesh-batman-adv-core-mesh-on-wan b/package/gluon-mesh-batman-adv-core/files/lib/gluon/upgrade/330-gluon-mesh-batman-adv-core-mesh-on-wan index 8db95145..7a964ee2 100755 --- a/package/gluon-mesh-batman-adv-core/files/lib/gluon/upgrade/330-gluon-mesh-batman-adv-core-mesh-on-wan +++ b/package/gluon-mesh-batman-adv-core/files/lib/gluon/upgrade/330-gluon-mesh-batman-adv-core-mesh-on-wan @@ -16,4 +16,3 @@ if not c:get('network', 'mesh_wan') then end c:save('network') -c:commit('network') diff --git a/package/gluon-mesh-batman-adv-core/files/lib/gluon/upgrade/340-gluon-mesh-batman-adv-core-mesh-on-lan b/package/gluon-mesh-batman-adv-core/files/lib/gluon/upgrade/340-gluon-mesh-batman-adv-core-mesh-on-lan index 8b192adb..99ca4213 100755 --- a/package/gluon-mesh-batman-adv-core/files/lib/gluon/upgrade/340-gluon-mesh-batman-adv-core-mesh-on-lan +++ b/package/gluon-mesh-batman-adv-core/files/lib/gluon/upgrade/340-gluon-mesh-batman-adv-core-mesh-on-lan @@ -7,7 +7,21 @@ local sysconfig = require 'gluon.sysconfig' local uci = require('luci.model.uci').cursor() local lutil = require 'luci.util' -if sysconfig.lan_ifname and not uci:get('network', 'mesh_lan') then +if not sysconfig.lan_ifname then + os.exit(0) +end + +uci:section('network', 'interface', 'mesh_lan', { + ifname = sysconfig.lan_ifname, + type = 'bridge', + igmp_snooping = 0, + proto = 'batadv', + mesh = 'bat0', + mesh_no_rebroadcast = '1', + macaddr = util.generate_mac(6), +}) + +if uci:get('network', 'mesh_lan', 'auto') == nil then local enable = site.mesh_on_lan if enable then @@ -15,23 +29,15 @@ if sysconfig.lan_ifname and not uci:get('network', 'mesh_lan') then if interfaces then for _, lanif in ipairs(lutil.split(sysconfig.lan_ifname, ' ')) do - if lutil.contains(interfaces, lanif) then - enable = false - break + if lutil.contains(interfaces, lanif) then + enable = false + break end end end end - uci:section('network', 'interface', 'mesh_lan', - { ifname = sysconfig.lan_ifname - , proto = 'batadv' - , mesh = 'bat0' - , mesh_no_rebroadcast = '1' - , macaddr = util.generate_mac(1, 1) - , auto = enable and 1 or 0 - }) - - uci:save('network') - uci:commit('network') + uci:set('network', 'mesh_lan', 'auto', enable and 1 or 0) end + +uci:save('network') diff --git a/package/gluon-mesh-batman-adv-core/files/lib/gluon/upgrade/350-gluon-mesh-batman-adv-core-rssid b/package/gluon-mesh-batman-adv-core/files/lib/gluon/upgrade/350-gluon-mesh-batman-adv-core-rssid index 5ddb4f90..b6b16574 100755 --- a/package/gluon-mesh-batman-adv-core/files/lib/gluon/upgrade/350-gluon-mesh-batman-adv-core-rssid +++ b/package/gluon-mesh-batman-adv-core/files/lib/gluon/upgrade/350-gluon-mesh-batman-adv-core-rssid @@ -3,8 +3,11 @@ local uci = require('luci.model.uci').cursor() if uci:get('system', 'rssid_wlan0') then - uci:set('system', 'rssid_wlan0', 'dev', 'mesh0') + if uci:get('wireless', 'mesh_radio0') then + uci:set('system', 'rssid_wlan0', 'dev', 'mesh0') + else + uci:set('system', 'rssid_wlan0', 'dev', 'ibss0') + end uci:save('system') - uci:commit('system') end diff --git a/package/gluon-mesh-batman-adv-core/files/usr/lib/lua/gluon/batman_adv.lua b/package/gluon-mesh-batman-adv-core/files/usr/lib/lua/gluon/batman_adv.lua deleted file mode 100644 index cd559fe5..00000000 --- a/package/gluon-mesh-batman-adv-core/files/usr/lib/lua/gluon/batman_adv.lua +++ /dev/null @@ -1,15 +0,0 @@ -local nixio = require 'nixio' - -module 'gluon.batman_adv' - -function interfaces(bat_if) - local iter = nixio.fs.glob('/sys/class/net/' .. bat_if .. '/lower_*') - return function() - local path = iter() - if path == nil then - return nil - end - local ifname = path:match('/lower_([^/]+)$') - return ifname - end -end diff --git a/package/gluon-mesh-batman-adv-core/src/respondd.c b/package/gluon-mesh-batman-adv-core/src/respondd.c index f0085457..7c2ac6c7 100644 --- a/package/gluon-mesh-batman-adv-core/src/respondd.c +++ b/package/gluon-mesh-batman-adv-core/src/respondd.c @@ -501,7 +501,9 @@ static struct json_object * get_batadv(void) { struct json_object *obj = json_object_new_object(); json_object_object_add(obj, "tq", json_object_new_int(tq)); - json_object_object_add(obj, "lastseen", json_object_new_double(lastseen)); + struct json_object *jso = json_object_new_double(lastseen); + json_object_set_serializer(jso, json_object_double_to_json_string, "%.3f", NULL); + json_object_object_add(obj, "lastseen", jso); json_object_object_add(interface, mac1, obj); } diff --git a/package/gluon-mesh-vpn-fastd/Makefile b/package/gluon-mesh-vpn-fastd/Makefile index 0875e485..bb33257e 100644 --- a/package/gluon-mesh-vpn-fastd/Makefile +++ b/package/gluon-mesh-vpn-fastd/Makefile @@ -12,7 +12,7 @@ define Package/gluon-mesh-vpn-fastd SECTION:=gluon CATEGORY:=Gluon TITLE:=Support for connecting batman-adv meshes via fastd - DEPENDS:=+gluon-core +libgluonutil gluon-mesh-batman-adv +gluon-wan-dnsmasq +fastd +iptables-mod-extra +simple-tc + DEPENDS:=+gluon-core +libgluonutil gluon-mesh-batman-adv +gluon-wan-dnsmasq +fastd +iptables +iptables-mod-extra +simple-tc endef define Build/Prepare diff --git a/package/gluon-mesh-vpn-fastd/files/lib/gluon/upgrade/400-mesh-vpn-fastd b/package/gluon-mesh-vpn-fastd/files/lib/gluon/upgrade/400-mesh-vpn-fastd index 316546bc..77f2e6f2 100755 --- a/package/gluon-mesh-vpn-fastd/files/lib/gluon/upgrade/400-mesh-vpn-fastd +++ b/package/gluon-mesh-vpn-fastd/files/lib/gluon/upgrade/400-mesh-vpn-fastd @@ -119,7 +119,6 @@ add_groups('mesh_vpn', site.fastd_mesh_vpn.groups) uci:save('fastd') -uci:commit('fastd') uci:section('network', 'interface', 'mesh_vpn', @@ -128,12 +127,11 @@ uci:section('network', 'interface', 'mesh_vpn', proto = 'batadv', mesh = 'bat0', mesh_no_rebroadcast = 1, - macaddr = util.generate_mac(4, 0), + macaddr = util.generate_mac(0), } ) uci:save('network') -uci:commit('network') uci:section('firewall', 'include', 'mesh_vpn_dns', @@ -145,4 +143,3 @@ uci:section('firewall', 'include', 'mesh_vpn_dns', ) uci:save('firewall') -uci:commit('firewall') diff --git a/package/gluon-mesh-vpn-fastd/files/lib/gluon/upgrade/410-mesh-vpn-fastd-generate-secret b/package/gluon-mesh-vpn-fastd/files/lib/gluon/upgrade/410-mesh-vpn-fastd-generate-secret index 68a2fe67..e581dea8 100755 --- a/package/gluon-mesh-vpn-fastd/files/lib/gluon/upgrade/410-mesh-vpn-fastd-generate-secret +++ b/package/gluon-mesh-vpn-fastd/files/lib/gluon/upgrade/410-mesh-vpn-fastd-generate-secret @@ -9,5 +9,4 @@ local secret = c:get("fastd", "mesh_vpn", "secret") if not secret or not secret:match(("%x"):rep(64)) then c:set("fastd", "mesh_vpn", "secret", "generate") c:save("fastd") - c:commit("fastd") end diff --git a/package/gluon-mesh-vpn-fastd/files/lib/gluon/upgrade/420-mesh-vpn-fastd-simple-tc b/package/gluon-mesh-vpn-fastd/files/lib/gluon/upgrade/420-mesh-vpn-fastd-simple-tc index d4cfcdde..3c3e10a4 100755 --- a/package/gluon-mesh-vpn-fastd/files/lib/gluon/upgrade/420-mesh-vpn-fastd-simple-tc +++ b/package/gluon-mesh-vpn-fastd/files/lib/gluon/upgrade/420-mesh-vpn-fastd-simple-tc @@ -28,5 +28,4 @@ if not uci:get('simple-tc', 'mesh_vpn') then uci:section('simple-tc', 'interface', 'mesh_vpn', config) uci:save('simple-tc') - uci:commit('simple-tc') end diff --git a/package/gluon-mesh-vpn-fastd/src/respondd.c b/package/gluon-mesh-vpn-fastd/src/respondd.c index 3045c77a..7354783a 100644 --- a/package/gluon-mesh-vpn-fastd/src/respondd.c +++ b/package/gluon-mesh-vpn-fastd/src/respondd.c @@ -192,7 +192,9 @@ static bool get_peer_connection(struct json_object **ret, struct json_object *co int64_t established_time = json_object_get_int64(established); *ret = json_object_new_object(); - json_object_object_add(*ret, "established", json_object_new_double(established_time/1000.0)); + struct json_object *jso = json_object_new_double(established_time/1000.0); + json_object_set_serializer(jso, json_object_double_to_json_string, "%.3f", NULL); + json_object_object_add(*ret, "established", jso); } else { *ret = NULL; diff --git a/package/gluon-neighbour-info/files/lib/gluon/upgrade/400-neighbour-info-firewall b/package/gluon-neighbour-info/files/lib/gluon/upgrade/400-neighbour-info-firewall index a6d7f490..373f166a 100755 --- a/package/gluon-neighbour-info/files/lib/gluon/upgrade/400-neighbour-info-firewall +++ b/package/gluon-neighbour-info/files/lib/gluon/upgrade/400-neighbour-info-firewall @@ -17,4 +17,3 @@ uci:section('firewall', 'rule', 'wan_respondd_reply', ) uci:save('firewall') -uci:commit('firewall') diff --git a/package/gluon-next-node/files/lib/gluon/upgrade/400-next-node b/package/gluon-next-node/files/lib/gluon/upgrade/400-next-node index 0ff959fe..79cc0369 100755 --- a/package/gluon-next-node/files/lib/gluon/upgrade/400-next-node +++ b/package/gluon-next-node/files/lib/gluon/upgrade/400-next-node @@ -39,7 +39,6 @@ c:section('network', 'route6', 'local_node_route6', ) c:save('network') -c:commit('network') c:delete('firewall', 'local_node') c:section('firewall', 'zone', 'local_node', @@ -52,4 +51,3 @@ c:section('firewall', 'zone', 'local_node', } ) c:save('firewall') -c:commit('firewall') diff --git a/package/gluon-node-info/files/lib/gluon/upgrade/500-node-info-system b/package/gluon-node-info/files/lib/gluon/upgrade/500-node-info-system index a17b9461..a70eb282 100755 --- a/package/gluon-node-info/files/lib/gluon/upgrade/500-node-info-system +++ b/package/gluon-node-info/files/lib/gluon/upgrade/500-node-info-system @@ -7,5 +7,4 @@ local config = 'gluon-node-info' if not uci:get_first(config, 'system') then uci:section(config, 'system') uci:save(config) - uci:commit(config) end diff --git a/package/gluon-node-info/files/lib/gluon/upgrade/510-node-info-role b/package/gluon-node-info/files/lib/gluon/upgrade/510-node-info-role index 6e54a234..06d42f8e 100755 --- a/package/gluon-node-info/files/lib/gluon/upgrade/510-node-info-role +++ b/package/gluon-node-info/files/lib/gluon/upgrade/510-node-info-role @@ -15,5 +15,4 @@ end if not role then uci:set(config, uci:get_first(config, 'system'), 'role', default_role) uci:save(config) - uci:commit(config) end diff --git a/package/gluon-node-info/files/lib/gluon/upgrade/520-node-info-whitespace-fix b/package/gluon-node-info/files/lib/gluon/upgrade/520-node-info-whitespace-fix new file mode 100755 index 00000000..49e7053d --- /dev/null +++ b/package/gluon-node-info/files/lib/gluon/upgrade/520-node-info-whitespace-fix @@ -0,0 +1,14 @@ +#!/usr/bin/lua +local uci = require('luci.model.uci').cursor() + +local sname = uci:get_first('gluon-node-info', 'location') +if sname then + local options = {'longitude', 'latitude', 'altitude'} + for _, option in ipairs(options) do + local value = uci:get('gluon-node-info', sname, option) + if value then + uci:set('gluon-node-info', sname, option, value:trim()) + end + end + uci:save('gluon-node-info') +end diff --git a/package/gluon-node-info/src/respondd.c b/package/gluon-node-info/src/respondd.c index dfbfd3f8..3b0e07dc 100644 --- a/package/gluon-node-info/src/respondd.c +++ b/package/gluon-node-info/src/respondd.c @@ -64,7 +64,15 @@ static struct json_object * get_number(struct uci_context *ctx, struct uci_secti if (*end) return NULL; - return json_object_new_double(d); + struct json_object *jso = json_object_new_double(d); + json_object_set_serializer(jso, json_object_double_to_json_string, "%.8f", NULL); + return jso; +} + +static void maybe_add_number(struct uci_context *ctx, struct uci_section *s, const char *name, struct json_object *parent) { + struct json_object *jso = get_number(ctx, s, name); + if (jso) + json_object_object_add(parent, name, jso); } static struct json_object * get_location(struct uci_context *ctx, struct uci_package *p) { @@ -78,17 +86,9 @@ static struct json_object * get_location(struct uci_context *ctx, struct uci_pac struct json_object *ret = json_object_new_object(); - struct json_object *latitude = get_number(ctx, s, "latitude"); - if (latitude) - json_object_object_add(ret, "latitude", latitude); - - struct json_object *longitude = get_number(ctx, s, "longitude"); - if (longitude) - json_object_object_add(ret, "longitude", longitude); - - struct json_object *altitude = get_number(ctx, s, "altitude"); - if (altitude) - json_object_object_add(ret, "altitude", altitude); + maybe_add_number(ctx, s, "latitude", ret); + maybe_add_number(ctx, s, "longitude", ret); + maybe_add_number(ctx, s, "altitude", ret); return ret; } diff --git a/package/gluon-respondd/files/lib/gluon/upgrade/400-respondd-firewall b/package/gluon-respondd/files/lib/gluon/upgrade/400-respondd-firewall index c5076830..a78cfb3d 100755 --- a/package/gluon-respondd/files/lib/gluon/upgrade/400-respondd-firewall +++ b/package/gluon-respondd/files/lib/gluon/upgrade/400-respondd-firewall @@ -29,4 +29,3 @@ uci:section('firewall', 'rule', 'client_respondd', ) uci:save('firewall') -uci:commit('firewall') diff --git a/package/gluon-respondd/src/respondd.c b/package/gluon-respondd/src/respondd.c index 85006d6f..be3c9a7a 100644 --- a/package/gluon-respondd/src/respondd.c +++ b/package/gluon-respondd/src/respondd.c @@ -107,13 +107,18 @@ static struct json_object * respondd_provider_nodeinfo(void) { static void add_uptime(struct json_object *obj) { FILE *f = fopen("/proc/uptime", "r"); + struct json_object* jso; if (!f) return; double uptime, idletime; if (fscanf(f, "%lf %lf", &uptime, &idletime) == 2) { - json_object_object_add(obj, "uptime", json_object_new_double(uptime)); - json_object_object_add(obj, "idletime", json_object_new_double(idletime)); + jso = json_object_new_double(uptime); + json_object_set_serializer(jso, json_object_double_to_json_string, "%.2f", NULL); + json_object_object_add(obj, "uptime", jso); + jso = json_object_new_double(idletime); + json_object_set_serializer(jso, json_object_double_to_json_string, "%.2f", NULL); + json_object_object_add(obj, "idletime", jso); } fclose(f); @@ -127,7 +132,9 @@ static void add_loadavg(struct json_object *obj) { double loadavg; unsigned proc_running, proc_total; if (fscanf(f, "%lf %*f %*f %u/%u", &loadavg, &proc_running, &proc_total) == 3) { - json_object_object_add(obj, "loadavg", json_object_new_double(loadavg)); + struct json_object *jso = json_object_new_double(loadavg); + json_object_set_serializer(jso, json_object_double_to_json_string, "%.2f", NULL); + json_object_object_add(obj, "loadavg", jso); struct json_object *processes = json_object_new_object(); json_object_object_add(processes, "running", json_object_new_int(proc_running)); @@ -176,7 +183,9 @@ static struct json_object * get_rootfs_usage(void) { if (statfs("/", &s)) return NULL; - return json_object_new_double(1 - (double)s.f_bfree / s.f_blocks); + struct json_object *jso = json_object_new_double(1 - (double)s.f_bfree / s.f_blocks); + json_object_set_serializer(jso, json_object_double_to_json_string, "%.4f", NULL); + return jso; } static struct json_object * respondd_provider_statistics(void) { diff --git a/package/gluon-setup-mode/files/lib/gluon/upgrade/300-setup-mode b/package/gluon-setup-mode/files/lib/gluon/upgrade/300-setup-mode index ae59c7aa..481a4fa0 100755 --- a/package/gluon-setup-mode/files/lib/gluon/upgrade/300-setup-mode +++ b/package/gluon-setup-mode/files/lib/gluon/upgrade/300-setup-mode @@ -11,6 +11,5 @@ if site.setup_mode local name = c:get_first("gluon-setup-mode", "setup_mode") c:set("gluon-setup-mode", name, "configured", 1) c:save('gluon-setup-mode') - c:commit('gluon-setup-mode') end diff --git a/package/gluon-setup-mode/files/lib/gluon/upgrade/310-setup-mode-migrate b/package/gluon-setup-mode/files/lib/gluon/upgrade/310-setup-mode-migrate index 9d3b9b0a..3b5165c4 100755 --- a/package/gluon-setup-mode/files/lib/gluon/upgrade/310-setup-mode-migrate +++ b/package/gluon-setup-mode/files/lib/gluon/upgrade/310-setup-mode-migrate @@ -12,7 +12,6 @@ if old == '1' then c:set('gluon-setup-mode', setup_mode, 'configured', '1') c:save('gluon-setup-mode') - c:commit('gluon-setup-mode') end os.remove('/etc/config/gluon-config-mode') diff --git a/package/gluon-setup-mode/files/lib/gluon/upgrade/320-setup-ifname b/package/gluon-setup-mode/files/lib/gluon/upgrade/320-setup-ifname index 3c4a8afe..a2b4f796 100755 --- a/package/gluon-setup-mode/files/lib/gluon/upgrade/320-setup-ifname +++ b/package/gluon-setup-mode/files/lib/gluon/upgrade/320-setup-ifname @@ -8,7 +8,7 @@ if sysconfig.setup_ifname then os.exit(0) end -if platform.match('ar71xx', 'generic', {'cpe510', 'nanostation-m', 'nanostation-m-xw', 'unifi-outdoor-plus'}) then +if platform.match('ar71xx', 'generic', {'cpe510', 'nanostation-m', 'nanostation-m-xw', 'unifi-outdoor-plus', 'uap-pro', 'unifiac-pro'}) then sysconfig.setup_ifname = sysconfig.config_ifname or sysconfig.wan_ifname or sysconfig.lan_ifname else sysconfig.setup_ifname = sysconfig.config_ifname or sysconfig.lan_ifname or sysconfig.wan_ifname diff --git a/package/gluon-status-page-api/files/lib/gluon/upgrade/500-status-page-api b/package/gluon-status-page-api/files/lib/gluon/upgrade/500-status-page-api index a5000012..a11fac9b 100755 --- a/package/gluon-status-page-api/files/lib/gluon/upgrade/500-status-page-api +++ b/package/gluon-status-page-api/files/lib/gluon/upgrade/500-status-page-api @@ -10,6 +10,4 @@ uci batch <<-EOF set uhttpd.main.home=/lib/gluon/status-page/www set uhttpd.main.max_requests=32 - - commit uhttpd EOF diff --git a/package/gluon-status-page/files/lib/gluon/status-page/www/cgi-bin/status b/package/gluon-status-page/files/lib/gluon/status-page/www/cgi-bin/status deleted file mode 100755 index ea520e22..00000000 --- a/package/gluon-status-page/files/lib/gluon/status-page/www/cgi-bin/status +++ /dev/null @@ -1,160 +0,0 @@ -#!/usr/bin/lua - -local util = require("luci.util") -local fs = require("nixio.fs") -local ltn12 = require 'luci.ltn12' -local sys = require("luci.sys") -local json = require("luci.jsonc") -local nixio = require 'nixio' -local platform_info = require("platform_info") - -local hostname = sys.hostname() -local model = platform_info.get_model() -local release = util.trim(fs.readfile("/lib/gluon/release") or "") - -function escape_html(s) - return (s:gsub('&', '&'):gsub('<', '<'):gsub('>', '>'):gsub('"', '"')) -end - -function neighbours(ifname) - local info = util.exec("gluon-neighbour-info -d ff02::2:1001 -p 1001 -r nodeinfo -t 3 -i " .. ifname) - local macs = {} - for _, line in ipairs(util.split(info)) do - local data = json.parse(line) - if data then - local function add_macs(list) - if list then - for _, mac in ipairs(list) do - macs[mac] = data - end - end - end - - if data["network"] then - add_macs(data["network"]["mesh_interfaces"]) - - if data["network"]["mesh"] and data["network"]["mesh"]["bat0"] and - data["network"]["mesh"]["bat0"]["interfaces"] then - local interfaces = data["network"]["mesh"]["bat0"]["interfaces"] - add_macs(interfaces["other"]) - add_macs(interfaces["wireless"]) - add_macs(interfaces["tunnel"]) - end - end - end - end - - return macs -end - -io.write("Content-type: text/html\n\n") -io.write("\n") -io.write("") -io.write("") -io.write("") -io.write("") -io.write("" .. escape_html(hostname) .. "") -io.write("") -io.write("") - -io.write("

" .. escape_html(hostname) .. "

") -io.write("
")
-
-io.write("Model: " .. escape_html(model) .. "\n")
-io.write("Firmware release: " .. escape_html(release) .. "\n\n")
-
-io.write(escape_html(util.trim(sys.exec("uptime | sed 's/^ \+//'"))) .. "\n\n")
-io.write(escape_html(sys.exec("ip address show dev br-client")) .. "\n")
-io.write(escape_html(sys.exec("free -m")) .. "\n")
-io.write(escape_html(sys.exec("df /rom /overlay")))
-io.write("
") - -io.write("

Neighbours

") - -local interfaces = util.split(util.trim(util.exec("iw dev | egrep 'type IBSS|type mesh' -B 5 | grep Interface | cut -d' ' -f2"))) - -for _, ifname in ipairs(interfaces) do - io.write("

" .. escape_html(ifname) .. "

") - io.write("
")
-
-  for _, line in ipairs(util.split(util.exec("iw dev " .. ifname .. " station dump"))) do
-    local mac = line:match("^Station (.*) %(on ")
-    if mac then
-      io.write("Station " .. mac .. " (on " .. escape_html(ifname) .. ")\n")
-    else
-      io.write(escape_html(line) .. "\n")
-    end
-  end
-
-  io.write("
") -end - -local stat, fastd_status = pcall( - function() - local fastd_sock = nixio.socket('unix', 'stream') - assert(fastd_sock:connect('/var/run/fastd.mesh_vpn.socket')) - - decoder = json.new() - ltn12.pump.all(ltn12.source.file(fastd_sock), decoder:sink()) - return decoder:get() - end -) - -io.write("

VPN status

") -io.write("
")
-
-if stat then
-  io.write(string.format("fastd running for %.3f seconds\n", fastd_status.uptime/1000))
-
-  local peers = 0
-  local connections = 0
-
-  for key, peer in pairs(fastd_status.peers) do
-    peers = peers+1
-
-    if peer.connection then
-      connections = connections+1
-    end
-  end
-
-  io.write(string.format("There are %i peers configured, of which %i are connected:\n\n", peers, connections))
-
-  for key, peer in pairs(fastd_status.peers) do
-    io.write(string.format("%s: ", escape_html(peer.name)))
-
-    if peer.connection then
-      io.write(string.format("connected for %.3f seconds\n", peer.connection.established/1000))
-    else
-      io.write("not connected\n")
-    end
-  end
-
-else
-  io.write("fastd not running")
-end
-
-io.write("
") - -io.write("") -io.write("") -io.write("") diff --git a/package/gluon-status-page/files/lib/gluon/status-page/www/status.js b/package/gluon-status-page/files/lib/gluon/status-page/www/status.js deleted file mode 100644 index e17102d0..00000000 --- a/package/gluon-status-page/files/lib/gluon/status-page/www/status.js +++ /dev/null @@ -1,9 +0,0 @@ -function update_node(id, ip, hostname) { - var el = document.getElementById(id); - - if (!el) - return; - - el.href = "http://[" + ip + "]/"; - el.textContent += " (" + hostname + ")"; -} diff --git a/package/gluon-status-page/src/js/lib/gui/neighbours.js b/package/gluon-status-page/src/js/lib/gui/neighbours.js index ff782506..56933667 100644 --- a/package/gluon-status-page/src/js/lib/gui/neighbours.js +++ b/package/gluon-status-page/src/js/lib/gui/neighbours.js @@ -31,20 +31,13 @@ function (Helper, SignalGraph, Signal) { } function TableEntry(parent, nodeInfo, color, stream, mgmtBus, signal) { - var el = document.createElement("tr") - parent.appendChild(el) + var el = parent.insertRow() - var tdHostname = document.createElement("td") - var tdTQ = document.createElement("td") - var tdSignal = document.createElement("td") - var tdDistance = document.createElement("td") - var tdInactive = document.createElement("td") - - el.appendChild(tdHostname) - el.appendChild(tdTQ) - el.appendChild(tdSignal) - el.appendChild(tdDistance) - el.appendChild(tdInactive) + var tdHostname = el.insertCell() + var tdTQ = el.insertCell() + var tdSignal = el.insertCell() + var tdDistance = el.insertCell() + var tdInactive = el.insertCell() var marker = document.createElement("span") marker.textContent = "⬤ " @@ -69,7 +62,7 @@ function (Helper, SignalGraph, Signal) { el.destroy = function () { unsubscribe() - parent.removeChild(el) + parent.tBodies[0].removeChild(el) } return el @@ -135,8 +128,7 @@ function (Helper, SignalGraph, Signal) { el.appendChild(h) var table = document.createElement("table") - var tr = document.createElement("tr") - table.appendChild(tr) + var tr = table.insertRow() table.classList.add("datatable") var th = document.createElement("th") diff --git a/package/gluon-status-page/src/js/lib/gui/statistics.js b/package/gluon-status-page/src/js/lib/gui/statistics.js index af984e6e..244a2e96 100644 --- a/package/gluon-status-page/src/js/lib/gui/statistics.js +++ b/package/gluon-status-page/src/js/lib/gui/statistics.js @@ -22,28 +22,38 @@ define(["lib/helper"], function (Helper) { return el } - function mkRow(table, label, stream) { - var tr = document.createElement("tr") + function mkRow(table, label, stream, sorted) { + + var i = -1 + + if (sorted) { + for (i = 0; i < table.rows.length; i++) { + if (label < table.rows[i].firstChild.textContent) + break + } + } + + var tr = table.insertRow(i) var th = document.createElement("th") var td = streamElement("td", stream) th.textContent = label tr.appendChild(th) tr.appendChild(td) - table.appendChild(tr) tr.destroy = function () { td.destroy() - table.removeChild(tr) + table.tBodies[0].removeChild(tr) } return tr } function mkTrafficRow(table, children, label, stream, selector) { - var tr = document.createElement("tr") + var tr = table.insertRow() var th = document.createElement("th") - var td = document.createElement("td") th.textContent = label + tr.appendChild(th) + var td = tr.insertCell() var traffic = stream.slidingWindow(2, 2) var pkts = streamNode(traffic.map(deltaUptime(selector + ".packets")).map(prettyPackets)) @@ -56,10 +66,6 @@ define(["lib/helper"], function (Helper) { td.appendChild(document.createElement("br")) td.appendChild(bytes) - tr.appendChild(th) - tr.appendChild(td) - table.appendChild(tr) - children.push(pkts) children.push(bw) children.push(bytes) @@ -127,7 +133,7 @@ define(["lib/helper"], function (Helper) { stream.startWith(d) .map(peer.path) .filter(function (d) { return d !== undefined }) - .map(prettyPeer)) + .map(prettyPeer), true) }) } }) diff --git a/patches/openwrt/0014-fix-UBNT-XM-model-detection.patch b/patches/openwrt/0014-fix-UBNT-XM-model-detection.patch index 4fbdd403..08240588 100644 --- a/patches/openwrt/0014-fix-UBNT-XM-model-detection.patch +++ b/patches/openwrt/0014-fix-UBNT-XM-model-detection.patch @@ -5,7 +5,7 @@ Subject: fix UBNT XM model detection Signed-off-by: Neal Oakey diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh -index d0abf42..f345fae 100755 +index dab4d2c..e7b3cd2 100755 --- a/target/linux/ar71xx/base-files/lib/ar71xx.sh +++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh @@ -64,6 +64,40 @@ wndr3700_board_detect() { @@ -49,7 +49,7 @@ index d0abf42..f345fae 100755 cybertan_get_hw_magic() { local part -@@ -472,12 +506,14 @@ ar71xx_board_detect() { +@@ -475,12 +509,14 @@ ar71xx_board_detect() { ;; *"Bullet M") name="bullet-m" @@ -64,7 +64,7 @@ index d0abf42..f345fae 100755 ;; *"Nanostation M XW") name="nanostation-m-xw" -@@ -664,6 +700,7 @@ ar71xx_board_detect() { +@@ -667,6 +703,7 @@ ar71xx_board_detect() { ;; *"Rocket M") name="rocket-m" diff --git a/patches/openwrt/0017-netifd-update-to-latest-git-master.patch b/patches/openwrt/0017-netifd-update-to-latest-git-master.patch index 3a173661..8128cfb0 100644 --- a/patches/openwrt/0017-netifd-update-to-latest-git-master.patch +++ b/patches/openwrt/0017-netifd-update-to-latest-git-master.patch @@ -3,7 +3,7 @@ Date: Wed, 9 Mar 2016 06:46:44 +0100 Subject: netifd: update to latest git master diff --git a/package/network/config/netifd/Makefile b/package/network/config/netifd/Makefile -index 619024b..f7563d5 100644 +index 619024b..84a4592 100644 --- a/package/network/config/netifd/Makefile +++ b/package/network/config/netifd/Makefile @@ -1,13 +1,13 @@ @@ -11,7 +11,7 @@ index 619024b..f7563d5 100644 PKG_NAME:=netifd -PKG_VERSION:=2015-12-16 -+PKG_VERSION:=2016-03-07 ++PKG_VERSION:=2016-03-31 PKG_RELEASE=$(PKG_SOURCE_VERSION) PKG_SOURCE_PROTO:=git @@ -19,7 +19,7 @@ index 619024b..f7563d5 100644 +PKG_SOURCE_URL=$(OPENWRT_GIT)/project/netifd.git PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) -PKG_SOURCE_VERSION:=245527193e90906451be35c2b8e972b8712ea6ab -+PKG_SOURCE_VERSION:=bd1ee3efb46ae013d81b1aec51668e7595274e69 ++PKG_SOURCE_VERSION:=6fd6be6b7f3fc4883fdc464fcbcb2b5e8d8e8174 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz PKG_MAINTAINER:=Felix Fietkau # PKG_MIRROR_MD5SUM:= @@ -53,3 +53,130 @@ index af3aaa8..5515b91 100755 for dev in $(echo "$radio_devs" | sort -u); do /sbin/wifi up "$dev" done +diff --git a/package/network/config/netifd/patches/0001-Revert-device-Don-t-process-link-events-anymore-in-d.patch b/package/network/config/netifd/patches/0001-Revert-device-Don-t-process-link-events-anymore-in-d.patch +new file mode 100644 +index 0000000..312964f +--- /dev/null ++++ b/package/network/config/netifd/patches/0001-Revert-device-Don-t-process-link-events-anymore-in-d.patch +@@ -0,0 +1,121 @@ ++From e0f19fdae88f3ef505e22533915f8328f4793980 Mon Sep 17 00:00:00 2001 ++Message-Id: ++From: Matthias Schiffer ++Date: Thu, 5 May 2016 21:49:33 +0200 ++Subject: [PATCH] Revert "device: Don't process link events anymore in device ++ user specific callback handlers" ++ ++This reverts commit 4902ba2999dec02e82066d70ab6096b852a33007. ++--- ++ device.h | 2 ++ ++ macvlan.c | 8 ++++++++ ++ system-linux.c | 2 +- ++ vlan.c | 6 ++++++ ++ vlandev.c | 8 ++++++++ ++ 5 files changed, 25 insertions(+), 1 deletion(-) ++ ++diff --git a/device.h b/device.h ++index ac77cfb..ef1c608 100644 ++--- a/device.h +++++ b/device.h ++@@ -59,6 +59,8 @@ struct device_type { ++ struct list_head list; ++ const char *name; ++ +++ bool keep_link_status; +++ ++ const struct uci_blob_param_list *config_params; ++ ++ struct device *(*create)(const char *name, struct blob_attr *attr); ++diff --git a/macvlan.c b/macvlan.c ++index a0f11ae..051fe05 100644 ++--- a/macvlan.c +++++ b/macvlan.c ++@@ -72,6 +72,12 @@ macvlan_base_cb(struct device_user *dev, enum device_event ev) ++ case DEV_EVENT_REMOVE: ++ device_set_present(&mvdev->dev, false); ++ break; +++ case DEV_EVENT_LINK_UP: +++ device_set_link(&mvdev->dev, true); +++ break; +++ case DEV_EVENT_LINK_DOWN: +++ device_set_link(&mvdev->dev, false); +++ break; ++ default: ++ return; ++ } ++@@ -255,6 +261,8 @@ macvlan_create(const char *name, struct blob_attr *attr) ++ const struct device_type macvlan_device_type = { ++ .name = "MAC VLAN", ++ .config_params = &macvlan_attr_list, +++ .keep_link_status = true, +++ ++ .create = macvlan_create, ++ .config_init = macvlan_config_init, ++ .reload = macvlan_reload, ++diff --git a/system-linux.c b/system-linux.c ++index 351a994..794c1dd 100644 ++--- a/system-linux.c +++++ b/system-linux.c ++@@ -464,7 +464,7 @@ static int cb_rtnl_event(struct nl_msg *msg, void *arg) ++ goto out; ++ ++ struct device *dev = device_get(nla_data(nla[IFLA_IFNAME]), false); ++- if (!dev) +++ if (!dev || dev->type->keep_link_status) ++ goto out; ++ ++ if (!system_get_dev_sysctl("/sys/class/net/%s/carrier", dev->ifname, buf, sizeof(buf))) ++diff --git a/vlan.c b/vlan.c ++index ac434ce..8d93799 100644 ++--- a/vlan.c +++++ b/vlan.c ++@@ -79,6 +79,11 @@ static void vlan_dev_cb(struct device_user *dep, enum device_event ev) ++ case DEV_EVENT_REMOVE: ++ device_set_present(&vldev->dev, new_state); ++ break; +++ case DEV_EVENT_LINK_UP: +++ new_state = true; +++ case DEV_EVENT_LINK_DOWN: +++ device_set_link(&vldev->dev, new_state); +++ break; ++ case DEV_EVENT_UPDATE_IFNAME: ++ vlan_dev_set_name(vldev, dep->dev); ++ device_broadcast_event(&vldev->dev, ev); ++@@ -97,6 +102,7 @@ static struct device *get_vlan_device(struct device *dev, int id, bool create) ++ static const struct device_type vlan_type = { ++ .name = "VLAN", ++ .config_params = &device_attr_list, +++ .keep_link_status = true, ++ .free = free_vlan_if, ++ }; ++ struct vlan_device *vldev; ++diff --git a/vlandev.c b/vlandev.c ++index b93527c..884e6ef 100644 ++--- a/vlandev.c +++++ b/vlandev.c ++@@ -63,6 +63,12 @@ vlandev_base_cb(struct device_user *dev, enum device_event ev) ++ case DEV_EVENT_REMOVE: ++ device_set_present(&mvdev->dev, false); ++ break; +++ case DEV_EVENT_LINK_UP: +++ device_set_link(&mvdev->dev, true); +++ break; +++ case DEV_EVENT_LINK_DOWN: +++ device_set_link(&mvdev->dev, false); +++ break; ++ default: ++ return; ++ } ++@@ -243,6 +249,8 @@ vlandev_create(const char *name, struct blob_attr *attr) ++ const struct device_type vlandev_device_type = { ++ .name = "VLANDEV", ++ .config_params = &vlandev_attr_list, +++ .keep_link_status = true, +++ ++ .create = vlandev_create, ++ .config_init = vlandev_config_init, ++ .reload = vlandev_reload, ++-- ++2.8.2 ++ diff --git a/patches/openwrt/0018-x86-fix-platform_export_bootpart-for-Xen-virtual-disks.patch b/patches/openwrt/0018-x86-fix-platform_export_bootpart-for-Xen-virtual-disks.patch new file mode 100644 index 00000000..4e0ce138 --- /dev/null +++ b/patches/openwrt/0018-x86-fix-platform_export_bootpart-for-Xen-virtual-disks.patch @@ -0,0 +1,25 @@ +From: Alexander Dahl +Date: Thu, 17 Mar 2016 15:04:09 +0100 +Subject: x86: fix platform_export_bootpart() for Xen virtual disks + +Virtual disk devices in a Xen virtual machine (DomU) can be /dev/xvda, +/dev/xvdb and so on with partitions like /dev/xdva1. Devices named like +this where not considered before. This resulted in a non working +sysupgrade, because the boot partition could not be found. + +Signed-off-by: Alexander Dahl +Suggested-by: Matthias Schiffer + +diff --git a/target/linux/x86/base-files/lib/upgrade/platform.sh b/target/linux/x86/base-files/lib/upgrade/platform.sh +index 73ab5ef..adc119c 100644 +--- a/target/linux/x86/base-files/lib/upgrade/platform.sh ++++ b/target/linux/x86/base-files/lib/upgrade/platform.sh +@@ -17,7 +17,7 @@ platform_export_bootpart() { + PARTUUID=[a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9]-02) + uuid="${disk#PARTUUID=}" + uuid="${uuid%-02}" +- for disk in /dev/[hsv]d[a-z]; do ++ for disk in /dev/[hsv]d[a-z] /dev/xvd[a-z]; do + set -- $(dd if=$disk bs=1 skip=440 count=4 2>/dev/null | hexdump -v -e '4/1 "%02x "') + if [ "$4$3$2$1" = "$uuid" ]; then + export BOOTPART="${disk}1" diff --git a/patches/openwrt/0019-Support-LibreSSL-as-provider-of-openssl.patch b/patches/openwrt/0019-Support-LibreSSL-as-provider-of-openssl.patch new file mode 100644 index 00000000..cf627622 --- /dev/null +++ b/patches/openwrt/0019-Support-LibreSSL-as-provider-of-openssl.patch @@ -0,0 +1,27 @@ +From: Matthias Schiffer +Date: Wed, 30 Mar 2016 02:59:19 +0200 +Subject: Support LibreSSL as provider of openssl + +The build scripts check for openssl by grepping the string "OpenSSL" in +the output of openssl version command. LibreSSL fails this test as it +outputs something like "LibreSSL 2.2.4". This patch fix the +prereq-bulid.mk file so that it accepts LibreSSL as openssl provider as +well. + +Signed-off-by: Marek Behun + +Backport of r48267 + +diff --git a/include/prereq-build.mk b/include/prereq-build.mk +index 32c4ada..f36d57c 100644 +--- a/include/prereq-build.mk ++++ b/include/prereq-build.mk +@@ -151,7 +151,7 @@ $(eval $(call SetupHostCommand,file,Please install the 'file' package, \ + file --version 2>&1 | grep file)) + + $(eval $(call SetupHostCommand,openssl,Please install the 'openssl' utility, \ +- openssl version | grep OpenSSL)) ++ openssl version | grep '\(OpenSSL\|LibreSSL\)')) + + + # Install ldconfig stub diff --git a/patches/openwrt/0020-ar71xx-check-both-HWID-and-HWREV-on-upgrades-of-TP-LINK-devices.patch b/patches/openwrt/0020-ar71xx-check-both-HWID-and-HWREV-on-upgrades-of-TP-LINK-devices.patch new file mode 100644 index 00000000..77b47675 --- /dev/null +++ b/patches/openwrt/0020-ar71xx-check-both-HWID-and-HWREV-on-upgrades-of-TP-LINK-devices.patch @@ -0,0 +1,48 @@ +From: Matthias Schiffer +Date: Fri, 1 Apr 2016 23:16:13 +0200 +Subject: ar71xx: check both HWID and HWREV on upgrades of TP-LINK devices + +There's no reason for us to be more lenient than the stock firmware, so +better check the HWREV as well to avoid bricked devices. + +Signed-off-by: Matthias Schiffer + +Backport of r49105 + +diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh +index d025632..c5c1871 100755 +--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh ++++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh +@@ -66,6 +66,10 @@ tplink_get_image_hwid() { + get_image "$@" | dd bs=4 count=1 skip=16 2>/dev/null | hexdump -v -n 4 -e '1/1 "%02x"' + } + ++tplink_get_image_mid() { ++ get_image "$@" | dd bs=4 count=1 skip=17 2>/dev/null | hexdump -v -n 4 -e '1/1 "%02x"' ++} ++ + tplink_get_image_boot_size() { + get_image "$@" | dd bs=4 count=1 skip=37 2>/dev/null | hexdump -v -n 4 -e '1/1 "%02x"' + } +@@ -366,13 +370,17 @@ platform_check_image() { + } + + local hwid +- local imageid ++ local mid ++ local imagehwid ++ local imagemid + + hwid=$(tplink_get_hwid) +- imageid=$(tplink_get_image_hwid "$1") ++ mid=$(tplink_get_mid) ++ imagehwid=$(tplink_get_image_hwid "$1") ++ imagemid=$(tplink_get_image_mid "$1") + +- [ "$hwid" != "$imageid" ] && { +- echo "Invalid image, hardware ID mismatch, hw:$hwid image:$imageid." ++ [ "$hwid" != "$imagehwid" -o "$mid" != "$imagemid" ] && { ++ echo "Invalid image, hardware ID mismatch, hw:$hwid $mid image:$imagehwid $imagemid." + return 1 + } + diff --git a/patches/openwrt/0021-ar71xx-avoid-AR71XX_MODEL-ending-with-a-space-on-some-TP-LINK-like-devices.patch b/patches/openwrt/0021-ar71xx-avoid-AR71XX_MODEL-ending-with-a-space-on-some-TP-LINK-like-devices.patch new file mode 100644 index 00000000..70b3a004 --- /dev/null +++ b/patches/openwrt/0021-ar71xx-avoid-AR71XX_MODEL-ending-with-a-space-on-some-TP-LINK-like-devices.patch @@ -0,0 +1,45 @@ +From: Matthias Schiffer +Date: Fri, 1 Apr 2016 23:19:16 +0200 +Subject: ar71xx: avoid AR71XX_MODEL ending with a space on some TP-LINK-like devices + +Instead of adding the space when combining $model and $hwver, add the space +to the beginning of $hwver, so the resulting string won't end with a space +when $hwver is set to the empty string. + +Signed-off-by: Matthias Schiffer + +Backport of r49106 + +diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh +index e7b3cd2..180a075 100755 +--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh ++++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh +@@ -133,7 +133,7 @@ tplink_board_detect() { + hwid=$(tplink_get_hwid) + mid=$(tplink_get_mid) + hwver=${hwid:6:2} +- hwver="v${hwver#0}" ++ hwver=" v${hwver#0}" + + case "$hwid" in + "015000"*) +@@ -196,8 +196,8 @@ tplink_board_detect() { + "083000"*) + model="TP-Link TL-WA830RE" + +- if [ "$hwver" = 'v10' ]; then +- hwver='v1' ++ if [ "$hwver" = ' v10' ]; then ++ hwver=' v1' + fi + ;; + "084100"*) +@@ -296,7 +296,7 @@ tplink_board_detect() { + ;; + esac + +- AR71XX_MODEL="$model $hwver" ++ AR71XX_MODEL="$model$hwver" + } + + tplink_pharos_get_model_string() { diff --git a/patches/openwrt/0022-ar71xx-fix-the-revision-of-a-few-TP-LINK-devices-in-AR71XX_MODEL-to-match-labels-image-names.patch b/patches/openwrt/0022-ar71xx-fix-the-revision-of-a-few-TP-LINK-devices-in-AR71XX_MODEL-to-match-labels-image-names.patch new file mode 100644 index 00000000..9330e547 --- /dev/null +++ b/patches/openwrt/0022-ar71xx-fix-the-revision-of-a-few-TP-LINK-devices-in-AR71XX_MODEL-to-match-labels-image-names.patch @@ -0,0 +1,39 @@ +From: Matthias Schiffer +Date: Fri, 1 Apr 2016 23:21:32 +0200 +Subject: ar71xx: fix the revision of a few TP-LINK devices in AR71XX_MODEL to match labels/image names + +Let's not confuse users about the revisions of their devices when we can +easily avoid it. + +Not tested on real hardware. + +Signed-off-by: Matthias Schiffer + +Backport of r49107 + +diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh +index 180a075..ddd6611 100755 +--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh ++++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh +@@ -162,6 +162,10 @@ tplink_board_detect() { + ;; + "071000"*) + model="TP-Link TL-WR710N" ++ ++ if [ "$hwid" = '07100002' -a "$mid" = '00000002' ]; then ++ hwver=' v2.1' ++ fi + ;; + "072001"*) + model="TP-Link TL-WR720N" +@@ -202,6 +206,10 @@ tplink_board_detect() { + ;; + "084100"*) + model="TP-Link TL-WR841N/ND" ++ ++ if [ "$hwid" = '08410002' -a "$mid" = '00000002' ]; then ++ hwver=' v1.5' ++ fi + ;; + "084200"*) + model="TP-Link TL-WR842N/ND" diff --git a/patches/openwrt/0023-ar71xx-build-image-for-TL-WR710N-v2.1.patch b/patches/openwrt/0023-ar71xx-build-image-for-TL-WR710N-v2.1.patch new file mode 100644 index 00000000..5a225d7d --- /dev/null +++ b/patches/openwrt/0023-ar71xx-build-image-for-TL-WR710N-v2.1.patch @@ -0,0 +1,41 @@ +From: Matthias Schiffer +Date: Sat, 2 Apr 2016 00:56:50 +0200 +Subject: ar71xx: build image for TL-WR710N v2.1 + +This patch just extends target/linux/ar71xx/image/Makefile to build +images also for version 2.1 of TL-WR710N +patch against the latest git + +Signed off by: Norbert Wegener + +Backport of r47849 + +diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile +index 9a7acbd..d42ceef 100644 +--- a/target/linux/ar71xx/image/Makefile ++++ b/target/linux/ar71xx/image/Makefile +@@ -476,6 +476,15 @@ define Device/tl-wr710n-v2 + CONSOLE := ttyATH0,115200 + endef + ++define Device/tl-wr710n-v2.1 ++ $(Device/tplink-8mlzma) ++ BOARDNAME := TL-WR710N ++ DEVICE_PROFILE := TLWR710 ++ TPLINK_HWID := 0x07100002 ++ TPLINK_HWREV := 0x00000002 ++ CONSOLE := ttyATH0,115200 ++endef ++ + define Device/tl-wr720n-v3 + $(Device/tplink-4mlzma) + BOARDNAME := TL-WR720N-v3 +@@ -491,7 +500,7 @@ define Device/tl-wr720n-v4 + TPLINK_HWID := 0x07200104 + CONSOLE := ttyATH0,115200 + endef +-TARGET_DEVICES += tl-wr703n-v1 tl-wr710n-v1 tl-wr710n-v2 tl-wr720n-v3 tl-wr720n-v4 ++TARGET_DEVICES += tl-wr703n-v1 tl-wr710n-v1 tl-wr710n-v2 tl-wr710n-v2.1 tl-wr720n-v3 tl-wr720n-v4 + + define Device/tl-wr740n-v4 + $(Device/tplink-4mlzma) diff --git a/patches/openwrt/0024-xtables-addons-build-fix-configure-compatiblity-with-POSIX-shells.patch b/patches/openwrt/0024-xtables-addons-build-fix-configure-compatiblity-with-POSIX-shells.patch new file mode 100644 index 00000000..fa4b76a5 --- /dev/null +++ b/patches/openwrt/0024-xtables-addons-build-fix-configure-compatiblity-with-POSIX-shells.patch @@ -0,0 +1,2026 @@ +From: Matthias Schiffer +Date: Tue, 5 Apr 2016 20:30:56 +0200 +Subject: xtables-addons: build: fix configure compatiblity with POSIX shells + +diff --git a/package/network/utils/xtables-addons/patches/001-build-fix-configure-compatiblity-with-POSIX-shells.patch b/package/network/utils/xtables-addons/patches/001-build-fix-configure-compatiblity-with-POSIX-shells.patch +new file mode 100644 +index 0000000..e0b11b5 +--- /dev/null ++++ b/package/network/utils/xtables-addons/patches/001-build-fix-configure-compatiblity-with-POSIX-shells.patch +@@ -0,0 +1,51 @@ ++From f07a0a5cb8b3c5e1aee8b30c7fa21ccfbf24a95a Mon Sep 17 00:00:00 2001 ++Message-Id: ++From: Matthias Schiffer ++Date: Fri, 1 Apr 2016 22:24:00 +0200 ++Subject: [PATCH] build: fix configure compatiblity with POSIX shells ++ ++The kernel version detection code uses some bashisms, which makes the build ++fail on Debian systems where /bin/sh links to dash. Replace with POSIX- ++conforming commands at the cost of requiring awk. ++--- ++ configure.ac | 24 +++++++++--------------- ++ 1 file changed, 9 insertions(+), 15 deletions(-) ++ ++diff --git a/configure.ac b/configure.ac ++index 82a1355..5a5ea57 100644 ++--- a/configure.ac +++++ b/configure.ac ++@@ -44,21 +44,15 @@ regular_CFLAGS="-Wall -Waggregate-return -Wmissing-declarations \ ++ ++ if test -n "$kbuilddir"; then ++ AC_MSG_CHECKING([kernel version that we will build against]) ++- krel="$(make -sC "$kbuilddir" M=$PWD kernelrelease)"; ++- kmajor="${krel%%[[^0-9]]*}"; ++- kmajor="$(($kmajor+0))"; ++- krel="${krel:${#kmajor}}"; ++- krel="${krel#.}"; ++- kminor="${krel%%[[^0-9]]*}"; ++- kminor="$(($kminor+0))"; ++- krel="${krel:${#kminor}}"; ++- krel="${krel#.}"; ++- kmicro="${krel%%[[^0-9]]*}"; ++- kmicro="$(($kmicro+0))"; ++- krel="${krel:${#kmicro}}"; ++- krel="${krel#.}"; ++- kstable="${krel%%[[^0-9]]*}"; ++- kstable="$(($kstable+0))"; +++ krel="$(make -sC "$kbuilddir" M=$PWD kernelrelease | $AWK -v 'FS=[[^0-9.]]' '{print $1; exit}')"; +++ save_IFS=$IFS; +++ IFS='.'; +++ set x $krel; +++ IFS=$save_IFS; +++ kmajor="$(($2+0))"; +++ kminor="$(($3+0))"; +++ kmicro="$(($4+0))"; +++ kstable="$(($5+0))"; ++ if test -z "$kmajor" -o -z "$kminor" -o -z "$kmicro"; then ++ echo "WARNING: Version detection did not succeed. Continue at own luck."; ++ else ++-- ++2.8.0 ++ +diff --git a/package/network/utils/xtables-addons/patches/002-fix-kernel-version-detection.patch b/package/network/utils/xtables-addons/patches/002-fix-kernel-version-detection.patch +index d3b7caa..6a7a099 100644 +--- a/package/network/utils/xtables-addons/patches/002-fix-kernel-version-detection.patch ++++ b/package/network/utils/xtables-addons/patches/002-fix-kernel-version-detection.patch +@@ -1,1954 +1,11 @@ +---- a/configure +-+++ b/configure +-@@ -1,9 +1,11 @@ +- #! /bin/sh +- # Guess values for system-dependent variables and create Makefiles. +--# Generated by GNU Autoconf 2.69 for xtables-addons 2.5. +-+# Generated by GNU Autoconf 2.68 for xtables-addons 2.5. +- # +- # +--# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. +-+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, +-+# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software +-+# Foundation, Inc. +- # +- # +- # This configure script is free software; the Free Software Foundation +-@@ -132,31 +134,6 @@ export LANGUAGE +- # CDPATH. +- (unset CDPATH) >/dev/null 2>&1 && unset CDPATH +- +--# Use a proper internal environment variable to ensure we don't fall +-- # into an infinite loop, continuously re-executing ourselves. +-- if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then +-- _as_can_reexec=no; export _as_can_reexec; +-- # We cannot yet assume a decent shell, so we have to provide a +--# neutralization value for shells without unset; and this also +--# works around shells that cannot unset nonexistent variables. +--# Preserve -v and -x to the replacement shell. +--BASH_ENV=/dev/null +--ENV=/dev/null +--(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +--case $- in # (((( +-- *v*x* | *x*v* ) as_opts=-vx ;; +-- *v* ) as_opts=-v ;; +-- *x* ) as_opts=-x ;; +-- * ) as_opts= ;; +--esac +--exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +--# Admittedly, this is quite paranoid, since all the known shells bail +--# out after a failed `exec'. +--$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +--as_fn_exit 255 +-- fi +-- # We don't want this to propagate to other subprocesses. +-- { _as_can_reexec=; unset _as_can_reexec;} +- if test "x$CONFIG_SHELL" = x; then +- as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : +- emulate sh +-@@ -190,8 +167,7 @@ if ( set x; as_fn_ret_success y && test +- else +- exitcode=1; echo positional parameters were not saved. +- fi +--test x\$exitcode = x0 || exit 1 +--test -x / || exit 1" +-+test x\$exitcode = x0 || exit 1" +- as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO +- as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO +- eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && +-@@ -244,25 +220,21 @@ IFS=$as_save_IFS +- +- +- if test "x$CONFIG_SHELL" != x; then : +-- export CONFIG_SHELL +-- # We cannot yet assume a decent shell, so we have to provide a +--# neutralization value for shells without unset; and this also +--# works around shells that cannot unset nonexistent variables. +--# Preserve -v and -x to the replacement shell. +--BASH_ENV=/dev/null +--ENV=/dev/null +--(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +--case $- in # (((( +-- *v*x* | *x*v* ) as_opts=-vx ;; +-- *v* ) as_opts=-v ;; +-- *x* ) as_opts=-x ;; +-- * ) as_opts= ;; +--esac +--exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +--# Admittedly, this is quite paranoid, since all the known shells bail +--# out after a failed `exec'. +--$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +--exit 255 +-+ # We cannot yet assume a decent shell, so we have to provide a +-+ # neutralization value for shells without unset; and this also +-+ # works around shells that cannot unset nonexistent variables. +-+ # Preserve -v and -x to the replacement shell. +-+ BASH_ENV=/dev/null +-+ ENV=/dev/null +-+ (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +-+ export CONFIG_SHELL +-+ case $- in # (((( +-+ *v*x* | *x*v* ) as_opts=-vx ;; +-+ *v* ) as_opts=-v ;; +-+ *x* ) as_opts=-x ;; +-+ * ) as_opts= ;; +-+ esac +-+ exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"} +- fi +- +- if test x$as_have_required = xno; then : +-@@ -364,14 +336,6 @@ $as_echo X"$as_dir" | +- +- +- } # as_fn_mkdir_p +-- +--# as_fn_executable_p FILE +--# ----------------------- +--# Test if FILE is an executable regular file. +--as_fn_executable_p () +--{ +-- test -f "$1" && test -x "$1" +--} # as_fn_executable_p +- # as_fn_append VAR VALUE +- # ---------------------- +- # Append the text in VALUE to the end of the definition contained in VAR. Take +-@@ -493,10 +457,6 @@ as_cr_alnum=$as_cr_Letters$as_cr_digits +- chmod +x "$as_me.lineno" || +- { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } +- +-- # If we had to re-execute with $CONFIG_SHELL, we're ensured to have +-- # already done that, so ensure we don't try to do so again and fall +-- # in an infinite loop. This has already happened in practice. +-- _as_can_reexec=no; export _as_can_reexec +- # Don't try to exec as it changes $[0], causing all sort of problems +- # (the dirname of $[0] is not the place where we might find the +- # original and so on. Autoconf is especially sensitive to this). +-@@ -531,16 +491,16 @@ if (echo >conf$$.file) 2>/dev/null; then +- # ... but there are two gotchas: +- # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. +- # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. +-- # In both cases, we have to default to `cp -pR'. +-+ # In both cases, we have to default to `cp -p'. +- ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || +-- as_ln_s='cp -pR' +-+ as_ln_s='cp -p' +- elif ln conf$$.file conf$$ 2>/dev/null; then +- as_ln_s=ln +- else +-- as_ln_s='cp -pR' +-+ as_ln_s='cp -p' +- fi +- else +-- as_ln_s='cp -pR' +-+ as_ln_s='cp -p' +- fi +- rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +- rmdir conf$$.dir 2>/dev/null +-@@ -552,8 +512,28 @@ else +- as_mkdir_p=false +- fi +- +--as_test_x='test -x' +--as_executable_p=as_fn_executable_p +-+if test -x / >/dev/null 2>&1; then +-+ as_test_x='test -x' +-+else +-+ if ls -dL / >/dev/null 2>&1; then +-+ as_ls_L_option=L +-+ else +-+ as_ls_L_option= +-+ fi +-+ as_test_x=' +-+ eval sh -c '\'' +-+ if test -d "$1"; then +-+ test -d "$1/."; +-+ else +-+ case $1 in #( +-+ -*)set "./$1";; +-+ esac; +-+ case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( +-+ ???[sx]*):;;*)false;;esac;fi +-+ '\'' sh +-+ ' +-+fi +-+as_executable_p=$as_test_x +- +- # Sed expression to map a string onto a valid CPP name. +- as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" +-@@ -688,10 +668,6 @@ CPPFLAGS +- LDFLAGS +- CFLAGS +- CC +--AM_BACKSLASH +--AM_DEFAULT_VERBOSITY +--AM_DEFAULT_V +--AM_V +- am__untar +- am__tar +- AMTAR +-@@ -756,7 +732,6 @@ SHELL' +- ac_subst_files='' +- ac_user_opts=' +- enable_option_checking +--enable_silent_rules +- enable_dependency_tracking +- enable_static +- enable_shared +-@@ -1237,6 +1212,8 @@ target=$target_alias +- if test "x$host_alias" != x; then +- if test "x$build_alias" = x; then +- cross_compiling=maybe +-+ $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host. +-+ If a cross compiler is detected then cross compile mode will be used" >&2 +- elif test "x$build_alias" != "x$host_alias"; then +- cross_compiling=yes +- fi +-@@ -1400,12 +1377,8 @@ Optional Features: +- --disable-option-checking ignore unrecognized --enable/--with options +- --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) +- --enable-FEATURE[=ARG] include FEATURE [ARG=yes] +-- --enable-silent-rules less verbose build output (undo: "make V=1") +-- --disable-silent-rules verbose build output (undo: "make V=0") +-- --enable-dependency-tracking +-- do not reject slow dependency extractors +-- --disable-dependency-tracking +-- speeds up one-time build +-+ --disable-dependency-tracking speeds up one-time build +-+ --enable-dependency-tracking do not reject slow dependency extractors +- --enable-static[=PKGS] build static libraries [default=no] +- --enable-shared[=PKGS] build shared libraries [default=yes] +- --enable-fast-install[=PKGS] +-@@ -1415,7 +1388,7 @@ Optional Features: +- Optional Packages: +- --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] +- --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) +-- --with-pic[=PKGS] try to use only PIC/non-PIC objects [default=use +-+ --with-pic try to use only PIC/non-PIC objects [default=use +- both] +- --with-gnu-ld assume the C compiler uses GNU ld [default=no] +- --with-sysroot=DIR Search for dependent libraries within DIR +-@@ -1512,9 +1485,9 @@ test -n "$ac_init_help" && exit $ac_stat +- if $ac_init_version; then +- cat <<\_ACEOF +- xtables-addons configure 2.5 +--generated by GNU Autoconf 2.69 +-+generated by GNU Autoconf 2.68 +- +--Copyright (C) 2012 Free Software Foundation, Inc. +-+Copyright (C) 2010 Free Software Foundation, Inc. +- This configure script is free software; the Free Software Foundation +- gives unlimited permission to copy, distribute and modify it. +- _ACEOF +-@@ -1590,7 +1563,7 @@ $as_echo "$ac_try_echo"; } >&5 +- test ! -s conftest.err +- } && test -s conftest$ac_exeext && { +- test "$cross_compiling" = yes || +-- test -x conftest$ac_exeext +-+ $as_test_x conftest$ac_exeext +- }; then : +- ac_retval=0 +- else +-@@ -1877,7 +1850,7 @@ This file contains any messages produced +- running configure, to aid debugging if configure makes a mistake. +- +- It was created by xtables-addons $as_me 2.5, which was +--generated by GNU Autoconf 2.69. Invocation command line was +-+generated by GNU Autoconf 2.68. Invocation command line was +- +- $ $0 $@ +- +-@@ -2293,7 +2266,7 @@ case $as_dir/ in #(( +- # by default. +- for ac_prog in ginstall scoinst install; do +- for ac_exec_ext in '' $ac_executable_extensions; do +-- if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then +-+ if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then +- if test $ac_prog = install && +- grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then +- # AIX install. It has an incompatible calling convention. +-@@ -2349,10 +2322,13 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCR +- +- test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' +- +--am__api_version='1.14' +-+am__api_version='1.11' +- +- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 +- $as_echo_n "checking whether build environment is sane... " >&6; } +-+# Just in case +-+sleep 1 +-+echo timestamp > conftest.file +- # Reject unsafe characters in $srcdir or the absolute working directory +- # name. Accept space and tab only in the latter. +- am_lf=' +-@@ -2363,40 +2339,32 @@ case `pwd` in +- esac +- case $srcdir in +- *[\\\"\#\$\&\'\`$am_lf\ \ ]*) +-- as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;; +-+ as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;; +- esac +- +--# Do 'set' in a subshell so we don't clobber the current shell's +-+# Do `set' in a subshell so we don't clobber the current shell's +- # arguments. Must try -L first in case configure is actually a +- # symlink; some systems play weird games with the mod time of symlinks +- # (eg FreeBSD returns the mod time of the symlink's containing +- # directory). +- if ( +-- am_has_slept=no +-- for am_try in 1 2; do +-- echo "timestamp, slept: $am_has_slept" > conftest.file +-- set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` +-- if test "$*" = "X"; then +-- # -L didn't work. +-- set X `ls -t "$srcdir/configure" conftest.file` +-- fi +-- if test "$*" != "X $srcdir/configure conftest.file" \ +-- && test "$*" != "X conftest.file $srcdir/configure"; then +-+ set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` +-+ if test "$*" = "X"; then +-+ # -L didn't work. +-+ set X `ls -t "$srcdir/configure" conftest.file` +-+ fi +-+ rm -f conftest.file +-+ if test "$*" != "X $srcdir/configure conftest.file" \ +-+ && test "$*" != "X conftest.file $srcdir/configure"; then +-+ +-+ # If neither matched, then we have a broken ls. This can happen +-+ # if, for instance, CONFIG_SHELL is bash and it inherits a +-+ # broken ls alias from the environment. This has actually +-+ # happened. Such a system could not be considered "sane". +-+ as_fn_error $? "ls -t appears to fail. Make sure there is not a broken +-+alias in your environment" "$LINENO" 5 +-+ fi +- +-- # If neither matched, then we have a broken ls. This can happen +-- # if, for instance, CONFIG_SHELL is bash and it inherits a +-- # broken ls alias from the environment. This has actually +-- # happened. Such a system could not be considered "sane". +-- as_fn_error $? "ls -t appears to fail. Make sure there is not a broken +-- alias in your environment" "$LINENO" 5 +-- fi +-- if test "$2" = conftest.file || test $am_try -eq 2; then +-- break +-- fi +-- # Just in case. +-- sleep 1 +-- am_has_slept=yes +-- done +- test "$2" = conftest.file +- ) +- then +-@@ -2408,16 +2376,6 @@ Check your system clock" "$LINENO" 5 +- fi +- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +- $as_echo "yes" >&6; } +--# If we didn't sleep, we still need to ensure time stamps of config.status and +--# generated files are strictly newer. +--am_sleep_pid= +--if grep 'slept: no' conftest.file >/dev/null 2>&1; then +-- ( sleep 1 ) & +-- am_sleep_pid=$! +--fi +-- +--rm -f conftest.file +-- +- test "$program_prefix" != NONE && +- program_transform_name="s&^&$program_prefix&;$program_transform_name" +- # Use a double $ so make ignores it. +-@@ -2440,12 +2398,12 @@ if test x"${MISSING+set}" != xset; then +- esac +- fi +- # Use eval to expand $SHELL +--if eval "$MISSING --is-lightweight"; then +-- am_missing_run="$MISSING " +-+if eval "$MISSING --run true"; then +-+ am_missing_run="$MISSING --run " +- else +- am_missing_run= +-- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 +--$as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;} +-+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`missing' script is too old or missing" >&5 +-+$as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} +- fi +- +- if test x"${install_sh}" != xset; then +-@@ -2457,10 +2415,10 @@ if test x"${install_sh}" != xset; then +- esac +- fi +- +--# Installed binaries are usually stripped using 'strip' when the user +--# run "make install-strip". However 'strip' might not be the right +-+# Installed binaries are usually stripped using `strip' when the user +-+# run `make install-strip'. However `strip' might not be the right +- # tool to use in cross-compilation environments, therefore Automake +--# will honor the 'STRIP' environment variable to overrule this program. +-+# will honor the `STRIP' environment variable to overrule this program. +- if test "$cross_compiling" != no; then +- if test -n "$ac_tool_prefix"; then +- # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +-@@ -2479,7 +2437,7 @@ do +- IFS=$as_save_IFS +- test -z "$as_dir" && as_dir=. +- for ac_exec_ext in '' $ac_executable_extensions; do +-- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then +-+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then +- ac_cv_prog_STRIP="${ac_tool_prefix}strip" +- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 +- break 2 +-@@ -2519,7 +2477,7 @@ do +- IFS=$as_save_IFS +- test -z "$as_dir" && as_dir=. +- for ac_exec_ext in '' $ac_executable_extensions; do +-- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then +-+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then +- ac_cv_prog_ac_ct_STRIP="strip" +- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 +- break 2 +-@@ -2570,7 +2528,7 @@ do +- test -z "$as_dir" && as_dir=. +- for ac_prog in mkdir gmkdir; do +- for ac_exec_ext in '' $ac_executable_extensions; do +-- as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue +-+ { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue +- case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( +- 'mkdir (GNU coreutils) '* | \ +- 'mkdir (coreutils) '* | \ +-@@ -2599,6 +2557,12 @@ fi +- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 +- $as_echo "$MKDIR_P" >&6; } +- +-+mkdir_p="$MKDIR_P" +-+case $mkdir_p in +-+ [\\/$]* | ?:[\\/]*) ;; +-+ */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; +-+esac +-+ +- for ac_prog in gawk mawk nawk awk +- do +- # Extract the first word of "$ac_prog", so it can be a program name with args. +-@@ -2617,7 +2581,7 @@ do +- IFS=$as_save_IFS +- test -z "$as_dir" && as_dir=. +- for ac_exec_ext in '' $ac_executable_extensions; do +-- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then +-+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then +- ac_cv_prog_AWK="$ac_prog" +- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 +- break 2 +-@@ -2681,45 +2645,6 @@ else +- fi +- rmdir .tst 2>/dev/null +- +--# Check whether --enable-silent-rules was given. +--if test "${enable_silent_rules+set}" = set; then : +-- enableval=$enable_silent_rules; +--fi +-- +--case $enable_silent_rules in # ((( +-- yes) AM_DEFAULT_VERBOSITY=0;; +-- no) AM_DEFAULT_VERBOSITY=1;; +-- *) AM_DEFAULT_VERBOSITY=1;; +--esac +--am_make=${MAKE-make} +--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 +--$as_echo_n "checking whether $am_make supports nested variables... " >&6; } +--if ${am_cv_make_support_nested_variables+:} false; then : +-- $as_echo_n "(cached) " >&6 +--else +-- if $as_echo 'TRUE=$(BAR$(V)) +--BAR0=false +--BAR1=true +--V=1 +--am__doit: +-- @$(TRUE) +--.PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then +-- am_cv_make_support_nested_variables=yes +--else +-- am_cv_make_support_nested_variables=no +--fi +--fi +--{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 +--$as_echo "$am_cv_make_support_nested_variables" >&6; } +--if test $am_cv_make_support_nested_variables = yes; then +-- AM_V='$(V)' +-- AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' +--else +-- AM_V=$AM_DEFAULT_VERBOSITY +-- AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY +--fi +--AM_BACKSLASH='\' +-- +- if test "`cd $srcdir && pwd`" != "`pwd`"; then +- # Use -I$(srcdir) only when $(srcdir) != ., so that make's output +- # is not polluted with repeated "-I." +-@@ -2770,111 +2695,18 @@ AUTOHEADER=${AUTOHEADER-"${am_missing_ru +- +- MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} +- +--# For better backward compatibility. To be removed once Automake 1.9.x +--# dies out for good. For more background, see: +--# +--# +--mkdir_p='$(MKDIR_P)' +-- +- # We need awk for the "check" target. The system "awk" is bad on +- # some platforms. +- # Always define AMTAR for backward compatibility. Yes, it's still used +- # in the wild :-( We should find a proper way to deprecate it ... +- AMTAR='$${TAR-tar}' +- +-- +--# We'll loop over all known methods to create a tar archive until one works. +--_am_tools='gnutar pax cpio none' +-- +- am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' +- +- +- +- +- +-- +--# POSIX will say in a future version that running "rm -f" with no argument +--# is OK; and we want to be able to make that assumption in our Makefile +--# recipes. So use an aggressive probe to check that the usage we want is +--# actually supported "in the wild" to an acceptable degree. +--# See automake bug#10828. +--# To make any issue more visible, cause the running configure to be aborted +--# by default if the 'rm' program in use doesn't match our expectations; the +--# user can still override this though. +--if rm -f && rm -fr && rm -rf; then : OK; else +-- cat >&2 <<'END' +--Oops! +-- +--Your 'rm' program seems unable to run without file operands specified +--on the command line, even when the '-f' option is present. This is contrary +--to the behaviour of most rm programs out there, and not conforming with +--the upcoming POSIX standard: +-- +--Please tell bug-automake@gnu.org about your system, including the value +--of your $PATH and any error possibly output before this message. This +--can help us improve future automake versions. +-- +--END +-- if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then +-- echo 'Configuration will proceed anyway, since you have set the' >&2 +-- echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 +-- echo >&2 +-- else +-- cat >&2 <<'END' +--Aborting the configuration process, to ensure you take notice of the issue. +-- +--You can download and install GNU coreutils to get an 'rm' implementation +--that behaves properly: . +-- +--If you want to complete the configuration process using your problematic +--'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM +--to "yes", and re-run configure. +-- +--END +-- as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5 +-- fi +--fi +-- +--# Check whether --enable-silent-rules was given. +--if test "${enable_silent_rules+set}" = set; then : +-- enableval=$enable_silent_rules; +--fi +-- +--case $enable_silent_rules in # ((( +-- yes) AM_DEFAULT_VERBOSITY=0;; +-- no) AM_DEFAULT_VERBOSITY=1;; +-- *) AM_DEFAULT_VERBOSITY=0;; +--esac +--am_make=${MAKE-make} +--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 +--$as_echo_n "checking whether $am_make supports nested variables... " >&6; } +--if ${am_cv_make_support_nested_variables+:} false; then : +-- $as_echo_n "(cached) " >&6 +--else +-- if $as_echo 'TRUE=$(BAR$(V)) +--BAR0=false +--BAR1=true +--V=1 +--am__doit: +-- @$(TRUE) +--.PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then +-- am_cv_make_support_nested_variables=yes +--else +-- am_cv_make_support_nested_variables=no +--fi +--fi +--{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 +--$as_echo "$am_cv_make_support_nested_variables" >&6; } +--if test $am_cv_make_support_nested_variables = yes; then +-- AM_V='$(V)' +-- AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' +--else +-- AM_V=$AM_DEFAULT_VERBOSITY +-- AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY +--fi +--AM_BACKSLASH='\' +-- +-- +- ac_ext=c +- ac_cpp='$CPP $CPPFLAGS' +- ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +-@@ -2897,7 +2729,7 @@ do +- IFS=$as_save_IFS +- test -z "$as_dir" && as_dir=. +- for ac_exec_ext in '' $ac_executable_extensions; do +-- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then +-+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then +- ac_cv_prog_CC="${ac_tool_prefix}gcc" +- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 +- break 2 +-@@ -2937,7 +2769,7 @@ do +- IFS=$as_save_IFS +- test -z "$as_dir" && as_dir=. +- for ac_exec_ext in '' $ac_executable_extensions; do +-- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then +-+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then +- ac_cv_prog_ac_ct_CC="gcc" +- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 +- break 2 +-@@ -2990,7 +2822,7 @@ do +- IFS=$as_save_IFS +- test -z "$as_dir" && as_dir=. +- for ac_exec_ext in '' $ac_executable_extensions; do +-- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then +-+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then +- ac_cv_prog_CC="${ac_tool_prefix}cc" +- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 +- break 2 +-@@ -3031,7 +2863,7 @@ do +- IFS=$as_save_IFS +- test -z "$as_dir" && as_dir=. +- for ac_exec_ext in '' $ac_executable_extensions; do +-- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then +-+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then +- if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then +- ac_prog_rejected=yes +- continue +-@@ -3089,7 +2921,7 @@ do +- IFS=$as_save_IFS +- test -z "$as_dir" && as_dir=. +- for ac_exec_ext in '' $ac_executable_extensions; do +-- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then +-+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then +- ac_cv_prog_CC="$ac_tool_prefix$ac_prog" +- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 +- break 2 +-@@ -3133,7 +2965,7 @@ do +- IFS=$as_save_IFS +- test -z "$as_dir" && as_dir=. +- for ac_exec_ext in '' $ac_executable_extensions; do +-- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then +-+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then +- ac_cv_prog_ac_ct_CC="$ac_prog" +- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 +- break 2 +-@@ -3579,7 +3411,8 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ +- /* end confdefs.h. */ +- #include +- #include +--struct stat; +-+#include +-+#include +- /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +- struct buf { int x; }; +- FILE * (*rcsopen) (struct buf *, struct stat *, int); +-@@ -3663,65 +3496,6 @@ ac_cpp='$CPP $CPPFLAGS' +- ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +- ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +- ac_compiler_gnu=$ac_cv_c_compiler_gnu +-- +--ac_ext=c +--ac_cpp='$CPP $CPPFLAGS' +--ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +--ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +--ac_compiler_gnu=$ac_cv_c_compiler_gnu +--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 +--$as_echo_n "checking whether $CC understands -c and -o together... " >&6; } +--if ${am_cv_prog_cc_c_o+:} false; then : +-- $as_echo_n "(cached) " >&6 +--else +-- cat confdefs.h - <<_ACEOF >conftest.$ac_ext +--/* end confdefs.h. */ +-- +--int +--main () +--{ +-- +-- ; +-- return 0; +--} +--_ACEOF +-- # Make sure it works both with $CC and with simple cc. +-- # Following AC_PROG_CC_C_O, we do the test twice because some +-- # compilers refuse to overwrite an existing .o file with -o, +-- # though they will create one. +-- am_cv_prog_cc_c_o=yes +-- for am_i in 1 2; do +-- if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5 +-- ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5 +-- ac_status=$? +-- echo "$as_me:$LINENO: \$? = $ac_status" >&5 +-- (exit $ac_status); } \ +-- && test -f conftest2.$ac_objext; then +-- : OK +-- else +-- am_cv_prog_cc_c_o=no +-- break +-- fi +-- done +-- rm -f core conftest* +-- unset am_i +--fi +--{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 +--$as_echo "$am_cv_prog_cc_c_o" >&6; } +--if test "$am_cv_prog_cc_c_o" != yes; then +-- # Losing compiler, so override with the script. +-- # FIXME: It is wrong to rewrite CC. +-- # But if we don't then we get into trouble of one sort or another. +-- # A longer-term fix would be to have automake use am__CC in this case, +-- # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" +-- CC="$am_aux_dir/compile $CC" +--fi +--ac_ext=c +--ac_cpp='$CPP $CPPFLAGS' +--ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +--ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +--ac_compiler_gnu=$ac_cv_c_compiler_gnu +-- +- DEPDIR="${am__leading_dot}deps" +- +- ac_config_commands="$ac_config_commands depfiles" +-@@ -3741,7 +3515,7 @@ am__quote= +- _am_result=none +- # First try GNU make style include. +- echo "include confinc" > confmf +--# Ignore all kinds of additional output from 'make'. +-+# Ignore all kinds of additional output from `make'. +- case `$am_make -s -f confmf 2> /dev/null` in #( +- *the\ am__doit\ target*) +- am__include=include +-@@ -3797,8 +3571,8 @@ else +- # We make a subdir and do the tests there. Otherwise we can end up +- # making bogus files that we don't know about and never remove. For +- # instance it was reported that on HP-UX the gcc test will end up +-- # making a dummy file named 'D' -- because '-MD' means "put the output +-- # in D". +-+ # making a dummy file named `D' -- because `-MD' means `put the output +-+ # in D'. +- rm -rf conftest.dir +- mkdir conftest.dir +- # Copy depcomp to subdir because otherwise we won't find it if we're +-@@ -3833,16 +3607,16 @@ else +- : > sub/conftest.c +- for i in 1 2 3 4 5 6; do +- echo '#include "conftst'$i'.h"' >> sub/conftest.c +-- # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with +-- # Solaris 10 /bin/sh. +-- echo '/* dummy */' > sub/conftst$i.h +-+ # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with +-+ # Solaris 8's {/usr,}/bin/sh. +-+ touch sub/conftst$i.h +- done +- echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf +- +-- # We check with '-c' and '-o' for the sake of the "dashmstdout" +-+ # We check with `-c' and `-o' for the sake of the "dashmstdout" +- # mode. It turns out that the SunPro C++ compiler does not properly +-- # handle '-M -o', and we need to detect this. Also, some Intel +-- # versions had trouble with output in subdirs. +-+ # handle `-M -o', and we need to detect this. Also, some Intel +-+ # versions had trouble with output in subdirs +- am__obj=sub/conftest.${OBJEXT-o} +- am__minus_obj="-o $am__obj" +- case $depmode in +-@@ -3851,8 +3625,8 @@ else +- test "$am__universal" = false || continue +- ;; +- nosideeffect) +-- # After this tag, mechanisms are not by side-effect, so they'll +-- # only be used when explicitly requested. +-+ # after this tag, mechanisms are not by side-effect, so they'll +-+ # only be used when explicitly requested +- if test "x$enable_dependency_tracking" = xyes; then +- continue +- else +-@@ -3860,7 +3634,7 @@ else +- fi +- ;; +- msvc7 | msvc7msys | msvisualcpp | msvcmsys) +-- # This compiler won't grok '-c -o', but also, the minuso test has +-+ # This compiler won't grok `-c -o', but also, the minuso test has +- # not run yet. These depmodes are late enough in the game, and +- # so weak that their functioning should not be impacted. +- am__obj=conftest.${OBJEXT-o} +-@@ -3914,6 +3688,131 @@ else +- fi +- +- +-+if test "x$CC" != xcc; then +-+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC and cc understand -c and -o together" >&5 +-+$as_echo_n "checking whether $CC and cc understand -c and -o together... " >&6; } +-+else +-+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether cc understands -c and -o together" >&5 +-+$as_echo_n "checking whether cc understands -c and -o together... " >&6; } +-+fi +-+set dummy $CC; ac_cc=`$as_echo "$2" | +-+ sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'` +-+if eval \${ac_cv_prog_cc_${ac_cc}_c_o+:} false; then : +-+ $as_echo_n "(cached) " >&6 +-+else +-+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext +-+/* end confdefs.h. */ +-+ +-+int +-+main () +-+{ +-+ +-+ ; +-+ return 0; +-+} +-+_ACEOF +-+# Make sure it works both with $CC and with simple cc. +-+# We do the test twice because some compilers refuse to overwrite an +-+# existing .o file with -o, though they will create one. +-+ac_try='$CC -c conftest.$ac_ext -o conftest2.$ac_objext >&5' +-+rm -f conftest2.* +-+if { { case "(($ac_try" in +-+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; +-+ *) ac_try_echo=$ac_try;; +-+esac +-+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +-+$as_echo "$ac_try_echo"; } >&5 +-+ (eval "$ac_try") 2>&5 +-+ ac_status=$? +-+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 +-+ test $ac_status = 0; } && +-+ test -f conftest2.$ac_objext && { { case "(($ac_try" in +-+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; +-+ *) ac_try_echo=$ac_try;; +-+esac +-+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +-+$as_echo "$ac_try_echo"; } >&5 +-+ (eval "$ac_try") 2>&5 +-+ ac_status=$? +-+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 +-+ test $ac_status = 0; }; +-+then +-+ eval ac_cv_prog_cc_${ac_cc}_c_o=yes +-+ if test "x$CC" != xcc; then +-+ # Test first that cc exists at all. +-+ if { ac_try='cc -c conftest.$ac_ext >&5' +-+ { { case "(($ac_try" in +-+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; +-+ *) ac_try_echo=$ac_try;; +-+esac +-+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +-+$as_echo "$ac_try_echo"; } >&5 +-+ (eval "$ac_try") 2>&5 +-+ ac_status=$? +-+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 +-+ test $ac_status = 0; }; }; then +-+ ac_try='cc -c conftest.$ac_ext -o conftest2.$ac_objext >&5' +-+ rm -f conftest2.* +-+ if { { case "(($ac_try" in +-+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; +-+ *) ac_try_echo=$ac_try;; +-+esac +-+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +-+$as_echo "$ac_try_echo"; } >&5 +-+ (eval "$ac_try") 2>&5 +-+ ac_status=$? +-+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 +-+ test $ac_status = 0; } && +-+ test -f conftest2.$ac_objext && { { case "(($ac_try" in +-+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; +-+ *) ac_try_echo=$ac_try;; +-+esac +-+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +-+$as_echo "$ac_try_echo"; } >&5 +-+ (eval "$ac_try") 2>&5 +-+ ac_status=$? +-+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 +-+ test $ac_status = 0; }; +-+ then +-+ # cc works too. +-+ : +-+ else +-+ # cc exists but doesn't like -o. +-+ eval ac_cv_prog_cc_${ac_cc}_c_o=no +-+ fi +-+ fi +-+ fi +-+else +-+ eval ac_cv_prog_cc_${ac_cc}_c_o=no +-+fi +-+rm -f core conftest* +-+ +-+fi +-+if eval test \$ac_cv_prog_cc_${ac_cc}_c_o = yes; then +-+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +-+$as_echo "yes" >&6; } +-+else +-+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +-+$as_echo "no" >&6; } +-+ +-+$as_echo "#define NO_MINUS_C_MINUS_O 1" >>confdefs.h +-+ +-+fi +-+ +-+# FIXME: we rely on the cache variable name because +-+# there is no other way. +-+set dummy $CC +-+am_cc=`echo $2 | sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'` +-+eval am_t=\$ac_cv_prog_cc_${am_cc}_c_o +-+if test "$am_t" != yes; then +-+ # Losing compiler, so override with the script. +-+ # FIXME: It is wrong to rewrite CC. +-+ # But if we don't then we get into trouble of one sort or another. +-+ # A longer-term fix would be to have automake use am__CC in this case, +-+ # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" +-+ CC="$am_aux_dir/compile $CC" +-+fi +-+ +- +- +- if test -n "$ac_tool_prefix"; then +-@@ -3935,7 +3834,7 @@ do +- IFS=$as_save_IFS +- test -z "$as_dir" && as_dir=. +- for ac_exec_ext in '' $ac_executable_extensions; do +-- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then +-+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then +- ac_cv_prog_AR="$ac_tool_prefix$ac_prog" +- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 +- break 2 +-@@ -3979,7 +3878,7 @@ do +- IFS=$as_save_IFS +- test -z "$as_dir" && as_dir=. +- for ac_exec_ext in '' $ac_executable_extensions; do +-- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then +-+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then +- ac_cv_prog_ac_ct_AR="$ac_prog" +- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 +- break 2 +-@@ -4023,13 +3922,7 @@ $as_echo_n "checking the archiver ($AR) +- if ${am_cv_ar_interface+:} false; then : +- $as_echo_n "(cached) " >&6 +- else +-- ac_ext=c +--ac_cpp='$CPP $CPPFLAGS' +--ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +--ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +--ac_compiler_gnu=$ac_cv_c_compiler_gnu +-- +-- am_cv_ar_interface=ar +-+ am_cv_ar_interface=ar +- cat confdefs.h - <<_ACEOF >conftest.$ac_ext +- /* end confdefs.h. */ +- int some_variable = 0; +-@@ -4060,11 +3953,6 @@ if ac_fn_c_try_compile "$LINENO"; then : +- +- fi +- rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +-- ac_ext=c +--ac_cpp='$CPP $CPPFLAGS' +--ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +--ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +--ac_compiler_gnu=$ac_cv_c_compiler_gnu +- +- fi +- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_ar_interface" >&5 +-@@ -4126,8 +4014,8 @@ esac +- +- +- +--macro_version='2.4.2' +--macro_revision='1.3337' +-+macro_version='2.4' +-+macro_revision='1.3293' +- +- +- +-@@ -4305,7 +4193,7 @@ do +- for ac_prog in sed gsed; do +- for ac_exec_ext in '' $ac_executable_extensions; do +- ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" +-- as_fn_executable_p "$ac_path_SED" || continue +-+ { test -f "$ac_path_SED" && $as_test_x "$ac_path_SED"; } || continue +- # Check for GNU ac_path_SED and select it if it is found. +- # Check for GNU $ac_path_SED +- case `"$ac_path_SED" --version 2>&1` in +-@@ -4381,7 +4269,7 @@ do +- for ac_prog in grep ggrep; do +- for ac_exec_ext in '' $ac_executable_extensions; do +- ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" +-- as_fn_executable_p "$ac_path_GREP" || continue +-+ { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue +- # Check for GNU ac_path_GREP and select it if it is found. +- # Check for GNU $ac_path_GREP +- case `"$ac_path_GREP" --version 2>&1` in +-@@ -4447,7 +4335,7 @@ do +- for ac_prog in egrep; do +- for ac_exec_ext in '' $ac_executable_extensions; do +- ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" +-- as_fn_executable_p "$ac_path_EGREP" || continue +-+ { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue +- # Check for GNU ac_path_EGREP and select it if it is found. +- # Check for GNU $ac_path_EGREP +- case `"$ac_path_EGREP" --version 2>&1` in +-@@ -4514,7 +4402,7 @@ do +- for ac_prog in fgrep; do +- for ac_exec_ext in '' $ac_executable_extensions; do +- ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext" +-- as_fn_executable_p "$ac_path_FGREP" || continue +-+ { test -f "$ac_path_FGREP" && $as_test_x "$ac_path_FGREP"; } || continue +- # Check for GNU ac_path_FGREP and select it if it is found. +- # Check for GNU $ac_path_FGREP +- case `"$ac_path_FGREP" --version 2>&1` in +-@@ -4770,7 +4658,7 @@ do +- IFS=$as_save_IFS +- test -z "$as_dir" && as_dir=. +- for ac_exec_ext in '' $ac_executable_extensions; do +-- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then +-+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then +- ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog" +- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 +- break 2 +-@@ -4814,7 +4702,7 @@ do +- IFS=$as_save_IFS +- test -z "$as_dir" && as_dir=. +- for ac_exec_ext in '' $ac_executable_extensions; do +-- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then +-+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then +- ac_cv_prog_ac_ct_DUMPBIN="$ac_prog" +- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 +- break 2 +-@@ -4972,11 +4860,6 @@ else +- lt_cv_sys_max_cmd_len=196608 +- ;; +- +-- os2*) +-- # The test takes a long time on OS/2. +-- lt_cv_sys_max_cmd_len=8192 +-- ;; +-- +- osf*) +- # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure +- # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not +-@@ -5016,7 +4899,7 @@ else +- # If test is not a shell built-in, we'll probably end up computing a +- # maximum length that is only half of the actual maximum length, but +- # we can't tell. +-- while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \ +-+ while { test "X"`func_fallback_echo "$teststring$teststring" 2>/dev/null` \ +- = "X$teststring$teststring"; } >/dev/null 2>&1 && +- test $i != 17 # 1/2 MB should be enough +- do +-@@ -5238,7 +5121,7 @@ do +- IFS=$as_save_IFS +- test -z "$as_dir" && as_dir=. +- for ac_exec_ext in '' $ac_executable_extensions; do +-- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then +-+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then +- ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" +- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 +- break 2 +-@@ -5278,7 +5161,7 @@ do +- IFS=$as_save_IFS +- test -z "$as_dir" && as_dir=. +- for ac_exec_ext in '' $ac_executable_extensions; do +-- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then +-+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then +- ac_cv_prog_ac_ct_OBJDUMP="objdump" +- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 +- break 2 +-@@ -5445,7 +5328,7 @@ irix5* | irix6* | nonstopux*) +- lt_cv_deplibs_check_method=pass_all +- ;; +- +--# This must be glibc/ELF. +-+# This must be Linux ELF. +- linux* | k*bsd*-gnu | kopensolaris*-gnu) +- lt_cv_deplibs_check_method=pass_all +- ;; +-@@ -5584,7 +5467,7 @@ do +- IFS=$as_save_IFS +- test -z "$as_dir" && as_dir=. +- for ac_exec_ext in '' $ac_executable_extensions; do +-- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then +-+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then +- ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" +- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 +- break 2 +-@@ -5624,7 +5507,7 @@ do +- IFS=$as_save_IFS +- test -z "$as_dir" && as_dir=. +- for ac_exec_ext in '' $ac_executable_extensions; do +-- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then +-+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then +- ac_cv_prog_ac_ct_DLLTOOL="dlltool" +- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 +- break 2 +-@@ -5727,7 +5610,7 @@ do +- IFS=$as_save_IFS +- test -z "$as_dir" && as_dir=. +- for ac_exec_ext in '' $ac_executable_extensions; do +-- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then +-+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then +- ac_cv_prog_AR="$ac_tool_prefix$ac_prog" +- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 +- break 2 +-@@ -5771,7 +5654,7 @@ do +- IFS=$as_save_IFS +- test -z "$as_dir" && as_dir=. +- for ac_exec_ext in '' $ac_executable_extensions; do +-- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then +-+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then +- ac_cv_prog_ac_ct_AR="$ac_prog" +- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 +- break 2 +-@@ -5896,7 +5779,7 @@ do +- IFS=$as_save_IFS +- test -z "$as_dir" && as_dir=. +- for ac_exec_ext in '' $ac_executable_extensions; do +-- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then +-+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then +- ac_cv_prog_STRIP="${ac_tool_prefix}strip" +- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 +- break 2 +-@@ -5936,7 +5819,7 @@ do +- IFS=$as_save_IFS +- test -z "$as_dir" && as_dir=. +- for ac_exec_ext in '' $ac_executable_extensions; do +-- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then +-+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then +- ac_cv_prog_ac_ct_STRIP="strip" +- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 +- break 2 +-@@ -5995,7 +5878,7 @@ do +- IFS=$as_save_IFS +- test -z "$as_dir" && as_dir=. +- for ac_exec_ext in '' $ac_executable_extensions; do +-- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then +-+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then +- ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" +- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 +- break 2 +-@@ -6035,7 +5918,7 @@ do +- IFS=$as_save_IFS +- test -z "$as_dir" && as_dir=. +- for ac_exec_ext in '' $ac_executable_extensions; do +-- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then +-+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then +- ac_cv_prog_ac_ct_RANLIB="ranlib" +- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 +- break 2 +-@@ -6085,13 +5968,13 @@ old_postuninstall_cmds= +- if test -n "$RANLIB"; then +- case $host_os in +- openbsd*) +-- old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" +-+ old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib" +- ;; +- *) +-- old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" +-+ old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib" +- ;; +- esac +-- old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" +-+ old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" +- fi +- +- case $host_os in +-@@ -6238,7 +6121,6 @@ for ac_symprfx in "" "_"; do +- # which start with @ or ?. +- lt_cv_sys_global_symbol_pipe="$AWK '"\ +- " {last_section=section; section=\$ 3};"\ +--" /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ +- " /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ +- " \$ 0!~/External *\|/{next};"\ +- " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ +-@@ -6627,7 +6509,7 @@ $as_echo "$lt_cv_cc_needs_belf" >&6; } +- CFLAGS="$SAVE_CFLAGS" +- fi +- ;; +--*-*solaris*) +-+sparc*-*solaris*) +- # Find out which ABI we are using. +- echo 'int i;' > conftest.$ac_ext +- if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 +-@@ -6638,20 +6520,7 @@ $as_echo "$lt_cv_cc_needs_belf" >&6; } +- case `/usr/bin/file conftest.o` in +- *64-bit*) +- case $lt_cv_prog_gnu_ld in +-- yes*) +-- case $host in +-- i?86-*-solaris*) +-- LD="${LD-ld} -m elf_x86_64" +-- ;; +-- sparc*-*-solaris*) +-- LD="${LD-ld} -m elf64_sparc" +-- ;; +-- esac +-- # GNU ld 2.21 introduced _sol2 emulations. Use them if available. +-- if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then +-- LD="${LD-ld}_sol2" +-- fi +-- ;; +-+ yes*) LD="${LD-ld} -m elf64_sparc" ;; +- *) +- if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then +- LD="${LD-ld} -64" +-@@ -6684,7 +6553,7 @@ do +- IFS=$as_save_IFS +- test -z "$as_dir" && as_dir=. +- for ac_exec_ext in '' $ac_executable_extensions; do +-- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then +-+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then +- ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt" +- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 +- break 2 +-@@ -6724,7 +6593,7 @@ do +- IFS=$as_save_IFS +- test -z "$as_dir" && as_dir=. +- for ac_exec_ext in '' $ac_executable_extensions; do +-- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then +-+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then +- ac_cv_prog_ac_ct_MANIFEST_TOOL="mt" +- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 +- break 2 +-@@ -6804,7 +6673,7 @@ do +- IFS=$as_save_IFS +- test -z "$as_dir" && as_dir=. +- for ac_exec_ext in '' $ac_executable_extensions; do +-- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then +-+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then +- ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil" +- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 +- break 2 +-@@ -6844,7 +6713,7 @@ do +- IFS=$as_save_IFS +- test -z "$as_dir" && as_dir=. +- for ac_exec_ext in '' $ac_executable_extensions; do +-- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then +-+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then +- ac_cv_prog_ac_ct_DSYMUTIL="dsymutil" +- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 +- break 2 +-@@ -6896,7 +6765,7 @@ do +- IFS=$as_save_IFS +- test -z "$as_dir" && as_dir=. +- for ac_exec_ext in '' $ac_executable_extensions; do +-- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then +-+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then +- ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit" +- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 +- break 2 +-@@ -6936,7 +6805,7 @@ do +- IFS=$as_save_IFS +- test -z "$as_dir" && as_dir=. +- for ac_exec_ext in '' $ac_executable_extensions; do +-- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then +-+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then +- ac_cv_prog_ac_ct_NMEDIT="nmedit" +- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 +- break 2 +-@@ -6988,7 +6857,7 @@ do +- IFS=$as_save_IFS +- test -z "$as_dir" && as_dir=. +- for ac_exec_ext in '' $ac_executable_extensions; do +-- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then +-+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then +- ac_cv_prog_LIPO="${ac_tool_prefix}lipo" +- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 +- break 2 +-@@ -7028,7 +6897,7 @@ do +- IFS=$as_save_IFS +- test -z "$as_dir" && as_dir=. +- for ac_exec_ext in '' $ac_executable_extensions; do +-- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then +-+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then +- ac_cv_prog_ac_ct_LIPO="lipo" +- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 +- break 2 +-@@ -7080,7 +6949,7 @@ do +- IFS=$as_save_IFS +- test -z "$as_dir" && as_dir=. +- for ac_exec_ext in '' $ac_executable_extensions; do +-- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then +-+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then +- ac_cv_prog_OTOOL="${ac_tool_prefix}otool" +- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 +- break 2 +-@@ -7120,7 +6989,7 @@ do +- IFS=$as_save_IFS +- test -z "$as_dir" && as_dir=. +- for ac_exec_ext in '' $ac_executable_extensions; do +-- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then +-+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then +- ac_cv_prog_ac_ct_OTOOL="otool" +- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 +- break 2 +-@@ -7172,7 +7041,7 @@ do +- IFS=$as_save_IFS +- test -z "$as_dir" && as_dir=. +- for ac_exec_ext in '' $ac_executable_extensions; do +-- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then +-+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then +- ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64" +- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 +- break 2 +-@@ -7212,7 +7081,7 @@ do +- IFS=$as_save_IFS +- test -z "$as_dir" && as_dir=. +- for ac_exec_ext in '' $ac_executable_extensions; do +-- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then +-+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then +- ac_cv_prog_ac_ct_OTOOL64="otool64" +- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 +- break 2 +-@@ -7291,13 +7160,7 @@ else +- $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ +- -dynamiclib -Wl,-single_module conftest.c 2>conftest.err +- _lt_result=$? +-- # If there is a non-empty error log, and "single_module" +-- # appears in it, assume the flag caused a linker warning +-- if test -s conftest.err && $GREP single_module conftest.err; then +-- cat conftest.err >&5 +-- # Otherwise, if the output was created with a 0 exit code from +-- # the compiler, it worked. +-- elif test -f libconftest.dylib && test $_lt_result -eq 0; then +-+ if test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 0; then +- lt_cv_apple_cc_single_mod=yes +- else +- cat conftest.err >&5 +-@@ -7308,7 +7171,6 @@ else +- fi +- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5 +- $as_echo "$lt_cv_apple_cc_single_mod" >&6; } +-- +- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5 +- $as_echo_n "checking for -exported_symbols_list linker flag... " >&6; } +- if ${lt_cv_ld_exported_symbols_list+:} false; then : +-@@ -7341,7 +7203,6 @@ rm -f core conftest.err conftest.$ac_obj +- fi +- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5 +- $as_echo "$lt_cv_ld_exported_symbols_list" >&6; } +-- +- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5 +- $as_echo_n "checking for -force_load linker flag... " >&6; } +- if ${lt_cv_ld_force_load+:} false; then : +-@@ -7363,9 +7224,7 @@ _LT_EOF +- echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5 +- $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err +- _lt_result=$? +-- if test -s conftest.err && $GREP force_load conftest.err; then +-- cat conftest.err >&5 +-- elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then +-+ if test -f conftest && test ! -s conftest.err && test $_lt_result = 0 && $GREP forced_load conftest 2>&1 >/dev/null; then +- lt_cv_ld_force_load=yes +- else +- cat conftest.err >&5 +-@@ -7740,22 +7599,7 @@ fi +- +- # Check whether --with-pic was given. +- if test "${with_pic+set}" = set; then : +-- withval=$with_pic; lt_p=${PACKAGE-default} +-- case $withval in +-- yes|no) pic_mode=$withval ;; +-- *) +-- pic_mode=default +-- # Look at the argument we got. We use all the common list separators. +-- lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," +-- for lt_pkg in $withval; do +-- IFS="$lt_save_ifs" +-- if test "X$lt_pkg" = "X$lt_p"; then +-- pic_mode=yes +-- fi +-- done +-- IFS="$lt_save_ifs" +-- ;; +-- esac +-+ withval=$with_pic; pic_mode="$withval" +- else +- pic_mode=default +- fi +-@@ -7833,10 +7677,6 @@ LIBTOOL='$(SHELL) $(top_builddir)/libtoo +- +- +- +-- +-- +-- +-- +- test -z "$LN_S" && LN_S="ln -s" +- +- +-@@ -8126,10 +7966,6 @@ _lt_linker_boilerplate=`cat conftest.err +- $RM -r conftest* +- +- +--## CAVEAT EMPTOR: +--## There is no encapsulation within the following macros, do not change +--## the running order or otherwise move them around unless you know exactly +--## what you are doing... +- if test -n "$compiler"; then +- +- lt_prog_compiler_no_builtin_flag= +-@@ -8296,9 +8132,7 @@ lt_prog_compiler_static= +- case $cc_basename in +- nvcc*) # Cuda Compiler Driver 2.2 +- lt_prog_compiler_wl='-Xlinker ' +-- if test -n "$lt_prog_compiler_pic"; then +-- lt_prog_compiler_pic="-Xcompiler $lt_prog_compiler_pic" +-- fi +-+ lt_prog_compiler_pic='-Xcompiler -fPIC' +- ;; +- esac +- else +-@@ -8389,33 +8223,18 @@ lt_prog_compiler_static= +- ;; +- *) +- case `$CC -V 2>&1 | sed 5q` in +-- *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [1-7].* | *Sun*Fortran*\ 8.[0-3]*) +-+ *Sun\ F* | *Sun*Fortran*) +- # Sun Fortran 8.3 passes all unrecognized flags to the linker +- lt_prog_compiler_pic='-KPIC' +- lt_prog_compiler_static='-Bstatic' +- lt_prog_compiler_wl='' +- ;; +-- *Sun\ F* | *Sun*Fortran*) +-- lt_prog_compiler_pic='-KPIC' +-- lt_prog_compiler_static='-Bstatic' +-- lt_prog_compiler_wl='-Qoption ld ' +-- ;; +- *Sun\ C*) +- # Sun C 5.9 +- lt_prog_compiler_pic='-KPIC' +- lt_prog_compiler_static='-Bstatic' +- lt_prog_compiler_wl='-Wl,' +- ;; +-- *Intel*\ [CF]*Compiler*) +-- lt_prog_compiler_wl='-Wl,' +-- lt_prog_compiler_pic='-fPIC' +-- lt_prog_compiler_static='-static' +-- ;; +-- *Portland\ Group*) +-- lt_prog_compiler_wl='-Wl,' +-- lt_prog_compiler_pic='-fpic' +-- lt_prog_compiler_static='-Bstatic' +-- ;; +- esac +- ;; +- esac +-@@ -8777,6 +8596,7 @@ $as_echo_n "checking whether the $compil +- hardcode_direct=no +- hardcode_direct_absolute=no +- hardcode_libdir_flag_spec= +-+ hardcode_libdir_flag_spec_ld= +- hardcode_libdir_separator= +- hardcode_minus_L=no +- hardcode_shlibpath_var=unsupported +-@@ -9026,7 +8846,8 @@ _LT_EOF +- xlf* | bgf* | bgxlf* | mpixlf*) +- # IBM XL Fortran 10.1 on PPC cannot create shared libs itself +- whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive' +-- hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' +-+ hardcode_libdir_flag_spec= +-+ hardcode_libdir_flag_spec_ld='-rpath $libdir' +- archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' +- if test "x$supports_anon_versioning" = xyes; then +- archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ +-@@ -9405,7 +9226,6 @@ fi +- # The linker will not automatically build a static lib if we build a DLL. +- # _LT_TAGVAR(old_archive_from_new_cmds, )='true' +- enable_shared_with_static_runtimes=yes +-- exclude_expsyms='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' +- export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' +- # Don't use ranlib +- old_postinstall_cmds='chmod 644 $oldlib' +-@@ -9451,7 +9271,6 @@ fi +- hardcode_shlibpath_var=unsupported +- if test "$lt_cv_ld_force_load" = "yes"; then +- whole_archive_flag_spec='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' +-- +- else +- whole_archive_flag_spec='' +- fi +-@@ -9480,6 +9299,10 @@ fi +- hardcode_shlibpath_var=no +- ;; +- +-+ freebsd1*) +-+ ld_shlibs=no +-+ ;; +-+ +- # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor +- # support. Future versions do this automatically, but an explicit c++rt0.o +- # does not break anything, and helps significantly (at the cost of a little +-@@ -9492,7 +9315,7 @@ fi +- ;; +- +- # Unfortunately, older versions of FreeBSD 2 do not have this feature. +-- freebsd2.*) +-+ freebsd2*) +- archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' +- hardcode_direct=yes +- hardcode_minus_L=yes +-@@ -9531,6 +9354,7 @@ fi +- fi +- if test "$with_gnu_ld" = no; then +- hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' +-+ hardcode_libdir_flag_spec_ld='+b $libdir' +- hardcode_libdir_separator=: +- hardcode_direct=yes +- hardcode_direct_absolute=yes +-@@ -10154,6 +9978,11 @@ esac +- +- +- +-+ +-+ +-+ +-+ +-+ +- { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 +- $as_echo_n "checking dynamic linker characteristics... " >&6; } +- +-@@ -10243,7 +10072,7 @@ need_version=unknown +- +- case $host_os in +- aix3*) +-- version_type=linux # correct to gnu/linux during the next big refactor +-+ version_type=linux +- library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' +- shlibpath_var=LIBPATH +- +-@@ -10252,7 +10081,7 @@ aix3*) +- ;; +- +- aix[4-9]*) +-- version_type=linux # correct to gnu/linux during the next big refactor +-+ version_type=linux +- need_lib_prefix=no +- need_version=no +- hardcode_into_libs=yes +-@@ -10317,7 +10146,7 @@ beos*) +- ;; +- +- bsdi[45]*) +-- version_type=linux # correct to gnu/linux during the next big refactor +-+ version_type=linux +- need_version=no +- library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' +- soname_spec='${libname}${release}${shared_ext}$major' +-@@ -10456,7 +10285,7 @@ darwin* | rhapsody*) +- ;; +- +- dgux*) +-- version_type=linux # correct to gnu/linux during the next big refactor +-+ version_type=linux +- need_lib_prefix=no +- need_version=no +- library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' +-@@ -10464,6 +10293,10 @@ dgux*) +- shlibpath_var=LD_LIBRARY_PATH +- ;; +- +-+freebsd1*) +-+ dynamic_linker=no +-+ ;; +-+ +- freebsd* | dragonfly*) +- # DragonFly does not have aout. When/if they implement a new +- # versioning mechanism, adjust this. +-@@ -10471,7 +10304,7 @@ freebsd* | dragonfly*) +- objformat=`/usr/bin/objformat` +- else +- case $host_os in +-- freebsd[23].*) objformat=aout ;; +-+ freebsd[123]*) objformat=aout ;; +- *) objformat=elf ;; +- esac +- fi +-@@ -10489,7 +10322,7 @@ freebsd* | dragonfly*) +- esac +- shlibpath_var=LD_LIBRARY_PATH +- case $host_os in +-- freebsd2.*) +-+ freebsd2*) +- shlibpath_overrides_runpath=yes +- ;; +- freebsd3.[01]* | freebsdelf3.[01]*) +-@@ -10509,18 +10342,17 @@ freebsd* | dragonfly*) +- ;; +- +- gnu*) +-- version_type=linux # correct to gnu/linux during the next big refactor +-+ version_type=linux +- need_lib_prefix=no +- need_version=no +- library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' +- soname_spec='${libname}${release}${shared_ext}$major' +- shlibpath_var=LD_LIBRARY_PATH +-- shlibpath_overrides_runpath=no +- hardcode_into_libs=yes +- ;; +- +- haiku*) +-- version_type=linux # correct to gnu/linux during the next big refactor +-+ version_type=linux +- need_lib_prefix=no +- need_version=no +- dynamic_linker="$host_os runtime_loader" +-@@ -10581,7 +10413,7 @@ hpux9* | hpux10* | hpux11*) +- ;; +- +- interix[3-9]*) +-- version_type=linux # correct to gnu/linux during the next big refactor +-+ version_type=linux +- need_lib_prefix=no +- need_version=no +- library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' +-@@ -10597,7 +10429,7 @@ irix5* | irix6* | nonstopux*) +- nonstopux*) version_type=nonstopux ;; +- *) +- if test "$lt_cv_prog_gnu_ld" = yes; then +-- version_type=linux # correct to gnu/linux during the next big refactor +-+ version_type=linux +- else +- version_type=irix +- fi ;; +-@@ -10634,9 +10466,9 @@ linux*oldld* | linux*aout* | linux*coff* +- dynamic_linker=no +- ;; +- +--# This must be glibc/ELF. +-+# This must be Linux ELF. +- linux* | k*bsd*-gnu | kopensolaris*-gnu) +-- version_type=linux # correct to gnu/linux during the next big refactor +-+ version_type=linux +- need_lib_prefix=no +- need_version=no +- library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' +-@@ -10718,7 +10550,7 @@ netbsd*) +- ;; +- +- newsos6) +-- version_type=linux # correct to gnu/linux during the next big refactor +-+ version_type=linux +- library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' +- shlibpath_var=LD_LIBRARY_PATH +- shlibpath_overrides_runpath=yes +-@@ -10787,7 +10619,7 @@ rdos*) +- ;; +- +- solaris*) +-- version_type=linux # correct to gnu/linux during the next big refactor +-+ version_type=linux +- need_lib_prefix=no +- need_version=no +- library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' +-@@ -10812,7 +10644,7 @@ sunos4*) +- ;; +- +- sysv4 | sysv4.3*) +-- version_type=linux # correct to gnu/linux during the next big refactor +-+ version_type=linux +- library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' +- soname_spec='${libname}${release}${shared_ext}$major' +- shlibpath_var=LD_LIBRARY_PATH +-@@ -10836,7 +10668,7 @@ sysv4 | sysv4.3*) +- +- sysv4*MP*) +- if test -d /usr/nec ;then +-- version_type=linux # correct to gnu/linux during the next big refactor +-+ version_type=linux +- library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' +- soname_spec='$libname${shared_ext}.$major' +- shlibpath_var=LD_LIBRARY_PATH +-@@ -10867,7 +10699,7 @@ sysv5* | sco3.2v5* | sco5v6* | unixware* +- +- tpf*) +- # TPF is a cross-target only. Preferred cross-host = GNU/Linux. +-- version_type=linux # correct to gnu/linux during the next big refactor +-+ version_type=linux +- need_lib_prefix=no +- need_version=no +- library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' +-@@ -10877,7 +10709,7 @@ tpf*) +- ;; +- +- uts4*) +-- version_type=linux # correct to gnu/linux during the next big refactor +-+ version_type=linux +- library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' +- soname_spec='${libname}${release}${shared_ext}$major' +- shlibpath_var=LD_LIBRARY_PATH +-@@ -11659,8 +11491,6 @@ CC="$lt_save_CC" +- +- +- +-- +-- +- ac_config_commands="$ac_config_commands libtool" +- +- +-@@ -11726,7 +11556,7 @@ do +- IFS=$as_save_IFS +- test -z "$as_dir" && as_dir=. +- for ac_exec_ext in '' $ac_executable_extensions; do +-- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then +-+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then +- ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" +- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 +- break 2 +-@@ -11769,7 +11599,7 @@ do +- IFS=$as_save_IFS +- test -z "$as_dir" && as_dir=. +- for ac_exec_ext in '' $ac_executable_extensions; do +-- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then +-+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then +- ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" +- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 +- break 2 +-@@ -11932,7 +11762,7 @@ regular_CFLAGS="-Wall -Waggregate-return +- if test -n "$kbuilddir"; then +- { $as_echo "$as_me:${as_lineno-$LINENO}: checking kernel version that we will build against" >&5 +- $as_echo_n "checking kernel version that we will build against... " >&6; } +-- krel="$(make -sC "$kbuilddir" M=$PWD kernelrelease)"; +-+ krel="$(make -sC "$kbuilddir" M=$PWD kernelversion)"; +- kmajor="${krel%%[^0-9]*}"; +- kmajor="$(($kmajor+0))"; +- krel="${krel:${#kmajor}}"; +-@@ -12076,14 +11906,6 @@ LIBOBJS=$ac_libobjs +- LTLIBOBJS=$ac_ltlibobjs +- +- +--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 +--$as_echo_n "checking that generated files are newer than configure... " >&6; } +-- if test -n "$am_sleep_pid"; then +-- # Hide warnings about reused PIDs. +-- wait $am_sleep_pid 2>/dev/null +-- fi +-- { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5 +--$as_echo "done" >&6; } +- if test -n "$EXEEXT"; then +- am__EXEEXT_TRUE= +- am__EXEEXT_FALSE='#' +-@@ -12398,16 +12220,16 @@ if (echo >conf$$.file) 2>/dev/null; then +- # ... but there are two gotchas: +- # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. +- # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. +-- # In both cases, we have to default to `cp -pR'. +-+ # In both cases, we have to default to `cp -p'. +- ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || +-- as_ln_s='cp -pR' +-+ as_ln_s='cp -p' +- elif ln conf$$.file conf$$ 2>/dev/null; then +- as_ln_s=ln +- else +-- as_ln_s='cp -pR' +-+ as_ln_s='cp -p' +- fi +- else +-- as_ln_s='cp -pR' +-+ as_ln_s='cp -p' +- fi +- rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +- rmdir conf$$.dir 2>/dev/null +-@@ -12467,16 +12289,28 @@ else +- as_mkdir_p=false +- fi +- +-- +--# as_fn_executable_p FILE +--# ----------------------- +--# Test if FILE is an executable regular file. +--as_fn_executable_p () +--{ +-- test -f "$1" && test -x "$1" +--} # as_fn_executable_p +--as_test_x='test -x' +--as_executable_p=as_fn_executable_p +-+if test -x / >/dev/null 2>&1; then +-+ as_test_x='test -x' +-+else +-+ if ls -dL / >/dev/null 2>&1; then +-+ as_ls_L_option=L +-+ else +-+ as_ls_L_option= +-+ fi +-+ as_test_x=' +-+ eval sh -c '\'' +-+ if test -d "$1"; then +-+ test -d "$1/."; +-+ else +-+ case $1 in #( +-+ -*)set "./$1";; +-+ esac; +-+ case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( +-+ ???[sx]*):;;*)false;;esac;fi +-+ '\'' sh +-+ ' +-+fi +-+as_executable_p=$as_test_x +- +- # Sed expression to map a string onto a valid CPP name. +- as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" +-@@ -12498,7 +12332,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_wri +- # values after options handling. +- ac_log=" +- This file was extended by xtables-addons $as_me 2.5, which was +--generated by GNU Autoconf 2.69. Invocation command line was +-+generated by GNU Autoconf 2.68. Invocation command line was +- +- CONFIG_FILES = $CONFIG_FILES +- CONFIG_HEADERS = $CONFIG_HEADERS +-@@ -12564,10 +12398,10 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_writ +- ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" +- ac_cs_version="\\ +- xtables-addons config.status 2.5 +--configured by $0, generated by GNU Autoconf 2.69, +-+configured by $0, generated by GNU Autoconf 2.68, +- with options \\"\$ac_cs_config\\" +- +--Copyright (C) 2012 Free Software Foundation, Inc. +-+Copyright (C) 2010 Free Software Foundation, Inc. +- This config.status script is free software; the Free Software Foundation +- gives unlimited permission to copy, distribute and modify it." +- +-@@ -12658,7 +12492,7 @@ fi +- _ACEOF +- cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +- if \$ac_cs_recheck; then +-- set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion +-+ set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion +- shift +- \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 +- CONFIG_SHELL='$SHELL' +-@@ -12700,7 +12534,6 @@ pic_mode='`$ECHO "$pic_mode" | $SED "$de +- enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`' +- SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`' +- ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`' +--PATH_SEPARATOR='`$ECHO "$PATH_SEPARATOR" | $SED "$delay_single_quote_subst"`' +- host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`' +- host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`' +- host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`' +-@@ -12783,6 +12616,7 @@ with_gnu_ld='`$ECHO "$with_gnu_ld" | $SE +- allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`' +- no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`' +- hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`' +-+hardcode_libdir_flag_spec_ld='`$ECHO "$hardcode_libdir_flag_spec_ld" | $SED "$delay_single_quote_subst"`' +- hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`' +- hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`' +- hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`' +-@@ -12838,7 +12672,6 @@ _LTECHO_EOF' +- # Quote evaled strings. +- for var in SHELL \ +- ECHO \ +--PATH_SEPARATOR \ +- SED \ +- GREP \ +- EGREP \ +-@@ -12889,6 +12722,7 @@ with_gnu_ld \ +- allow_undefined_flag \ +- no_undefined_flag \ +- hardcode_libdir_flag_spec \ +-+hardcode_libdir_flag_spec_ld \ +- hardcode_libdir_separator \ +- exclude_expsyms \ +- include_expsyms \ +-@@ -13575,7 +13409,7 @@ $as_echo "$as_me: executing $ac_file com +- +- case $ac_file$ac_mode in +- "depfiles":C) test x"$AMDEP_TRUE" != x"" || { +-- # Older Autoconf quotes --file arguments for eval, but not when files +-+ # Autoconf 2.62 quotes --file arguments for eval, but not when files +- # are listed without --file. Let's play safe and only enable the eval +- # if we detect the quoting. +- case $CONFIG_FILES in +-@@ -13588,7 +13422,7 @@ $as_echo "$as_me: executing $ac_file com +- # Strip MF so we end up with the name of the file. +- mf=`echo "$mf" | sed -e 's/:.*$//'` +- # Check whether this is an Automake generated Makefile or not. +-- # We used to match only the files named 'Makefile.in', but +-+ # We used to match only the files named `Makefile.in', but +- # some people rename them; so instead we look at the file content. +- # Grep'ing the first line is not enough: some people post-process +- # each Makefile.in and add a new line on top of each file to say so. +-@@ -13622,19 +13456,21 @@ $as_echo X"$mf" | +- continue +- fi +- # Extract the definition of DEPDIR, am__include, and am__quote +-- # from the Makefile without running 'make'. +-+ # from the Makefile without running `make'. +- DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` +- test -z "$DEPDIR" && continue +- am__include=`sed -n 's/^am__include = //p' < "$mf"` +-- test -z "$am__include" && continue +-+ test -z "am__include" && continue +- am__quote=`sed -n 's/^am__quote = //p' < "$mf"` +-+ # When using ansi2knr, U may be empty or an underscore; expand it +-+ U=`sed -n 's/^U = //p' < "$mf"` +- # Find all dependency output files, they are included files with +- # $(DEPDIR) in their names. We invoke sed twice because it is the +- # simplest approach to changing $(DEPDIR) to its actual value in the +- # expansion. +- for file in `sed -n " +- s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ +-- sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do +-+ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do +- # Make sure the directory exists. +- test -f "$dirpart/$file" && continue +- fdir=`$as_dirname -- "$file" || +-@@ -13688,8 +13524,8 @@ $as_echo X"$file" | +- # NOTE: Changes made to this file will be lost: look at ltmain.sh. +- # +- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, +--# 2006, 2007, 2008, 2009, 2010, 2011 Free Software +--# Foundation, Inc. +-+# 2006, 2007, 2008, 2009, 2010 Free Software Foundation, +-+# Inc. +- # Written by Gordon Matzigkeit, 1996 +- # +- # This file is part of GNU Libtool. +-@@ -13743,9 +13579,6 @@ SHELL=$lt_SHELL +- # An echo program that protects backslashes. +- ECHO=$lt_ECHO +- +--# The PATH separator for the build system. +--PATH_SEPARATOR=$lt_PATH_SEPARATOR +-- +- # The host system. +- host_alias=$host_alias +- host=$host +-@@ -14047,6 +13880,10 @@ no_undefined_flag=$lt_no_undefined_flag +- # This must work even if \$libdir does not exist +- hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec +- +-+# If ld is used when linking, flag to hardcode \$libdir into a binary +-+# during linking. This must work even if \$libdir does not exist. +-+hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld +-+ +- # Whether we need a single "-rpath" flag with a separated argument. +- hardcode_libdir_separator=$lt_hardcode_libdir_separator +- + --- a/configure.ac + +++ b/configure.ac +-@@ -44,7 +44,7 @@ regular_CFLAGS="-Wall -Waggregate-return ++@@ -44,7 +44,7 @@ regular_CFLAGS="-Wall -Waggregate-return -Wmissing-declarations \ + + if test -n "$kbuilddir"; then + AC_MSG_CHECKING([kernel version that we will build against]) +-- krel="$(make -sC "$kbuilddir" M=$PWD kernelrelease)"; +-+ krel="$(make -sC "$kbuilddir" M=$PWD kernelversion)"; +- kmajor="${krel%%[[^0-9]]*}"; +- kmajor="$(($kmajor+0))"; +- krel="${krel:${#kmajor}}"; ++- krel="$(make -sC "$kbuilddir" M=$PWD kernelrelease | $AWK -v 'FS=[[^0-9.]]' '{print $1; exit}')"; +++ krel="$(make -sC "$kbuilddir" M=$PWD kernelversion | $AWK -v 'FS=[[^0-9.]]' '{print $1; exit}')"; ++ save_IFS=$IFS; ++ IFS='.'; ++ set x $krel; diff --git a/patches/openwrt/0025-tools-add-tar-host-build-required-for-sort-name-which-was-only-added-in-the-latest-version.patch b/patches/openwrt/0025-tools-add-tar-host-build-required-for-sort-name-which-was-only-added-in-the-latest-version.patch new file mode 100644 index 00000000..52fb08db --- /dev/null +++ b/patches/openwrt/0025-tools-add-tar-host-build-required-for-sort-name-which-was-only-added-in-the-latest-version.patch @@ -0,0 +1,81 @@ +From: Matthias Schiffer +Date: Sun, 24 Apr 2016 08:44:30 +0200 +Subject: tools: add tar host build, required for --sort=name which was only added in the latest version + +Signed-off-by: Felix Fietkau + +Backport of r46876 + +diff --git a/tools/Makefile b/tools/Makefile +index c6cded8..98ce8c5 100644 +--- a/tools/Makefile ++++ b/tools/Makefile +@@ -81,6 +81,9 @@ endif + # dependency for tools which have patches directory + $(foreach tool, $(tools-y), $(if $(wildcard $(curdir)/$(tool)/patches),$(eval $(curdir)/$(tool)/compile += $(curdir)/patch/install))) + ++$(foreach tool, $(tools-y), $(eval $(curdir)/$(tool)/compile += $(curdir)/tar/install)) ++tools-y += tar ++ + $(curdir)/builddirs := $(tools-y) $(tools-dep) $(tools-) + $(curdir)/builddirs-default := $(tools-y) + +diff --git a/tools/tar/Makefile b/tools/tar/Makefile +new file mode 100644 +index 0000000..975e783 +--- /dev/null ++++ b/tools/tar/Makefile +@@ -0,0 +1,30 @@ ++# ++# Copyright (C) 2015 OpenWrt.org ++# ++# This is free software, licensed under the GNU General Public License v2. ++# See /LICENSE for more information. ++# ++include $(TOPDIR)/rules.mk ++ ++PKG_NAME:=tar ++PKG_VERSION:=1.28 ++ ++PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz ++PKG_SOURCE_URL:=@GNU/tar ++PKG_MD5SUM:=49b6306167724fe48f419a33a5beb857 ++ ++HOST_BUILD_PARALLEL := 1 ++ ++include $(INCLUDE_DIR)/host-build.mk ++ ++HOSTCC := $(HOSTCC_NOCACHE) ++HOSTCXX := $(HOSTCXX_NOCACHE) ++ ++HOST_CONFIGURE_ARGS += \ ++ --without-posix-acls \ ++ --without-selinux \ ++ --without-xattrs \ ++ --disable-acl \ ++ --disable-nls ++ ++$(eval $(call HostBuild)) +diff --git a/tools/tar/patches/100-fix_xattr_disable.patch b/tools/tar/patches/100-fix_xattr_disable.patch +new file mode 100644 +index 0000000..5735bd2 +--- /dev/null ++++ b/tools/tar/patches/100-fix_xattr_disable.patch +@@ -0,0 +1,17 @@ ++--- a/lib/xattr-at.c +++++ b/lib/xattr-at.c ++@@ -18,6 +18,8 @@ ++ ++ #include ++ +++#ifdef HAVE_XATTRS +++ ++ #include "xattr-at.h" ++ #include "openat.h" ++ ++@@ -108,3 +110,5 @@ ++ #undef AT_FUNC_RESULT ++ #undef AT_FUNC_POST_FILE_PARAM_DECLS ++ #undef AT_FUNC_POST_FILE_ARGS +++ +++#endif diff --git a/patches/openwrt/0026-tools-compile-flock-before-everything-else.patch b/patches/openwrt/0026-tools-compile-flock-before-everything-else.patch new file mode 100644 index 00000000..c9291166 --- /dev/null +++ b/patches/openwrt/0026-tools-compile-flock-before-everything-else.patch @@ -0,0 +1,31 @@ +From: Matthias Schiffer +Date: Sun, 24 Apr 2016 08:44:47 +0200 +Subject: tools: compile flock before everything else + +Signed-off-by: Felix Fietkau + +Backport of r48413 + +diff --git a/tools/Makefile b/tools/Makefile +index 98ce8c5..3402c08 100644 +--- a/tools/Makefile ++++ b/tools/Makefile +@@ -26,7 +26,7 @@ endif + tools-$(BUILD_TOOLCHAIN) += gmp mpfr mpc libelf + tools-y += m4 libtool autoconf automake flex bison pkg-config sed mklibs + tools-y += sstrip make-ext4fs e2fsprogs mtd-utils mkimage +-tools-y += firmware-utils patch-image patch quilt yaffs2 flock padjffs2 ++tools-y += firmware-utils patch-image patch quilt yaffs2 padjffs2 + tools-y += mm-macros missing-macros xz cmake scons bc findutils gengetopt patchelf + tools-$(CONFIG_TARGET_orion_generic) += wrt350nv2-builder upslug2 + tools-$(CONFIG_powerpc) += upx +@@ -84,6 +84,9 @@ $(foreach tool, $(tools-y), $(if $(wildcard $(curdir)/$(tool)/patches),$(eval $( + $(foreach tool, $(tools-y), $(eval $(curdir)/$(tool)/compile += $(curdir)/tar/install)) + tools-y += tar + ++$(curdir)/tar/compile := $(curdir)/flock/install ++tools-y += flock ++ + $(curdir)/builddirs := $(tools-y) $(tools-dep) $(tools-) + $(curdir)/builddirs-default := $(tools-y) + diff --git a/patches/openwrt/0027-rules.mk-make-the-locked-template-available-even-if-flock-has-not-been-built-yet-fall-back-to-unlocked-shell-command.patch b/patches/openwrt/0027-rules.mk-make-the-locked-template-available-even-if-flock-has-not-been-built-yet-fall-back-to-unlocked-shell-command.patch new file mode 100644 index 00000000..5e851cdf --- /dev/null +++ b/patches/openwrt/0027-rules.mk-make-the-locked-template-available-even-if-flock-has-not-been-built-yet-fall-back-to-unlocked-shell-command.patch @@ -0,0 +1,32 @@ +From: Matthias Schiffer +Date: Sun, 24 Apr 2016 08:45:44 +0200 +Subject: rules.mk: make the locked template available even if flock has not been built yet (fall back to unlocked shell command) + +Signed-off-by: Felix Fietkau + +Backport of r48414 + +diff --git a/rules.mk b/rules.mk +index 9d0134d..ece5026 100644 +--- a/rules.mk ++++ b/rules.mk +@@ -310,12 +310,16 @@ endef + # Execute commands under flock + # $(1) => The shell expression. + # $(2) => The lock name. If not given, the global lock will be used. +-define locked ++ifneq ($(wildcard $(STAGING_DIR_HOST)/bin/flock),) ++ define locked + SHELL= \ +- $(STAGING_DIR_HOST)/bin/flock \ ++ flock \ + $(TMP_DIR)/.$(if $(2),$(strip $(2)),global).flock \ + -c '$(subst ','\'',$(1))' +-endef ++ endef ++else ++ locked=$(1) ++endif + + # Recursively copy paths into another directory, purge dangling + # symlinks before. diff --git a/patches/openwrt/0028-build-add-locking-for-downloads-fixes-race-conditions-with-multiple-variants.patch b/patches/openwrt/0028-build-add-locking-for-downloads-fixes-race-conditions-with-multiple-variants.patch new file mode 100644 index 00000000..ffa18527 --- /dev/null +++ b/patches/openwrt/0028-build-add-locking-for-downloads-fixes-race-conditions-with-multiple-variants.patch @@ -0,0 +1,20 @@ +From: Matthias Schiffer +Date: Sun, 24 Apr 2016 08:48:45 +0200 +Subject: build: add locking for downloads (fixes race conditions with multiple variants) + +Signed-off-by: Felix Fietkau + +Backport of r48416 + +diff --git a/include/download.mk b/include/download.mk +index e518cce..9176b11 100644 +--- a/include/download.mk ++++ b/include/download.mk +@@ -182,6 +182,6 @@ define Download + + $(DL_DIR)/$(FILE): + mkdir -p $(DL_DIR) +- $(if $(DownloadMethod/$(call dl_method,$(URL),$(PROTO))),$(DownloadMethod/$(call dl_method,$(URL),$(PROTO))),$(DownloadMethod/unknown)) ++ $(call locked,$(if $(DownloadMethod/$(call dl_method,$(URL),$(PROTO))),$(DownloadMethod/$(call dl_method,$(URL),$(PROTO))),$(DownloadMethod/unknown)),$(FILE)) + + endef diff --git a/patches/openwrt/0029-download.mk-fix-packed-checkout-mirroring-support.patch b/patches/openwrt/0029-download.mk-fix-packed-checkout-mirroring-support.patch new file mode 100644 index 00000000..5c0572c1 --- /dev/null +++ b/patches/openwrt/0029-download.mk-fix-packed-checkout-mirroring-support.patch @@ -0,0 +1,26 @@ +From: Matthias Schiffer +Date: Sun, 24 Apr 2016 08:49:27 +0200 +Subject: download.mk: fix packed checkout mirroring support + +Changeset r48416 broke the downloading of mirrored, packed scm checkouts. + +Fix this by removing the "@" sign in front of the download command which is +now executed as part of a larger shell command under flock. + +Signed-off-by: Jo-Philipp Wich + +Backport of r48733 + +diff --git a/include/download.mk b/include/download.mk +index 9176b11..130bbc5 100644 +--- a/include/download.mk ++++ b/include/download.mk +@@ -48,7 +48,7 @@ define DownloadMethod/default + endef + + define wrap_mirror +- $(if $(if $(MIRROR),$(filter-out x,$(MIRROR_MD5SUM))),@$(SCRIPT_DIR)/download.pl "$(DL_DIR)" "$(FILE)" "$(MIRROR_MD5SUM)" "" || ( $(1) ),$(1)) ++$(if $(if $(MIRROR),$(filter-out x,$(MIRROR_MD5SUM))),$(SCRIPT_DIR)/download.pl "$(DL_DIR)" "$(FILE)" "$(MIRROR_MD5SUM)" "" || ( $(1) ),$(1)) + endef + + define DownloadMethod/cvs diff --git a/patches/openwrt/0030-kernel-backport-spi-nor-driver-from-4.4.9.patch b/patches/openwrt/0030-kernel-backport-spi-nor-driver-from-4.4.9.patch new file mode 100644 index 00000000..7e3ca845 --- /dev/null +++ b/patches/openwrt/0030-kernel-backport-spi-nor-driver-from-4.4.9.patch @@ -0,0 +1,2025 @@ +From: Matthias Schiffer +Date: Sat, 7 May 2016 00:07:51 +0200 +Subject: kernel: backport spi-nor driver from 4.4.9 + +diff --git a/target/linux/ar71xx/patches-3.18/407-mtd-m25p80-allow-to-pass-probe-types-via-platform-data.patch b/target/linux/ar71xx/patches-3.18/407-mtd-m25p80-allow-to-pass-probe-types-via-platform-data.patch +index 568f516..6a91320 100644 +--- a/target/linux/ar71xx/patches-3.18/407-mtd-m25p80-allow-to-pass-probe-types-via-platform-data.patch ++++ b/target/linux/ar71xx/patches-3.18/407-mtd-m25p80-allow-to-pass-probe-types-via-platform-data.patch +@@ -1,11 +1,11 @@ + --- a/drivers/mtd/devices/m25p80.c + +++ b/drivers/mtd/devices/m25p80.c +-@@ -246,7 +246,9 @@ static int m25p_probe(struct spi_device ++@@ -229,7 +229,9 @@ static int m25p_probe(struct spi_device + + ppdata.of_node = spi->dev.of_node; + +-- return mtd_device_parse_register(&flash->mtd, NULL, &ppdata, +-+ return mtd_device_parse_register(&flash->mtd, ++- return mtd_device_parse_register(&nor->mtd, NULL, &ppdata, +++ return mtd_device_parse_register(&nor->mtd, + + data ? data->part_probes : NULL, + + &ppdata, + data ? data->parts : NULL, +diff --git a/target/linux/ar71xx/patches-3.18/412-mtd-m25p80-zero-partition-parser-data.patch b/target/linux/ar71xx/patches-3.18/412-mtd-m25p80-zero-partition-parser-data.patch +index d51694d..175acf6 100644 +--- a/target/linux/ar71xx/patches-3.18/412-mtd-m25p80-zero-partition-parser-data.patch ++++ b/target/linux/ar71xx/patches-3.18/412-mtd-m25p80-zero-partition-parser-data.patch +@@ -1,10 +1,10 @@ + --- a/drivers/mtd/devices/m25p80.c + +++ b/drivers/mtd/devices/m25p80.c +-@@ -244,6 +244,7 @@ static int m25p_probe(struct spi_device ++@@ -227,6 +227,7 @@ static int m25p_probe(struct spi_device + if (ret) + return ret; + + + memset(&ppdata, '\0', sizeof(ppdata)); + ppdata.of_node = spi->dev.of_node; + +- return mtd_device_parse_register(&flash->mtd, ++ return mtd_device_parse_register(&nor->mtd, +diff --git a/target/linux/ar71xx/patches-3.18/462-mtd-m25p80-set-spi-transfer-type.patch b/target/linux/ar71xx/patches-3.18/462-mtd-m25p80-set-spi-transfer-type.patch +index 3320e5b..11bf9ff 100644 +--- a/target/linux/ar71xx/patches-3.18/462-mtd-m25p80-set-spi-transfer-type.patch ++++ b/target/linux/ar71xx/patches-3.18/462-mtd-m25p80-set-spi-transfer-type.patch +@@ -1,6 +1,6 @@ + --- a/drivers/mtd/devices/m25p80.c + +++ b/drivers/mtd/devices/m25p80.c +-@@ -142,10 +142,12 @@ static int m25p80_read(struct spi_nor *n ++@@ -137,10 +137,12 @@ static int m25p80_read(struct spi_nor *n + flash->command[0] = nor->read_opcode; + m25p_addr2cmd(nor, from, flash->command); + +diff --git a/target/linux/ar71xx/patches-3.18/464-spi-ath79-fix-fast-flash-read.patch b/target/linux/ar71xx/patches-3.18/464-spi-ath79-fix-fast-flash-read.patch +index e48665d..758d231 100644 +--- a/target/linux/ar71xx/patches-3.18/464-spi-ath79-fix-fast-flash-read.patch ++++ b/target/linux/ar71xx/patches-3.18/464-spi-ath79-fix-fast-flash-read.patch +@@ -1,6 +1,6 @@ + --- a/drivers/mtd/devices/m25p80.c + +++ b/drivers/mtd/devices/m25p80.c +-@@ -142,6 +142,9 @@ static int m25p80_read(struct spi_nor *n ++@@ -137,6 +137,9 @@ static int m25p80_read(struct spi_nor *n + flash->command[0] = nor->read_opcode; + m25p_addr2cmd(nor, from, flash->command); + +@@ -25,7 +25,7 @@ + while (len--) { + --- a/include/linux/spi/spi.h + +++ b/include/linux/spi/spi.h +-@@ -637,6 +637,7 @@ struct spi_transfer { ++@@ -633,6 +633,7 @@ struct spi_transfer { + u16 delay_usecs; + u32 speed_hz; + enum spi_transfer_type type; +diff --git a/target/linux/brcm63xx/patches-3.18/202-MTD-DEVICES-m25p80-use-parsers-if-provided-in-flash-.patch b/target/linux/brcm63xx/patches-3.18/202-MTD-DEVICES-m25p80-use-parsers-if-provided-in-flash-.patch +index b949694..be62e67 100644 +--- a/target/linux/brcm63xx/patches-3.18/202-MTD-DEVICES-m25p80-use-parsers-if-provided-in-flash-.patch ++++ b/target/linux/brcm63xx/patches-3.18/202-MTD-DEVICES-m25p80-use-parsers-if-provided-in-flash-.patch +@@ -11,12 +11,12 @@ Signed-off-by: Jonas Gorski + + --- a/drivers/mtd/devices/m25p80.c + +++ b/drivers/mtd/devices/m25p80.c +-@@ -246,7 +246,8 @@ static int m25p_probe(struct spi_device ++@@ -229,7 +229,8 @@ static int m25p_probe(struct spi_device + + ppdata.of_node = spi->dev.of_node; + +-- return mtd_device_parse_register(&flash->mtd, NULL, &ppdata, +-+ return mtd_device_parse_register(&flash->mtd, ++- return mtd_device_parse_register(&nor->mtd, NULL, &ppdata, +++ return mtd_device_parse_register(&nor->mtd, + + data ? data->part_probe_types : NULL, &ppdata, + data ? data->parts : NULL, + data ? data->nr_parts : 0); +diff --git a/target/linux/brcm63xx/patches-3.18/203-MTD-DEVICES-m25p80-add-support-for-limiting-reads.patch b/target/linux/brcm63xx/patches-3.18/203-MTD-DEVICES-m25p80-add-support-for-limiting-reads.patch +index 740fb2d..3877442 100644 +--- a/target/linux/brcm63xx/patches-3.18/203-MTD-DEVICES-m25p80-add-support-for-limiting-reads.patch ++++ b/target/linux/brcm63xx/patches-3.18/203-MTD-DEVICES-m25p80-add-support-for-limiting-reads.patch +@@ -11,15 +11,15 @@ Signed-off-by: Jonas Gorski + + --- a/drivers/mtd/devices/m25p80.c + +++ b/drivers/mtd/devices/m25p80.c +-@@ -32,6 +32,7 @@ struct m25p { ++@@ -31,6 +31,7 @@ ++ struct m25p { + struct spi_device *spi; + struct spi_nor spi_nor; +- struct mtd_info mtd; + + int max_transfer_len; + u8 command[MAX_CMD_SIZE]; + }; + +-@@ -121,7 +122,7 @@ static inline unsigned int m25p80_rx_nbi ++@@ -119,7 +120,7 @@ static inline unsigned int m25p80_rx_nbi + * Read an address range from the nor chip. The address range + * may be any size provided it is within the physical boundaries. + */ +@@ -28,7 +28,7 @@ Signed-off-by: Jonas Gorski + size_t *retlen, u_char *buf) + { + struct m25p *flash = nor->priv; +-@@ -157,6 +158,29 @@ static int m25p80_read(struct spi_nor *n ++@@ -152,6 +153,29 @@ static int m25p80_read(struct spi_nor *n + return 0; + } + +@@ -58,7 +58,7 @@ Signed-off-by: Jonas Gorski + static int m25p80_erase(struct spi_nor *nor, loff_t offset) + { + struct m25p *flash = nor->priv; +-@@ -240,6 +264,9 @@ static int m25p_probe(struct spi_device ++@@ -223,6 +247,9 @@ static int m25p_probe(struct spi_device + else + flash_name = spi->modalias; + +diff --git a/target/linux/brcm63xx/patches-3.18/414-MTD-m25p80-allow-passing-pp_data.patch b/target/linux/brcm63xx/patches-3.18/414-MTD-m25p80-allow-passing-pp_data.patch +index b7bf57f..e421e9a 100644 +--- a/target/linux/brcm63xx/patches-3.18/414-MTD-m25p80-allow-passing-pp_data.patch ++++ b/target/linux/brcm63xx/patches-3.18/414-MTD-m25p80-allow-passing-pp_data.patch +@@ -10,7 +10,7 @@ Subject: [PATCH 64/79] MTD: m25p80: allow passing pp_data + + --- a/drivers/mtd/devices/m25p80.c + +++ b/drivers/mtd/devices/m25p80.c +-@@ -267,6 +267,9 @@ static int m25p_probe(struct spi_device ++@@ -250,6 +250,9 @@ static int m25p_probe(struct spi_device + if (data) + flash->max_transfer_len = data->max_transfer_len; + +diff --git a/target/linux/generic/patches-3.18/043-mtd_GD25Q128B_support_backport_from_3.19.patch b/target/linux/generic/patches-3.18/043-mtd_GD25Q128B_support_backport_from_3.19.patch +deleted file mode 100644 +index 4d0403b..0000000 +--- a/target/linux/generic/patches-3.18/043-mtd_GD25Q128B_support_backport_from_3.19.patch ++++ /dev/null +@@ -1,10 +0,0 @@ +---- a/drivers/mtd/spi-nor/spi-nor.c +-+++ b/drivers/mtd/spi-nor/spi-nor.c +-@@ -510,6 +510,7 @@ static const struct spi_device_id spi_no +- /* GigaDevice */ +- { "gd25q32", INFO(0xc84016, 0, 64 * 1024, 64, SECT_4K) }, +- { "gd25q64", INFO(0xc84017, 0, 64 * 1024, 128, SECT_4K) }, +-+ { "gd25q128", INFO(0xc84018, 0, 64 * 1024, 256, SECT_4K) }, +- +- /* Intel/Numonyx -- xxxs33b */ +- { "160s33b", INFO(0x898911, 0, 64 * 1024, 32, 0) }, +diff --git a/target/linux/generic/patches-3.18/093-m25p80_spi-nor_update_to_4.4.9.patch b/target/linux/generic/patches-3.18/093-m25p80_spi-nor_update_to_4.4.9.patch +new file mode 100644 +index 0000000..5f74d3a +--- /dev/null ++++ b/target/linux/generic/patches-3.18/093-m25p80_spi-nor_update_to_4.4.9.patch +@@ -0,0 +1,1579 @@ ++--- a/drivers/mtd/devices/m25p80.c +++++ b/drivers/mtd/devices/m25p80.c ++@@ -31,7 +31,6 @@ ++ struct m25p { ++ struct spi_device *spi; ++ struct spi_nor spi_nor; ++- struct mtd_info mtd; ++ u8 command[MAX_CMD_SIZE]; ++ }; ++ ++@@ -62,8 +61,7 @@ static int m25p_cmdsz(struct spi_nor *no ++ return 1 + nor->addr_width; ++ } ++ ++-static int m25p80_write_reg(struct spi_nor *nor, u8 opcode, u8 *buf, int len, ++- int wr_en) +++static int m25p80_write_reg(struct spi_nor *nor, u8 opcode, u8 *buf, int len) ++ { ++ struct m25p *flash = nor->priv; ++ struct spi_device *spi = flash->spi; ++@@ -128,13 +126,10 @@ static int m25p80_read(struct spi_nor *n ++ struct spi_device *spi = flash->spi; ++ struct spi_transfer t[2]; ++ struct spi_message m; ++- int dummy = nor->read_dummy; ++- int ret; +++ unsigned int dummy = nor->read_dummy; ++ ++- /* Wait till previous write/erase is done. */ ++- ret = nor->wait_till_ready(nor); ++- if (ret) ++- return ret; +++ /* convert the dummy cycles to the number of bytes */ +++ dummy /= 8; ++ ++ spi_message_init(&m); ++ memset(t, 0, (sizeof t)); ++@@ -160,20 +155,9 @@ static int m25p80_read(struct spi_nor *n ++ static int m25p80_erase(struct spi_nor *nor, loff_t offset) ++ { ++ struct m25p *flash = nor->priv; ++- int ret; ++ ++ dev_dbg(nor->dev, "%dKiB at 0x%08x\n", ++- flash->mtd.erasesize / 1024, (u32)offset); ++- ++- /* Wait until finished previous write command. */ ++- ret = nor->wait_till_ready(nor); ++- if (ret) ++- return ret; ++- ++- /* Send write enable, then erase commands. */ ++- ret = nor->write_reg(nor, SPINOR_OP_WREN, NULL, 0, 0); ++- if (ret) ++- return ret; +++ flash->spi_nor.mtd.erasesize / 1024, (u32)offset); ++ ++ /* Set up command buffer. */ ++ flash->command[0] = nor->erase_opcode; ++@@ -215,11 +199,10 @@ static int m25p_probe(struct spi_device ++ nor->read_reg = m25p80_read_reg; ++ ++ nor->dev = &spi->dev; ++- nor->mtd = &flash->mtd; +++ nor->flash_node = spi->dev.of_node; ++ nor->priv = flash; ++ ++ spi_set_drvdata(spi, flash); ++- flash->mtd.priv = nor; ++ flash->spi = spi; ++ ++ if (spi->mode & SPI_RX_QUAD) ++@@ -228,7 +211,7 @@ static int m25p_probe(struct spi_device ++ mode = SPI_NOR_DUAL; ++ ++ if (data && data->name) ++- flash->mtd.name = data->name; +++ nor->mtd.name = data->name; ++ ++ /* For some (historical?) reason many platforms provide two different ++ * names in flash_platform_data: "name" and "type". Quite often name is ++@@ -246,7 +229,7 @@ static int m25p_probe(struct spi_device ++ ++ ppdata.of_node = spi->dev.of_node; ++ ++- return mtd_device_parse_register(&flash->mtd, NULL, &ppdata, +++ return mtd_device_parse_register(&nor->mtd, NULL, &ppdata, ++ data ? data->parts : NULL, ++ data ? data->nr_parts : 0); ++ } ++@@ -257,64 +240,68 @@ static int m25p_remove(struct spi_device ++ struct m25p *flash = spi_get_drvdata(spi); ++ ++ /* Clean up MTD stuff. */ ++- return mtd_device_unregister(&flash->mtd); +++ return mtd_device_unregister(&flash->spi_nor.mtd); ++ } ++ ++- ++ /* ++- * XXX This needs to be kept in sync with spi_nor_ids. We can't share ++- * it with spi-nor, because if this is built as a module then modpost ++- * won't be able to read it and add appropriate aliases. +++ * Do NOT add to this array without reading the following: +++ * +++ * Historically, many flash devices are bound to this driver by their name. But +++ * since most of these flash are compatible to some extent, and their +++ * differences can often be differentiated by the JEDEC read-ID command, we +++ * encourage new users to add support to the spi-nor library, and simply bind +++ * against a generic string here (e.g., "jedec,spi-nor"). +++ * +++ * Many flash names are kept here in this list (as well as in spi-nor.c) to +++ * keep them available as module aliases for existing platforms. ++ */ ++ static const struct spi_device_id m25p_ids[] = { ++- {"at25fs010"}, {"at25fs040"}, {"at25df041a"}, {"at25df321a"}, ++- {"at25df641"}, {"at26f004"}, {"at26df081a"}, {"at26df161a"}, ++- {"at26df321"}, {"at45db081d"}, ++- {"en25f32"}, {"en25p32"}, {"en25q32b"}, {"en25p64"}, ++- {"en25q64"}, {"en25qh128"}, {"en25qh256"}, ++- {"f25l32pa"}, ++- {"mr25h256"}, {"mr25h10"}, ++- {"gd25q32"}, {"gd25q64"}, ++- {"160s33b"}, {"320s33b"}, {"640s33b"}, ++- {"mx25l2005a"}, {"mx25l4005a"}, {"mx25l8005"}, {"mx25l1606e"}, ++- {"mx25l3205d"}, {"mx25l3255e"}, {"mx25l6405d"}, {"mx25l12805d"}, ++- {"mx25l12855e"},{"mx25l25635e"},{"mx25l25655e"},{"mx66l51235l"}, ++- {"mx66l1g55g"}, ++- {"n25q064"}, {"n25q128a11"}, {"n25q128a13"}, {"n25q256a"}, ++- {"n25q512a"}, {"n25q512ax3"}, {"n25q00"}, ++- {"pm25lv512"}, {"pm25lv010"}, {"pm25lq032"}, ++- {"s25sl032p"}, {"s25sl064p"}, {"s25fl256s0"}, {"s25fl256s1"}, ++- {"s25fl512s"}, {"s70fl01gs"}, {"s25sl12800"}, {"s25sl12801"}, ++- {"s25fl129p0"}, {"s25fl129p1"}, {"s25sl004a"}, {"s25sl008a"}, ++- {"s25sl016a"}, {"s25sl032a"}, {"s25sl064a"}, {"s25fl008k"}, ++- {"s25fl016k"}, {"s25fl064k"}, ++- {"sst25vf040b"},{"sst25vf080b"},{"sst25vf016b"},{"sst25vf032b"}, ++- {"sst25vf064c"},{"sst25wf512"}, {"sst25wf010"}, {"sst25wf020"}, ++- {"sst25wf040"}, ++- {"m25p05"}, {"m25p10"}, {"m25p20"}, {"m25p40"}, ++- {"m25p80"}, {"m25p16"}, {"m25p32"}, {"m25p64"}, ++- {"m25p128"}, {"n25q032"}, +++ /* +++ * Entries not used in DTs that should be safe to drop after replacing +++ * them with "nor-jedec" in platform data. +++ */ +++ {"s25sl064a"}, {"w25x16"}, {"m25p10"}, {"m25px64"}, +++ +++ /* +++ * Entries that were used in DTs without "nor-jedec" fallback and should +++ * be kept for backward compatibility. +++ */ +++ {"at25df321a"}, {"at25df641"}, {"at26df081a"}, +++ {"mr25h256"}, +++ {"mx25l4005a"}, {"mx25l1606e"}, {"mx25l6405d"}, {"mx25l12805d"}, +++ {"mx25l25635e"},{"mx66l51235l"}, +++ {"n25q064"}, {"n25q128a11"}, {"n25q128a13"}, {"n25q512a"}, +++ {"s25fl256s1"}, {"s25fl512s"}, {"s25sl12801"}, {"s25fl008k"}, +++ {"s25fl064k"}, +++ {"sst25vf040b"},{"sst25vf016b"},{"sst25vf032b"},{"sst25wf040"}, +++ {"m25p40"}, {"m25p80"}, {"m25p16"}, {"m25p32"}, +++ {"m25p64"}, {"m25p128"}, +++ {"w25x80"}, {"w25x32"}, {"w25q32"}, {"w25q32dw"}, +++ {"w25q80bl"}, {"w25q128"}, {"w25q256"}, +++ +++ /* Flashes that can't be detected using JEDEC */ ++ {"m25p05-nonjedec"}, {"m25p10-nonjedec"}, {"m25p20-nonjedec"}, ++ {"m25p40-nonjedec"}, {"m25p80-nonjedec"}, {"m25p16-nonjedec"}, ++ {"m25p32-nonjedec"}, {"m25p64-nonjedec"}, {"m25p128-nonjedec"}, ++- {"m45pe10"}, {"m45pe80"}, {"m45pe16"}, ++- {"m25pe20"}, {"m25pe80"}, {"m25pe16"}, ++- {"m25px16"}, {"m25px32"}, {"m25px32-s0"}, {"m25px32-s1"}, ++- {"m25px64"}, {"m25px80"}, ++- {"w25x10"}, {"w25x20"}, {"w25x40"}, {"w25x80"}, ++- {"w25x16"}, {"w25x32"}, {"w25q32"}, {"w25q32dw"}, ++- {"w25x64"}, {"w25q64"}, {"w25q80"}, {"w25q80bl"}, ++- {"w25q128"}, {"w25q256"}, {"cat25c11"}, ++- {"cat25c03"}, {"cat25c09"}, {"cat25c17"}, {"cat25128"}, +++ ++ { }, ++ }; ++ MODULE_DEVICE_TABLE(spi, m25p_ids); ++ +++static const struct of_device_id m25p_of_table[] = { +++ /* +++ * Generic compatibility for SPI NOR that can be identified by the +++ * JEDEC READ ID opcode (0x9F). Use this, if possible. +++ */ +++ { .compatible = "jedec,spi-nor" }, +++ {} +++}; +++MODULE_DEVICE_TABLE(of, m25p_of_table); ++ ++ static struct spi_driver m25p80_driver = { ++ .driver = { ++ .name = "m25p80", ++- .owner = THIS_MODULE, +++ .of_match_table = m25p_of_table, ++ }, ++ .id_table = m25p_ids, ++ .probe = m25p_probe, ++--- a/drivers/mtd/spi-nor/spi-nor.c +++++ b/drivers/mtd/spi-nor/spi-nor.c ++@@ -16,19 +16,63 @@ ++ #include ++ #include ++ #include +++#include ++ ++-#include ++ #include ++ #include ++ #include ++ #include ++ ++ /* Define max times to check status register before we give up. */ ++-#define MAX_READY_WAIT_JIFFIES (40 * HZ) /* M25P16 specs 40s max chip erase */ ++ ++-#define JEDEC_MFR(_jedec_id) ((_jedec_id) >> 16) +++/* +++ * For everything but full-chip erase; probably could be much smaller, but kept +++ * around for safety for now +++ */ +++#define DEFAULT_READY_WAIT_JIFFIES (40UL * HZ) +++ +++/* +++ * For full-chip erase, calibrated to a 2MB flash (M25P16); should be scaled up +++ * for larger flash +++ */ +++#define CHIP_ERASE_2MB_READY_WAIT_JIFFIES (40UL * HZ) +++ +++#define SPI_NOR_MAX_ID_LEN 6 +++ +++struct flash_info { +++ char *name; +++ +++ /* +++ * This array stores the ID bytes. +++ * The first three bytes are the JEDIC ID. +++ * JEDEC ID zero means "no ID" (mostly older chips). +++ */ +++ u8 id[SPI_NOR_MAX_ID_LEN]; +++ u8 id_len; +++ +++ /* The size listed here is what works with SPINOR_OP_SE, which isn't +++ * necessarily called a "sector" by the vendor. +++ */ +++ unsigned sector_size; +++ u16 n_sectors; +++ +++ u16 page_size; +++ u16 addr_width; +++ +++ u16 flags; +++#define SECT_4K 0x01 /* SPINOR_OP_BE_4K works uniformly */ +++#define SPI_NOR_NO_ERASE 0x02 /* No erase command needed */ +++#define SST_WRITE 0x04 /* use SST byte programming */ +++#define SPI_NOR_NO_FR 0x08 /* Can't do fastread */ +++#define SECT_4K_PMC 0x10 /* SPINOR_OP_BE_4K_PMC works uniformly */ +++#define SPI_NOR_DUAL_READ 0x20 /* Flash supports Dual Read */ +++#define SPI_NOR_QUAD_READ 0x40 /* Flash supports Quad Read */ +++#define USE_FSR 0x80 /* use flag status register */ +++}; ++ ++-static const struct spi_device_id *spi_nor_match_id(const char *name); +++#define JEDEC_MFR(info) ((info)->id[0]) +++ +++static const struct flash_info *spi_nor_match_id(const char *name); ++ ++ /* ++ * Read the status register, returning its value in the location ++@@ -98,7 +142,7 @@ static inline int spi_nor_read_dummy_cyc ++ case SPI_NOR_FAST: ++ case SPI_NOR_DUAL: ++ case SPI_NOR_QUAD: ++- return 1; +++ return 8; ++ case SPI_NOR_NORMAL: ++ return 0; ++ } ++@@ -112,7 +156,7 @@ static inline int spi_nor_read_dummy_cyc ++ static inline int write_sr(struct spi_nor *nor, u8 val) ++ { ++ nor->cmd_buf[0] = val; ++- return nor->write_reg(nor, SPINOR_OP_WRSR, nor->cmd_buf, 1, 0); +++ return nor->write_reg(nor, SPINOR_OP_WRSR, nor->cmd_buf, 1); ++ } ++ ++ /* ++@@ -121,7 +165,7 @@ static inline int write_sr(struct spi_no ++ */ ++ static inline int write_enable(struct spi_nor *nor) ++ { ++- return nor->write_reg(nor, SPINOR_OP_WREN, NULL, 0, 0); +++ return nor->write_reg(nor, SPINOR_OP_WREN, NULL, 0); ++ } ++ ++ /* ++@@ -129,7 +173,7 @@ static inline int write_enable(struct sp ++ */ ++ static inline int write_disable(struct spi_nor *nor) ++ { ++- return nor->write_reg(nor, SPINOR_OP_WRDI, NULL, 0, 0); +++ return nor->write_reg(nor, SPINOR_OP_WRDI, NULL, 0); ++ } ++ ++ static inline struct spi_nor *mtd_to_spi_nor(struct mtd_info *mtd) ++@@ -138,23 +182,24 @@ static inline struct spi_nor *mtd_to_spi ++ } ++ ++ /* Enable/disable 4-byte addressing mode. */ ++-static inline int set_4byte(struct spi_nor *nor, u32 jedec_id, int enable) +++static inline int set_4byte(struct spi_nor *nor, const struct flash_info *info, +++ int enable) ++ { ++ int status; ++ bool need_wren = false; ++ u8 cmd; ++ ++- switch (JEDEC_MFR(jedec_id)) { ++- case CFI_MFR_ST: /* Micron, actually */ +++ switch (JEDEC_MFR(info)) { +++ case SNOR_MFR_MICRON: ++ /* Some Micron need WREN command; all will accept it */ ++ need_wren = true; ++- case CFI_MFR_MACRONIX: ++- case 0xEF /* winbond */: +++ case SNOR_MFR_MACRONIX: +++ case SNOR_MFR_WINBOND: ++ if (need_wren) ++ write_enable(nor); ++ ++ cmd = enable ? SPINOR_OP_EN4B : SPINOR_OP_EX4B; ++- status = nor->write_reg(nor, cmd, NULL, 0, 0); +++ status = nor->write_reg(nor, cmd, NULL, 0); ++ if (need_wren) ++ write_disable(nor); ++ ++@@ -162,63 +207,73 @@ static inline int set_4byte(struct spi_n ++ default: ++ /* Spansion style */ ++ nor->cmd_buf[0] = enable << 7; ++- return nor->write_reg(nor, SPINOR_OP_BRWR, nor->cmd_buf, 1, 0); +++ return nor->write_reg(nor, SPINOR_OP_BRWR, nor->cmd_buf, 1); ++ } ++ } ++- ++-static int spi_nor_wait_till_ready(struct spi_nor *nor) +++static inline int spi_nor_sr_ready(struct spi_nor *nor) ++ { ++- unsigned long deadline; ++- int sr; ++- ++- deadline = jiffies + MAX_READY_WAIT_JIFFIES; ++- ++- do { ++- cond_resched(); +++ int sr = read_sr(nor); +++ if (sr < 0) +++ return sr; +++ else +++ return !(sr & SR_WIP); +++} ++ ++- sr = read_sr(nor); ++- if (sr < 0) ++- break; ++- else if (!(sr & SR_WIP)) ++- return 0; ++- } while (!time_after_eq(jiffies, deadline)); +++static inline int spi_nor_fsr_ready(struct spi_nor *nor) +++{ +++ int fsr = read_fsr(nor); +++ if (fsr < 0) +++ return fsr; +++ else +++ return fsr & FSR_READY; +++} ++ ++- return -ETIMEDOUT; +++static int spi_nor_ready(struct spi_nor *nor) +++{ +++ int sr, fsr; +++ sr = spi_nor_sr_ready(nor); +++ if (sr < 0) +++ return sr; +++ fsr = nor->flags & SNOR_F_USE_FSR ? spi_nor_fsr_ready(nor) : 1; +++ if (fsr < 0) +++ return fsr; +++ return sr && fsr; ++ } ++ ++-static int spi_nor_wait_till_fsr_ready(struct spi_nor *nor) +++/* +++ * Service routine to read status register until ready, or timeout occurs. +++ * Returns non-zero if error. +++ */ +++static int spi_nor_wait_till_ready_with_timeout(struct spi_nor *nor, +++ unsigned long timeout_jiffies) ++ { ++ unsigned long deadline; ++- int sr; ++- int fsr; +++ int timeout = 0, ret; ++ ++- deadline = jiffies + MAX_READY_WAIT_JIFFIES; +++ deadline = jiffies + timeout_jiffies; +++ +++ while (!timeout) { +++ if (time_after_eq(jiffies, deadline)) +++ timeout = 1; +++ +++ ret = spi_nor_ready(nor); +++ if (ret < 0) +++ return ret; +++ if (ret) +++ return 0; ++ ++- do { ++ cond_resched(); +++ } ++ ++- sr = read_sr(nor); ++- if (sr < 0) { ++- break; ++- } else if (!(sr & SR_WIP)) { ++- fsr = read_fsr(nor); ++- if (fsr < 0) ++- break; ++- if (fsr & FSR_READY) ++- return 0; ++- } ++- } while (!time_after_eq(jiffies, deadline)); +++ dev_err(nor->dev, "flash operation timed out\n"); ++ ++ return -ETIMEDOUT; ++ } ++ ++-/* ++- * Service routine to read status register until ready, or timeout occurs. ++- * Returns non-zero if error. ++- */ ++-static int wait_till_ready(struct spi_nor *nor) +++static int spi_nor_wait_till_ready(struct spi_nor *nor) ++ { ++- return nor->wait_till_ready(nor); +++ return spi_nor_wait_till_ready_with_timeout(nor, +++ DEFAULT_READY_WAIT_JIFFIES); ++ } ++ ++ /* ++@@ -228,19 +283,9 @@ static int wait_till_ready(struct spi_no ++ */ ++ static int erase_chip(struct spi_nor *nor) ++ { ++- int ret; ++- ++- dev_dbg(nor->dev, " %lldKiB\n", (long long)(nor->mtd->size >> 10)); +++ dev_dbg(nor->dev, " %lldKiB\n", (long long)(nor->mtd.size >> 10)); ++ ++- /* Wait until finished previous write command. */ ++- ret = wait_till_ready(nor); ++- if (ret) ++- return ret; ++- ++- /* Send write enable, then erase commands. */ ++- write_enable(nor); ++- ++- return nor->write_reg(nor, SPINOR_OP_CHIP_ERASE, NULL, 0, 0); +++ return nor->write_reg(nor, SPINOR_OP_CHIP_ERASE, NULL, 0); ++ } ++ ++ static int spi_nor_lock_and_prep(struct spi_nor *nor, enum spi_nor_ops ops) ++@@ -294,11 +339,28 @@ static int spi_nor_erase(struct mtd_info ++ ++ /* whole-chip erase? */ ++ if (len == mtd->size) { +++ unsigned long timeout; +++ +++ write_enable(nor); +++ ++ if (erase_chip(nor)) { ++ ret = -EIO; ++ goto erase_err; ++ } ++ +++ /* +++ * Scale the timeout linearly with the size of the flash, with +++ * a minimum calibrated to an old 2MB flash. We could try to +++ * pull these from CFI/SFDP, but these values should be good +++ * enough for now. +++ */ +++ timeout = max(CHIP_ERASE_2MB_READY_WAIT_JIFFIES, +++ CHIP_ERASE_2MB_READY_WAIT_JIFFIES * +++ (unsigned long)(mtd->size / SZ_2M)); +++ ret = spi_nor_wait_till_ready_with_timeout(nor, timeout); +++ if (ret) +++ goto erase_err; +++ ++ /* REVISIT in some cases we could speed up erasing large regions ++ * by using SPINOR_OP_SE instead of SPINOR_OP_BE_4K. We may have set up ++ * to use "small sector erase", but that's not always optimal. ++@@ -307,6 +369,8 @@ static int spi_nor_erase(struct mtd_info ++ /* "sector"-at-a-time erase */ ++ } else { ++ while (len) { +++ write_enable(nor); +++ ++ if (nor->erase(nor, addr)) { ++ ret = -EIO; ++ goto erase_err; ++@@ -314,9 +378,15 @@ static int spi_nor_erase(struct mtd_info ++ ++ addr += mtd->erasesize; ++ len -= mtd->erasesize; +++ +++ ret = spi_nor_wait_till_ready(nor); +++ if (ret) +++ goto erase_err; ++ } ++ } ++ +++ write_disable(nor); +++ ++ spi_nor_unlock_and_unprep(nor, SPI_NOR_OPS_ERASE); ++ ++ instr->state = MTD_ERASE_DONE; ++@@ -330,152 +400,267 @@ erase_err: ++ return ret; ++ } ++ ++-static int spi_nor_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len) +++static void stm_get_locked_range(struct spi_nor *nor, u8 sr, loff_t *ofs, +++ uint64_t *len) ++ { ++- struct spi_nor *nor = mtd_to_spi_nor(mtd); ++- uint32_t offset = ofs; ++- uint8_t status_old, status_new; ++- int ret = 0; +++ struct mtd_info *mtd = &nor->mtd; +++ u8 mask = SR_BP2 | SR_BP1 | SR_BP0; +++ int shift = ffs(mask) - 1; +++ int pow; +++ +++ if (!(sr & mask)) { +++ /* No protection */ +++ *ofs = 0; +++ *len = 0; +++ } else { +++ pow = ((sr & mask) ^ mask) >> shift; +++ *len = mtd->size >> pow; +++ *ofs = mtd->size - *len; +++ } +++} ++ ++- ret = spi_nor_lock_and_prep(nor, SPI_NOR_OPS_LOCK); ++- if (ret) ++- return ret; +++/* +++ * Return 1 if the entire region is locked, 0 otherwise +++ */ +++static int stm_is_locked_sr(struct spi_nor *nor, loff_t ofs, uint64_t len, +++ u8 sr) +++{ +++ loff_t lock_offs; +++ uint64_t lock_len; ++ ++- /* Wait until finished previous command */ ++- ret = wait_till_ready(nor); ++- if (ret) ++- goto err; +++ stm_get_locked_range(nor, sr, &lock_offs, &lock_len); +++ +++ return (ofs + len <= lock_offs + lock_len) && (ofs >= lock_offs); +++} +++ +++/* +++ * Lock a region of the flash. Compatible with ST Micro and similar flash. +++ * Supports only the block protection bits BP{0,1,2} in the status register +++ * (SR). Does not support these features found in newer SR bitfields: +++ * - TB: top/bottom protect - only handle TB=0 (top protect) +++ * - SEC: sector/block protect - only handle SEC=0 (block protect) +++ * - CMP: complement protect - only support CMP=0 (range is not complemented) +++ * +++ * Sample table portion for 8MB flash (Winbond w25q64fw): +++ * +++ * SEC | TB | BP2 | BP1 | BP0 | Prot Length | Protected Portion +++ * -------------------------------------------------------------------------- +++ * X | X | 0 | 0 | 0 | NONE | NONE +++ * 0 | 0 | 0 | 0 | 1 | 128 KB | Upper 1/64 +++ * 0 | 0 | 0 | 1 | 0 | 256 KB | Upper 1/32 +++ * 0 | 0 | 0 | 1 | 1 | 512 KB | Upper 1/16 +++ * 0 | 0 | 1 | 0 | 0 | 1 MB | Upper 1/8 +++ * 0 | 0 | 1 | 0 | 1 | 2 MB | Upper 1/4 +++ * 0 | 0 | 1 | 1 | 0 | 4 MB | Upper 1/2 +++ * X | X | 1 | 1 | 1 | 8 MB | ALL +++ * +++ * Returns negative on errors, 0 on success. +++ */ +++static int stm_lock(struct spi_nor *nor, loff_t ofs, uint64_t len) +++{ +++ struct mtd_info *mtd = &nor->mtd; +++ u8 status_old, status_new; +++ u8 mask = SR_BP2 | SR_BP1 | SR_BP0; +++ u8 shift = ffs(mask) - 1, pow, val; ++ ++ status_old = read_sr(nor); ++ ++- if (offset < mtd->size - (mtd->size / 2)) ++- status_new = status_old | SR_BP2 | SR_BP1 | SR_BP0; ++- else if (offset < mtd->size - (mtd->size / 4)) ++- status_new = (status_old & ~SR_BP0) | SR_BP2 | SR_BP1; ++- else if (offset < mtd->size - (mtd->size / 8)) ++- status_new = (status_old & ~SR_BP1) | SR_BP2 | SR_BP0; ++- else if (offset < mtd->size - (mtd->size / 16)) ++- status_new = (status_old & ~(SR_BP0 | SR_BP1)) | SR_BP2; ++- else if (offset < mtd->size - (mtd->size / 32)) ++- status_new = (status_old & ~SR_BP2) | SR_BP1 | SR_BP0; ++- else if (offset < mtd->size - (mtd->size / 64)) ++- status_new = (status_old & ~(SR_BP2 | SR_BP0)) | SR_BP1; ++- else ++- status_new = (status_old & ~(SR_BP2 | SR_BP1)) | SR_BP0; +++ /* SPI NOR always locks to the end */ +++ if (ofs + len != mtd->size) { +++ /* Does combined region extend to end? */ +++ if (!stm_is_locked_sr(nor, ofs + len, mtd->size - ofs - len, +++ status_old)) +++ return -EINVAL; +++ len = mtd->size - ofs; +++ } +++ +++ /* +++ * Need smallest pow such that: +++ * +++ * 1 / (2^pow) <= (len / size) +++ * +++ * so (assuming power-of-2 size) we do: +++ * +++ * pow = ceil(log2(size / len)) = log2(size) - floor(log2(len)) +++ */ +++ pow = ilog2(mtd->size) - ilog2(len); +++ val = mask - (pow << shift); +++ if (val & ~mask) +++ return -EINVAL; +++ /* Don't "lock" with no region! */ +++ if (!(val & mask)) +++ return -EINVAL; +++ +++ status_new = (status_old & ~mask) | val; ++ ++ /* Only modify protection if it will not unlock other areas */ ++- if ((status_new & (SR_BP2 | SR_BP1 | SR_BP0)) > ++- (status_old & (SR_BP2 | SR_BP1 | SR_BP0))) { ++- write_enable(nor); ++- ret = write_sr(nor, status_new); ++- if (ret) ++- goto err; +++ if ((status_new & mask) <= (status_old & mask)) +++ return -EINVAL; +++ +++ write_enable(nor); +++ return write_sr(nor, status_new); +++} +++ +++/* +++ * Unlock a region of the flash. See stm_lock() for more info +++ * +++ * Returns negative on errors, 0 on success. +++ */ +++static int stm_unlock(struct spi_nor *nor, loff_t ofs, uint64_t len) +++{ +++ struct mtd_info *mtd = &nor->mtd; +++ uint8_t status_old, status_new; +++ u8 mask = SR_BP2 | SR_BP1 | SR_BP0; +++ u8 shift = ffs(mask) - 1, pow, val; +++ +++ status_old = read_sr(nor); +++ +++ /* Cannot unlock; would unlock larger region than requested */ +++ if (stm_is_locked_sr(nor, ofs - mtd->erasesize, mtd->erasesize, +++ status_old)) +++ return -EINVAL; +++ +++ /* +++ * Need largest pow such that: +++ * +++ * 1 / (2^pow) >= (len / size) +++ * +++ * so (assuming power-of-2 size) we do: +++ * +++ * pow = floor(log2(size / len)) = log2(size) - ceil(log2(len)) +++ */ +++ pow = ilog2(mtd->size) - order_base_2(mtd->size - (ofs + len)); +++ if (ofs + len == mtd->size) { +++ val = 0; /* fully unlocked */ +++ } else { +++ val = mask - (pow << shift); +++ /* Some power-of-two sizes are not supported */ +++ if (val & ~mask) +++ return -EINVAL; ++ } ++ ++-err: ++- spi_nor_unlock_and_unprep(nor, SPI_NOR_OPS_LOCK); ++- return ret; +++ status_new = (status_old & ~mask) | val; +++ +++ /* Only modify protection if it will not lock other areas */ +++ if ((status_new & mask) >= (status_old & mask)) +++ return -EINVAL; +++ +++ write_enable(nor); +++ return write_sr(nor, status_new); ++ } ++ ++-static int spi_nor_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len) +++/* +++ * Check if a region of the flash is (completely) locked. See stm_lock() for +++ * more info. +++ * +++ * Returns 1 if entire region is locked, 0 if any portion is unlocked, and +++ * negative on errors. +++ */ +++static int stm_is_locked(struct spi_nor *nor, loff_t ofs, uint64_t len) +++{ +++ int status; +++ +++ status = read_sr(nor); +++ if (status < 0) +++ return status; +++ +++ return stm_is_locked_sr(nor, ofs, len, status); +++} +++ +++static int spi_nor_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len) ++ { ++ struct spi_nor *nor = mtd_to_spi_nor(mtd); ++- uint32_t offset = ofs; ++- uint8_t status_old, status_new; ++- int ret = 0; +++ int ret; ++ ++- ret = spi_nor_lock_and_prep(nor, SPI_NOR_OPS_UNLOCK); +++ ret = spi_nor_lock_and_prep(nor, SPI_NOR_OPS_LOCK); ++ if (ret) ++ return ret; ++ ++- /* Wait until finished previous command */ ++- ret = wait_till_ready(nor); ++- if (ret) ++- goto err; +++ ret = nor->flash_lock(nor, ofs, len); ++ ++- status_old = read_sr(nor); +++ spi_nor_unlock_and_unprep(nor, SPI_NOR_OPS_UNLOCK); +++ return ret; +++} ++ ++- if (offset+len > mtd->size - (mtd->size / 64)) ++- status_new = status_old & ~(SR_BP2 | SR_BP1 | SR_BP0); ++- else if (offset+len > mtd->size - (mtd->size / 32)) ++- status_new = (status_old & ~(SR_BP2 | SR_BP1)) | SR_BP0; ++- else if (offset+len > mtd->size - (mtd->size / 16)) ++- status_new = (status_old & ~(SR_BP2 | SR_BP0)) | SR_BP1; ++- else if (offset+len > mtd->size - (mtd->size / 8)) ++- status_new = (status_old & ~SR_BP2) | SR_BP1 | SR_BP0; ++- else if (offset+len > mtd->size - (mtd->size / 4)) ++- status_new = (status_old & ~(SR_BP0 | SR_BP1)) | SR_BP2; ++- else if (offset+len > mtd->size - (mtd->size / 2)) ++- status_new = (status_old & ~SR_BP1) | SR_BP2 | SR_BP0; ++- else ++- status_new = (status_old & ~SR_BP0) | SR_BP2 | SR_BP1; +++static int spi_nor_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len) +++{ +++ struct spi_nor *nor = mtd_to_spi_nor(mtd); +++ int ret; ++ ++- /* Only modify protection if it will not lock other areas */ ++- if ((status_new & (SR_BP2 | SR_BP1 | SR_BP0)) < ++- (status_old & (SR_BP2 | SR_BP1 | SR_BP0))) { ++- write_enable(nor); ++- ret = write_sr(nor, status_new); ++- if (ret) ++- goto err; ++- } +++ ret = spi_nor_lock_and_prep(nor, SPI_NOR_OPS_UNLOCK); +++ if (ret) +++ return ret; ++ ++-err: ++- spi_nor_unlock_and_unprep(nor, SPI_NOR_OPS_UNLOCK); +++ ret = nor->flash_unlock(nor, ofs, len); +++ +++ spi_nor_unlock_and_unprep(nor, SPI_NOR_OPS_LOCK); ++ return ret; ++ } ++ ++-struct flash_info { ++- /* JEDEC id zero means "no ID" (most older chips); otherwise it has ++- * a high byte of zero plus three data bytes: the manufacturer id, ++- * then a two byte device id. ++- */ ++- u32 jedec_id; ++- u16 ext_id; +++static int spi_nor_is_locked(struct mtd_info *mtd, loff_t ofs, uint64_t len) +++{ +++ struct spi_nor *nor = mtd_to_spi_nor(mtd); +++ int ret; ++ ++- /* The size listed here is what works with SPINOR_OP_SE, which isn't ++- * necessarily called a "sector" by the vendor. ++- */ ++- unsigned sector_size; ++- u16 n_sectors; +++ ret = spi_nor_lock_and_prep(nor, SPI_NOR_OPS_UNLOCK); +++ if (ret) +++ return ret; ++ ++- u16 page_size; ++- u16 addr_width; +++ ret = nor->flash_is_locked(nor, ofs, len); ++ ++- u16 flags; ++-#define SECT_4K 0x01 /* SPINOR_OP_BE_4K works uniformly */ ++-#define SPI_NOR_NO_ERASE 0x02 /* No erase command needed */ ++-#define SST_WRITE 0x04 /* use SST byte programming */ ++-#define SPI_NOR_NO_FR 0x08 /* Can't do fastread */ ++-#define SECT_4K_PMC 0x10 /* SPINOR_OP_BE_4K_PMC works uniformly */ ++-#define SPI_NOR_DUAL_READ 0x20 /* Flash supports Dual Read */ ++-#define SPI_NOR_QUAD_READ 0x40 /* Flash supports Quad Read */ ++-#define USE_FSR 0x80 /* use flag status register */ ++-}; +++ spi_nor_unlock_and_unprep(nor, SPI_NOR_OPS_LOCK); +++ return ret; +++} ++ +++/* Used when the "_ext_id" is two bytes at most */ ++ #define INFO(_jedec_id, _ext_id, _sector_size, _n_sectors, _flags) \ ++- ((kernel_ulong_t)&(struct flash_info) { \ ++- .jedec_id = (_jedec_id), \ ++- .ext_id = (_ext_id), \ +++ .id = { \ +++ ((_jedec_id) >> 16) & 0xff, \ +++ ((_jedec_id) >> 8) & 0xff, \ +++ (_jedec_id) & 0xff, \ +++ ((_ext_id) >> 8) & 0xff, \ +++ (_ext_id) & 0xff, \ +++ }, \ +++ .id_len = (!(_jedec_id) ? 0 : (3 + ((_ext_id) ? 2 : 0))), \ +++ .sector_size = (_sector_size), \ +++ .n_sectors = (_n_sectors), \ +++ .page_size = 256, \ +++ .flags = (_flags), +++ +++#define INFO6(_jedec_id, _ext_id, _sector_size, _n_sectors, _flags) \ +++ .id = { \ +++ ((_jedec_id) >> 16) & 0xff, \ +++ ((_jedec_id) >> 8) & 0xff, \ +++ (_jedec_id) & 0xff, \ +++ ((_ext_id) >> 16) & 0xff, \ +++ ((_ext_id) >> 8) & 0xff, \ +++ (_ext_id) & 0xff, \ +++ }, \ +++ .id_len = 6, \ ++ .sector_size = (_sector_size), \ ++ .n_sectors = (_n_sectors), \ ++ .page_size = 256, \ ++- .flags = (_flags), \ ++- }) +++ .flags = (_flags), ++ ++ #define CAT25_INFO(_sector_size, _n_sectors, _page_size, _addr_width, _flags) \ ++- ((kernel_ulong_t)&(struct flash_info) { \ ++ .sector_size = (_sector_size), \ ++ .n_sectors = (_n_sectors), \ ++ .page_size = (_page_size), \ ++ .addr_width = (_addr_width), \ ++- .flags = (_flags), \ ++- }) +++ .flags = (_flags), ++ ++ /* NOTE: double check command sets and memory organization when you add ++ * more nor chips. This current list focusses on newer chips, which ++ * have been converging on command sets which including JEDEC ID. +++ * +++ * All newly added entries should describe *hardware* and should use SECT_4K +++ * (or SECT_4K_PMC) if hardware supports erasing 4 KiB sectors. For usage +++ * scenarios excluding small sectors there is config option that can be +++ * disabled: CONFIG_MTD_SPI_NOR_USE_4K_SECTORS. +++ * For historical (and compatibility) reasons (before we got above config) some +++ * old entries may be missing 4K flag. ++ */ ++-static const struct spi_device_id spi_nor_ids[] = { +++static const struct flash_info spi_nor_ids[] = { ++ /* Atmel -- some are (confusingly) marketed as "DataFlash" */ ++ { "at25fs010", INFO(0x1f6601, 0, 32 * 1024, 4, SECT_4K) }, ++ { "at25fs040", INFO(0x1f6604, 0, 64 * 1024, 8, SECT_4K) }, ++@@ -499,6 +684,7 @@ static const struct spi_device_id spi_no ++ { "en25q64", INFO(0x1c3017, 0, 64 * 1024, 128, SECT_4K) }, ++ { "en25qh128", INFO(0x1c7018, 0, 64 * 1024, 256, 0) }, ++ { "en25qh256", INFO(0x1c7019, 0, 64 * 1024, 512, 0) }, +++ { "en25s64", INFO(0x1c3817, 0, 64 * 1024, 128, SECT_4K) }, ++ ++ /* ESMT */ ++ { "f25l32pa", INFO(0x8c2016, 0, 64 * 1024, 64, SECT_4K) }, ++@@ -507,16 +693,24 @@ static const struct spi_device_id spi_no ++ { "mr25h256", CAT25_INFO( 32 * 1024, 1, 256, 2, SPI_NOR_NO_ERASE | SPI_NOR_NO_FR) }, ++ { "mr25h10", CAT25_INFO(128 * 1024, 1, 256, 3, SPI_NOR_NO_ERASE | SPI_NOR_NO_FR) }, ++ +++ /* Fujitsu */ +++ { "mb85rs1mt", INFO(0x047f27, 0, 128 * 1024, 1, SPI_NOR_NO_ERASE) }, +++ ++ /* GigaDevice */ ++ { "gd25q32", INFO(0xc84016, 0, 64 * 1024, 64, SECT_4K) }, ++ { "gd25q64", INFO(0xc84017, 0, 64 * 1024, 128, SECT_4K) }, +++ { "gd25q128", INFO(0xc84018, 0, 64 * 1024, 256, SECT_4K) }, ++ ++ /* Intel/Numonyx -- xxxs33b */ ++ { "160s33b", INFO(0x898911, 0, 64 * 1024, 32, 0) }, ++ { "320s33b", INFO(0x898912, 0, 64 * 1024, 64, 0) }, ++ { "640s33b", INFO(0x898913, 0, 64 * 1024, 128, 0) }, ++ +++ /* ISSI */ +++ { "is25cd512", INFO(0x7f9d20, 0, 32 * 1024, 2, SECT_4K) }, +++ ++ /* Macronix */ +++ { "mx25l512e", INFO(0xc22010, 0, 64 * 1024, 1, SECT_4K) }, ++ { "mx25l2005a", INFO(0xc22012, 0, 64 * 1024, 4, SECT_4K) }, ++ { "mx25l4005a", INFO(0xc22013, 0, 64 * 1024, 8, SECT_4K) }, ++ { "mx25l8005", INFO(0xc22014, 0, 64 * 1024, 16, 0) }, ++@@ -524,6 +718,7 @@ static const struct spi_device_id spi_no ++ { "mx25l3205d", INFO(0xc22016, 0, 64 * 1024, 64, 0) }, ++ { "mx25l3255e", INFO(0xc29e16, 0, 64 * 1024, 64, SECT_4K) }, ++ { "mx25l6405d", INFO(0xc22017, 0, 64 * 1024, 128, 0) }, +++ { "mx25u6435f", INFO(0xc22537, 0, 64 * 1024, 128, SECT_4K) }, ++ { "mx25l12805d", INFO(0xc22018, 0, 64 * 1024, 256, 0) }, ++ { "mx25l12855e", INFO(0xc22618, 0, 64 * 1024, 256, 0) }, ++ { "mx25l25635e", INFO(0xc22019, 0, 64 * 1024, 512, 0) }, ++@@ -532,13 +727,16 @@ static const struct spi_device_id spi_no ++ { "mx66l1g55g", INFO(0xc2261b, 0, 64 * 1024, 2048, SPI_NOR_QUAD_READ) }, ++ ++ /* Micron */ ++- { "n25q064", INFO(0x20ba17, 0, 64 * 1024, 128, 0) }, ++- { "n25q128a11", INFO(0x20bb18, 0, 64 * 1024, 256, 0) }, ++- { "n25q128a13", INFO(0x20ba18, 0, 64 * 1024, 256, 0) }, ++- { "n25q256a", INFO(0x20ba19, 0, 64 * 1024, 512, SECT_4K) }, ++- { "n25q512a", INFO(0x20bb20, 0, 64 * 1024, 1024, SECT_4K) }, ++- { "n25q512ax3", INFO(0x20ba20, 0, 64 * 1024, 1024, USE_FSR) }, ++- { "n25q00", INFO(0x20ba21, 0, 64 * 1024, 2048, USE_FSR) }, +++ { "n25q032", INFO(0x20ba16, 0, 64 * 1024, 64, SPI_NOR_QUAD_READ) }, +++ { "n25q032a", INFO(0x20bb16, 0, 64 * 1024, 64, SPI_NOR_QUAD_READ) }, +++ { "n25q064", INFO(0x20ba17, 0, 64 * 1024, 128, SECT_4K | SPI_NOR_QUAD_READ) }, +++ { "n25q064a", INFO(0x20bb17, 0, 64 * 1024, 128, SECT_4K | SPI_NOR_QUAD_READ) }, +++ { "n25q128a11", INFO(0x20bb18, 0, 64 * 1024, 256, SPI_NOR_QUAD_READ) }, +++ { "n25q128a13", INFO(0x20ba18, 0, 64 * 1024, 256, SPI_NOR_QUAD_READ) }, +++ { "n25q256a", INFO(0x20ba19, 0, 64 * 1024, 512, SECT_4K | SPI_NOR_QUAD_READ) }, +++ { "n25q512a", INFO(0x20bb20, 0, 64 * 1024, 1024, SECT_4K | USE_FSR | SPI_NOR_QUAD_READ) }, +++ { "n25q512ax3", INFO(0x20ba20, 0, 64 * 1024, 1024, SECT_4K | USE_FSR | SPI_NOR_QUAD_READ) }, +++ { "n25q00", INFO(0x20ba21, 0, 64 * 1024, 2048, SECT_4K | USE_FSR | SPI_NOR_QUAD_READ) }, ++ ++ /* PMC */ ++ { "pm25lv512", INFO(0, 0, 32 * 1024, 2, SECT_4K_PMC) }, ++@@ -549,23 +747,28 @@ static const struct spi_device_id spi_no ++ * for the chips listed here (without boot sectors). ++ */ ++ { "s25sl032p", INFO(0x010215, 0x4d00, 64 * 1024, 64, SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, ++- { "s25sl064p", INFO(0x010216, 0x4d00, 64 * 1024, 128, 0) }, +++ { "s25sl064p", INFO(0x010216, 0x4d00, 64 * 1024, 128, SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, ++ { "s25fl256s0", INFO(0x010219, 0x4d00, 256 * 1024, 128, 0) }, ++ { "s25fl256s1", INFO(0x010219, 0x4d01, 64 * 1024, 512, SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, ++ { "s25fl512s", INFO(0x010220, 0x4d00, 256 * 1024, 256, SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, ++ { "s70fl01gs", INFO(0x010221, 0x4d00, 256 * 1024, 256, 0) }, ++ { "s25sl12800", INFO(0x012018, 0x0300, 256 * 1024, 64, 0) }, ++ { "s25sl12801", INFO(0x012018, 0x0301, 64 * 1024, 256, 0) }, ++- { "s25fl129p0", INFO(0x012018, 0x4d00, 256 * 1024, 64, 0) }, ++- { "s25fl129p1", INFO(0x012018, 0x4d01, 64 * 1024, 256, 0) }, +++ { "s25fl128s", INFO6(0x012018, 0x4d0180, 64 * 1024, 256, SECT_4K | SPI_NOR_QUAD_READ) }, +++ { "s25fl129p0", INFO(0x012018, 0x4d00, 256 * 1024, 64, SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, +++ { "s25fl129p1", INFO(0x012018, 0x4d01, 64 * 1024, 256, SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, ++ { "s25sl004a", INFO(0x010212, 0, 64 * 1024, 8, 0) }, ++ { "s25sl008a", INFO(0x010213, 0, 64 * 1024, 16, 0) }, ++ { "s25sl016a", INFO(0x010214, 0, 64 * 1024, 32, 0) }, ++ { "s25sl032a", INFO(0x010215, 0, 64 * 1024, 64, 0) }, ++ { "s25sl064a", INFO(0x010216, 0, 64 * 1024, 128, 0) }, ++- { "s25fl008k", INFO(0xef4014, 0, 64 * 1024, 16, SECT_4K) }, ++- { "s25fl016k", INFO(0xef4015, 0, 64 * 1024, 32, SECT_4K) }, +++ { "s25fl004k", INFO(0xef4013, 0, 64 * 1024, 8, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, +++ { "s25fl008k", INFO(0xef4014, 0, 64 * 1024, 16, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, +++ { "s25fl016k", INFO(0xef4015, 0, 64 * 1024, 32, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, ++ { "s25fl064k", INFO(0xef4017, 0, 64 * 1024, 128, SECT_4K) }, +++ { "s25fl132k", INFO(0x014016, 0, 64 * 1024, 64, SECT_4K) }, +++ { "s25fl164k", INFO(0x014017, 0, 64 * 1024, 128, SECT_4K) }, +++ { "s25fl204k", INFO(0x014013, 0, 64 * 1024, 8, SECT_4K | SPI_NOR_DUAL_READ) }, ++ ++ /* SST -- large erase sizes are "overlays", "sectors" are 4K */ ++ { "sst25vf040b", INFO(0xbf258d, 0, 64 * 1024, 8, SECT_4K | SST_WRITE) }, ++@@ -576,7 +779,10 @@ static const struct spi_device_id spi_no ++ { "sst25wf512", INFO(0xbf2501, 0, 64 * 1024, 1, SECT_4K | SST_WRITE) }, ++ { "sst25wf010", INFO(0xbf2502, 0, 64 * 1024, 2, SECT_4K | SST_WRITE) }, ++ { "sst25wf020", INFO(0xbf2503, 0, 64 * 1024, 4, SECT_4K | SST_WRITE) }, +++ { "sst25wf020a", INFO(0x621612, 0, 64 * 1024, 4, SECT_4K) }, +++ { "sst25wf040b", INFO(0x621613, 0, 64 * 1024, 8, SECT_4K) }, ++ { "sst25wf040", INFO(0xbf2504, 0, 64 * 1024, 8, SECT_4K | SST_WRITE) }, +++ { "sst25wf080", INFO(0xbf2505, 0, 64 * 1024, 16, SECT_4K | SST_WRITE) }, ++ ++ /* ST Microelectronics -- newer production may have feature updates */ ++ { "m25p05", INFO(0x202010, 0, 32 * 1024, 2, 0) }, ++@@ -588,7 +794,6 @@ static const struct spi_device_id spi_no ++ { "m25p32", INFO(0x202016, 0, 64 * 1024, 64, 0) }, ++ { "m25p64", INFO(0x202017, 0, 64 * 1024, 128, 0) }, ++ { "m25p128", INFO(0x202018, 0, 256 * 1024, 64, 0) }, ++- { "n25q032", INFO(0x20ba16, 0, 64 * 1024, 64, 0) }, ++ ++ { "m25p05-nonjedec", INFO(0, 0, 32 * 1024, 2, 0) }, ++ { "m25p10-nonjedec", INFO(0, 0, 32 * 1024, 4, 0) }, ++@@ -616,6 +821,7 @@ static const struct spi_device_id spi_no ++ { "m25px80", INFO(0x207114, 0, 64 * 1024, 16, 0) }, ++ ++ /* Winbond -- w25x "blocks" are 64K, "sectors" are 4KiB */ +++ { "w25x05", INFO(0xef3010, 0, 64 * 1024, 1, SECT_4K) }, ++ { "w25x10", INFO(0xef3011, 0, 64 * 1024, 2, SECT_4K) }, ++ { "w25x20", INFO(0xef3012, 0, 64 * 1024, 4, SECT_4K) }, ++ { "w25x40", INFO(0xef3013, 0, 64 * 1024, 8, SECT_4K) }, ++@@ -623,9 +829,11 @@ static const struct spi_device_id spi_no ++ { "w25x16", INFO(0xef3015, 0, 64 * 1024, 32, SECT_4K) }, ++ { "w25x32", INFO(0xef3016, 0, 64 * 1024, 64, SECT_4K) }, ++ { "w25q32", INFO(0xef4016, 0, 64 * 1024, 64, SECT_4K) }, ++- { "w25q32dw", INFO(0xef6016, 0, 64 * 1024, 64, SECT_4K) }, +++ { "w25q32dw", INFO(0xef6016, 0, 64 * 1024, 64, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, ++ { "w25x64", INFO(0xef3017, 0, 64 * 1024, 128, SECT_4K) }, ++ { "w25q64", INFO(0xef4017, 0, 64 * 1024, 128, SECT_4K) }, +++ { "w25q64dw", INFO(0xef6017, 0, 64 * 1024, 128, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, +++ { "w25q128fw", INFO(0xef6018, 0, 64 * 1024, 256, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, ++ { "w25q80", INFO(0xef5014, 0, 64 * 1024, 16, SECT_4K) }, ++ { "w25q80bl", INFO(0xef4014, 0, 64 * 1024, 16, SECT_4K) }, ++ { "w25q128", INFO(0xef4018, 0, 64 * 1024, 256, SECT_4K) }, ++@@ -640,35 +848,27 @@ static const struct spi_device_id spi_no ++ { }, ++ }; ++ ++-static const struct spi_device_id *spi_nor_read_id(struct spi_nor *nor) +++static const struct flash_info *spi_nor_read_id(struct spi_nor *nor) ++ { ++ int tmp; ++- u8 id[5]; ++- u32 jedec; ++- u16 ext_jedec; ++- struct flash_info *info; +++ u8 id[SPI_NOR_MAX_ID_LEN]; +++ const struct flash_info *info; ++ ++- tmp = nor->read_reg(nor, SPINOR_OP_RDID, id, 5); +++ tmp = nor->read_reg(nor, SPINOR_OP_RDID, id, SPI_NOR_MAX_ID_LEN); ++ if (tmp < 0) { ++ dev_dbg(nor->dev, " error %d reading JEDEC ID\n", tmp); ++ return ERR_PTR(tmp); ++ } ++- jedec = id[0]; ++- jedec = jedec << 8; ++- jedec |= id[1]; ++- jedec = jedec << 8; ++- jedec |= id[2]; ++- ++- ext_jedec = id[3] << 8 | id[4]; ++ ++ for (tmp = 0; tmp < ARRAY_SIZE(spi_nor_ids) - 1; tmp++) { ++- info = (void *)spi_nor_ids[tmp].driver_data; ++- if (info->jedec_id == jedec) { ++- if (info->ext_id == 0 || info->ext_id == ext_jedec) +++ info = &spi_nor_ids[tmp]; +++ if (info->id_len) { +++ if (!memcmp(info->id, id, info->id_len)) ++ return &spi_nor_ids[tmp]; ++ } ++ } ++- dev_err(nor->dev, "unrecognized JEDEC id %06x\n", jedec); +++ dev_err(nor->dev, "unrecognized JEDEC id bytes: %02x, %2x, %2x\n", +++ id[0], id[1], id[2]); ++ return ERR_PTR(-ENODEV); ++ } ++ ++@@ -703,11 +903,6 @@ static int sst_write(struct mtd_info *mt ++ if (ret) ++ return ret; ++ ++- /* Wait until finished previous write command. */ ++- ret = wait_till_ready(nor); ++- if (ret) ++- goto time_out; ++- ++ write_enable(nor); ++ ++ nor->sst_write_second = false; ++@@ -719,7 +914,7 @@ static int sst_write(struct mtd_info *mt ++ ++ /* write one byte. */ ++ nor->write(nor, to, 1, retlen, buf); ++- ret = wait_till_ready(nor); +++ ret = spi_nor_wait_till_ready(nor); ++ if (ret) ++ goto time_out; ++ } ++@@ -731,7 +926,7 @@ static int sst_write(struct mtd_info *mt ++ ++ /* write two bytes. */ ++ nor->write(nor, to, 2, retlen, buf + actual); ++- ret = wait_till_ready(nor); +++ ret = spi_nor_wait_till_ready(nor); ++ if (ret) ++ goto time_out; ++ to += 2; ++@@ -740,7 +935,7 @@ static int sst_write(struct mtd_info *mt ++ nor->sst_write_second = false; ++ ++ write_disable(nor); ++- ret = wait_till_ready(nor); +++ ret = spi_nor_wait_till_ready(nor); ++ if (ret) ++ goto time_out; ++ ++@@ -751,7 +946,7 @@ static int sst_write(struct mtd_info *mt ++ nor->program_opcode = SPINOR_OP_BP; ++ nor->write(nor, to, 1, retlen, buf + actual); ++ ++- ret = wait_till_ready(nor); +++ ret = spi_nor_wait_till_ready(nor); ++ if (ret) ++ goto time_out; ++ write_disable(nor); ++@@ -779,11 +974,6 @@ static int spi_nor_write(struct mtd_info ++ if (ret) ++ return ret; ++ ++- /* Wait until finished previous write command. */ ++- ret = wait_till_ready(nor); ++- if (ret) ++- goto write_err; ++- ++ write_enable(nor); ++ ++ page_offset = to & (nor->page_size - 1); ++@@ -802,16 +992,20 @@ static int spi_nor_write(struct mtd_info ++ if (page_size > nor->page_size) ++ page_size = nor->page_size; ++ ++- wait_till_ready(nor); +++ ret = spi_nor_wait_till_ready(nor); +++ if (ret) +++ goto write_err; +++ ++ write_enable(nor); ++ ++ nor->write(nor, to + i, page_size, retlen, buf + i); ++ } ++ } ++ +++ ret = spi_nor_wait_till_ready(nor); ++ write_err: ++ spi_nor_unlock_and_unprep(nor, SPI_NOR_OPS_WRITE); ++- return 0; +++ return ret; ++ } ++ ++ static int macronix_quad_enable(struct spi_nor *nor) ++@@ -821,10 +1015,9 @@ static int macronix_quad_enable(struct s ++ val = read_sr(nor); ++ write_enable(nor); ++ ++- nor->cmd_buf[0] = val | SR_QUAD_EN_MX; ++- nor->write_reg(nor, SPINOR_OP_WRSR, nor->cmd_buf, 1, 0); +++ write_sr(nor, val | SR_QUAD_EN_MX); ++ ++- if (wait_till_ready(nor)) +++ if (spi_nor_wait_till_ready(nor)) ++ return 1; ++ ++ ret = read_sr(nor); ++@@ -847,7 +1040,7 @@ static int write_sr_cr(struct spi_nor *n ++ nor->cmd_buf[0] = val & 0xff; ++ nor->cmd_buf[1] = (val >> 8); ++ ++- return nor->write_reg(nor, SPINOR_OP_WRSR, nor->cmd_buf, 2, 0); +++ return nor->write_reg(nor, SPINOR_OP_WRSR, nor->cmd_buf, 2); ++ } ++ ++ static int spansion_quad_enable(struct spi_nor *nor) ++@@ -874,18 +1067,20 @@ static int spansion_quad_enable(struct s ++ return 0; ++ } ++ ++-static int set_quad_mode(struct spi_nor *nor, u32 jedec_id) +++static int set_quad_mode(struct spi_nor *nor, const struct flash_info *info) ++ { ++ int status; ++ ++- switch (JEDEC_MFR(jedec_id)) { ++- case CFI_MFR_MACRONIX: +++ switch (JEDEC_MFR(info)) { +++ case SNOR_MFR_MACRONIX: ++ status = macronix_quad_enable(nor); ++ if (status) { ++ dev_err(nor->dev, "Macronix quad-read not enabled\n"); ++ return -EINVAL; ++ } ++ return status; +++ case SNOR_MFR_MICRON: +++ return 0; ++ default: ++ status = spansion_quad_enable(nor); ++ if (status) { ++@@ -904,21 +1099,15 @@ static int spi_nor_check(struct spi_nor ++ return -EINVAL; ++ } ++ ++- if (!nor->read_id) ++- nor->read_id = spi_nor_read_id; ++- if (!nor->wait_till_ready) ++- nor->wait_till_ready = spi_nor_wait_till_ready; ++- ++ return 0; ++ } ++ ++ int spi_nor_scan(struct spi_nor *nor, const char *name, enum read_mode mode) ++ { ++- const struct spi_device_id *id = NULL; ++- struct flash_info *info; +++ const struct flash_info *info = NULL; ++ struct device *dev = nor->dev; ++- struct mtd_info *mtd = nor->mtd; ++- struct device_node *np = dev->of_node; +++ struct mtd_info *mtd = &nor->mtd; +++ struct device_node *np = nor->flash_node; ++ int ret; ++ int i; ++ ++@@ -926,19 +1115,25 @@ int spi_nor_scan(struct spi_nor *nor, co ++ if (ret) ++ return ret; ++ ++- id = spi_nor_match_id(name); ++- if (!id) +++ if (name) +++ info = spi_nor_match_id(name); +++ /* Try to auto-detect if chip name wasn't specified or not found */ +++ if (!info) +++ info = spi_nor_read_id(nor); +++ if (IS_ERR_OR_NULL(info)) ++ return -ENOENT; ++ ++- info = (void *)id->driver_data; ++- ++- if (info->jedec_id) { ++- const struct spi_device_id *jid; +++ /* +++ * If caller has specified name of flash model that can normally be +++ * detected using JEDEC, let's verify it. +++ */ +++ if (name && info->id_len) { +++ const struct flash_info *jinfo; ++ ++- jid = nor->read_id(nor); ++- if (IS_ERR(jid)) { ++- return PTR_ERR(jid); ++- } else if (jid != id) { +++ jinfo = spi_nor_read_id(nor); +++ if (IS_ERR(jinfo)) { +++ return PTR_ERR(jinfo); +++ } else if (jinfo != info) { ++ /* ++ * JEDEC knows better, so overwrite platform ID. We ++ * can't trust partitions any longer, but we'll let ++@@ -947,28 +1142,28 @@ int spi_nor_scan(struct spi_nor *nor, co ++ * information, even if it's not 100% accurate. ++ */ ++ dev_warn(dev, "found %s, expected %s\n", ++- jid->name, id->name); ++- id = jid; ++- info = (void *)jid->driver_data; +++ jinfo->name, info->name); +++ info = jinfo; ++ } ++ } ++ ++ mutex_init(&nor->lock); ++ ++ /* ++- * Atmel, SST and Intel/Numonyx serial nor tend to power ++- * up with the software protection bits set +++ * Atmel, SST, Intel/Numonyx, and others serial NOR tend to power up +++ * with the software protection bits set ++ */ ++ ++- if (JEDEC_MFR(info->jedec_id) == CFI_MFR_ATMEL || ++- JEDEC_MFR(info->jedec_id) == CFI_MFR_INTEL || ++- JEDEC_MFR(info->jedec_id) == CFI_MFR_SST) { +++ if (JEDEC_MFR(info) == SNOR_MFR_ATMEL || +++ JEDEC_MFR(info) == SNOR_MFR_INTEL || +++ JEDEC_MFR(info) == SNOR_MFR_SST) { ++ write_enable(nor); ++ write_sr(nor, 0); ++ } ++ ++ if (!mtd->name) ++ mtd->name = dev_name(dev); +++ mtd->priv = nor; ++ mtd->type = MTD_NORFLASH; ++ mtd->writesize = 1; ++ mtd->flags = MTD_CAP_NORFLASH; ++@@ -976,10 +1171,17 @@ int spi_nor_scan(struct spi_nor *nor, co ++ mtd->_erase = spi_nor_erase; ++ mtd->_read = spi_nor_read; ++ ++- /* nor protection support for STmicro chips */ ++- if (JEDEC_MFR(info->jedec_id) == CFI_MFR_ST) { +++ /* NOR protection support for STmicro/Micron chips and similar */ +++ if (JEDEC_MFR(info) == SNOR_MFR_MICRON) { +++ nor->flash_lock = stm_lock; +++ nor->flash_unlock = stm_unlock; +++ nor->flash_is_locked = stm_is_locked; +++ } +++ +++ if (nor->flash_lock && nor->flash_unlock && nor->flash_is_locked) { ++ mtd->_lock = spi_nor_lock; ++ mtd->_unlock = spi_nor_unlock; +++ mtd->_is_locked = spi_nor_is_locked; ++ } ++ ++ /* sst nor chips use AAI word program */ ++@@ -988,9 +1190,8 @@ int spi_nor_scan(struct spi_nor *nor, co ++ else ++ mtd->_write = spi_nor_write; ++ ++- if ((info->flags & USE_FSR) && ++- nor->wait_till_ready == spi_nor_wait_till_ready) ++- nor->wait_till_ready = spi_nor_wait_till_fsr_ready; +++ if (info->flags & USE_FSR) +++ nor->flags |= SNOR_F_USE_FSR; ++ ++ #ifdef CONFIG_MTD_SPI_NOR_USE_4K_SECTORS ++ /* prefer "small sector" erase if possible */ ++@@ -1031,7 +1232,7 @@ int spi_nor_scan(struct spi_nor *nor, co ++ ++ /* Quad/Dual-read mode takes precedence over fast/normal */ ++ if (mode == SPI_NOR_QUAD && info->flags & SPI_NOR_QUAD_READ) { ++- ret = set_quad_mode(nor, info->jedec_id); +++ ret = set_quad_mode(nor, info); ++ if (ret) { ++ dev_err(dev, "quad mode not supported\n"); ++ return ret; ++@@ -1067,7 +1268,7 @@ int spi_nor_scan(struct spi_nor *nor, co ++ else if (mtd->size > 0x1000000) { ++ /* enable 4-byte addressing if the device exceeds 16MiB */ ++ nor->addr_width = 4; ++- if (JEDEC_MFR(info->jedec_id) == CFI_MFR_AMD) { +++ if (JEDEC_MFR(info) == SNOR_MFR_SPANSION) { ++ /* Dedicated 4-byte command set */ ++ switch (nor->flash_read) { ++ case SPI_NOR_QUAD: ++@@ -1088,14 +1289,14 @@ int spi_nor_scan(struct spi_nor *nor, co ++ nor->erase_opcode = SPINOR_OP_SE_4B; ++ mtd->erasesize = info->sector_size; ++ } else ++- set_4byte(nor, info->jedec_id, 1); +++ set_4byte(nor, info, 1); ++ } else { ++ nor->addr_width = 3; ++ } ++ ++ nor->read_dummy = spi_nor_read_dummy_cycles(nor); ++ ++- dev_info(dev, "%s (%lld Kbytes)\n", id->name, +++ dev_info(dev, "%s (%lld Kbytes)\n", info->name, ++ (long long)mtd->size >> 10); ++ ++ dev_dbg(dev, ++@@ -1118,11 +1319,11 @@ int spi_nor_scan(struct spi_nor *nor, co ++ } ++ EXPORT_SYMBOL_GPL(spi_nor_scan); ++ ++-static const struct spi_device_id *spi_nor_match_id(const char *name) +++static const struct flash_info *spi_nor_match_id(const char *name) ++ { ++- const struct spi_device_id *id = spi_nor_ids; +++ const struct flash_info *id = spi_nor_ids; ++ ++- while (id->name[0]) { +++ while (id->name) { ++ if (!strcmp(name, id->name)) ++ return id; ++ id++; ++--- a/include/linux/mtd/spi-nor.h +++++ b/include/linux/mtd/spi-nor.h ++@@ -10,6 +10,23 @@ ++ #ifndef __LINUX_MTD_SPI_NOR_H ++ #define __LINUX_MTD_SPI_NOR_H ++ +++#include +++#include +++ +++/* +++ * Manufacturer IDs +++ * +++ * The first byte returned from the flash after sending opcode SPINOR_OP_RDID. +++ * Sometimes these are the same as CFI IDs, but sometimes they aren't. +++ */ +++#define SNOR_MFR_ATMEL CFI_MFR_ATMEL +++#define SNOR_MFR_INTEL CFI_MFR_INTEL +++#define SNOR_MFR_MICRON CFI_MFR_ST /* ST Micro <--> Micron */ +++#define SNOR_MFR_MACRONIX CFI_MFR_MACRONIX +++#define SNOR_MFR_SPANSION CFI_MFR_AMD +++#define SNOR_MFR_SST CFI_MFR_SST +++#define SNOR_MFR_WINBOND 0xef /* Also used by some Spansion */ +++ ++ /* ++ * Note on opcode nomenclature: some opcodes have a format like ++ * SPINOR_OP_FUNCTION{4,}_x_y_z. The numbers x, y, and z stand for the number ++@@ -56,22 +73,29 @@ ++ /* Used for Spansion flashes only. */ ++ #define SPINOR_OP_BRWR 0x17 /* Bank register write */ ++ +++/* Used for Micron flashes only. */ +++#define SPINOR_OP_RD_EVCR 0x65 /* Read EVCR register */ +++#define SPINOR_OP_WD_EVCR 0x61 /* Write EVCR register */ +++ ++ /* Status Register bits. */ ++-#define SR_WIP 1 /* Write in progress */ ++-#define SR_WEL 2 /* Write enable latch */ +++#define SR_WIP BIT(0) /* Write in progress */ +++#define SR_WEL BIT(1) /* Write enable latch */ ++ /* meaning of other SR_* bits may differ between vendors */ ++-#define SR_BP0 4 /* Block protect 0 */ ++-#define SR_BP1 8 /* Block protect 1 */ ++-#define SR_BP2 0x10 /* Block protect 2 */ ++-#define SR_SRWD 0x80 /* SR write protect */ +++#define SR_BP0 BIT(2) /* Block protect 0 */ +++#define SR_BP1 BIT(3) /* Block protect 1 */ +++#define SR_BP2 BIT(4) /* Block protect 2 */ +++#define SR_SRWD BIT(7) /* SR write protect */ +++ +++#define SR_QUAD_EN_MX BIT(6) /* Macronix Quad I/O */ ++ ++-#define SR_QUAD_EN_MX 0x40 /* Macronix Quad I/O */ +++/* Enhanced Volatile Configuration Register bits */ +++#define EVCR_QUAD_EN_MICRON BIT(7) /* Micron Quad I/O */ ++ ++ /* Flag Status Register bits */ ++-#define FSR_READY 0x80 +++#define FSR_READY BIT(7) ++ ++ /* Configuration Register bits. */ ++-#define CR_QUAD_EN_SPAN 0x2 /* Spansion Quad I/O */ +++#define CR_QUAD_EN_SPAN BIT(1) /* Spansion Quad I/O */ ++ ++ enum read_mode { ++ SPI_NOR_NORMAL = 0, ++@@ -80,33 +104,6 @@ enum read_mode { ++ SPI_NOR_QUAD, ++ }; ++ ++-/** ++- * struct spi_nor_xfer_cfg - Structure for defining a Serial Flash transfer ++- * @wren: command for "Write Enable", or 0x00 for not required ++- * @cmd: command for operation ++- * @cmd_pins: number of pins to send @cmd (1, 2, 4) ++- * @addr: address for operation ++- * @addr_pins: number of pins to send @addr (1, 2, 4) ++- * @addr_width: number of address bytes ++- * (3,4, or 0 for address not required) ++- * @mode: mode data ++- * @mode_pins: number of pins to send @mode (1, 2, 4) ++- * @mode_cycles: number of mode cycles (0 for mode not required) ++- * @dummy_cycles: number of dummy cycles (0 for dummy not required) ++- */ ++-struct spi_nor_xfer_cfg { ++- u8 wren; ++- u8 cmd; ++- u8 cmd_pins; ++- u32 addr; ++- u8 addr_pins; ++- u8 addr_width; ++- u8 mode; ++- u8 mode_pins; ++- u8 mode_cycles; ++- u8 dummy_cycles; ++-}; ++- ++ #define SPI_NOR_MAX_CMD_SIZE 8 ++ enum spi_nor_ops { ++ SPI_NOR_OPS_READ = 0, ++@@ -116,11 +113,18 @@ enum spi_nor_ops { ++ SPI_NOR_OPS_UNLOCK, ++ }; ++ +++enum spi_nor_option_flags { +++ SNOR_F_USE_FSR = BIT(0), +++}; +++ +++struct mtd_info; +++ ++ /** ++ * struct spi_nor - Structure for defining a the SPI NOR layer ++ * @mtd: point to a mtd_info structure ++ * @lock: the lock for the read/write/erase/lock/unlock operations ++ * @dev: point to a spi device, or a spi nor controller device. +++ * @flash_node: point to a device node describing this flash instance. ++ * @page_size: the page size of the SPI NOR ++ * @addr_width: number of address bytes ++ * @erase_opcode: the opcode for erasing a sector ++@@ -129,29 +133,29 @@ enum spi_nor_ops { ++ * @program_opcode: the program opcode ++ * @flash_read: the mode of the read ++ * @sst_write_second: used by the SST write operation ++- * @cfg: used by the read_xfer/write_xfer +++ * @flags: flag options for the current SPI-NOR (SNOR_F_*) ++ * @cmd_buf: used by the write_reg ++ * @prepare: [OPTIONAL] do some preparations for the ++ * read/write/erase/lock/unlock operations ++ * @unprepare: [OPTIONAL] do some post work after the ++ * read/write/erase/lock/unlock operations ++- * @read_xfer: [OPTIONAL] the read fundamental primitive ++- * @write_xfer: [OPTIONAL] the writefundamental primitive ++ * @read_reg: [DRIVER-SPECIFIC] read out the register ++ * @write_reg: [DRIVER-SPECIFIC] write data to the register ++- * @read_id: [REPLACEABLE] read out the ID data, and find ++- * the proper spi_device_id ++- * @wait_till_ready: [REPLACEABLE] wait till the NOR becomes ready ++ * @read: [DRIVER-SPECIFIC] read data from the SPI NOR ++ * @write: [DRIVER-SPECIFIC] write data to the SPI NOR ++ * @erase: [DRIVER-SPECIFIC] erase a sector of the SPI NOR ++ * at the offset @offs +++ * @flash_lock: [FLASH-SPECIFIC] lock a region of the SPI NOR +++ * @flash_unlock: [FLASH-SPECIFIC] unlock a region of the SPI NOR +++ * @flash_is_locked: [FLASH-SPECIFIC] check if a region of the SPI NOR is +++ * completely locked ++ * @priv: the private data ++ */ ++ struct spi_nor { ++- struct mtd_info *mtd; +++ struct mtd_info mtd; ++ struct mutex lock; ++ struct device *dev; +++ struct device_node *flash_node; ++ u32 page_size; ++ u8 addr_width; ++ u8 erase_opcode; ++@@ -160,20 +164,13 @@ struct spi_nor { ++ u8 program_opcode; ++ enum read_mode flash_read; ++ bool sst_write_second; ++- struct spi_nor_xfer_cfg cfg; +++ u32 flags; ++ u8 cmd_buf[SPI_NOR_MAX_CMD_SIZE]; ++ ++ int (*prepare)(struct spi_nor *nor, enum spi_nor_ops ops); ++ void (*unprepare)(struct spi_nor *nor, enum spi_nor_ops ops); ++- int (*read_xfer)(struct spi_nor *nor, struct spi_nor_xfer_cfg *cfg, ++- u8 *buf, size_t len); ++- int (*write_xfer)(struct spi_nor *nor, struct spi_nor_xfer_cfg *cfg, ++- u8 *buf, size_t len); ++ int (*read_reg)(struct spi_nor *nor, u8 opcode, u8 *buf, int len); ++- int (*write_reg)(struct spi_nor *nor, u8 opcode, u8 *buf, int len, ++- int write_enable); ++- const struct spi_device_id *(*read_id)(struct spi_nor *nor); ++- int (*wait_till_ready)(struct spi_nor *nor); +++ int (*write_reg)(struct spi_nor *nor, u8 opcode, u8 *buf, int len); ++ ++ int (*read)(struct spi_nor *nor, loff_t from, ++ size_t len, size_t *retlen, u_char *read_buf); ++@@ -181,6 +178,10 @@ struct spi_nor { ++ size_t len, size_t *retlen, const u_char *write_buf); ++ int (*erase)(struct spi_nor *nor, loff_t offs); ++ +++ int (*flash_lock)(struct spi_nor *nor, loff_t ofs, uint64_t len); +++ int (*flash_unlock)(struct spi_nor *nor, loff_t ofs, uint64_t len); +++ int (*flash_is_locked)(struct spi_nor *nor, loff_t ofs, uint64_t len); +++ ++ void *priv; ++ }; ++ +diff --git a/target/linux/generic/patches-3.18/462-m25p80-mx-disable-software-protection.patch b/target/linux/generic/patches-3.18/462-m25p80-mx-disable-software-protection.patch +index fef483a..eb99609 100644 +--- a/target/linux/generic/patches-3.18/462-m25p80-mx-disable-software-protection.patch ++++ b/target/linux/generic/patches-3.18/462-m25p80-mx-disable-software-protection.patch +@@ -1,10 +1,14 @@ ++Disable software protection bits for Macronix flashes. ++ ++Signed-off-by: Felix Fietkau ++ + --- a/drivers/mtd/spi-nor/spi-nor.c + +++ b/drivers/mtd/spi-nor/spi-nor.c +-@@ -963,6 +963,7 @@ int spi_nor_scan(struct spi_nor *nor, co ++@@ -1164,6 +1164,7 @@ int spi_nor_scan(struct spi_nor *nor, co + +- if (JEDEC_MFR(info->jedec_id) == CFI_MFR_ATMEL || +- JEDEC_MFR(info->jedec_id) == CFI_MFR_INTEL || +-+ JEDEC_MFR(info->jedec_id) == CFI_MFR_MACRONIX || +- JEDEC_MFR(info->jedec_id) == CFI_MFR_SST) { ++ if (JEDEC_MFR(info) == SNOR_MFR_ATMEL || ++ JEDEC_MFR(info) == SNOR_MFR_INTEL || +++ JEDEC_MFR(info) == SNOR_MFR_MACRONIX || ++ JEDEC_MFR(info) == SNOR_MFR_SST) { + write_enable(nor); + write_sr(nor, 0); +diff --git a/target/linux/generic/patches-3.18/472-mtd-m25p80-add-support-for-Winbond-W25X05-flash.patch b/target/linux/generic/patches-3.18/472-mtd-m25p80-add-support-for-Winbond-W25X05-flash.patch +deleted file mode 100644 +index dca6895..0000000 +--- a/target/linux/generic/patches-3.18/472-mtd-m25p80-add-support-for-Winbond-W25X05-flash.patch ++++ /dev/null +@@ -1,20 +0,0 @@ +-From eef9dfc4e821408af1af13aa0cc707fc496fb7c6 Mon Sep 17 00:00:00 2001 +-From: Gabor Juhos +-Date: Wed, 11 Dec 2013 19:05:59 +0100 +-Subject: [PATCH] m25p80: add support for the Winbond W25X05 flash +- +-Signed-off-by: Gabor Juhos +---- +- drivers/mtd/devices/m25p80.c | 1 + +- 1 file changed, 1 insertion(+) +- +---- a/drivers/mtd/spi-nor/spi-nor.c +-+++ b/drivers/mtd/spi-nor/spi-nor.c +-@@ -617,6 +617,7 @@ static const struct spi_device_id spi_no +- { "m25px80", INFO(0x207114, 0, 64 * 1024, 16, 0) }, +- +- /* Winbond -- w25x "blocks" are 64K, "sectors" are 4KiB */ +-+ { "w25x05", INFO(0xef3010, 0, 64 * 1024, 1, SECT_4K) }, +- { "w25x10", INFO(0xef3011, 0, 64 * 1024, 2, SECT_4K) }, +- { "w25x20", INFO(0xef3012, 0, 64 * 1024, 4, SECT_4K) }, +- { "w25x40", INFO(0xef3013, 0, 64 * 1024, 8, SECT_4K) }, +diff --git a/target/linux/generic/patches-3.18/473-mtd-spi-nor-add-support-for-the-Macronix-MX25L512E-S.patch b/target/linux/generic/patches-3.18/473-mtd-spi-nor-add-support-for-the-Macronix-MX25L512E-S.patch +deleted file mode 100644 +index 9ba7a4a..0000000 +--- a/target/linux/generic/patches-3.18/473-mtd-spi-nor-add-support-for-the-Macronix-MX25L512E-S.patch ++++ /dev/null +@@ -1,21 +0,0 @@ +-From 0d7388de0911c1a4fc4a8a3898ef9d0ab818ca08 Mon Sep 17 00:00:00 2001 +-From: Gabor Juhos +-Date: Tue, 7 Apr 2015 18:35:15 +0200 +-Subject: [PATCH] mtd: spi-nor: add support for the Macronix MX25L512E SPI +- flash chip +- +-Signed-off-by: Gabor Juhos +---- +- drivers/mtd/spi-nor/spi-nor.c | 1 + +- 1 file changed, 1 insertion(+) +- +---- a/drivers/mtd/spi-nor/spi-nor.c +-+++ b/drivers/mtd/spi-nor/spi-nor.c +-@@ -518,6 +518,7 @@ static const struct spi_device_id spi_no +- { "640s33b", INFO(0x898913, 0, 64 * 1024, 128, 0) }, +- +- /* Macronix */ +-+ { "mx25l512e", INFO(0xc22010, 0, 64 * 1024, 1, SECT_4K) }, +- { "mx25l2005a", INFO(0xc22012, 0, 64 * 1024, 4, SECT_4K) }, +- { "mx25l4005a", INFO(0xc22013, 0, 64 * 1024, 8, SECT_4K) }, +- { "mx25l8005", INFO(0xc22014, 0, 64 * 1024, 16, 0) }, +diff --git a/target/linux/generic/patches-3.18/474-mtd-spi-nor-add-support-for-the-ISSI-SI25CD512-SPI-f.patch b/target/linux/generic/patches-3.18/474-mtd-spi-nor-add-support-for-the-ISSI-SI25CD512-SPI-f.patch +deleted file mode 100644 +index b06ac73..0000000 +--- a/target/linux/generic/patches-3.18/474-mtd-spi-nor-add-support-for-the-ISSI-SI25CD512-SPI-f.patch ++++ /dev/null +@@ -1,22 +0,0 @@ +-From 34e2b403040a2f9d3ba071d95a7f42457e2950f9 Mon Sep 17 00:00:00 2001 +-From: Gabor Juhos +-Date: Tue, 7 Apr 2015 18:35:15 +0200 +-Subject: [PATCH] mtd: spi-nor: add support for the ISSI SI25CD512 SPI flash +- +-Signed-off-by: Gabor Juhos +---- +- drivers/mtd/spi-nor/spi-nor.c | 3 +++ +- 1 file changed, 3 insertions(+) +- +---- a/drivers/mtd/spi-nor/spi-nor.c +-+++ b/drivers/mtd/spi-nor/spi-nor.c +-@@ -517,6 +517,9 @@ static const struct spi_device_id spi_no +- { "320s33b", INFO(0x898912, 0, 64 * 1024, 64, 0) }, +- { "640s33b", INFO(0x898913, 0, 64 * 1024, 128, 0) }, +- +-+ /* ISSI */ +-+ { "is25cd512", INFO(0x7f9d20, 0, 32 * 1024, 2, SECT_4K) }, +-+ +- /* Macronix */ +- { "mx25l512e", INFO(0xc22010, 0, 64 * 1024, 1, SECT_4K) }, +- { "mx25l2005a", INFO(0xc22012, 0, 64 * 1024, 4, SECT_4K) }, +diff --git a/target/linux/lantiq/patches-3.18/0022-MTD-m25p80-allow-loading-mtd-name-from-OF.patch b/target/linux/lantiq/patches-3.18/0022-MTD-m25p80-allow-loading-mtd-name-from-OF.patch +deleted file mode 100644 +index 203eb94..0000000 +--- a/target/linux/lantiq/patches-3.18/0022-MTD-m25p80-allow-loading-mtd-name-from-OF.patch ++++ /dev/null +@@ -1,44 +0,0 @@ +-From 4400e1f593ea40a51912128adb4f53d59e62cad8 Mon Sep 17 00:00:00 2001 +-From: John Crispin +-Date: Wed, 10 Sep 2014 22:40:18 +0200 +-Subject: [PATCH 22/36] MTD: m25p80: allow loading mtd name from OF +- +-In accordance with the physmap flash we should honour the linux,mtd-name +-property when deciding what name the mtd device has. +- +-Signed-off-by: Thomas Langer +-Signed-off-by: John Crispin +---- +- drivers/mtd/devices/m25p80.c | 6 ++++++ +- 1 file changed, 6 insertions(+) +- +---- a/drivers/mtd/devices/m25p80.c +-+++ b/drivers/mtd/devices/m25p80.c +-@@ -19,6 +19,7 @@ +- #include +- #include +- #include +-+#include +- +- #include +- #include +-@@ -198,6 +199,10 @@ static int m25p_probe(struct spi_device +- enum read_mode mode = SPI_NOR_NORMAL; +- char *flash_name = NULL; +- int ret; +-+ const char __maybe_unused *of_mtd_name = NULL; +-+ +-+ of_property_read_string(spi->dev.of_node, +-+ "linux,mtd-name", &of_mtd_name); +- +- data = dev_get_platdata(&spi->dev); +- +-@@ -229,6 +234,8 @@ static int m25p_probe(struct spi_device +- +- if (data && data->name) +- flash->mtd.name = data->name; +-+ else if (of_mtd_name) +-+ flash->mtd.name = of_mtd_name; +- +- /* For some (historical?) reason many platforms provide two different +- * names in flash_platform_data: "name" and "type". Quite often name is +diff --git a/target/linux/mpc85xx/files/arch/powerpc/boot/dts/tl-wdr4900-v1.dts b/target/linux/mpc85xx/files/arch/powerpc/boot/dts/tl-wdr4900-v1.dts +index 2beb39c..21f823d 100644 +--- a/target/linux/mpc85xx/files/arch/powerpc/boot/dts/tl-wdr4900-v1.dts ++++ b/target/linux/mpc85xx/files/arch/powerpc/boot/dts/tl-wdr4900-v1.dts +@@ -37,7 +37,7 @@ + flash@0 { + #address-cells = <1>; + #size-cells = <1>; +- compatible = "spansion,s25fl129p1"; ++ compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <25000000>; + +diff --git a/target/linux/ramips/patches-3.18/0044-mtd-add-chunked-read-io-to-m25p80.patch b/target/linux/ramips/patches-3.18/0044-mtd-add-chunked-read-io-to-m25p80.patch +deleted file mode 100644 +index 1716e1c..0000000 +--- a/target/linux/ramips/patches-3.18/0044-mtd-add-chunked-read-io-to-m25p80.patch ++++ /dev/null +@@ -1,103 +0,0 @@ +---- a/drivers/mtd/devices/m25p80.c +-+++ b/drivers/mtd/devices/m25p80.c +-@@ -19,6 +19,7 @@ +- #include +- #include +- #include +-+#include +- +- #include +- #include +-@@ -32,6 +33,7 @@ struct m25p { +- struct spi_device *spi; +- struct spi_nor spi_nor; +- struct mtd_info mtd; +-+ u16 chunk_size; +- u8 command[MAX_CMD_SIZE]; +- }; +- +-@@ -157,6 +159,61 @@ static int m25p80_read(struct spi_nor *n +- return 0; +- } +- +-+static void m25p80_chunked_write(struct spi_nor *nor, loff_t _from, size_t _len, +-+ size_t *_retlen, const u_char *_buf) +-+{ +-+ struct m25p *flash = nor->priv; +-+ int chunk_size; +-+ int retlen = 0; +-+ +-+ chunk_size = flash->chunk_size; +-+ if (!chunk_size) +-+ chunk_size = _len; +-+ +-+ if (nor->addr_width > 3) +-+ chunk_size -= nor->addr_width - 3; +-+ +-+ while (retlen < _len) { +-+ size_t len = min_t(int, chunk_size, _len - retlen); +-+ const u_char *buf = _buf + retlen; +-+ loff_t from = _from + retlen; +-+ +-+ nor->wait_till_ready(nor); +-+ nor->write_reg(nor, SPINOR_OP_WREN, NULL, 0, 0); +-+ +-+ m25p80_write(nor, from, len, &retlen, buf); +-+ } +-+ *_retlen += retlen; +-+} +-+ +-+static int m25p80_chunked_read(struct spi_nor *nor, loff_t _from, size_t _len, +-+ size_t *_retlen, u_char *_buf) +-+{ +-+ struct m25p *flash = nor->priv; +-+ int chunk_size; +-+ +-+ chunk_size = flash->chunk_size; +-+ if (!chunk_size) +-+ chunk_size = _len; +-+ +-+ *_retlen = 0; +-+ +-+ while (*_retlen < _len) { +-+ size_t len = min_t(int, chunk_size, _len - *_retlen); +-+ u_char *buf = _buf + *_retlen; +-+ loff_t from = _from + *_retlen; +-+ int retlen = 0; +-+ int ret = m25p80_read(nor, from, len, &retlen, buf); +-+ +-+ if (ret) +-+ return ret; +-+ +-+ *_retlen += retlen; +-+ } +-+ +-+ return 0; +-+} +-+ +- static int m25p80_erase(struct spi_nor *nor, loff_t offset) +- { +- struct m25p *flash = nor->priv; +-@@ -197,6 +254,7 @@ static int m25p_probe(struct spi_device +- struct spi_nor *nor; +- enum read_mode mode = SPI_NOR_NORMAL; +- char *flash_name = NULL; +-+ u32 val; +- int ret; +- +- data = dev_get_platdata(&spi->dev); +-@@ -244,6 +302,14 @@ static int m25p_probe(struct spi_device +- if (ret) +- return ret; +- +-+ if (spi->dev.of_node && +-+ !of_property_read_u32(spi->dev.of_node, "m25p,chunked-io", &val)) { +-+ dev_warn(&spi->dev, "using chunked io\n"); +-+ nor->read = m25p80_chunked_read; +-+ nor->write = m25p80_chunked_write; +-+ flash->chunk_size = val; +-+ } +-+ +- ppdata.of_node = spi->dev.of_node; +- +- return mtd_device_parse_register(&flash->mtd, NULL, &ppdata, diff --git a/patches/openwrt/0031-kernel-mtd-spi-nor-wait-until-status-register-writes-are-ready.patch b/patches/openwrt/0031-kernel-mtd-spi-nor-wait-until-status-register-writes-are-ready.patch new file mode 100644 index 00000000..f90f9c61 --- /dev/null +++ b/patches/openwrt/0031-kernel-mtd-spi-nor-wait-until-status-register-writes-are-ready.patch @@ -0,0 +1,115 @@ +From: Matthias Schiffer +Date: Sat, 7 May 2016 00:17:55 +0200 +Subject: kernel: mtd: spi-nor: wait until status register writes are ready + +diff --git a/target/linux/generic/patches-3.18/094-0001-mtd-spi-nor-wait-until-lock-unlock-operations-are-re.patch b/target/linux/generic/patches-3.18/094-0001-mtd-spi-nor-wait-until-lock-unlock-operations-are-re.patch +new file mode 100644 +index 0000000..2c2e5f3 +--- /dev/null ++++ b/target/linux/generic/patches-3.18/094-0001-mtd-spi-nor-wait-until-lock-unlock-operations-are-re.patch +@@ -0,0 +1,66 @@ ++From 32321e950d8a237d7e8f3a9b76220007dfa87544 Mon Sep 17 00:00:00 2001 ++Message-Id: <32321e950d8a237d7e8f3a9b76220007dfa87544.1462572686.git.mschiffer@universe-factory.net> ++From: =?UTF-8?q?Ezequiel=20Garc=C3=ADa?= ++Date: Mon, 28 Dec 2015 17:54:51 -0300 ++Subject: [PATCH] mtd: spi-nor: wait until lock/unlock operations are ready ++ ++On Micron and Numonyx devices, the status register write command ++(WRSR), raises a work-in-progress bit (WIP) on the status register. ++The datasheets for these devices specify that while the status ++register write is in progress, the status register WIP bit can still ++be read to check the end of the operation. ++ ++This commit adds a wait_till_ready call on lock/unlock operations, ++which is required for Micron and Numonyx but should be harmless for ++others. This is needed to prevent applications from issuing erase or ++program operations before the unlock operation is completed. ++ ++Reported-by: Stas Sergeev ++Signed-off-by: Ezequiel Garcia ++Signed-off-by: Brian Norris ++--- ++ drivers/mtd/spi-nor/spi-nor.c | 12 ++++++++++-- ++ 1 file changed, 10 insertions(+), 2 deletions(-) ++ ++--- a/drivers/mtd/spi-nor/spi-nor.c +++++ b/drivers/mtd/spi-nor/spi-nor.c ++@@ -462,6 +462,7 @@ static int stm_lock(struct spi_nor *nor, ++ u8 status_old, status_new; ++ u8 mask = SR_BP2 | SR_BP1 | SR_BP0; ++ u8 shift = ffs(mask) - 1, pow, val; +++ int ret; ++ ++ status_old = read_sr(nor); ++ ++@@ -498,7 +499,10 @@ static int stm_lock(struct spi_nor *nor, ++ return -EINVAL; ++ ++ write_enable(nor); ++- return write_sr(nor, status_new); +++ ret = write_sr(nor, status_new); +++ if (ret) +++ return ret; +++ return spi_nor_wait_till_ready(nor); ++ } ++ ++ /* ++@@ -512,6 +516,7 @@ static int stm_unlock(struct spi_nor *no ++ uint8_t status_old, status_new; ++ u8 mask = SR_BP2 | SR_BP1 | SR_BP0; ++ u8 shift = ffs(mask) - 1, pow, val; +++ int ret; ++ ++ status_old = read_sr(nor); ++ ++@@ -546,7 +551,10 @@ static int stm_unlock(struct spi_nor *no ++ return -EINVAL; ++ ++ write_enable(nor); ++- return write_sr(nor, status_new); +++ ret = write_sr(nor, status_new); +++ if (ret) +++ return ret; +++ return spi_nor_wait_till_ready(nor); ++ } ++ ++ /* +diff --git a/target/linux/generic/patches-3.18/094-0002-mtd-spi-nor-wait-for-SR_WIP-to-clear-on-initial-unlo.patch b/target/linux/generic/patches-3.18/094-0002-mtd-spi-nor-wait-for-SR_WIP-to-clear-on-initial-unlo.patch +new file mode 100644 +index 0000000..a0573d5 +--- /dev/null ++++ b/target/linux/generic/patches-3.18/094-0002-mtd-spi-nor-wait-for-SR_WIP-to-clear-on-initial-unlo.patch +@@ -0,0 +1,33 @@ ++From edf891ef9ab773363f8e58022a26d7d31604aed6 Mon Sep 17 00:00:00 2001 ++Message-Id: ++From: Brian Norris ++Date: Fri, 29 Jan 2016 11:25:30 -0800 ++Subject: [PATCH] mtd: spi-nor: wait for SR_WIP to clear on initial unlock ++ ++Fixup a piece leftover by commit 32321e950d8a ("mtd: spi-nor: wait until ++lock/unlock operations are ready"). That commit made us wait for the WIP ++bit to settle after lock/unlock operations, but it missed the open-coded ++"unlock" that happens at probe() time. ++ ++We should probably have this code utilize the unlock() routines in the ++future, to avoid duplication, but unfortunately, flash which need to be ++unlocked don't all have a proper ->flash_unlock() callback. ++ ++Signed-off-by: Brian Norris ++Cc: Stas Sergeev ++Reviewed-by: Ezequiel Garcia ++Tested-by: Ezequiel Garcia ++--- ++ drivers/mtd/spi-nor/spi-nor.c | 1 + ++ 1 file changed, 1 insertion(+) ++ ++--- a/drivers/mtd/spi-nor/spi-nor.c +++++ b/drivers/mtd/spi-nor/spi-nor.c ++@@ -1167,6 +1167,7 @@ int spi_nor_scan(struct spi_nor *nor, co ++ JEDEC_MFR(info) == SNOR_MFR_SST) { ++ write_enable(nor); ++ write_sr(nor, 0); +++ spi_nor_wait_till_ready(nor); ++ } ++ ++ if (!mtd->name) diff --git a/patches/openwrt/0032-kernel-mtd-spi-nor-unlock-Winbond-flashs.patch b/patches/openwrt/0032-kernel-mtd-spi-nor-unlock-Winbond-flashs.patch new file mode 100644 index 00000000..655f9ab1 --- /dev/null +++ b/patches/openwrt/0032-kernel-mtd-spi-nor-unlock-Winbond-flashs.patch @@ -0,0 +1,56 @@ +From: Matthias Schiffer +Date: Sat, 7 May 2016 00:29:06 +0200 +Subject: kernel: mtd: spi-nor: unlock Winbond flashs + +diff --git a/target/linux/generic/patches-3.18/463-Revert-mtd-spi-nor-fix-Spansion-regressions-aliased-.patch b/target/linux/generic/patches-3.18/463-Revert-mtd-spi-nor-fix-Spansion-regressions-aliased-.patch +new file mode 100644 +index 0000000..4682b7a +--- /dev/null ++++ b/target/linux/generic/patches-3.18/463-Revert-mtd-spi-nor-fix-Spansion-regressions-aliased-.patch +@@ -0,0 +1,46 @@ ++From 20bbd73b6b04677a73933830363ab3178adc2ce9 Mon Sep 17 00:00:00 2001 ++Message-Id: <20bbd73b6b04677a73933830363ab3178adc2ce9.1462573588.git.mschiffer@universe-factory.net> ++From: Matthias Schiffer ++Date: Sat, 7 May 2016 00:26:23 +0200 ++Subject: [PATCH] Revert "mtd: spi-nor: fix Spansion regressions (aliased with ++ Winbond)" ++ ++This reverts commit 67b9bcd36906e12a15ffec19463afbbd6a41660e. ++--- ++ drivers/mtd/spi-nor/spi-nor.c | 6 ++++-- ++ include/linux/mtd/spi-nor.h | 2 +- ++ 2 files changed, 5 insertions(+), 3 deletions(-) ++ ++--- a/drivers/mtd/spi-nor/spi-nor.c +++++ b/drivers/mtd/spi-nor/spi-nor.c ++@@ -1165,7 +1165,8 @@ int spi_nor_scan(struct spi_nor *nor, co ++ if (JEDEC_MFR(info) == SNOR_MFR_ATMEL || ++ JEDEC_MFR(info) == SNOR_MFR_INTEL || ++ JEDEC_MFR(info) == SNOR_MFR_MACRONIX || ++- JEDEC_MFR(info) == SNOR_MFR_SST) { +++ JEDEC_MFR(info) == SNOR_MFR_SST || +++ JEDEC_MFR(info) == SNOR_MFR_WINBOND) { ++ write_enable(nor); ++ write_sr(nor, 0); ++ spi_nor_wait_till_ready(nor); ++@@ -1182,7 +1183,8 @@ int spi_nor_scan(struct spi_nor *nor, co ++ mtd->_read = spi_nor_read; ++ ++ /* NOR protection support for STmicro/Micron chips and similar */ ++- if (JEDEC_MFR(info) == SNOR_MFR_MICRON) { +++ if (JEDEC_MFR(info) == SNOR_MFR_MICRON || +++ JEDEC_MFR(info) == SNOR_MFR_WINBOND) { ++ nor->flash_lock = stm_lock; ++ nor->flash_unlock = stm_unlock; ++ nor->flash_is_locked = stm_is_locked; ++--- a/include/linux/mtd/spi-nor.h +++++ b/include/linux/mtd/spi-nor.h ++@@ -25,7 +25,7 @@ ++ #define SNOR_MFR_MACRONIX CFI_MFR_MACRONIX ++ #define SNOR_MFR_SPANSION CFI_MFR_AMD ++ #define SNOR_MFR_SST CFI_MFR_SST ++-#define SNOR_MFR_WINBOND 0xef /* Also used by some Spansion */ +++#define SNOR_MFR_WINBOND 0xef ++ ++ /* ++ * Note on opcode nomenclature: some opcodes have a format like diff --git a/patches/openwrt/0033-tools-pkg-config-fix-build-with-GCC-6.patch b/patches/openwrt/0033-tools-pkg-config-fix-build-with-GCC-6.patch new file mode 100644 index 00000000..840b8b60 --- /dev/null +++ b/patches/openwrt/0033-tools-pkg-config-fix-build-with-GCC-6.patch @@ -0,0 +1,37 @@ +From: Matthias Schiffer +Date: Sun, 8 May 2016 15:53:14 +0200 +Subject: tools: pkg-config: fix build with GCC 6 + +Fixes the following error: + +gdate.c: In function ‘g_date_strftime’: +gdate.c:2497:7: error: format not a string literal, format string not checked [-Werror=format-nonliteral] + tmplen = strftime (tmpbuf, tmpbufsize, locale_format, &tm); + ^~~~~~ + +Signed-off-by: Matthias Schiffer + +diff --git a/tools/pkg-config/patches/001-glib-gdate-suppress-string-format-literal-warning.patch b/tools/pkg-config/patches/001-glib-gdate-suppress-string-format-literal-warning.patch +new file mode 100644 +index 0000000..6849299 +--- /dev/null ++++ b/tools/pkg-config/patches/001-glib-gdate-suppress-string-format-literal-warning.patch +@@ -0,0 +1,18 @@ ++--- a/glib/glib/gdate.c +++++ b/glib/glib/gdate.c ++@@ -2439,6 +2439,9 @@ win32_strftime_helper (const GDate *d, ++ * ++ * Returns: number of characters written to the buffer, or 0 the buffer was too small ++ */ +++#pragma GCC diagnostic push +++#pragma GCC diagnostic ignored "-Wformat-nonliteral" +++ ++ gsize ++ g_date_strftime (gchar *s, ++ gsize slen, ++@@ -2549,3 +2552,5 @@ g_date_strftime (gchar *s, ++ return retval; ++ #endif ++ } +++ +++#pragma GCC diagnostic pop diff --git a/patches/openwrt/0034-tools-mkimage-sync-include-linux-compiler-.h-with-u-boot-master.patch b/patches/openwrt/0034-tools-mkimage-sync-include-linux-compiler-.h-with-u-boot-master.patch new file mode 100644 index 00000000..edca566c --- /dev/null +++ b/patches/openwrt/0034-tools-mkimage-sync-include-linux-compiler-.h-with-u-boot-master.patch @@ -0,0 +1,815 @@ +From: Matthias Schiffer +Date: Sun, 8 May 2016 22:06:51 +0200 +Subject: tools: mkimage: sync include/linux/compiler*.h with u-boot master + +Fixes build with GCC 6. + +Signed-off-by: Matthias Schiffer + +diff --git a/tools/mkimage/patches/200-compiler-support.patch b/tools/mkimage/patches/200-compiler-support.patch +new file mode 100644 +index 0000000..ca9c5b5 +--- /dev/null ++++ b/tools/mkimage/patches/200-compiler-support.patch +@@ -0,0 +1,702 @@ ++diff --git b/include/linux/compiler-gcc.h a/include/linux/compiler-gcc.h ++index e057bd2..22ab246 100644 ++--- b/include/linux/compiler-gcc.h +++++ a/include/linux/compiler-gcc.h ++@@ -5,14 +5,28 @@ ++ /* ++ * Common definitions for all gcc versions go here. ++ */ ++-#define GCC_VERSION (__GNUC__ * 10000 \ ++- + __GNUC_MINOR__ * 100 \ ++- + __GNUC_PATCHLEVEL__) ++- +++#define GCC_VERSION (__GNUC__ * 10000 \ +++ + __GNUC_MINOR__ * 100 \ +++ + __GNUC_PATCHLEVEL__) ++ ++ /* Optimization barrier */ +++ ++ /* The "volatile" is due to gcc bugs */ ++ #define barrier() __asm__ __volatile__("": : :"memory") +++/* +++ * This version is i.e. to prevent dead stores elimination on @ptr +++ * where gcc and llvm may behave differently when otherwise using +++ * normal barrier(): while gcc behavior gets along with a normal +++ * barrier(), llvm needs an explicit input variable to be assumed +++ * clobbered. The issue is as follows: while the inline asm might +++ * access any memory it wants, the compiler could have fit all of +++ * @ptr into memory registers instead, and since @ptr never escaped +++ * from that, it proofed that the inline asm wasn't touching any of +++ * it. This version works well with both compilers, i.e. we're telling +++ * the compiler that the inline asm absolutely may see the contents +++ * of @ptr. See also: https://llvm.org/bugs/show_bug.cgi?id=15495 +++ */ +++#define barrier_data(ptr) __asm__ __volatile__("": :"r"(ptr) :"memory") ++ ++ /* ++ * This macro obfuscates arithmetic on a variable address so that gcc ++@@ -32,58 +46,63 @@ ++ * the inline assembly constraint from =g to =r, in this particular ++ * case either is valid. ++ */ ++-#define RELOC_HIDE(ptr, off) \ ++- ({ unsigned long __ptr; \ ++- __asm__ ("" : "=r"(__ptr) : "0"(ptr)); \ ++- (typeof(ptr)) (__ptr + (off)); }) +++#define RELOC_HIDE(ptr, off) \ +++({ \ +++ unsigned long __ptr; \ +++ __asm__ ("" : "=r"(__ptr) : "0"(ptr)); \ +++ (typeof(ptr)) (__ptr + (off)); \ +++}) ++ ++ /* Make the optimizer believe the variable can be manipulated arbitrarily. */ ++-#define OPTIMIZER_HIDE_VAR(var) __asm__ ("" : "=r" (var) : "0" (var)) +++#define OPTIMIZER_HIDE_VAR(var) \ +++ __asm__ ("" : "=r" (var) : "0" (var)) ++ ++ #ifdef __CHECKER__ ++-#define __must_be_array(arr) 0 +++#define __must_be_array(a) 0 ++ #else ++ /* &a[0] degrades to a pointer: a different type from an array */ ++-#define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0])) +++#define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0])) ++ #endif ++ ++ /* ++ * Force always-inline if the user requests it so via the .config, ++ * or if gcc is too old: ++ */ ++-#if !defined(CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING) || \ +++#if !defined(CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING) || \ ++ !defined(CONFIG_OPTIMIZE_INLINING) || (__GNUC__ < 4) ++-# define inline inline __attribute__((always_inline)) notrace ++-# define __inline__ __inline__ __attribute__((always_inline)) notrace ++-# define __inline __inline __attribute__((always_inline)) notrace +++#define inline inline __attribute__((always_inline)) notrace +++#define __inline__ __inline__ __attribute__((always_inline)) notrace +++#define __inline __inline __attribute__((always_inline)) notrace ++ #else ++ /* A lot of inline functions can cause havoc with function tracing */ ++-# define inline inline notrace ++-# define __inline__ __inline__ notrace ++-# define __inline __inline notrace +++#define inline inline notrace +++#define __inline__ __inline__ notrace +++#define __inline __inline notrace ++ #endif ++ ++-#define __deprecated __attribute__((deprecated)) ++-#ifndef __packed ++-#define __packed __attribute__((packed)) ++-#endif ++-#ifndef __weak ++-#define __weak __attribute__((weak)) ++-#endif +++#define __always_inline inline __attribute__((always_inline)) +++#define noinline __attribute__((noinline)) +++ +++#define __deprecated __attribute__((deprecated)) +++#define __packed __attribute__((packed)) +++#define __weak __attribute__((weak)) +++#define __alias(symbol) __attribute__((alias(#symbol))) ++ ++ /* ++- * it doesn't make sense on ARM (currently the only user of __naked) to trace ++- * naked functions because then mcount is called without stack and frame pointer ++- * being set up and there is no chance to restore the lr register to the value ++- * before mcount was called. +++ * it doesn't make sense on ARM (currently the only user of __naked) +++ * to trace naked functions because then mcount is called without +++ * stack and frame pointer being set up and there is no chance to +++ * restore the lr register to the value before mcount was called. +++ * +++ * The asm() bodies of naked functions often depend on standard calling +++ * conventions, therefore they must be noinline and noclone. ++ * ++- * The asm() bodies of naked functions often depend on standard calling conventions, ++- * therefore they must be noinline and noclone. GCC 4.[56] currently fail to enforce ++- * this, so we must do so ourselves. See GCC PR44290. +++ * GCC 4.[56] currently fail to enforce this, so we must do so ourselves. +++ * See GCC PR44290. ++ */ ++-#define __naked __attribute__((naked)) noinline __noclone notrace +++#define __naked __attribute__((naked)) noinline __noclone notrace ++ ++-#define __noreturn __attribute__((noreturn)) +++#define __noreturn __attribute__((noreturn)) ++ ++ /* ++ * From the GCC manual: ++@@ -95,34 +114,170 @@ ++ * would be. ++ * [...] ++ */ ++-#ifndef __pure ++-#define __pure __attribute__((pure)) +++#define __pure __attribute__((pure)) +++#define __aligned(x) __attribute__((aligned(x))) +++#define __printf(a, b) __attribute__((format(printf, a, b))) +++#define __scanf(a, b) __attribute__((format(scanf, a, b))) +++#define __attribute_const__ __attribute__((__const__)) +++#define __maybe_unused __attribute__((unused)) +++#define __always_unused __attribute__((unused)) +++ +++/* gcc version specific checks */ +++ +++#if GCC_VERSION < 30200 +++# error Sorry, your compiler is too old - please upgrade it. +++#endif +++ +++#if GCC_VERSION < 30300 +++# define __used __attribute__((__unused__)) +++#else +++# define __used __attribute__((__used__)) +++#endif +++ +++#ifdef CONFIG_GCOV_KERNEL +++# if GCC_VERSION < 30400 +++# error "GCOV profiling support for gcc versions below 3.4 not included" +++# endif /* __GNUC_MINOR__ */ +++#endif /* CONFIG_GCOV_KERNEL */ +++ +++#if GCC_VERSION >= 30400 +++#define __must_check __attribute__((warn_unused_result)) +++#endif +++ +++#if GCC_VERSION >= 40000 +++ +++/* GCC 4.1.[01] miscompiles __weak */ +++#ifdef __KERNEL__ +++# if GCC_VERSION >= 40100 && GCC_VERSION <= 40101 +++# error Your version of gcc miscompiles the __weak directive +++# endif +++#endif +++ +++#define __used __attribute__((__used__)) +++#define __compiler_offsetof(a, b) \ +++ __builtin_offsetof(a, b) +++ +++#if GCC_VERSION >= 40100 && GCC_VERSION < 40600 +++# define __compiletime_object_size(obj) __builtin_object_size(obj, 0) +++#endif +++ +++#if GCC_VERSION >= 40300 +++/* Mark functions as cold. gcc will assume any path leading to a call +++ * to them will be unlikely. This means a lot of manual unlikely()s +++ * are unnecessary now for any paths leading to the usual suspects +++ * like BUG(), printk(), panic() etc. [but let's keep them for now for +++ * older compilers] +++ * +++ * Early snapshots of gcc 4.3 don't support this and we can't detect this +++ * in the preprocessor, but we can live with this because they're unreleased. +++ * Maketime probing would be overkill here. +++ * +++ * gcc also has a __attribute__((__hot__)) to move hot functions into +++ * a special section, but I don't see any sense in this right now in +++ * the kernel context +++ */ +++#define __cold __attribute__((__cold__)) +++ +++#define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__) +++ +++#ifndef __CHECKER__ +++# define __compiletime_warning(message) __attribute__((warning(message))) +++# define __compiletime_error(message) __attribute__((error(message))) +++#endif /* __CHECKER__ */ +++#endif /* GCC_VERSION >= 40300 */ +++ +++#if GCC_VERSION >= 40500 +++/* +++ * Mark a position in code as unreachable. This can be used to +++ * suppress control flow warnings after asm blocks that transfer +++ * control elsewhere. +++ * +++ * Early snapshots of gcc 4.5 don't support this and we can't detect +++ * this in the preprocessor, but we can live with this because they're +++ * unreleased. Really, we need to have autoconf for the kernel. +++ */ +++#define unreachable() __builtin_unreachable() +++ +++/* Mark a function definition as prohibited from being cloned. */ +++#define __noclone __attribute__((__noclone__)) +++ +++#endif /* GCC_VERSION >= 40500 */ +++ +++#if GCC_VERSION >= 40600 +++/* +++ * When used with Link Time Optimization, gcc can optimize away C functions or +++ * variables which are referenced only from assembly code. __visible tells the +++ * optimizer that something else uses this function or variable, thus preventing +++ * this. +++ */ +++#define __visible __attribute__((externally_visible)) ++ #endif ++-#ifndef __aligned ++-#define __aligned(x) __attribute__((aligned(x))) +++ +++ +++#if GCC_VERSION >= 40900 && !defined(__CHECKER__) +++/* +++ * __assume_aligned(n, k): Tell the optimizer that the returned +++ * pointer can be assumed to be k modulo n. The second argument is +++ * optional (default 0), so we use a variadic macro to make the +++ * shorthand. +++ * +++ * Beware: Do not apply this to functions which may return +++ * ERR_PTRs. Also, it is probably unwise to apply it to functions +++ * returning extra information in the low bits (but in that case the +++ * compiler should see some alignment anyway, when the return value is +++ * massaged by 'flags = ptr & 3; ptr &= ~3;'). +++ */ +++#define __assume_aligned(a, ...) __attribute__((__assume_aligned__(a, ## __VA_ARGS__))) ++ #endif ++-#define __printf(a, b) __attribute__((format(printf, a, b))) ++-#define __scanf(a, b) __attribute__((format(scanf, a, b))) ++-#define noinline __attribute__((noinline)) ++-#define __attribute_const__ __attribute__((__const__)) ++-#define __maybe_unused __attribute__((unused)) ++-#define __always_unused __attribute__((unused)) ++ ++-#define __gcc_header(x) #x ++-#define _gcc_header(x) __gcc_header(linux/compiler-gcc##x.h) ++-#define gcc_header(x) _gcc_header(x) ++-#include gcc_header(__GNUC__) +++/* +++ * GCC 'asm goto' miscompiles certain code sequences: +++ * +++ * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670 +++ * +++ * Work it around via a compiler barrier quirk suggested by Jakub Jelinek. +++ * +++ * (asm goto is automatically volatile - the naming reflects this.) +++ */ +++#define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0) +++ +++#ifdef CONFIG_ARCH_USE_BUILTIN_BSWAP +++#if GCC_VERSION >= 40400 +++#define __HAVE_BUILTIN_BSWAP32__ +++#define __HAVE_BUILTIN_BSWAP64__ +++#endif +++#if GCC_VERSION >= 40800 || (defined(__powerpc__) && GCC_VERSION >= 40600) +++#define __HAVE_BUILTIN_BSWAP16__ +++#endif +++#endif /* CONFIG_ARCH_USE_BUILTIN_BSWAP */ +++ +++#if GCC_VERSION >= 50000 +++#define KASAN_ABI_VERSION 4 +++#elif GCC_VERSION >= 40902 +++#define KASAN_ABI_VERSION 3 +++#endif +++ +++#if GCC_VERSION >= 40902 +++/* +++ * Tell the compiler that address safety instrumentation (KASAN) +++ * should not be applied to that function. +++ * Conflicts with inlining: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67368 +++ */ +++#define __no_sanitize_address __attribute__((no_sanitize_address)) +++#endif +++ +++#endif /* gcc version >= 40000 specific checks */ ++ ++ #if !defined(__noclone) ++ #define __noclone /* not needed */ ++ #endif ++ +++#if !defined(__no_sanitize_address) +++#define __no_sanitize_address +++#endif +++ ++ /* ++ * A trick to suppress uninitialized variable warning without generating any ++ * code ++ */ ++ #define uninitialized_var(x) x = x ++- ++-#ifndef __always_inline ++-#define __always_inline inline __attribute__((always_inline)) ++-#endif ++diff --git b/include/linux/compiler-gcc3.h a/include/linux/compiler-gcc3.h ++deleted file mode 100644 ++index 7d89feb..0000000 ++--- b/include/linux/compiler-gcc3.h +++++ /dev/null ++@@ -1,23 +0,0 @@ ++-#ifndef __LINUX_COMPILER_H ++-#error "Please don't include directly, include instead." ++-#endif ++- ++-#if GCC_VERSION < 30200 ++-# error Sorry, your compiler is too old - please upgrade it. ++-#endif ++- ++-#if GCC_VERSION >= 30300 ++-# define __used __attribute__((__used__)) ++-#else ++-# define __used __attribute__((__unused__)) ++-#endif ++- ++-#if GCC_VERSION >= 30400 ++-#define __must_check __attribute__((warn_unused_result)) ++-#endif ++- ++-#ifdef CONFIG_GCOV_KERNEL ++-# if GCC_VERSION < 30400 ++-# error "GCOV profiling support for gcc versions below 3.4 not included" ++-# endif /* __GNUC_MINOR__ */ ++-#endif /* CONFIG_GCOV_KERNEL */ ++diff --git b/include/linux/compiler-gcc4.h a/include/linux/compiler-gcc4.h ++deleted file mode 100644 ++index c982a09..0000000 ++--- b/include/linux/compiler-gcc4.h +++++ /dev/null ++@@ -1,81 +0,0 @@ ++-#ifndef __LINUX_COMPILER_H ++-#error "Please don't include directly, include instead." ++-#endif ++- ++-#define __used __attribute__((__used__)) ++-#define __must_check __attribute__((warn_unused_result)) ++-#define __compiler_offsetof(a,b) __builtin_offsetof(a,b) ++- ++-#if GCC_VERSION >= 40100 && GCC_VERSION < 40600 ++-# define __compiletime_object_size(obj) __builtin_object_size(obj, 0) ++-#endif ++- ++-#if GCC_VERSION >= 40300 ++-/* Mark functions as cold. gcc will assume any path leading to a call ++- to them will be unlikely. This means a lot of manual unlikely()s ++- are unnecessary now for any paths leading to the usual suspects ++- like BUG(), printk(), panic() etc. [but let's keep them for now for ++- older compilers] ++- ++- Early snapshots of gcc 4.3 don't support this and we can't detect this ++- in the preprocessor, but we can live with this because they're unreleased. ++- Maketime probing would be overkill here. ++- ++- gcc also has a __attribute__((__hot__)) to move hot functions into ++- a special section, but I don't see any sense in this right now in ++- the kernel context */ ++-#define __cold __attribute__((__cold__)) ++- ++-#define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__) ++- ++-#ifndef __CHECKER__ ++-# define __compiletime_warning(message) __attribute__((warning(message))) ++-# define __compiletime_error(message) __attribute__((error(message))) ++-#endif /* __CHECKER__ */ ++-#endif /* GCC_VERSION >= 40300 */ ++- ++-#if GCC_VERSION >= 40500 ++-/* ++- * Mark a position in code as unreachable. This can be used to ++- * suppress control flow warnings after asm blocks that transfer ++- * control elsewhere. ++- * ++- * Early snapshots of gcc 4.5 don't support this and we can't detect ++- * this in the preprocessor, but we can live with this because they're ++- * unreleased. Really, we need to have autoconf for the kernel. ++- */ ++-#define unreachable() __builtin_unreachable() ++- ++-/* Mark a function definition as prohibited from being cloned. */ ++-#define __noclone __attribute__((__noclone__)) ++- ++-#endif /* GCC_VERSION >= 40500 */ ++- ++-#if GCC_VERSION >= 40600 ++-/* ++- * Tell the optimizer that something else uses this function or variable. ++- */ ++-#define __visible __attribute__((externally_visible)) ++-#endif ++- ++-/* ++- * GCC 'asm goto' miscompiles certain code sequences: ++- * ++- * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670 ++- * ++- * Work it around via a compiler barrier quirk suggested by Jakub Jelinek. ++- * Fixed in GCC 4.8.2 and later versions. ++- * ++- * (asm goto is automatically volatile - the naming reflects this.) ++- */ ++-#define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0) ++- ++-#ifdef CONFIG_ARCH_USE_BUILTIN_BSWAP ++-#if GCC_VERSION >= 40400 ++-#define __HAVE_BUILTIN_BSWAP32__ ++-#define __HAVE_BUILTIN_BSWAP64__ ++-#endif ++-#if GCC_VERSION >= 40800 || (defined(__powerpc__) && GCC_VERSION >= 40600) ++-#define __HAVE_BUILTIN_BSWAP16__ ++-#endif ++-#endif /* CONFIG_ARCH_USE_BUILTIN_BSWAP */ ++diff --git b/include/linux/compiler-intel.h a/include/linux/compiler-intel.h ++index ba147a1..d4c7113 100644 ++--- b/include/linux/compiler-intel.h +++++ a/include/linux/compiler-intel.h ++@@ -13,9 +13,14 @@ ++ /* Intel ECC compiler doesn't support gcc specific asm stmts. ++ * It uses intrinsics to do the equivalent things. ++ */ +++#undef barrier +++#undef barrier_data ++ #undef RELOC_HIDE ++ #undef OPTIMIZER_HIDE_VAR ++ +++#define barrier() __memory_barrier() +++#define barrier_data(ptr) barrier() +++ ++ #define RELOC_HIDE(ptr, off) \ ++ ({ unsigned long __ptr; \ ++ __ptr = (unsigned long) (ptr); \ ++diff --git b/include/linux/compiler.h a/include/linux/compiler.h ++index d5ad7b1..020ad16 100644 ++--- b/include/linux/compiler.h +++++ a/include/linux/compiler.h ++@@ -17,6 +17,7 @@ ++ # define __release(x) __context__(x,-1) ++ # define __cond_lock(x,c) ((c) ? ({ __acquire(x); 1; }) : 0) ++ # define __percpu __attribute__((noderef, address_space(3))) +++# define __pmem __attribute__((noderef, address_space(5))) ++ #ifdef CONFIG_SPARSE_RCU_POINTER ++ # define __rcu __attribute__((noderef, address_space(4))) ++ #else ++@@ -42,6 +43,7 @@ extern void __chk_io_ptr(const volatile void __iomem *); ++ # define __cond_lock(x,c) (c) ++ # define __percpu ++ # define __rcu +++# define __pmem ++ #endif ++ ++ /* Indirect macros required for expanded argument pasting, eg. __LINE__. */ ++@@ -54,7 +56,11 @@ extern void __chk_io_ptr(const volatile void __iomem *); ++ #include ++ #endif ++ +++#if defined(CC_USING_HOTPATCH) && !defined(__CHECKER__) +++#define notrace __attribute__((hotpatch(0,0))) +++#else ++ #define notrace __attribute__((no_instrument_function)) +++#endif ++ ++ /* Intel compiler defines __GNUC__. So we will overwrite implementations ++ * coming from above header files here ++@@ -138,7 +144,7 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect); ++ */ ++ #define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) ) ++ #define __trace_if(cond) \ ++- if (__builtin_constant_p((cond)) ? !!(cond) : \ +++ if (__builtin_constant_p(!!(cond)) ? !!(cond) : \ ++ ({ \ ++ int ______r; \ ++ static struct ftrace_branch_data \ ++@@ -165,6 +171,10 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect); ++ # define barrier() __memory_barrier() ++ #endif ++ +++#ifndef barrier_data +++# define barrier_data(ptr) barrier() +++#endif +++ ++ /* Unreachable code */ ++ #ifndef unreachable ++ # define unreachable() do { } while (1) ++@@ -186,6 +196,126 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect); ++ # define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __LINE__) ++ #endif ++ +++#include +++ +++#define __READ_ONCE_SIZE \ +++({ \ +++ switch (size) { \ +++ case 1: *(__u8 *)res = *(volatile __u8 *)p; break; \ +++ case 2: *(__u16 *)res = *(volatile __u16 *)p; break; \ +++ case 4: *(__u32 *)res = *(volatile __u32 *)p; break; \ +++ case 8: *(__u64 *)res = *(volatile __u64 *)p; break; \ +++ default: \ +++ barrier(); \ +++ __builtin_memcpy((void *)res, (const void *)p, size); \ +++ barrier(); \ +++ } \ +++}) +++ +++static __always_inline +++void __read_once_size(const volatile void *p, void *res, int size) +++{ +++ __READ_ONCE_SIZE; +++} +++ +++#ifdef CONFIG_KASAN +++/* +++ * This function is not 'inline' because __no_sanitize_address confilcts +++ * with inlining. Attempt to inline it may cause a build failure. +++ * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67368 +++ * '__maybe_unused' allows us to avoid defined-but-not-used warnings. +++ */ +++static __no_sanitize_address __maybe_unused +++void __read_once_size_nocheck(const volatile void *p, void *res, int size) +++{ +++ __READ_ONCE_SIZE; +++} +++#else +++static __always_inline +++void __read_once_size_nocheck(const volatile void *p, void *res, int size) +++{ +++ __READ_ONCE_SIZE; +++} +++#endif +++ +++static __always_inline void __write_once_size(volatile void *p, void *res, int size) +++{ +++ switch (size) { +++ case 1: *(volatile __u8 *)p = *(__u8 *)res; break; +++ case 2: *(volatile __u16 *)p = *(__u16 *)res; break; +++ case 4: *(volatile __u32 *)p = *(__u32 *)res; break; +++ case 8: *(volatile __u64 *)p = *(__u64 *)res; break; +++ default: +++ barrier(); +++ __builtin_memcpy((void *)p, (const void *)res, size); +++ barrier(); +++ } +++} +++ +++/* +++ * Prevent the compiler from merging or refetching reads or writes. The +++ * compiler is also forbidden from reordering successive instances of +++ * READ_ONCE, WRITE_ONCE and ACCESS_ONCE (see below), but only when the +++ * compiler is aware of some particular ordering. One way to make the +++ * compiler aware of ordering is to put the two invocations of READ_ONCE, +++ * WRITE_ONCE or ACCESS_ONCE() in different C statements. +++ * +++ * In contrast to ACCESS_ONCE these two macros will also work on aggregate +++ * data types like structs or unions. If the size of the accessed data +++ * type exceeds the word size of the machine (e.g., 32 bits or 64 bits) +++ * READ_ONCE() and WRITE_ONCE() will fall back to memcpy and print a +++ * compile-time warning. +++ * +++ * Their two major use cases are: (1) Mediating communication between +++ * process-level code and irq/NMI handlers, all running on the same CPU, +++ * and (2) Ensuring that the compiler does not fold, spindle, or otherwise +++ * mutilate accesses that either do not require ordering or that interact +++ * with an explicit memory barrier or atomic instruction that provides the +++ * required ordering. +++ */ +++ +++#define __READ_ONCE(x, check) \ +++({ \ +++ union { typeof(x) __val; char __c[1]; } __u; \ +++ if (check) \ +++ __read_once_size(&(x), __u.__c, sizeof(x)); \ +++ else \ +++ __read_once_size_nocheck(&(x), __u.__c, sizeof(x)); \ +++ __u.__val; \ +++}) +++#define READ_ONCE(x) __READ_ONCE(x, 1) +++ +++/* +++ * Use READ_ONCE_NOCHECK() instead of READ_ONCE() if you need +++ * to hide memory access from KASAN. +++ */ +++#define READ_ONCE_NOCHECK(x) __READ_ONCE(x, 0) +++ +++#define WRITE_ONCE(x, val) \ +++({ \ +++ union { typeof(x) __val; char __c[1]; } __u = \ +++ { .__val = (__force typeof(x)) (val) }; \ +++ __write_once_size(&(x), __u.__c, sizeof(x)); \ +++ __u.__val; \ +++}) +++ +++/** +++ * smp_cond_acquire() - Spin wait for cond with ACQUIRE ordering +++ * @cond: boolean expression to wait for +++ * +++ * Equivalent to using smp_load_acquire() on the condition variable but employs +++ * the control dependency of the wait to reduce the barrier on many platforms. +++ * +++ * The control dependency provides a LOAD->STORE order, the additional RMB +++ * provides LOAD->LOAD order, together they provide LOAD->{LOAD,STORE} order, +++ * aka. ACQUIRE. +++ */ +++#define smp_cond_acquire(cond) do { \ +++ while (!(cond)) \ +++ cpu_relax(); \ +++ smp_rmb(); /* ctrl + rmb := acquire */ \ +++} while (0) +++ ++ #endif /* __KERNEL__ */ ++ ++ #endif /* __ASSEMBLY__ */ ++@@ -304,6 +434,14 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect); ++ #define __visible ++ #endif ++ +++/* +++ * Assume alignment of return value. +++ */ +++#ifndef __assume_aligned +++#define __assume_aligned(a, ...) +++#endif +++ +++ ++ /* Are two types/vars the same type (ignoring qualifiers)? */ ++ #ifndef __same_type ++ # define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b)) ++@@ -311,7 +449,7 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect); ++ ++ /* Is this type a native word size -- useful for atomic operations */ ++ #ifndef __native_word ++-# define __native_word(t) (sizeof(t) == sizeof(int) || sizeof(t) == sizeof(long)) +++# define __native_word(t) (sizeof(t) == sizeof(char) || sizeof(t) == sizeof(short) || sizeof(t) == sizeof(int) || sizeof(t) == sizeof(long)) ++ #endif ++ ++ /* Compile time object size, -1 for unknown */ ++@@ -373,12 +511,38 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect); ++ * to make the compiler aware of ordering is to put the two invocations of ++ * ACCESS_ONCE() in different C statements. ++ * ++- * This macro does absolutely -nothing- to prevent the CPU from reordering, ++- * merging, or refetching absolutely anything at any time. Its main intended ++- * use is to mediate communication between process-level code and irq/NMI ++- * handlers, all running on the same CPU. +++ * ACCESS_ONCE will only work on scalar types. For union types, ACCESS_ONCE +++ * on a union member will work as long as the size of the member matches the +++ * size of the union and the size is smaller than word size. +++ * +++ * The major use cases of ACCESS_ONCE used to be (1) Mediating communication +++ * between process-level code and irq/NMI handlers, all running on the same CPU, +++ * and (2) Ensuring that the compiler does not fold, spindle, or otherwise +++ * mutilate accesses that either do not require ordering or that interact +++ * with an explicit memory barrier or atomic instruction that provides the +++ * required ordering. +++ * +++ * If possible use READ_ONCE()/WRITE_ONCE() instead. +++ */ +++#define __ACCESS_ONCE(x) ({ \ +++ __maybe_unused typeof(x) __var = (__force typeof(x)) 0; \ +++ (volatile typeof(x) *)&(x); }) +++#define ACCESS_ONCE(x) (*__ACCESS_ONCE(x)) +++ +++/** +++ * lockless_dereference() - safely load a pointer for later dereference +++ * @p: The pointer to load +++ * +++ * Similar to rcu_dereference(), but for situations where the pointed-to +++ * object's lifetime is managed by something other than RCU. That +++ * "something other" might be reference counting or simple immortality. ++ */ ++-#define ACCESS_ONCE(x) (*(volatile typeof(x) *)&(x)) +++#define lockless_dereference(p) \ +++({ \ +++ typeof(p) _________p1 = READ_ONCE(p); \ +++ smp_read_barrier_depends(); /* Dependency order vs. p above. */ \ +++ (_________p1); \ +++}) ++ ++ /* Ignore/forbid kprobes attach on very low level functions marked by this attribute: */ ++ #ifdef CONFIG_KPROBES +diff --git a/tools/mkimage/patches/200-gcc5_compat.patch b/tools/mkimage/patches/200-gcc5_compat.patch +deleted file mode 100644 +index 4d55f00..0000000 +--- a/tools/mkimage/patches/200-gcc5_compat.patch ++++ /dev/null +@@ -1,93 +0,0 @@ +-From 478b02f1a7043b673565075ea5016376f3293b23 Mon Sep 17 00:00:00 2001 +-From: Hans de Goede +-Date: Sat, 7 Feb 2015 22:52:40 +0100 +-Subject: [PATCH] Add linux/compiler-gcc5.h to fix builds with gcc5 +- +-Add linux/compiler-gcc5/h from the kernel sources at: +- +-commit 5631b8fba640a4ab2f8a954f63a603fa34eda96b +-Author: Steven Noonan +-Date: Sat Oct 25 15:09:42 2014 -0700 +- +- compiler/gcc4+: Remove inaccurate comment about 'asm goto' miscompiles +- +-Signed-off-by: Hans de Goede +---- +- include/linux/compiler-gcc5.h | 65 +++++++++++++++++++++++++++++++++++++++++ +- 1 file changed, 65 insertions(+) +- create mode 100644 include/linux/compiler-gcc5.h +- +-diff --git a/include/linux/compiler-gcc5.h b/include/linux/compiler-gcc5.h +-new file mode 100644 +-index 0000000..c8c5659 +---- /dev/null +-+++ b/include/linux/compiler-gcc5.h +-@@ -0,0 +1,65 @@ +-+#ifndef __LINUX_COMPILER_H +-+#error "Please don't include directly, include instead." +-+#endif +-+ +-+#define __used __attribute__((__used__)) +-+#define __must_check __attribute__((warn_unused_result)) +-+#define __compiler_offsetof(a, b) __builtin_offsetof(a, b) +-+ +-+/* Mark functions as cold. gcc will assume any path leading to a call +-+ to them will be unlikely. This means a lot of manual unlikely()s +-+ are unnecessary now for any paths leading to the usual suspects +-+ like BUG(), printk(), panic() etc. [but let's keep them for now for +-+ older compilers] +-+ +-+ Early snapshots of gcc 4.3 don't support this and we can't detect this +-+ in the preprocessor, but we can live with this because they're unreleased. +-+ Maketime probing would be overkill here. +-+ +-+ gcc also has a __attribute__((__hot__)) to move hot functions into +-+ a special section, but I don't see any sense in this right now in +-+ the kernel context */ +-+#define __cold __attribute__((__cold__)) +-+ +-+#define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__) +-+ +-+#ifndef __CHECKER__ +-+# define __compiletime_warning(message) __attribute__((warning(message))) +-+# define __compiletime_error(message) __attribute__((error(message))) +-+#endif /* __CHECKER__ */ +-+ +-+/* +-+ * Mark a position in code as unreachable. This can be used to +-+ * suppress control flow warnings after asm blocks that transfer +-+ * control elsewhere. +-+ * +-+ * Early snapshots of gcc 4.5 don't support this and we can't detect +-+ * this in the preprocessor, but we can live with this because they're +-+ * unreleased. Really, we need to have autoconf for the kernel. +-+ */ +-+#define unreachable() __builtin_unreachable() +-+ +-+/* Mark a function definition as prohibited from being cloned. */ +-+#define __noclone __attribute__((__noclone__)) +-+ +-+/* +-+ * Tell the optimizer that something else uses this function or variable. +-+ */ +-+#define __visible __attribute__((externally_visible)) +-+ +-+/* +-+ * GCC 'asm goto' miscompiles certain code sequences: +-+ * +-+ * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670 +-+ * +-+ * Work it around via a compiler barrier quirk suggested by Jakub Jelinek. +-+ * +-+ * (asm goto is automatically volatile - the naming reflects this.) +-+ */ +-+#define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0) +-+ +-+#ifdef CONFIG_ARCH_USE_BUILTIN_BSWAP +-+#define __HAVE_BUILTIN_BSWAP32__ +-+#define __HAVE_BUILTIN_BSWAP64__ +-+#define __HAVE_BUILTIN_BSWAP16__ +-+#endif /* CONFIG_ARCH_USE_BUILTIN_BSWAP */ +--- +-1.7.10.4 +- diff --git a/patches/openwrt/0035-toolchain-gcc-fix-build-with-GCC-6.patch b/patches/openwrt/0035-toolchain-gcc-fix-build-with-GCC-6.patch new file mode 100644 index 00000000..e828631b --- /dev/null +++ b/patches/openwrt/0035-toolchain-gcc-fix-build-with-GCC-6.patch @@ -0,0 +1,144 @@ +From: Matthias Schiffer +Date: Mon, 9 May 2016 00:16:38 +0200 +Subject: toolchain: gcc: fix build with GCC 6 + +At least for GCC 4.8, which is used by most targets. + +Signed-off-by: Matthias Schiffer + +diff --git a/toolchain/gcc/patches/4.8-linaro/030-gcc-6-compile.patch b/toolchain/gcc/patches/4.8-linaro/030-gcc-6-compile.patch +new file mode 100644 +index 0000000..c74f2aa +--- /dev/null ++++ b/toolchain/gcc/patches/4.8-linaro/030-gcc-6-compile.patch +@@ -0,0 +1,130 @@ ++Upstream commit r233721 ++ ++diff --git a/gcc/cp/Make-lang.in b/gcc/cp/Make-lang.in ++index bd1c1d7..a0ea0d4 100644 ++--- a/gcc/cp/Make-lang.in +++++ b/gcc/cp/Make-lang.in ++@@ -111,7 +111,7 @@ else ++ # deleting the $(srcdir)/cp/cfns.h file. ++ $(srcdir)/cp/cfns.h: ++ endif ++- gperf -o -C -E -k '1-6,$$' -j1 -D -N 'libc_name_p' -L ANSI-C \ +++ gperf -o -C -E -k '1-6,$$' -j1 -D -N 'libc_name_p' -L C++ \ ++ $(srcdir)/cp/cfns.gperf --output-file $(srcdir)/cp/cfns.h ++ ++ # ++diff --git a/gcc/cp/cfns.gperf b/gcc/cp/cfns.gperf ++index 05ca753..d9b16b8 100644 ++--- a/gcc/cp/cfns.gperf +++++ b/gcc/cp/cfns.gperf ++@@ -1,3 +1,5 @@ +++%language=C++ +++%define class-name libc_name ++ %{ ++ /* Copyright (C) 2000-2014 Free Software Foundation, Inc. ++ ++@@ -16,14 +18,6 @@ for more details. ++ You should have received a copy of the GNU General Public License ++ along with GCC; see the file COPYING3. If not see ++ . */ ++-#ifdef __GNUC__ ++-__inline ++-#endif ++-static unsigned int hash (const char *, unsigned int); ++-#ifdef __GNUC__ ++-__inline ++-#endif ++-const char * libc_name_p (const char *, unsigned int); ++ %} ++ %% ++ # The standard C library functions, for feeding to gperf; the result is used ++diff --git a/gcc/cp/cfns.h b/gcc/cp/cfns.h ++index c845ddf..65801d1 100644 ++--- a/gcc/cp/cfns.h +++++ b/gcc/cp/cfns.h ++@@ -1,5 +1,5 @@ ++-/* ANSI-C code produced by gperf version 3.0.3 */ ++-/* Command-line: gperf -o -C -E -k '1-6,$' -j1 -D -N libc_name_p -L ANSI-C cfns.gperf */ +++/* C++ code produced by gperf version 3.0.4 */ +++/* Command-line: gperf -o -C -E -k '1-6,$' -j1 -D -N libc_name_p -L C++ --output-file cfns.h cfns.gperf */ ++ ++ #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ ++ && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ ++@@ -28,7 +28,7 @@ ++ #error "gperf generated tables don't work with this execution character set. Please report a bug to ." ++ #endif ++ ++-#line 1 "cfns.gperf" +++#line 3 "cfns.gperf" ++ ++ /* Copyright (C) 2000-2014 Free Software Foundation, Inc. ++ ++@@ -47,25 +47,18 @@ for more details. ++ You should have received a copy of the GNU General Public License ++ along with GCC; see the file COPYING3. If not see ++ . */ ++-#ifdef __GNUC__ ++-__inline ++-#endif ++-static unsigned int hash (const char *, unsigned int); ++-#ifdef __GNUC__ ++-__inline ++-#endif ++-const char * libc_name_p (const char *, unsigned int); ++ /* maximum key range = 391, duplicates = 0 */ ++ ++-#ifdef __GNUC__ ++-__inline ++-#else ++-#ifdef __cplusplus ++-inline ++-#endif ++-#endif ++-static unsigned int ++-hash (register const char *str, register unsigned int len) +++class libc_name +++{ +++private: +++ static inline unsigned int hash (const char *str, unsigned int len); +++public: +++ static const char *libc_name_p (const char *str, unsigned int len); +++}; +++ +++inline unsigned int +++libc_name::hash (register const char *str, register unsigned int len) ++ { ++ static const unsigned short asso_values[] = ++ { ++@@ -122,14 +115,8 @@ hash (register const char *str, register unsigned int len) ++ return hval + asso_values[(unsigned char)str[len - 1]]; ++ } ++ ++-#ifdef __GNUC__ ++-__inline ++-#ifdef __GNUC_STDC_INLINE__ ++-__attribute__ ((__gnu_inline__)) ++-#endif ++-#endif ++ const char * ++-libc_name_p (register const char *str, register unsigned int len) +++libc_name::libc_name_p (register const char *str, register unsigned int len) ++ { ++ enum ++ { ++diff --git a/gcc/cp/except.c b/gcc/cp/except.c ++index 221971a..32340f5 100644 ++--- a/gcc/cp/except.c +++++ b/gcc/cp/except.c ++@@ -1030,7 +1030,8 @@ nothrow_libfn_p (const_tree fn) ++ unless the system headers are playing rename tricks, and if ++ they are, we don't want to be confused by them. */ ++ id = DECL_NAME (fn); ++- return !!libc_name_p (IDENTIFIER_POINTER (id), IDENTIFIER_LENGTH (id)); +++ return !!libc_name::libc_name_p (IDENTIFIER_POINTER (id), +++ IDENTIFIER_LENGTH (id)); ++ } ++ ++ /* Returns nonzero if an exception of type FROM will be caught by a ++-- ++1.7.1 ++ diff --git a/patches/openwrt/0036-ath79-dev-eth-fix-QCA9561-set-phy-interface-mode-and-mask.patch b/patches/openwrt/0036-ath79-dev-eth-fix-QCA9561-set-phy-interface-mode-and-mask.patch new file mode 100644 index 00000000..f7c393a3 --- /dev/null +++ b/patches/openwrt/0036-ath79-dev-eth-fix-QCA9561-set-phy-interface-mode-and-mask.patch @@ -0,0 +1,46 @@ +From: Matthias Schiffer +Date: Fri, 13 May 2016 20:59:44 +0200 +Subject: ath79: dev-eth: fix QCA9561 set phy interface mode and mask + +QCA9563 and QCA9561 are two series of Qualcomm SoC Dragonfly. The only different +is QCA9563 w/o internal switch. It has one GMAC with SGMII interface. But they +have the same device ID(0x1150). So they share the same codes. + +Signed-off-by: Miaoqing Pan + +Backport of OpenWrt r46971 + +diff --git a/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c b/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c +index ff94e2e..31d2438 100644 +--- a/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c ++++ b/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c +@@ -633,7 +633,6 @@ static int __init ath79_setup_phy_if_mode(unsigned int id, + case ATH79_SOC_AR9330: + case ATH79_SOC_AR9331: + case ATH79_SOC_QCA9533: +- case ATH79_SOC_QCA9561: + case ATH79_SOC_TP9343: + pdata->phy_if_mode = PHY_INTERFACE_MODE_MII; + break; +@@ -667,6 +666,11 @@ static int __init ath79_setup_phy_if_mode(unsigned int id, + } + break; + ++ case ATH79_SOC_QCA9561: ++ if (!pdata->phy_if_mode) ++ pdata->phy_if_mode = PHY_INTERFACE_MODE_MII; ++ break; ++ + default: + BUG(); + } +@@ -1035,7 +1039,8 @@ void __init ath79_register_eth(unsigned int id) + AR933X_RESET_GE0_MDIO; + pdata->set_speed = ath79_set_speed_dummy; + +- pdata->phy_mask = BIT(4); ++ if (!pdata->phy_mask) ++ pdata->phy_mask = BIT(4); + } else { + pdata->reset_bit = AR933X_RESET_GE1_MAC | + AR933X_RESET_GE1_MDIO; diff --git a/patches/openwrt/0037-ar71xx-use-correct-PLL-configuration-register-bitmask-for-QCA956x-SoC.patch b/patches/openwrt/0037-ar71xx-use-correct-PLL-configuration-register-bitmask-for-QCA956x-SoC.patch new file mode 100644 index 00000000..3a9968e3 --- /dev/null +++ b/patches/openwrt/0037-ar71xx-use-correct-PLL-configuration-register-bitmask-for-QCA956x-SoC.patch @@ -0,0 +1,33 @@ +From: Matthias Schiffer +Date: Fri, 13 May 2016 22:58:50 +0200 +Subject: ar71xx: use correct PLL configuration register bitmask for QCA956x SoC. + +Incorrect value causes clock inaccuracy as huge as 1/60. + +Signed-off-by: Dmitry Ivanov +Signed-off-by: Felix Fietkau + +Backport of OpenWrt r47363 + +diff --git a/target/linux/ar71xx/patches-3.18/735-MIPS-ath79-add-support-for-QCA956x-SoC.patch b/target/linux/ar71xx/patches-3.18/735-MIPS-ath79-add-support-for-QCA956x-SoC.patch +index b5c88e9..d3a14b2 100644 +--- a/target/linux/ar71xx/patches-3.18/735-MIPS-ath79-add-support-for-QCA956x-SoC.patch ++++ b/target/linux/ar71xx/patches-3.18/735-MIPS-ath79-add-support-for-QCA956x-SoC.patch +@@ -529,7 +529,7 @@ + +#define QCA956X_PLL_CPU_CONFIG1_NFRAC_L_SHIFT 0 + +#define QCA956X_PLL_CPU_CONFIG1_NFRAC_L_MASK 0x1f + +#define QCA956X_PLL_CPU_CONFIG1_NFRAC_H_SHIFT 5 +-+#define QCA956X_PLL_CPU_CONFIG1_NFRAC_H_MASK 0x3fff +++#define QCA956X_PLL_CPU_CONFIG1_NFRAC_H_MASK 0x1fff + +#define QCA956X_PLL_CPU_CONFIG1_NINT_SHIFT 18 + +#define QCA956X_PLL_CPU_CONFIG1_NINT_MASK 0x1ff + + +@@ -541,7 +541,7 @@ + +#define QCA956X_PLL_DDR_CONFIG1_NFRAC_L_SHIFT 0 + +#define QCA956X_PLL_DDR_CONFIG1_NFRAC_L_MASK 0x1f + +#define QCA956X_PLL_DDR_CONFIG1_NFRAC_H_SHIFT 5 +-+#define QCA956X_PLL_DDR_CONFIG1_NFRAC_H_MASK 0x3fff +++#define QCA956X_PLL_DDR_CONFIG1_NFRAC_H_MASK 0x1fff + +#define QCA956X_PLL_DDR_CONFIG1_NINT_SHIFT 18 + +#define QCA956X_PLL_DDR_CONFIG1_NINT_MASK 0x1ff + + diff --git a/patches/openwrt/0038-ar71xx-update-QCA956x-support.patch b/patches/openwrt/0038-ar71xx-update-QCA956x-support.patch new file mode 100644 index 00000000..3ae6c249 --- /dev/null +++ b/patches/openwrt/0038-ar71xx-update-QCA956x-support.patch @@ -0,0 +1,381 @@ +From: Matthias Schiffer +Date: Fri, 13 May 2016 22:18:40 +0200 +Subject: ar71xx: update QCA956x support + +- separate qca956x and tp9343 (they use different IDs) +- rename qca9561->qca956x for consistency +- add missing bits (device reset, gpio output select) +- fix wmac setup + +Signed-off-by: Roman Yeryomin + +Backport of OpenWrt r47981 + +diff --git a/target/linux/ar71xx/patches-3.18/735-MIPS-ath79-add-support-for-QCA956x-SoC.patch b/target/linux/ar71xx/patches-3.18/735-MIPS-ath79-add-support-for-QCA956x-SoC.patch +index d3a14b2..61b8976 100644 +--- a/target/linux/ar71xx/patches-3.18/735-MIPS-ath79-add-support-for-QCA956x-SoC.patch ++++ b/target/linux/ar71xx/patches-3.18/735-MIPS-ath79-add-support-for-QCA956x-SoC.patch +@@ -105,7 +105,7 @@ + qca953x_clocks_init(); + else if (soc_is_qca955x()) + qca955x_clocks_init(); +-+ else if (soc_is_qca956x()) +++ else if (soc_is_qca956x() || soc_is_tp9343()) + + qca956x_clocks_init(); + else + BUG(); +@@ -116,7 +116,7 @@ + reg = QCA953X_RESET_REG_RESET_MODULE; + else if (soc_is_qca955x()) + reg = QCA955X_RESET_REG_RESET_MODULE; +-+ else if (soc_is_qca956x()) +++ else if (soc_is_qca956x() || soc_is_tp9343()) + + reg = QCA956X_RESET_REG_RESET_MODULE; + else + panic("Reset register not defined for this SOC"); +@@ -125,20 +125,30 @@ + reg = QCA953X_RESET_REG_RESET_MODULE; + else if (soc_is_qca955x()) + reg = QCA955X_RESET_REG_RESET_MODULE; +-+ else if (soc_is_qca956x()) +++ else if (soc_is_qca956x() || soc_is_tp9343()) + + reg = QCA956X_RESET_REG_RESET_MODULE; + else + panic("Reset register not defined for this SOC"); + ++@@ -133,6 +137,8 @@ u32 ath79_device_reset_get(u32 mask) ++ reg = AR933X_RESET_REG_RESET_MODULE; ++ else if (soc_is_ar934x()) ++ reg = AR934X_RESET_REG_RESET_MODULE; +++ else if (soc_is_qca956x() || soc_is_tp9343()) +++ reg = QCA956X_RESET_REG_RESET_MODULE; ++ else ++ BUG(); ++ + --- a/arch/mips/ath79/dev-common.c + +++ b/arch/mips/ath79/dev-common.c +-@@ -94,7 +94,8 @@ void __init ath79_register_uart(void) ++@@ -94,7 +94,9 @@ void __init ath79_register_uart(void) + soc_is_ar913x() || + soc_is_ar934x() || + soc_is_qca953x() || + - soc_is_qca955x()) { + + soc_is_qca955x() || +-+ soc_is_qca956x()) { +++ soc_is_qca956x() || +++ soc_is_tp9343()) { + ath79_uart_data[0].uartclk = uart_clk_rate; + platform_device_register(&ath79_uart_device); + } else if (soc_is_ar933x()) { +@@ -168,14 +178,14 @@ + qca953x_usb_setup(); + else if (soc_is_qca955x()) + qca955x_usb_setup(); +-+ else if (soc_is_qca9561()) +++ else if (soc_is_qca956x()) + + qca956x_usb_setup(); + else + BUG(); + } + --- a/arch/mips/ath79/dev-wmac.c + +++ b/arch/mips/ath79/dev-wmac.c +-@@ -189,6 +189,24 @@ static void qca955x_wmac_setup(void) ++@@ -189,6 +189,26 @@ static void qca955x_wmac_setup(void) + ath79_wmac_data.is_clk_25mhz = true; + } + +@@ -195,16 +205,18 @@ + + ath79_wmac_data.is_clk_25mhz = false; + + else + + ath79_wmac_data.is_clk_25mhz = true; +++ +++ ath79_wmac_data.get_mac_revision = ar93xx_get_soc_revision; + +} + + + static bool __init + ar93xx_wmac_otp_read_word(void __iomem *base, int addr, u32 *data) + { +-@@ -392,6 +410,8 @@ void __init ath79_register_wmac(u8 *cal_ ++@@ -392,6 +412,8 @@ void __init ath79_register_wmac(u8 *cal_ + qca953x_wmac_setup(); + else if (soc_is_qca955x()) + qca955x_wmac_setup(); +-+ else if (soc_is_qca956x()) +++ else if (soc_is_qca956x() || soc_is_tp9343()) + + qca956x_wmac_setup(); + else + BUG(); +@@ -216,27 +228,38 @@ + case REV_ID_MAJOR_QCA9556: + case REV_ID_MAJOR_QCA9558: + + case REV_ID_MAJOR_TP9343: +-+ case REV_ID_MAJOR_QCA9561: +++ case REV_ID_MAJOR_QCA956X: + _prom_putchar = prom_putchar_ar71xx; + break; + + --- a/arch/mips/ath79/gpio.c + +++ b/arch/mips/ath79/gpio.c +-@@ -148,7 +148,8 @@ static void __iomem *ath79_gpio_get_func ++@@ -148,7 +148,10 @@ static void __iomem *ath79_gpio_get_func + soc_is_ar913x() || + soc_is_ar933x()) + reg = AR71XX_GPIO_REG_FUNC; + - else if (soc_is_ar934x() || soc_is_qca953x()) + + else if (soc_is_ar934x() || +-+ soc_is_qca953x() || soc_is_qca956x()) +++ soc_is_qca953x() || +++ soc_is_qca956x() || +++ soc_is_tp9343()) + reg = AR934X_GPIO_REG_FUNC; + else + BUG(); +-@@ -228,12 +229,15 @@ void __init ath79_gpio_init(void) ++@@ -187,7 +190,7 @@ void __init ath79_gpio_output_select(uns ++ unsigned int reg; ++ u32 t, s; ++ ++- BUG_ON(!soc_is_ar934x() && !soc_is_qca953x()); +++ BUG_ON(!soc_is_ar934x() && !soc_is_qca953x() && !soc_is_qca956x()); ++ ++ if (gpio >= AR934X_GPIO_COUNT) ++ return; ++@@ -228,12 +231,15 @@ void __init ath79_gpio_init(void) + ath79_gpio_count = QCA953X_GPIO_COUNT; + else if (soc_is_qca955x()) + ath79_gpio_count = QCA955X_GPIO_COUNT; +-+ else if (soc_is_qca956x()) +++ else if (soc_is_qca956x() || soc_is_tp9343()) + + ath79_gpio_count = QCA956X_GPIO_COUNT; + else + BUG(); +@@ -245,23 +268,24 @@ + ath79_gpio_chip.ngpio = ath79_gpio_count; + - if (soc_is_ar934x() || soc_is_qca953x() || soc_is_qca955x()) { + + if (soc_is_ar934x() || soc_is_qca953x() || soc_is_qca955x() || +-+ soc_is_qca956x()) { +++ soc_is_qca956x() || soc_is_tp9343()) { + ath79_gpio_chip.direction_input = ar934x_gpio_direction_input; + ath79_gpio_chip.direction_output = ar934x_gpio_direction_output; + } + --- a/arch/mips/ath79/irq.c + +++ b/arch/mips/ath79/irq.c +-@@ -107,7 +107,8 @@ static void __init ath79_misc_irq_init(v ++@@ -107,7 +107,9 @@ static void __init ath79_misc_irq_init(v + soc_is_ar933x() || + soc_is_ar934x() || + soc_is_qca953x() || + - soc_is_qca955x()) + + soc_is_qca955x() || +-+ soc_is_qca956x()) +++ soc_is_qca956x() || +++ soc_is_tp9343()) + ath79_misc_irq_chip.irq_ack = ar724x_misc_irq_ack; + else + BUG(); +-@@ -268,6 +269,97 @@ static void qca955x_irq_init(void) ++@@ -268,6 +270,97 @@ static void qca955x_irq_init(void) + irq_set_chained_handler(ATH79_CPU_IRQ(3), qca955x_ip3_irq_dispatch); + } + +@@ -359,21 +383,21 @@ + asmlinkage void plat_irq_dispatch(void) + { + unsigned long pending; +-@@ -397,6 +489,9 @@ void __init arch_init_irq(void) ++@@ -397,6 +490,9 @@ void __init arch_init_irq(void) + } else if (soc_is_qca955x()) { + ath79_ip2_handler = ath79_default_ip2_handler; + ath79_ip3_handler = ath79_default_ip3_handler; +-+ } else if (soc_is_qca956x()) { +++ } else if (soc_is_qca956x() || soc_is_tp9343()) { + + ath79_ip2_handler = ath79_default_ip2_handler; + + ath79_ip3_handler = ath79_default_ip3_handler; + } else { + BUG(); + } +-@@ -411,4 +506,6 @@ void __init arch_init_irq(void) ++@@ -411,4 +507,6 @@ void __init arch_init_irq(void) + qca953x_irq_init(); + else if (soc_is_qca955x()) + qca955x_irq_init(); +-+ else if (soc_is_qca956x()) +++ else if (soc_is_qca956x() || soc_is_tp9343()) + + qca956x_irq_init(); + } + --- a/arch/mips/ath79/Kconfig +@@ -428,7 +452,7 @@ + } else if (soc_is_qca955x()) { + ath79_pci_irq_map = qca955x_pci_irq_map; + ath79_pci_nr_irqs = ARRAY_SIZE(qca955x_pci_irq_map); +-+ } else if (soc_is_qca9561()) { +++ } else if (soc_is_qca956x()) { + + ath79_pci_irq_map = qca956x_pci_irq_map; + + ath79_pci_nr_irqs = ARRAY_SIZE(qca956x_pci_irq_map); + } else { +@@ -438,7 +462,7 @@ + QCA955X_PCI_MEM_SIZE, + 1, + ATH79_IP3_IRQ(2)); +-+ } else if (soc_is_qca9561()) { +++ } else if (soc_is_qca956x()) { + + pdev = ath79_register_pci_ar724x(0, + + QCA956X_PCI_CFG_BASE1, + + QCA956X_PCI_CTRL_BASE1, +@@ -456,15 +480,15 @@ + rev = id & QCA955X_REV_ID_REVISION_MASK; + break; + +-+ case REV_ID_MAJOR_TP9343: +-+ ath79_soc = ATH79_SOC_TP9343; +-+ chip = "9343"; +++ case REV_ID_MAJOR_QCA956X: +++ ath79_soc = ATH79_SOC_QCA956X; +++ chip = "956X"; + + rev = id & QCA956X_REV_ID_REVISION_MASK; + + break; + + +-+ case REV_ID_MAJOR_QCA9561: +-+ ath79_soc = ATH79_SOC_QCA9561; +-+ chip = "9561"; +++ case REV_ID_MAJOR_TP9343: +++ ath79_soc = ATH79_SOC_TP9343; +++ chip = "9343"; + + rev = id & QCA956X_REV_ID_REVISION_MASK; + + break; + + +@@ -476,7 +500,7 @@ + ath79_soc_rev = rev; + + - if (soc_is_qca953x() || soc_is_qca955x()) +-+ if (soc_is_qca953x() || soc_is_qca955x() || soc_is_qca9561()) +++ if (soc_is_qca953x() || soc_is_qca955x() || soc_is_qca956x()) + sprintf(ath79_sys_type, "Qualcomm Atheros QCA%s ver %u rev %u", + chip, ver, rev); + + else if (soc_is_tp9343()) +@@ -511,7 +535,21 @@ + #define AR9300_OTP_BASE 0x14000 + #define AR9300_OTP_STATUS 0x15f18 + #define AR9300_OTP_STATUS_TYPE 0x7 +-@@ -375,6 +392,49 @@ ++@@ -152,6 +169,13 @@ ++ #define AR9300_OTP_READ_DATA 0x15f1c ++ ++ /* +++ * Hidden Registers +++ */ +++#define QCA956X_DAM_RESET_OFFSET 0xb90001bc +++#define QCA956X_DAM_RESET_SIZE 0x4 +++#define QCA956X_INLINE_CHKSUM_ENG BIT(27) +++ +++/* ++ * DDR_CTRL block ++ */ ++ #define AR71XX_DDR_REG_PCI_WIN0 0x7c ++@@ -375,6 +399,49 @@ + #define QCA955X_PLL_CLK_CTRL_DDRCLK_FROM_DDRPLL BIT(21) + #define QCA955X_PLL_CLK_CTRL_AHBCLK_FROM_DDRPLL BIT(24) + +@@ -561,7 +599,7 @@ + /* + * USB_CONFIG block + */ +-@@ -422,6 +482,11 @@ ++@@ -422,6 +489,11 @@ + #define QCA955X_RESET_REG_BOOTSTRAP 0xb0 + #define QCA955X_RESET_REG_EXT_INT_STATUS 0xac + +@@ -573,7 +611,7 @@ + #define MISC_INT_ETHSW BIT(12) + #define MISC_INT_TIMER4 BIT(10) + #define MISC_INT_TIMER3 BIT(9) +-@@ -596,6 +661,8 @@ ++@@ -596,6 +668,8 @@ + + #define QCA955X_BOOTSTRAP_REF_CLK_40 BIT(4) + +@@ -582,7 +620,7 @@ + #define AR934X_PCIE_WMAC_INT_WMAC_MISC BIT(0) + #define AR934X_PCIE_WMAC_INT_WMAC_TX BIT(1) + #define AR934X_PCIE_WMAC_INT_WMAC_RXLP BIT(2) +-@@ -663,6 +730,37 @@ ++@@ -663,6 +737,37 @@ + QCA955X_EXT_INT_PCIE_RC2_INT1 | QCA955X_EXT_INT_PCIE_RC2_INT2 | \ + QCA955X_EXT_INT_PCIE_RC2_INT3) + +@@ -620,16 +658,16 @@ + #define REV_ID_MAJOR_MASK 0xfff0 + #define REV_ID_MAJOR_AR71XX 0x00a0 + #define REV_ID_MAJOR_AR913X 0x00b0 +-@@ -678,6 +776,8 @@ ++@@ -678,6 +783,8 @@ + #define REV_ID_MAJOR_QCA9533_V2 0x0160 + #define REV_ID_MAJOR_QCA9556 0x0130 + #define REV_ID_MAJOR_QCA9558 0x1130 + +#define REV_ID_MAJOR_TP9343 0x0150 +-+#define REV_ID_MAJOR_QCA9561 0x1150 +++#define REV_ID_MAJOR_QCA956X 0x1150 + + #define AR71XX_REV_ID_MINOR_MASK 0x3 + #define AR71XX_REV_ID_MINOR_AR7130 0x0 +-@@ -702,6 +802,8 @@ ++@@ -702,6 +809,8 @@ + + #define QCA955X_REV_ID_REVISION_MASK 0xf + +@@ -638,7 +676,7 @@ + /* + * SPI block + */ +-@@ -766,6 +868,19 @@ ++@@ -766,6 +875,19 @@ + #define QCA953X_GPIO_OUT_MUX_LED_LINK4 44 + #define QCA953X_GPIO_OUT_MUX_LED_LINK5 45 + +@@ -658,7 +696,7 @@ + #define AR71XX_GPIO_COUNT 16 + #define AR7240_GPIO_COUNT 18 + #define AR7241_GPIO_COUNT 20 +-@@ -774,6 +889,7 @@ ++@@ -774,6 +896,7 @@ + #define AR934X_GPIO_COUNT 23 + #define QCA953X_GPIO_COUNT 18 + #define QCA955X_GPIO_COUNT 24 +@@ -673,11 +711,11 @@ + ATH79_SOC_QCA9556, + ATH79_SOC_QCA9558, + + ATH79_SOC_TP9343, +-+ ATH79_SOC_QCA9561, +++ ATH79_SOC_QCA956X, + }; + + extern enum ath79_soc_type ath79_soc; +-@@ -126,6 +128,21 @@ static inline int soc_is_qca955x(void) ++@@ -126,6 +128,26 @@ static inline int soc_is_qca955x(void) + return soc_is_qca9556() || soc_is_qca9558(); + } + +@@ -685,15 +723,20 @@ + +{ + + return ath79_soc == ATH79_SOC_TP9343; + +} +-+ +++ + +static inline int soc_is_qca9561(void) + +{ +-+ return ath79_soc == ATH79_SOC_QCA9561; +++ return ath79_soc == ATH79_SOC_QCA956X; +++} +++ +++static inline int soc_is_qca9563(void) +++{ +++ return ath79_soc == ATH79_SOC_QCA956X; + +} + + + +static inline int soc_is_qca956x(void) + +{ +-+ return soc_is_tp9343() || soc_is_qca9561(); +++ return soc_is_qca9561() || soc_is_qca9563(); + +} + + + extern void __iomem *ath79_ddr_base; diff --git a/patches/openwrt/0039-ar71xx-fold-patch-622-MIPS-ath79-add-support-for-QCA956x-ethernet.patch-into-files.patch b/patches/openwrt/0039-ar71xx-fold-patch-622-MIPS-ath79-add-support-for-QCA956x-ethernet.patch-into-files.patch new file mode 100644 index 00000000..13161242 --- /dev/null +++ b/patches/openwrt/0039-ar71xx-fold-patch-622-MIPS-ath79-add-support-for-QCA956x-ethernet.patch-into-files.patch @@ -0,0 +1,176 @@ +From: Matthias Schiffer +Date: Fri, 13 May 2016 21:00:16 +0200 +Subject: ar71xx: fold patch 622-MIPS-ath79-add-support-for-QCA956x-ethernet.patch into files/ + +Signed-off-by: Felix Fietkau + +Backport of OpenWrt r48650 + +diff --git a/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c b/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c +index 31d2438..2efb9c7 100644 +--- a/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c ++++ b/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c +@@ -198,7 +198,6 @@ void __init ath79_register_mdio(unsigned int id, u32 phy_mask) + case ATH79_SOC_AR9330: + case ATH79_SOC_AR9331: + case ATH79_SOC_QCA9533: +- case ATH79_SOC_QCA9561: + case ATH79_SOC_TP9343: + mdio_dev = &ath79_mdio1_device; + mdio_data = &ath79_mdio1_data; +@@ -209,6 +208,7 @@ void __init ath79_register_mdio(unsigned int id, u32 phy_mask) + case ATH79_SOC_AR9344: + case ATH79_SOC_QCA9556: + case ATH79_SOC_QCA9558: ++ case ATH79_SOC_QCA956X: + if (id == 0) { + mdio_dev = &ath79_mdio0_device; + mdio_data = &ath79_mdio0_data; +@@ -258,7 +258,6 @@ void __init ath79_register_mdio(unsigned int id, u32 phy_mask) + break; + + case ATH79_SOC_QCA9533: +- case ATH79_SOC_QCA9561: + case ATH79_SOC_TP9343: + mdio_data->builtin_switch = 1; + break; +@@ -268,6 +267,11 @@ void __init ath79_register_mdio(unsigned int id, u32 phy_mask) + mdio_data->is_ar934x = 1; + break; + ++ case ATH79_SOC_QCA956X: ++ if (id == 1) ++ mdio_data->builtin_switch = 1; ++ break; ++ + default: + break; + } +@@ -387,6 +391,16 @@ static void qca955x_set_speed_sgmii(int speed) + iounmap(base); + } + ++static void qca956x_set_speed_sgmii(int speed) ++{ ++ void __iomem *base; ++ u32 val = ath79_get_eth_pll(0, speed); ++ ++ base = ioremap_nocache(AR71XX_PLL_BASE, AR71XX_PLL_SIZE); ++ __raw_writel(val, base + QCA955X_PLL_ETH_SGMII_CONTROL_REG); ++ iounmap(base); ++} ++ + static void ath79_set_speed_dummy(int speed) + { + } +@@ -517,6 +531,10 @@ struct ag71xx_switch_platform_data ath79_switch_data; + #define AR934X_PLL_VAL_100 0x00000101 + #define AR934X_PLL_VAL_10 0x00001616 + ++#define QCA956X_PLL_VAL_1000 0x03000000 ++#define QCA956X_PLL_VAL_100 0x00000101 ++#define QCA956X_PLL_VAL_10 0x00001919 ++ + static void __init ath79_init_eth_pll_data(unsigned int id) + { + struct ath79_eth_pll_data *pll_data; +@@ -575,13 +593,18 @@ static void __init ath79_init_eth_pll_data(unsigned int id) + case ATH79_SOC_QCA9533: + case ATH79_SOC_QCA9556: + case ATH79_SOC_QCA9558: +- case ATH79_SOC_QCA9561: + case ATH79_SOC_TP9343: + pll_10 = AR934X_PLL_VAL_10; + pll_100 = AR934X_PLL_VAL_100; + pll_1000 = AR934X_PLL_VAL_1000; + break; + ++ case ATH79_SOC_QCA956X: ++ pll_10 = QCA956X_PLL_VAL_10; ++ pll_100 = QCA956X_PLL_VAL_100; ++ pll_1000 = QCA956X_PLL_VAL_1000; ++ break; ++ + default: + BUG(); + } +@@ -656,6 +679,7 @@ static int __init ath79_setup_phy_if_mode(unsigned int id, + + case ATH79_SOC_QCA9556: + case ATH79_SOC_QCA9558: ++ case ATH79_SOC_QCA956X: + switch (pdata->phy_if_mode) { + case PHY_INTERFACE_MODE_MII: + case PHY_INTERFACE_MODE_RGMII: +@@ -666,11 +690,6 @@ static int __init ath79_setup_phy_if_mode(unsigned int id, + } + break; + +- case ATH79_SOC_QCA9561: +- if (!pdata->phy_if_mode) +- pdata->phy_if_mode = PHY_INTERFACE_MODE_MII; +- break; +- + default: + BUG(); + } +@@ -699,7 +718,7 @@ static int __init ath79_setup_phy_if_mode(unsigned int id, + case ATH79_SOC_AR7241: + case ATH79_SOC_AR9330: + case ATH79_SOC_AR9331: +- case ATH79_SOC_QCA9561: ++ case ATH79_SOC_QCA956X: + case ATH79_SOC_TP9343: + pdata->phy_if_mode = PHY_INTERFACE_MODE_GMII; + break; +@@ -1032,7 +1051,6 @@ void __init ath79_register_eth(unsigned int id) + pdata->fifo_cfg3 = 0x01f00140; + break; + +- case ATH79_SOC_QCA9561: + case ATH79_SOC_TP9343: + if (id == 0) { + pdata->reset_bit = AR933X_RESET_GE0_MAC | +@@ -1100,6 +1118,34 @@ void __init ath79_register_eth(unsigned int id) + pdata->fifo_cfg3 = 0x01f00140; + break; + ++ case ATH79_SOC_QCA956X: ++ if (id == 0) { ++ pdata->reset_bit = QCA955X_RESET_GE0_MAC | ++ QCA955X_RESET_GE0_MDIO; ++ if (pdata->phy_if_mode == PHY_INTERFACE_MODE_SGMII) ++ pdata->set_speed = qca956x_set_speed_sgmii; ++ else ++ /* FIXME */ ++ pdata->set_speed = ath79_set_speed_dummy; ++ } else { ++ pdata->reset_bit = QCA955X_RESET_GE1_MAC | ++ QCA955X_RESET_GE1_MDIO; ++ /* FIXME */ ++ pdata->set_speed = ath79_set_speed_dummy; ++ } ++ ++ pdata->ddr_flush = ath79_ddr_no_flush; ++ pdata->has_gbit = 1; ++ pdata->is_ar724x = 1; ++ ++ if (!pdata->fifo_cfg1) ++ pdata->fifo_cfg1 = 0x0010ffff; ++ if (!pdata->fifo_cfg2) ++ pdata->fifo_cfg2 = 0x015500aa; ++ if (!pdata->fifo_cfg3) ++ pdata->fifo_cfg3 = 0x01f00140; ++ break; ++ + default: + BUG(); + } +@@ -1140,7 +1186,6 @@ void __init ath79_register_eth(unsigned int id) + case ATH79_SOC_AR9330: + case ATH79_SOC_AR9331: + case ATH79_SOC_QCA9533: +- case ATH79_SOC_QCA9561: + case ATH79_SOC_TP9343: + pdata->mii_bus_dev = &ath79_mdio1_device.dev; + break; diff --git a/patches/openwrt/0040-ar71xx-fix-MDIO-bus-probe-on-QCA956x.patch b/patches/openwrt/0040-ar71xx-fix-MDIO-bus-probe-on-QCA956x.patch new file mode 100644 index 00000000..7594cf2f --- /dev/null +++ b/patches/openwrt/0040-ar71xx-fix-MDIO-bus-probe-on-QCA956x.patch @@ -0,0 +1,22 @@ +From: Matthias Schiffer +Date: Fri, 13 May 2016 21:00:41 +0200 +Subject: ar71xx: fix MDIO bus probe on QCA956x + +Signed-off-by: Felix Fietkau + +Backport of OpenWrt r48651 + +diff --git a/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c b/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c +index 2efb9c7..12a376e 100644 +--- a/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c ++++ b/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c +@@ -183,7 +183,8 @@ void __init ath79_register_mdio(unsigned int id, u32 phy_mask) + ath79_soc == ATH79_SOC_AR9342 || + ath79_soc == ATH79_SOC_AR9344 || + ath79_soc == ATH79_SOC_QCA9556 || +- ath79_soc == ATH79_SOC_QCA9558) ++ ath79_soc == ATH79_SOC_QCA9558 || ++ ath79_soc == ATH79_SOC_QCA956X) + max_id = 1; + else + max_id = 0; diff --git a/patches/openwrt/0041-ar71xx-fix-qca956x-ethernet-initialization.patch b/patches/openwrt/0041-ar71xx-fix-qca956x-ethernet-initialization.patch new file mode 100644 index 00000000..6cc5e950 --- /dev/null +++ b/patches/openwrt/0041-ar71xx-fix-qca956x-ethernet-initialization.patch @@ -0,0 +1,64 @@ +From: Matthias Schiffer +Date: Fri, 13 May 2016 21:01:19 +0200 +Subject: ar71xx: fix qca956x ethernet initialization + +Complete internal switch initialization for QCA956X. +Set default mdio device if the interface mode of GE0 is not SGMII (fix ticket #21520). + +Signed-off-by: Weijie Gao + +Backport of OpenWrt r48937 + +diff --git a/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c b/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c +index 12a376e..b43c80a 100644 +--- a/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c ++++ b/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c +@@ -271,6 +271,7 @@ void __init ath79_register_mdio(unsigned int id, u32 phy_mask) + case ATH79_SOC_QCA956X: + if (id == 1) + mdio_data->builtin_switch = 1; ++ mdio_data->is_ar934x = 1; + break; + + default: +@@ -1123,16 +1124,25 @@ void __init ath79_register_eth(unsigned int id) + if (id == 0) { + pdata->reset_bit = QCA955X_RESET_GE0_MAC | + QCA955X_RESET_GE0_MDIO; ++ + if (pdata->phy_if_mode == PHY_INTERFACE_MODE_SGMII) + pdata->set_speed = qca956x_set_speed_sgmii; + else +- /* FIXME */ +- pdata->set_speed = ath79_set_speed_dummy; ++ pdata->set_speed = ath79_set_speed_ge0; + } else { + pdata->reset_bit = QCA955X_RESET_GE1_MAC | + QCA955X_RESET_GE1_MDIO; +- /* FIXME */ ++ + pdata->set_speed = ath79_set_speed_dummy; ++ ++ pdata->switch_data = &ath79_switch_data; ++ ++ pdata->speed = SPEED_1000; ++ pdata->duplex = DUPLEX_FULL; ++ ++ /* reset the built-in switch */ ++ ath79_device_reset_set(AR934X_RESET_ETH_SWITCH); ++ ath79_device_reset_clear(AR934X_RESET_ETH_SWITCH); + } + + pdata->ddr_flush = ath79_ddr_no_flush; +@@ -1196,6 +1206,11 @@ void __init ath79_register_eth(unsigned int id) + /* don't assign any MDIO device by default */ + break; + ++ case ATH79_SOC_QCA956X: ++ if (pdata->phy_if_mode != PHY_INTERFACE_MODE_SGMII) ++ pdata->mii_bus_dev = &ath79_mdio1_device.dev; ++ break; ++ + default: + pdata->mii_bus_dev = &ath79_mdio0_device.dev; + break; diff --git a/patches/openwrt/0042-ar71xx-Support-for-Ubiquiti-UniFi-AP-AC-LITE.patch b/patches/openwrt/0042-ar71xx-Support-for-Ubiquiti-UniFi-AP-AC-LITE.patch new file mode 100644 index 00000000..21390fc7 --- /dev/null +++ b/patches/openwrt/0042-ar71xx-Support-for-Ubiquiti-UniFi-AP-AC-LITE.patch @@ -0,0 +1,562 @@ +From: Matthias Schiffer +Date: Fri, 13 May 2016 20:47:26 +0200 +Subject: ar71xx: Support for Ubiquiti UniFi AP AC LITE + +Add support for the Ubiquiti UniFi AP AC LITE +Signed-off-by: P.Wassi + +Backport of OpenWrt r48711 + +diff --git a/target/linux/ar71xx/base-files/etc/diag.sh b/target/linux/ar71xx/base-files/etc/diag.sh +index 5a184cd..8c6ac9a 100644 +--- a/target/linux/ar71xx/base-files/etc/diag.sh ++++ b/target/linux/ar71xx/base-files/etc/diag.sh +@@ -296,7 +296,8 @@ get_status_led() { + unifi) + status_led="ubnt:green:dome" + ;; +- uap-pro) ++ uap-pro | \ ++ unifiac) + status_led="ubnt:white:dome" + ;; + unifi-outdoor-plus) +diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network +index b2e15bb..e4a1473 100755 +--- a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network ++++ b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network +@@ -366,6 +366,7 @@ tl-wa901nd-v3 |\ + tl-wa901nd-v4 |\ + tl-wr703n |\ + tube2h |\ ++unifiac |\ + wndap360 |\ + mynet-rext |\ + wp543) +diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh +index ddd6611..8670583 100755 +--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh ++++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh +@@ -881,6 +881,9 @@ ar71xx_board_detect() { + *UniFi) + name="unifi" + ;; ++ *"UniFi-AC") ++ name="unifiac" ++ ;; + *"UniFi AP Pro") + name="uap-pro" + ;; +diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh +index c5c1871..4c43166 100755 +--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh ++++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh +@@ -251,6 +251,7 @@ platform_check_image() { + wlae-ag300n | \ + nbg460n_550n_550nh | \ + unifi | \ ++ unifiac | \ + unifi-outdoor | \ + carambola2 | \ + weio ) +diff --git a/target/linux/ar71xx/config-3.18 b/target/linux/ar71xx/config-3.18 +index e2ff826..9a81911 100644 +--- a/target/linux/ar71xx/config-3.18 ++++ b/target/linux/ar71xx/config-3.18 +@@ -137,6 +137,7 @@ CONFIG_ATH79_MACH_TL_WR941ND=y + CONFIG_ATH79_MACH_TL_WR941ND_V6=y + CONFIG_ATH79_MACH_TUBE2H=y + CONFIG_ATH79_MACH_UBNT=y ++CONFIG_ATH79_MACH_UBNT_UNIFIAC=y + CONFIG_ATH79_MACH_UBNT_XM=y + CONFIG_ATH79_MACH_WEIO=y + CONFIG_ATH79_MACH_WHR_HP_G300N=y +@@ -320,7 +321,7 @@ CONFIG_SOC_AR933X=y + CONFIG_SOC_AR934X=y + CONFIG_SOC_QCA953X=y + CONFIG_SOC_QCA955X=y +-# CONFIG_SOC_QCA956X is not set ++CONFIG_SOC_QCA956X=y + CONFIG_SPI=y + CONFIG_SPI_AP83=y + CONFIG_SPI_ATH79=y +diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-ubnt-unifiac.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-ubnt-unifiac.c +new file mode 100644 +index 0000000..3617ca7 +--- /dev/null ++++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-ubnt-unifiac.c +@@ -0,0 +1,109 @@ ++/* ++ * Ubiquiti UniFi AC (LITE) board support ++ * ++ * Copyright (C) 2015-2016 P. Wassi ++ * ++ * Derived from: mach-ubnt-xm.c ++ * ++ * 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. ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++ ++#include ++ ++#include "common.h" ++#include "dev-ap9x-pci.h" ++#include "dev-eth.h" ++#include "dev-gpio-buttons.h" ++#include "dev-leds-gpio.h" ++#include "dev-m25p80.h" ++#include "dev-wmac.h" ++#include "machtypes.h" ++ ++ ++#define UNIFIAC_KEYS_POLL_INTERVAL 20 ++#define UNIFIAC_KEYS_DEBOUNCE_INTERVAL (3 * UNIFIAC_KEYS_POLL_INTERVAL) ++ ++#define UNIFIAC_GPIO_LED_WHITE 7 ++#define UNIFIAC_GPIO_LED_BLUE 8 ++ ++#define UNIFIAC_GPIO_BTN_RESET 2 ++ ++#define UNIFIAC_MAC0_OFFSET 0x0000 ++#define UNIFIAC_WMAC_CALDATA_OFFSET 0x1000 ++#define UNIFIAC_PCI_CALDATA_OFFSET 0x5000 ++ ++ ++static struct flash_platform_data ubnt_unifiac_flash_data = { ++ /* mx25l12805d and mx25l12835f have the same JEDEC ID */ ++ .type = "mx25l12805d", ++}; ++ ++static struct gpio_led ubnt_unifiac_leds_gpio[] __initdata = { ++ { ++ .name = "ubnt:white:dome", ++ .gpio = UNIFIAC_GPIO_LED_WHITE, ++ .active_low = 0, ++ }, { ++ .name = "ubnt:blue:dome", ++ .gpio = UNIFIAC_GPIO_LED_BLUE, ++ .active_low = 0, ++ } ++}; ++ ++static struct gpio_keys_button ubnt_unifiac_gpio_keys[] __initdata = { ++ { ++ .desc = "reset", ++ .type = EV_KEY, ++ .code = KEY_RESTART, ++ .debounce_interval = UNIFIAC_KEYS_DEBOUNCE_INTERVAL, ++ .gpio = UNIFIAC_GPIO_BTN_RESET, ++ .active_low = 1, ++ } ++}; ++ ++static void __init ubnt_unifiac_setup(void) ++{ ++ u8 *eeprom = (u8 *) KSEG1ADDR(0x1fff0000); ++ ++ ath79_register_m25p80(&ubnt_unifiac_flash_data); ++ ++ ++ ath79_init_mac(ath79_eth0_data.mac_addr, ++ eeprom + UNIFIAC_MAC0_OFFSET, 0); ++ ++ ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_SGMII; ++ ath79_eth0_data.phy_mask = BIT(4); ++ ath79_eth0_pll_data.pll_10 = 0x00001313; ++ ++ ath79_register_mdio(0, ~BIT(4)); ++ ath79_register_eth(0); ++ ++ ++ ath79_register_wmac(eeprom + UNIFIAC_WMAC_CALDATA_OFFSET, NULL); ++ ++ ++ ap91_pci_init(eeprom + UNIFIAC_PCI_CALDATA_OFFSET, NULL); ++ ++ ++ ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_unifiac_leds_gpio), ++ ubnt_unifiac_leds_gpio); ++ ++ ath79_register_gpio_keys_polled(-1, UNIFIAC_KEYS_POLL_INTERVAL, ++ ARRAY_SIZE(ubnt_unifiac_gpio_keys), ++ ubnt_unifiac_gpio_keys); ++} ++ ++MIPS_MACHINE(ATH79_MACH_UBNT_UNIFIAC, "UBNT-UF-AC", "Ubiquiti UniFi-AC", ++ ubnt_unifiac_setup); +diff --git a/target/linux/ar71xx/generic/profiles/ubnt.mk b/target/linux/ar71xx/generic/profiles/ubnt.mk +index d8e24d0..94eff18 100644 +--- a/target/linux/ar71xx/generic/profiles/ubnt.mk ++++ b/target/linux/ar71xx/generic/profiles/ubnt.mk +@@ -38,6 +38,17 @@ endef + + $(eval $(call Profile,UBNTUNIFI)) + ++define Profile/UBNTUNIFIAC ++ NAME:=Ubiquiti UniFi AP AC ++ PACKAGES:=kmod-ath10k ath10k-firmware-qca988x ++endef ++ ++define Profile/UBNTUNIFIAC/Description ++ Package set optimized for the Ubiquiti UniFi AP AC. ++endef ++ ++$(eval $(call Profile,UBNTUNIFIAC)) ++ + define Profile/UBNTUNIFIOUTDOOR + NAME:=Ubiquiti UniFiAP Outdoor + PACKAGES:= +diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile +index d42ceef..dd59f2d 100644 +--- a/target/linux/ar71xx/image/Makefile ++++ b/target/linux/ar71xx/image/Makefile +@@ -740,6 +740,16 @@ define Device/oolite + endef + TARGET_DEVICES += oolite + ++define Device/ubnt-unifiac ++ DEVICE_PROFILE := UBNT UBNTUNIFIAC ++ IMAGE_SIZE := 7744k ++ MTDPARTS = spi0.0:384k(u-boot)ro,64k(u-boot-env)ro,7744k(firmware),7744k(ubnt-airos)ro,128k(bs)ro,256k(cfg)ro,64k(EEPROM)ro ++ IMAGES := sysupgrade.bin ++ IMAGE/sysupgrade.bin = append-kernel $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE) ++ BOARDNAME := UBNT-UF-AC ++endef ++TARGET_DEVICES += ubnt-unifiac ++ + rootfs_type=$(patsubst jffs2-%,jffs2,$(patsubst squashfs-%,squashfs,$(1))) + + # $(1): rootfs type. +diff --git a/target/linux/ar71xx/mikrotik/config-default b/target/linux/ar71xx/mikrotik/config-default +index b8a7bf1..2b1fe24 100644 +--- a/target/linux/ar71xx/mikrotik/config-default ++++ b/target/linux/ar71xx/mikrotik/config-default +@@ -97,6 +97,7 @@ CONFIG_ATH79_MACH_RBSXTLITE=y + # CONFIG_ATH79_MACH_TUBE2H is not set + # CONFIG_ATH79_MACH_UBNT is not set + # CONFIG_ATH79_MACH_UBNT_XM is not set ++# CONFIG_ATH79_MACH_UBNT_UNIFIAC is not set + # CONFIG_ATH79_MACH_WHR_HP_G300N is not set + # CONFIG_ATH79_MACH_WLAE_AG300N is not set + # CONFIG_ATH79_MACH_WLR8100 is not set +diff --git a/target/linux/ar71xx/nand/config-default b/target/linux/ar71xx/nand/config-default +index 626d676..f62cf1a 100644 +--- a/target/linux/ar71xx/nand/config-default ++++ b/target/linux/ar71xx/nand/config-default +@@ -59,6 +59,7 @@ + # CONFIG_ATH79_MACH_TL_WR941ND is not set + # CONFIG_ATH79_MACH_UBNT is not set + # CONFIG_ATH79_MACH_UBNT_XM is not set ++# CONFIG_ATH79_MACH_UBNT_UNIFIAC is not set + # CONFIG_ATH79_MACH_WHR_HP_G300N is not set + # CONFIG_ATH79_MACH_WLAE_AG300N is not set + # CONFIG_ATH79_MACH_WNDAP360 is not set +diff --git a/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch b/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch +index d6e786d..5a7a72c 100644 +--- a/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch ++++ b/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch +@@ -1,6 +1,6 @@ + --- a/arch/mips/ath79/machtypes.h + +++ b/arch/mips/ath79/machtypes.h +-@@ -16,22 +16,199 @@ ++@@ -16,22 +16,200 @@ + + enum ath79_mach_type { + ATH79_MACH_GENERIC = 0, +@@ -164,6 +164,7 @@ + + ATH79_MACH_UBNT_RS, /* Ubiquiti RouterStation */ + ATH79_MACH_UBNT_UAP_PRO, /* Ubiquiti UniFi AP Pro */ + ATH79_MACH_UBNT_UNIFI, /* Ubiquiti Unifi */ +++ ATH79_MACH_UBNT_UNIFIAC, /* Ubiquiti Unifi AC */ + ATH79_MACH_UBNT_UNIFI_OUTDOOR, /* Ubiquiti UnifiAP Outdoor */ + + ATH79_MACH_UBNT_UNIFI_OUTDOOR_PLUS, /* Ubiquiti UnifiAP Outdoor+ */ + ATH79_MACH_UBNT_XM, /* Ubiquiti Networks XM board rev 1.0 */ +@@ -1097,10 +1098,7 @@ + + select ATH79_DEV_M25P80 + + select ATH79_DEV_USB + + select ATH79_DEV_WMAC +- +--config ATH79_MACH_AP136 +-- bool "Atheros AP136/AP135 reference board" +-- select SOC_QCA955X +++ + +config ATH79_MACH_TL_WA7210N_V2 + + bool "TP-LINK TL-WA7210N v2 support" + + select SOC_AR724X +@@ -1115,19 +1113,12 @@ + + bool "TP-LINK TL-WA830RE v2 support" + + select SOC_AR934X + + select ATH79_DEV_ETH +- select ATH79_DEV_GPIO_BUTTONS +- select ATH79_DEV_LEDS_GPIO +-- select ATH79_DEV_NFC +-- select ATH79_DEV_SPI +++ select ATH79_DEV_GPIO_BUTTONS +++ select ATH79_DEV_LEDS_GPIO + + select ATH79_DEV_M25P80 +- select ATH79_DEV_USB +- select ATH79_DEV_WMAC +-- help +-- Say 'Y' here if you want your kernel to support the +-- Atheros AP136 or AP135 reference boards. +- +--config ATH79_MACH_AP81 +-- bool "Atheros AP81 reference board" +++ select ATH79_DEV_USB +++ select ATH79_DEV_WMAC +++ + +config ATH79_MACH_TL_WA901ND + + bool "TP-LINK TL-WA901ND/TL-WA7510N support" + + select SOC_AR724X +@@ -1139,11 +1130,11 @@ + + + +config ATH79_MACH_TL_WA901ND_V2 + + bool "TP-LINK TL-WA901ND v2 support" +- select SOC_AR913X +- select ATH79_DEV_ETH +- select ATH79_DEV_GPIO_BUTTONS +- select ATH79_DEV_LEDS_GPIO +- select ATH79_DEV_M25P80 +++ select SOC_AR913X +++ select ATH79_DEV_ETH +++ select ATH79_DEV_GPIO_BUTTONS +++ select ATH79_DEV_LEDS_GPIO +++ select ATH79_DEV_M25P80 + + select ATH79_DEV_WMAC + + + +config ATH79_MACH_TL_WDR3500 +@@ -1154,34 +1145,13 @@ + + select ATH79_DEV_GPIO_BUTTONS + + select ATH79_DEV_LEDS_GPIO + + select ATH79_DEV_M25P80 +- select ATH79_DEV_USB +- select ATH79_DEV_WMAC +-- help +-- Say 'Y' here if you want your kernel to support the +-- Atheros AP81 reference board. +- +--config ATH79_MACH_DB120 +-- bool "Atheros DB120 reference board" +++ select ATH79_DEV_USB +++ select ATH79_DEV_WMAC +++ + +config ATH79_MACH_TL_WDR4300 + + bool "TP-LINK TL-WDR3600/4300/4310 board support" +- select SOC_AR934X +- select ATH79_DEV_AP9X_PCI if PCI +- select ATH79_DEV_ETH +- select ATH79_DEV_GPIO_BUTTONS +- select ATH79_DEV_LEDS_GPIO +- select ATH79_DEV_M25P80 +-- select ATH79_DEV_NFC +- select ATH79_DEV_USB +- select ATH79_DEV_WMAC +-- help +-- Say 'Y' here if you want your kernel to support the +-- Atheros DB120 reference board. +- +--config ATH79_MACH_PB44 +-- bool "Atheros PB44 reference board" +-+config ATH79_MACH_TL_WR703N +-+ bool "TP-LINK TL-WR703N/TL-WR710N/TL-MR10U support" +-+ select SOC_AR933X +++ select SOC_AR934X +++ select ATH79_DEV_AP9X_PCI if PCI + + select ATH79_DEV_ETH + + select ATH79_DEV_GPIO_BUTTONS + + select ATH79_DEV_LEDS_GPIO +@@ -1189,8 +1159,8 @@ + + select ATH79_DEV_USB + + select ATH79_DEV_WMAC + + +-+config ATH79_MACH_TL_WR720N_V3 +-+ bool "TP-LINK TL-WR720N v3/v4 support" +++config ATH79_MACH_TL_WR703N +++ bool "TP-LINK TL-WR703N/TL-WR710N/TL-MR10U support" + + select SOC_AR933X + + select ATH79_DEV_ETH + + select ATH79_DEV_GPIO_BUTTONS +@@ -1198,7 +1168,28 @@ + + select ATH79_DEV_M25P80 + + select ATH79_DEV_USB + + select ATH79_DEV_WMAC +-+ ++ ++-config ATH79_MACH_AP136 ++- bool "Atheros AP136/AP135 reference board" ++- select SOC_QCA955X +++config ATH79_MACH_TL_WR720N_V3 +++ bool "TP-LINK TL-WR720N v3/v4 support" +++ select SOC_AR933X +++ select ATH79_DEV_ETH ++ select ATH79_DEV_GPIO_BUTTONS ++ select ATH79_DEV_LEDS_GPIO ++- select ATH79_DEV_NFC ++- select ATH79_DEV_SPI +++ select ATH79_DEV_M25P80 ++ select ATH79_DEV_USB ++ select ATH79_DEV_WMAC ++- help ++- Say 'Y' here if you want your kernel to support the ++- Atheros AP136 or AP135 reference boards. ++ ++-config ATH79_MACH_AP81 ++- bool "Atheros AP81 reference board" ++- select SOC_AR913X + +config ATH79_MACH_TL_WR741ND + + bool "TP-LINK TL-WR741ND support" + + select SOC_AR724X +@@ -1211,21 +1202,25 @@ + +config ATH79_MACH_TL_WR741ND_V4 + + bool "TP-LINK TL-WR741ND v4/TL-MR3220 v2 support" + + select SOC_AR933X +-+ select ATH79_DEV_ETH +-+ select ATH79_DEV_GPIO_BUTTONS +-+ select ATH79_DEV_LEDS_GPIO +-+ select ATH79_DEV_M25P80 +-+ select ATH79_DEV_USB +-+ select ATH79_DEV_WMAC +-+ +-+config ATH79_MACH_TL_WR841N_V1 +-+ bool "TP-LINK TL-WR841N v1 support" +- select SOC_AR71XX +-+ select ATH79_DEV_DSA + select ATH79_DEV_ETH + select ATH79_DEV_GPIO_BUTTONS + select ATH79_DEV_LEDS_GPIO +-- select ATH79_DEV_SPI ++ select ATH79_DEV_M25P80 ++ select ATH79_DEV_USB ++ select ATH79_DEV_WMAC ++- help ++- Say 'Y' here if you want your kernel to support the ++- Atheros AP81 reference board. ++ ++-config ATH79_MACH_DB120 ++- bool "Atheros DB120 reference board" +++config ATH79_MACH_TL_WR841N_V1 +++ bool "TP-LINK TL-WR841N v1 support" +++ select SOC_AR71XX +++ select ATH79_DEV_DSA +++ select ATH79_DEV_ETH +++ select ATH79_DEV_GPIO_BUTTONS +++ select ATH79_DEV_LEDS_GPIO + + select ATH79_DEV_M25P80 + + + +config ATH79_MACH_TL_WR841N_V8 +@@ -1268,15 +1263,21 @@ + + + +config ATH79_MACH_TL_WR1041N_V2 + + bool "TP-LINK TL-WR1041N v2 support" +-+ select SOC_AR934X +-+ select ATH79_DEV_AP9X_PCI if PCI +-+ select ATH79_DEV_ETH +-+ select ATH79_DEV_GPIO_BUTTONS +-+ select ATH79_DEV_LEDS_GPIO +-+ select ATH79_DEV_M25P80 +-+ select ATH79_DEV_USB +-+ select ATH79_DEV_WMAC +-+ ++ select SOC_AR934X ++ select ATH79_DEV_AP9X_PCI if PCI ++ select ATH79_DEV_ETH ++ select ATH79_DEV_GPIO_BUTTONS ++ select ATH79_DEV_LEDS_GPIO ++ select ATH79_DEV_M25P80 ++- select ATH79_DEV_NFC ++ select ATH79_DEV_USB ++ select ATH79_DEV_WMAC ++- help ++- Say 'Y' here if you want your kernel to support the ++- Atheros DB120 reference board. ++ ++-config ATH79_MACH_PB44 ++- bool "Atheros PB44 reference board" + +config ATH79_MACH_TL_WR1043ND + + bool "TP-LINK TL-WR1043ND support" + + select SOC_AR913X +@@ -1319,11 +1320,12 @@ + + + +config ATH79_MACH_TEW_673GRU + + bool "TRENDnet TEW-673GRU support" +-+ select SOC_AR71XX ++ select SOC_AR71XX + + select ATH79_DEV_AP9X_PCI if PCI +-+ select ATH79_DEV_ETH +-+ select ATH79_DEV_GPIO_BUTTONS +-+ select ATH79_DEV_LEDS_GPIO ++ select ATH79_DEV_ETH ++ select ATH79_DEV_GPIO_BUTTONS ++ select ATH79_DEV_LEDS_GPIO ++- select ATH79_DEV_SPI + + select ATH79_DEV_M25P80 + + select ATH79_DEV_USB + + select ATH79_NVRAM +@@ -1361,10 +1363,20 @@ + + config ATH79_MACH_UBNT_XM + bool "Ubiquiti Networks XM/UniFi boards" +-@@ -83,6 +1144,106 @@ config ATH79_MACH_UBNT_XM ++@@ -83,6 +1144,116 @@ config ATH79_MACH_UBNT_XM + Say 'Y' here if you want your kernel to support the + Ubiquiti Networks XM (rev 1.0) board. + +++config ATH79_MACH_UBNT_UNIFIAC +++ bool "Ubiquiti UniFi AC (LITE) support" +++ select SOC_QCA956X +++ select ATH79_DEV_AP9X_PCI if PCI +++ select ATH79_DEV_ETH +++ select ATH79_DEV_GPIO_BUTTONS +++ select ATH79_DEV_LEDS_GPIO +++ select ATH79_DEV_M25P80 +++ select ATH79_DEV_WMAC +++ + +config ATH79_MACH_WEIO + + bool "WeIO board" + + select SOC_AR933X +@@ -1468,7 +1480,7 @@ + endmenu + + config SOC_AR71XX +-@@ -124,7 +1285,10 @@ config ATH79_DEV_DSA ++@@ -124,7 +1295,10 @@ config ATH79_DEV_DSA + config ATH79_DEV_ETH + def_bool n + +@@ -1480,7 +1492,7 @@ + def_bool n + + config ATH79_DEV_GPIO_BUTTONS +-@@ -154,6 +1318,11 @@ config ATH79_PCI_ATH9K_FIXUP ++@@ -154,6 +1328,11 @@ config ATH79_PCI_ATH9K_FIXUP + def_bool n + + config ATH79_ROUTERBOOT +@@ -1494,7 +1506,7 @@ + endif + --- a/arch/mips/ath79/Makefile + +++ b/arch/mips/ath79/Makefile +-@@ -38,9 +38,128 @@ obj-$(CONFIG_ATH79_ROUTERBOOT) += route ++@@ -38,9 +38,129 @@ obj-$(CONFIG_ATH79_ROUTERBOOT) += route + # + # Machines + # +@@ -1596,6 +1608,7 @@ + +obj-$(CONFIG_ATH79_MACH_TL_WR720N_V3) += mach-tl-wr720n-v3.o + +obj-$(CONFIG_ATH79_MACH_TUBE2H) += mach-tube2h.o + +obj-$(CONFIG_ATH79_MACH_UBNT) += mach-ubnt.o +++obj-$(CONFIG_ATH79_MACH_UBNT_UNIFIAC) += mach-ubnt-unifiac.o + obj-$(CONFIG_ATH79_MACH_UBNT_XM) += mach-ubnt-xm.o + +obj-$(CONFIG_ATH79_MACH_WEIO) += mach-weio.o + +obj-$(CONFIG_ATH79_MACH_WHR_HP_G300N) += mach-whr-hp-g300n.o diff --git a/patches/openwrt/0043-ar71xx-Fix-eth0-support-for-Ubiquiti-UniFi-AP-AC.patch b/patches/openwrt/0043-ar71xx-Fix-eth0-support-for-Ubiquiti-UniFi-AP-AC.patch new file mode 100644 index 00000000..bae7f32e --- /dev/null +++ b/patches/openwrt/0043-ar71xx-Fix-eth0-support-for-Ubiquiti-UniFi-AP-AC.patch @@ -0,0 +1,21 @@ +From: Matthias Schiffer +Date: Fri, 13 May 2016 21:02:55 +0200 +Subject: ar71xx: Fix eth0 support for Ubiquiti UniFi AP AC + +Fix eth0 support for the Ubiquiti UniFi AP AC +Signed-off-by: Paul Wassi + +Backport of OpenWrt r49277 + +diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-ubnt-unifiac.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-ubnt-unifiac.c +index 3617ca7..072cf12 100644 +--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-ubnt-unifiac.c ++++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-ubnt-unifiac.c +@@ -84,6 +84,7 @@ static void __init ubnt_unifiac_setup(void) + eeprom + UNIFIAC_MAC0_OFFSET, 0); + + ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_SGMII; ++ ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; + ath79_eth0_data.phy_mask = BIT(4); + ath79_eth0_pll_data.pll_10 = 0x00001313; + diff --git a/patches/openwrt/0044-ar71xx-Rename-unifiac-to-unifiac-lite.patch b/patches/openwrt/0044-ar71xx-Rename-unifiac-to-unifiac-lite.patch new file mode 100644 index 00000000..cbd40637 --- /dev/null +++ b/patches/openwrt/0044-ar71xx-Rename-unifiac-to-unifiac-lite.patch @@ -0,0 +1,192 @@ +From: Matthias Schiffer +Date: Fri, 13 May 2016 21:24:44 +0200 +Subject: ar71xx: Rename unifiac to unifiac-lite + +To avoid confusion with different unifiac devices, rename existing target +"unifiac" to "unifiac-lite", before "unifiac-pro" is introduced. + +Signed-off-by: P.Wassi + +Backport of LEDE c855e70491fbd5d432915c4cbeb3b80f3a117e30 + +diff --git a/target/linux/ar71xx/base-files/etc/diag.sh b/target/linux/ar71xx/base-files/etc/diag.sh +index 8c6ac9a..3d711ca 100644 +--- a/target/linux/ar71xx/base-files/etc/diag.sh ++++ b/target/linux/ar71xx/base-files/etc/diag.sh +@@ -297,7 +297,7 @@ get_status_led() { + status_led="ubnt:green:dome" + ;; + uap-pro | \ +- unifiac) ++ unifiac-lite) + status_led="ubnt:white:dome" + ;; + unifi-outdoor-plus) +diff --git a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata +index e6fcec8..fa8a2c8 100644 +--- a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata ++++ b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata +@@ -75,7 +75,7 @@ case "$FIRMWARE" in + ath10kcal_extract "ART" 20480 2116 + ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) +16) + ;; +- unifiac) ++ unifiac-lite) + ath10kcal_extract "EEPROM" 20480 2116 + ;; + esac +diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network +index e4a1473..0269e6d 100755 +--- a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network ++++ b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network +@@ -366,7 +366,7 @@ tl-wa901nd-v3 |\ + tl-wa901nd-v4 |\ + tl-wr703n |\ + tube2h |\ +-unifiac |\ ++unifiac-lite |\ + wndap360 |\ + mynet-rext |\ + wp543) +diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh +index 8670583..d3e6db9 100755 +--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh ++++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh +@@ -881,8 +881,8 @@ ar71xx_board_detect() { + *UniFi) + name="unifi" + ;; +- *"UniFi-AC") +- name="unifiac" ++ *"UniFi-AC-LITE") ++ name="unifiac-lite" + ;; + *"UniFi AP Pro") + name="uap-pro" +diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh +index 4c43166..a1b65b7 100755 +--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh ++++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh +@@ -251,7 +251,7 @@ platform_check_image() { + wlae-ag300n | \ + nbg460n_550n_550nh | \ + unifi | \ +- unifiac | \ ++ unifiac-lite | \ + unifi-outdoor | \ + carambola2 | \ + weio ) +diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-ubnt-unifiac.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-ubnt-unifiac.c +index 072cf12..31cbe30 100644 +--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-ubnt-unifiac.c ++++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-ubnt-unifiac.c +@@ -73,7 +73,7 @@ static struct gpio_keys_button ubnt_unifiac_gpio_keys[] __initdata = { + } + }; + +-static void __init ubnt_unifiac_setup(void) ++static void __init ubnt_unifiac_lite_setup(void) + { + u8 *eeprom = (u8 *) KSEG1ADDR(0x1fff0000); + +@@ -81,7 +81,7 @@ static void __init ubnt_unifiac_setup(void) + + + ath79_init_mac(ath79_eth0_data.mac_addr, +- eeprom + UNIFIAC_MAC0_OFFSET, 0); ++ eeprom + UNIFIAC_MAC0_OFFSET, 0); + + ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_SGMII; + ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; +@@ -99,12 +99,12 @@ static void __init ubnt_unifiac_setup(void) + + + ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_unifiac_leds_gpio), +- ubnt_unifiac_leds_gpio); ++ ubnt_unifiac_leds_gpio); + + ath79_register_gpio_keys_polled(-1, UNIFIAC_KEYS_POLL_INTERVAL, +- ARRAY_SIZE(ubnt_unifiac_gpio_keys), +- ubnt_unifiac_gpio_keys); ++ ARRAY_SIZE(ubnt_unifiac_gpio_keys), ++ ubnt_unifiac_gpio_keys); + } + +-MIPS_MACHINE(ATH79_MACH_UBNT_UNIFIAC, "UBNT-UF-AC", "Ubiquiti UniFi-AC", +- ubnt_unifiac_setup); ++MIPS_MACHINE(ATH79_MACH_UBNT_UNIFIAC_LITE, "UBNT-UF-AC-LITE", "Ubiquiti UniFi-AC-LITE", ++ ubnt_unifiac_lite_setup); +diff --git a/target/linux/ar71xx/generic/profiles/ubnt.mk b/target/linux/ar71xx/generic/profiles/ubnt.mk +index 94eff18..eac0240 100644 +--- a/target/linux/ar71xx/generic/profiles/ubnt.mk ++++ b/target/linux/ar71xx/generic/profiles/ubnt.mk +@@ -38,16 +38,16 @@ endef + + $(eval $(call Profile,UBNTUNIFI)) + +-define Profile/UBNTUNIFIAC +- NAME:=Ubiquiti UniFi AP AC ++define Profile/UBNTUNIFIACLITE ++ NAME:=Ubiquiti UniFi AP AC LITE/LR + PACKAGES:=kmod-ath10k ath10k-firmware-qca988x + endef + +-define Profile/UBNTUNIFIAC/Description +- Package set optimized for the Ubiquiti UniFi AP AC. ++define Profile/UBNTUNIFIACLITE/Description ++ Package set optimized for the Ubiquiti UniFi AP AC LITE/LR. + endef + +-$(eval $(call Profile,UBNTUNIFIAC)) ++$(eval $(call Profile,UBNTUNIFIACLITE)) + + define Profile/UBNTUNIFIOUTDOOR + NAME:=Ubiquiti UniFiAP Outdoor +diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile +index dd59f2d..31aff78 100644 +--- a/target/linux/ar71xx/image/Makefile ++++ b/target/linux/ar71xx/image/Makefile +@@ -741,14 +741,19 @@ endef + TARGET_DEVICES += oolite + + define Device/ubnt-unifiac +- DEVICE_PROFILE := UBNT UBNTUNIFIAC ++ DEVICE_PROFILE := UBNT + IMAGE_SIZE := 7744k + MTDPARTS = spi0.0:384k(u-boot)ro,64k(u-boot-env)ro,7744k(firmware),7744k(ubnt-airos)ro,128k(bs)ro,256k(cfg)ro,64k(EEPROM)ro + IMAGES := sysupgrade.bin + IMAGE/sysupgrade.bin = append-kernel $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE) ++endef ++ ++define Device/ubnt-unifiac-lite ++ $(Device/ubnt-unifiac) ++ DEVICE_PROFILE := UBNT UBNTUNIFIACLITE + BOARDNAME := UBNT-UF-AC + endef +-TARGET_DEVICES += ubnt-unifiac ++TARGET_DEVICES += ubnt-unifiac-lite + + rootfs_type=$(patsubst jffs2-%,jffs2,$(patsubst squashfs-%,squashfs,$(1))) + +diff --git a/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch b/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch +index 5a7a72c..0ade403 100644 +--- a/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch ++++ b/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch +@@ -164,7 +164,7 @@ + + ATH79_MACH_UBNT_RS, /* Ubiquiti RouterStation */ + ATH79_MACH_UBNT_UAP_PRO, /* Ubiquiti UniFi AP Pro */ + ATH79_MACH_UBNT_UNIFI, /* Ubiquiti Unifi */ +-+ ATH79_MACH_UBNT_UNIFIAC, /* Ubiquiti Unifi AC */ +++ ATH79_MACH_UBNT_UNIFIAC_LITE, /* Ubiquiti Unifi AC LITE/LR */ + ATH79_MACH_UBNT_UNIFI_OUTDOOR, /* Ubiquiti UnifiAP Outdoor */ + + ATH79_MACH_UBNT_UNIFI_OUTDOOR_PLUS, /* Ubiquiti UnifiAP Outdoor+ */ + ATH79_MACH_UBNT_XM, /* Ubiquiti Networks XM board rev 1.0 */ +@@ -1368,7 +1368,7 @@ + Ubiquiti Networks XM (rev 1.0) board. + + +config ATH79_MACH_UBNT_UNIFIAC +-+ bool "Ubiquiti UniFi AC (LITE) support" +++ bool "Ubiquiti UniFi AC (LITE/LR) support" + + select SOC_QCA956X + + select ATH79_DEV_AP9X_PCI if PCI + + select ATH79_DEV_ETH diff --git a/patches/openwrt/0045-ar71xx-Add-support-for-Ubiquiti-UniFi-AP-AC-PRO.patch b/patches/openwrt/0045-ar71xx-Add-support-for-Ubiquiti-UniFi-AP-AC-PRO.patch new file mode 100644 index 00000000..30cf6d46 --- /dev/null +++ b/patches/openwrt/0045-ar71xx-Add-support-for-Ubiquiti-UniFi-AP-AC-PRO.patch @@ -0,0 +1,274 @@ +From: Matthias Schiffer +Date: Fri, 13 May 2016 21:34:05 +0200 +Subject: ar71xx: Add support for Ubiquiti UniFi AP AC PRO + +Add support for the Ubiquiti UniFi AP AC PRO +Signed-off-by: P.Wassi + +Backport of LEDE 8307c2fe686ded345c80318359d5b6679e581fa2 + +diff --git a/target/linux/ar71xx/base-files/etc/diag.sh b/target/linux/ar71xx/base-files/etc/diag.sh +index 3d711ca..775aac6 100644 +--- a/target/linux/ar71xx/base-files/etc/diag.sh ++++ b/target/linux/ar71xx/base-files/etc/diag.sh +@@ -297,7 +297,8 @@ get_status_led() { + status_led="ubnt:green:dome" + ;; + uap-pro | \ +- unifiac-lite) ++ unifiac-lite | \ ++ unifiac-pro) + status_led="ubnt:white:dome" + ;; + unifi-outdoor-plus) +diff --git a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata +index fa8a2c8..cde7aaf 100644 +--- a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata ++++ b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata +@@ -75,7 +75,8 @@ case "$FIRMWARE" in + ath10kcal_extract "ART" 20480 2116 + ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) +16) + ;; +- unifiac-lite) ++ unifiac-lite | \ ++ unifiac-pro) + ath10kcal_extract "EEPROM" 20480 2116 + ;; + esac +diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network +index 0269e6d..0a23756 100755 +--- a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network ++++ b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network +@@ -398,6 +398,13 @@ wpj344) + ucidef_add_switch_vlan "switch0" "2" "0t 2" + ;; + ++unifiac-pro) ++ ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2" ++ ucidef_add_switch "switch0" "1" "1" ++ ucidef_add_switch_vlan "switch0" "1" "0t 2" ++ ucidef_add_switch_vlan "switch0" "2" "0t 3" ++ ;; ++ + wpj531) + ucidef_set_interfaces_lan_wan "eth0" "eth1" + ;; +diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh +index d3e6db9..7fc951a 100755 +--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh ++++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh +@@ -884,6 +884,9 @@ ar71xx_board_detect() { + *"UniFi-AC-LITE") + name="unifiac-lite" + ;; ++ *"UniFi-AC-PRO") ++ name="unifiac-pro" ++ ;; + *"UniFi AP Pro") + name="uap-pro" + ;; +diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh +index a1b65b7..0e9833d 100755 +--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh ++++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh +@@ -252,6 +252,7 @@ platform_check_image() { + nbg460n_550n_550nh | \ + unifi | \ + unifiac-lite | \ ++ unifiac-pro | \ + unifi-outdoor | \ + carambola2 | \ + weio ) +diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-ubnt-unifiac.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-ubnt-unifiac.c +index 31cbe30..9194bc1 100644 +--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-ubnt-unifiac.c ++++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-ubnt-unifiac.c +@@ -21,6 +21,7 @@ + #include + + #include ++#include + + #include "common.h" + #include "dev-ap9x-pci.h" +@@ -29,6 +30,7 @@ + #include "dev-leds-gpio.h" + #include "dev-m25p80.h" + #include "dev-wmac.h" ++#include "dev-usb.h" + #include "machtypes.h" + + +@@ -108,3 +110,70 @@ static void __init ubnt_unifiac_lite_setup(void) + + MIPS_MACHINE(ATH79_MACH_UBNT_UNIFIAC_LITE, "UBNT-UF-AC-LITE", "Ubiquiti UniFi-AC-LITE", + ubnt_unifiac_lite_setup); ++ ++static struct ar8327_pad_cfg ubnt_unifiac_pro_ar8327_pad0_cfg = { ++ .mode = AR8327_PAD_MAC_SGMII, ++ .sgmii_delay_en = true, ++}; ++ ++static struct ar8327_platform_data ubnt_unifiac_pro_ar8327_data = { ++ .pad0_cfg = &ubnt_unifiac_pro_ar8327_pad0_cfg, ++ .port0_cfg = { ++ .force_link = 1, ++ .speed = AR8327_PORT_SPEED_1000, ++ .duplex = 1, ++ .txpause = 1, ++ .rxpause = 1, ++ }, ++}; ++ ++ ++static struct mdio_board_info ubnt_unifiac_pro_mdio0_info[] = { ++ { ++ .bus_id = "ag71xx-mdio.0", ++ .phy_addr = 0, ++ .platform_data = &ubnt_unifiac_pro_ar8327_data, ++ }, ++}; ++ ++static void __init ubnt_unifiac_pro_setup(void) ++{ ++ u8 *eeprom = (u8 *) KSEG1ADDR(0x1fff0000); ++ ++ ath79_register_m25p80(&ubnt_unifiac_flash_data); ++ ++ ++ ath79_init_mac(ath79_eth0_data.mac_addr, ++ eeprom + UNIFIAC_MAC0_OFFSET, 0); ++ ++ ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_SGMII; ++ ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; ++ ath79_eth0_data.phy_mask = BIT(0); ++ ++ mdiobus_register_board_info(ubnt_unifiac_pro_mdio0_info, ++ ARRAY_SIZE(ubnt_unifiac_pro_mdio0_info)); ++ ++ ath79_register_mdio(0, 0x00); ++ ath79_register_eth(0); ++ ++ ++ ath79_register_usb(); ++ ++ ++ ath79_register_wmac(eeprom + UNIFIAC_WMAC_CALDATA_OFFSET, NULL); ++ ++ ++ ap91_pci_init(eeprom + UNIFIAC_PCI_CALDATA_OFFSET, NULL); ++ ++ ++ ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_unifiac_leds_gpio), ++ ubnt_unifiac_leds_gpio); ++ ++ ath79_register_gpio_keys_polled(-1, UNIFIAC_KEYS_POLL_INTERVAL, ++ ARRAY_SIZE(ubnt_unifiac_gpio_keys), ++ ubnt_unifiac_gpio_keys); ++} ++ ++ ++MIPS_MACHINE(ATH79_MACH_UBNT_UNIFIAC_PRO, "UBNT-UF-AC-PRO", "Ubiquiti UniFi-AC-PRO", ++ ubnt_unifiac_pro_setup); +diff --git a/target/linux/ar71xx/generic/profiles/ubnt.mk b/target/linux/ar71xx/generic/profiles/ubnt.mk +index eac0240..69b8398 100644 +--- a/target/linux/ar71xx/generic/profiles/ubnt.mk ++++ b/target/linux/ar71xx/generic/profiles/ubnt.mk +@@ -49,6 +49,17 @@ endef + + $(eval $(call Profile,UBNTUNIFIACLITE)) + ++define Profile/UBNTUNIFIACPRO ++ NAME:=Ubiquiti UniFi AP AC PRO ++ PACKAGES:=kmod-ath10k ath10k-firmware-qca988x kmod-usb-core kmod-usb-ohci kmod-usb2 ++endef ++ ++define Profile/UBNTUNIFIACPRO/Description ++ Package set optimized for the Ubiquiti UniFi AP AC PRO. ++endef ++ ++$(eval $(call Profile,UBNTUNIFIACPRO)) ++ + define Profile/UBNTUNIFIOUTDOOR + NAME:=Ubiquiti UniFiAP Outdoor + PACKAGES:= +diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile +index 31aff78..916d4e2 100644 +--- a/target/linux/ar71xx/image/Makefile ++++ b/target/linux/ar71xx/image/Makefile +@@ -753,7 +753,13 @@ define Device/ubnt-unifiac-lite + DEVICE_PROFILE := UBNT UBNTUNIFIACLITE + BOARDNAME := UBNT-UF-AC + endef +-TARGET_DEVICES += ubnt-unifiac-lite ++ ++define Device/ubnt-unifiac-pro ++ $(Device/ubnt-unifiac) ++ DEVICE_PROFILE := UBNT UBNTUNIFIACPRO ++ BOARDNAME := UBNT-UF-AC-PRO ++endef ++TARGET_DEVICES += ubnt-unifiac-lite ubnt-unifiac-pro + + rootfs_type=$(patsubst jffs2-%,jffs2,$(patsubst squashfs-%,squashfs,$(1))) + +diff --git a/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch b/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch +index 0ade403..dbd3fca 100644 +--- a/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch ++++ b/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch +@@ -1,6 +1,6 @@ + --- a/arch/mips/ath79/machtypes.h + +++ b/arch/mips/ath79/machtypes.h +-@@ -16,22 +16,200 @@ ++@@ -16,22 +16,201 @@ + + enum ath79_mach_type { + ATH79_MACH_GENERIC = 0, +@@ -165,6 +165,7 @@ + ATH79_MACH_UBNT_UAP_PRO, /* Ubiquiti UniFi AP Pro */ + ATH79_MACH_UBNT_UNIFI, /* Ubiquiti Unifi */ + + ATH79_MACH_UBNT_UNIFIAC_LITE, /* Ubiquiti Unifi AC LITE/LR */ +++ ATH79_MACH_UBNT_UNIFIAC_PRO, /* Ubiquiti Unifi AC PRO */ + ATH79_MACH_UBNT_UNIFI_OUTDOOR, /* Ubiquiti UnifiAP Outdoor */ + + ATH79_MACH_UBNT_UNIFI_OUTDOOR_PLUS, /* Ubiquiti UnifiAP Outdoor+ */ + ATH79_MACH_UBNT_XM, /* Ubiquiti Networks XM board rev 1.0 */ +@@ -1363,12 +1364,12 @@ + + config ATH79_MACH_UBNT_XM + bool "Ubiquiti Networks XM/UniFi boards" +-@@ -83,6 +1144,116 @@ config ATH79_MACH_UBNT_XM ++@@ -83,6 +1144,117 @@ config ATH79_MACH_UBNT_XM + Say 'Y' here if you want your kernel to support the + Ubiquiti Networks XM (rev 1.0) board. + + +config ATH79_MACH_UBNT_UNIFIAC +-+ bool "Ubiquiti UniFi AC (LITE/LR) support" +++ bool "Ubiquiti UniFi AC (LITE/LR/PRO) support" + + select SOC_QCA956X + + select ATH79_DEV_AP9X_PCI if PCI + + select ATH79_DEV_ETH +@@ -1376,6 +1377,7 @@ + + select ATH79_DEV_LEDS_GPIO + + select ATH79_DEV_M25P80 + + select ATH79_DEV_WMAC +++ select ATH79_DEV_USB + + + +config ATH79_MACH_WEIO + + bool "WeIO board" +@@ -1480,7 +1482,7 @@ + endmenu + + config SOC_AR71XX +-@@ -124,7 +1295,10 @@ config ATH79_DEV_DSA ++@@ -124,7 +1296,10 @@ config ATH79_DEV_DSA + config ATH79_DEV_ETH + def_bool n + +@@ -1492,7 +1494,7 @@ + def_bool n + + config ATH79_DEV_GPIO_BUTTONS +-@@ -154,6 +1328,11 @@ config ATH79_PCI_ATH9K_FIXUP ++@@ -154,6 +1329,11 @@ config ATH79_PCI_ATH9K_FIXUP + def_bool n + + config ATH79_ROUTERBOOT diff --git a/patches/openwrt/0046-ar71xx-Generate-sysupgrade-images-for-OpenMesh-devic.patch b/patches/openwrt/0046-ar71xx-Generate-sysupgrade-images-for-OpenMesh-devic.patch new file mode 100644 index 00000000..6470646d --- /dev/null +++ b/patches/openwrt/0046-ar71xx-Generate-sysupgrade-images-for-OpenMesh-devic.patch @@ -0,0 +1,30 @@ +From: Sven Eckelmann +Date: Tue, 17 May 2016 16:38:29 +0200 +Subject: ar71xx: Generate sysupgrade images for OpenMesh devices + +Some OpenWrt based firmwares like Gluon expect that a sysupgrade image +exists when a device firmware can be updated via sysupgrade. This image +wasn't created until now because OpenMesh devices use the same image for +factory and sysupgrade flash. Copying the image from *factory.bin to +*sysupgrade.bin is therefore enough to make the sysupgrade functionality +visible. + +Reported-by: Matthias Schiffer +Signed-off-by: Sven Eckelmann + +Forwarded: https://patchwork.ozlabs.org/patch/624172/ + +diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile +index 916d4e2..f91e20e 100644 +--- a/target/linux/ar71xx/image/Makefile ++++ b/target/linux/ar71xx/image/Makefile +@@ -1877,6 +1877,9 @@ define Image/Build/OpenMesh + "$(BUILD_DIR)/fwupgrade.cfg-$(4)" "fwupgrade.cfg" \ + "$(KDIR_TMP)/vmlinux-$(2).uImage" "kernel" \ + "$(KDIR)/root.$(1)" "rootfs" ++ if [ -e "$(call factoryname,$(1),$(2))" ]; then \ ++ cp "$(call factoryname,$(1),$(2))" "$(call sysupname,$(1),$(2))"; \ ++ fi + endef + + diff --git a/patches/openwrt/0047-ar71xx-add-kernel-support-for-the-OpenMesh-MR1750-bo.patch b/patches/openwrt/0047-ar71xx-add-kernel-support-for-the-OpenMesh-MR1750-bo.patch new file mode 100644 index 00000000..35dcac61 --- /dev/null +++ b/patches/openwrt/0047-ar71xx-add-kernel-support-for-the-OpenMesh-MR1750-bo.patch @@ -0,0 +1,202 @@ +From: Sven Eckelmann +Date: Mon, 14 Sep 2015 20:10:43 +0000 +Subject: ar71xx: add kernel support for the OpenMesh MR1750 board + +Signed-off-by: Sven Eckelmann + +Backport of r46926 + +Forwarded: https://patchwork.ozlabs.org/patch/624173/ + +diff --git a/target/linux/ar71xx/config-3.18 b/target/linux/ar71xx/config-3.18 +index 9a81911..c5a3c9a 100644 +--- a/target/linux/ar71xx/config-3.18 ++++ b/target/linux/ar71xx/config-3.18 +@@ -79,6 +79,7 @@ CONFIG_ATH79_MACH_JWAP003=y + CONFIG_ATH79_MACH_MC_MAC1200R=y + CONFIG_ATH79_MACH_MR16=y + CONFIG_ATH79_MACH_MR12=y ++CONFIG_ATH79_MACH_MR1750=y + CONFIG_ATH79_MACH_MR600=y + CONFIG_ATH79_MACH_MR900=y + CONFIG_ATH79_MACH_MYNET_N600=y +diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-mr1750.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-mr1750.c +new file mode 100644 +index 0000000..8ace02f +--- /dev/null ++++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-mr1750.c +@@ -0,0 +1,129 @@ ++/* ++ * MR1750 board support ++ * ++ * Copyright (c) 2012 Qualcomm Atheros ++ * Copyright (c) 2012-2013 Marek Lindner ++ * ++ * 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. ++ * ++ */ ++ ++#include ++#include ++ ++#include ++ ++#include "common.h" ++#include "dev-ap9x-pci.h" ++#include "dev-gpio-buttons.h" ++#include "dev-eth.h" ++#include "dev-leds-gpio.h" ++#include "dev-m25p80.h" ++#include "dev-wmac.h" ++#include "machtypes.h" ++#include "pci.h" ++ ++#define MR1750_GPIO_LED_LAN 12 ++#define MR1750_GPIO_LED_WLAN_2G 13 ++#define MR1750_GPIO_LED_STATUS_GREEN 19 ++#define MR1750_GPIO_LED_STATUS_RED 21 ++#define MR1750_GPIO_LED_POWER 22 ++#define MR1750_GPIO_LED_WLAN_5G 23 ++ ++#define MR1750_GPIO_BTN_RESET 17 ++ ++#define MR1750_KEYS_POLL_INTERVAL 20 /* msecs */ ++#define MR1750_KEYS_DEBOUNCE_INTERVAL (3 * MR1750_KEYS_POLL_INTERVAL) ++ ++#define MR1750_MAC0_OFFSET 0 ++#define MR1750_WMAC_CALDATA_OFFSET 0x1000 ++ ++static struct gpio_led mr1750_leds_gpio[] __initdata = { ++ { ++ .name = "mr1750:blue:power", ++ .gpio = MR1750_GPIO_LED_POWER, ++ .active_low = 1, ++ }, ++ { ++ .name = "mr1750:blue:wan", ++ .gpio = MR1750_GPIO_LED_LAN, ++ .active_low = 1, ++ }, ++ { ++ .name = "mr1750:blue:wlan24", ++ .gpio = MR1750_GPIO_LED_WLAN_2G, ++ .active_low = 1, ++ }, ++ { ++ .name = "mr1750:blue:wlan58", ++ .gpio = MR1750_GPIO_LED_WLAN_5G, ++ .active_low = 1, ++ }, ++ { ++ .name = "mr1750:green:status", ++ .gpio = MR1750_GPIO_LED_STATUS_GREEN, ++ .active_low = 1, ++ }, ++ { ++ .name = "mr1750:red:status", ++ .gpio = MR1750_GPIO_LED_STATUS_RED, ++ .active_low = 1, ++ }, ++}; ++ ++static struct gpio_keys_button mr1750_gpio_keys[] __initdata = { ++ { ++ .desc = "Reset button", ++ .type = EV_KEY, ++ .code = KEY_RESTART, ++ .debounce_interval = MR1750_KEYS_DEBOUNCE_INTERVAL, ++ .gpio = MR1750_GPIO_BTN_RESET, ++ .active_low = 1, ++ }, ++}; ++ ++static void __init mr1750_setup(void) ++{ ++ u8 *art = (u8 *)KSEG1ADDR(0x1fff0000); ++ u8 mac[6]; ++ ++ ath79_eth0_pll_data.pll_1000 = 0xbe000101; ++ ath79_eth0_pll_data.pll_100 = 0x80000101; ++ ath79_eth0_pll_data.pll_10 = 0x80001313; ++ ++ ath79_register_m25p80(NULL); ++ ++ ath79_register_leds_gpio(-1, ARRAY_SIZE(mr1750_leds_gpio), ++ mr1750_leds_gpio); ++ ath79_register_gpio_keys_polled(-1, MR1750_KEYS_POLL_INTERVAL, ++ ARRAY_SIZE(mr1750_gpio_keys), ++ mr1750_gpio_keys); ++ ++ ath79_init_mac(mac, art + MR1750_MAC0_OFFSET, 1); ++ ath79_register_wmac(art + MR1750_WMAC_CALDATA_OFFSET, mac); ++ ath79_register_pci(); ++ ++ ath79_setup_qca955x_eth_cfg(QCA955X_ETH_CFG_RGMII_EN); ++ ath79_register_mdio(0, 0x0); ++ ++ ath79_init_mac(ath79_eth0_data.mac_addr, art + MR1750_MAC0_OFFSET, 0); ++ ++ /* GMAC0 is connected to the RMGII interface */ ++ ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; ++ ath79_eth0_data.phy_mask = BIT(5); ++ ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; ++ ++ ath79_register_eth(0); ++} ++ ++MIPS_MACHINE(ATH79_MACH_MR1750, "MR1750", "OpenMesh MR1750", mr1750_setup); +diff --git a/target/linux/ar71xx/patches-3.18/815-MIPS-ath79-add-mr1750-support.patch b/target/linux/ar71xx/patches-3.18/815-MIPS-ath79-add-mr1750-support.patch +new file mode 100644 +index 0000000..d802a12 +--- /dev/null ++++ b/target/linux/ar71xx/patches-3.18/815-MIPS-ath79-add-mr1750-support.patch +@@ -0,0 +1,39 @@ ++--- a/arch/mips/ath79/Kconfig +++++ b/arch/mips/ath79/Kconfig ++@@ -763,6 +763,16 @@ config ATH79_MACH_CAP4200AG ++ select ATH79_DEV_M25P80 ++ select ATH79_DEV_WMAC ++ +++config ATH79_MACH_MR1750 +++ bool "OpenMesh MR1750 board support" +++ select SOC_QCA955X +++ select ATH79_DEV_AP9X_PCI if PCI +++ select ATH79_DEV_ETH +++ select ATH79_DEV_GPIO_BUTTONS +++ select ATH79_DEV_LEDS_GPIO +++ select ATH79_DEV_M25P80 +++ select ATH79_DEV_WMAC +++ ++ config ATH79_MACH_MR900 ++ bool "OpenMesh MR900 board support" ++ select SOC_QCA955X ++--- a/arch/mips/ath79/Makefile +++++ b/arch/mips/ath79/Makefile ++@@ -80,6 +80,7 @@ obj-$(CONFIG_ATH79_MACH_HORNET_UB) += ma ++ obj-$(CONFIG_ATH79_MACH_MC_MAC1200R) += mach-mc-mac1200r.o ++ obj-$(CONFIG_ATH79_MACH_MR12) += mach-mr12.o ++ obj-$(CONFIG_ATH79_MACH_MR16) += mach-mr16.o +++obj-$(CONFIG_ATH79_MACH_MR1750) += mach-mr1750.o ++ obj-$(CONFIG_ATH79_MACH_MR600) += mach-mr600.o ++ obj-$(CONFIG_ATH79_MACH_MR900) += mach-mr900.o ++ obj-$(CONFIG_ATH79_MACH_MYNET_N600) += mach-mynet-n600.o ++--- a/arch/mips/ath79/machtypes.h +++++ b/arch/mips/ath79/machtypes.h ++@@ -69,6 +69,7 @@ enum ath79_mach_type { ++ ATH79_MACH_HORNET_UB, /* ALFA Networks Hornet-UB */ ++ ATH79_MACH_MR12, /* Cisco Meraki MR12 */ ++ ATH79_MACH_MR16, /* Cisco Meraki MR16 */ +++ ATH79_MACH_MR1750, /* OpenMesh MR1750 */ ++ ATH79_MACH_MR600V2, /* OpenMesh MR600v2 */ ++ ATH79_MACH_MR600, /* OpenMesh MR600 */ ++ ATH79_MACH_MR900, /* OpenMesh MR900 */ diff --git a/patches/openwrt/0048-ar71xx-add-user-space-support-for-the-OpenMesh-MR175.patch b/patches/openwrt/0048-ar71xx-add-user-space-support-for-the-OpenMesh-MR175.patch new file mode 100644 index 00000000..3e6363c7 --- /dev/null +++ b/patches/openwrt/0048-ar71xx-add-user-space-support-for-the-OpenMesh-MR175.patch @@ -0,0 +1,67 @@ +From: Sven Eckelmann +Date: Mon, 14 Sep 2015 20:11:01 +0000 +Subject: ar71xx: add user-space support for the OpenMesh MR1750 board + +Signed-off-by: Sven Eckelmann + +Backport of r46927 + +Forwarded: https://patchwork.ozlabs.org/patch/624174/ + +diff --git a/target/linux/ar71xx/base-files/etc/diag.sh b/target/linux/ar71xx/base-files/etc/diag.sh +index 775aac6..44d2ddf 100644 +--- a/target/linux/ar71xx/base-files/etc/diag.sh ++++ b/target/linux/ar71xx/base-files/etc/diag.sh +@@ -143,6 +143,9 @@ get_status_led() { + mr600v2) + status_led="mr600:blue:power" + ;; ++ mr1750) ++ status_led="mr1750:blue:power" ++ ;; + mr900 | \ + mr900v2) + status_led="mr900:blue:power" +diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds +index a4b355a..c451124 100644 +--- a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds ++++ b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds +@@ -239,6 +239,12 @@ mr600) + ucidef_set_led_wlan "wlan58" "WLAN58" "mr600:green:wlan58" "phy0tpt" + ;; + ++mr1750) ++ ucidef_set_led_netdev "lan" "LAN" "mr1750:blue:wan" "eth0" ++ ucidef_set_led_wlan "wlan58" "WLAN58" "mr1750:blue:wlan58" "phy0tpt" ++ ucidef_set_led_wlan "wlan24" "WLAN24" "mr1750:blue:wlan24" "phy1tpt" ++ ;; ++ + mr900 | \ + mr900v2) + ucidef_set_led_netdev "lan" "LAN" "mr900:blue:wan" "eth0" +diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network +index 0a23756..4066506 100755 +--- a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network ++++ b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network +@@ -334,6 +334,7 @@ eap300v2 |\ + eap7660d |\ + el-mini |\ + loco-m-xw |\ ++mr1750 |\ + mr600 |\ + mr600v2 |\ + mr900 |\ +diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh +index 7fc951a..587d029 100755 +--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh ++++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh +@@ -562,6 +562,9 @@ ar71xx_board_detect() { + *MR600v2) + name="mr600v2" + ;; ++ *MR1750) ++ name="mr1750" ++ ;; + *MR600) + name="mr600" + ;; diff --git a/patches/openwrt/0049-scripts-om-fwupgradecfg-gen.sh-add-support-for-the-M.patch b/patches/openwrt/0049-scripts-om-fwupgradecfg-gen.sh-add-support-for-the-M.patch new file mode 100644 index 00000000..66b0bc4f --- /dev/null +++ b/patches/openwrt/0049-scripts-om-fwupgradecfg-gen.sh-add-support-for-the-M.patch @@ -0,0 +1,32 @@ +From: Sven Eckelmann +Date: Mon, 14 Sep 2015 20:11:18 +0000 +Subject: scripts/om-fwupgradecfg-gen.sh: add support for the MR1750 + +Signed-off-by: Sven Eckelmann + +Backport of r46928 + +Forwarded: https://patchwork.ozlabs.org/patch/624175/ + +diff --git a/scripts/om-fwupgradecfg-gen.sh b/scripts/om-fwupgradecfg-gen.sh +index e132954..c790214 100644 +--- a/scripts/om-fwupgradecfg-gen.sh ++++ b/scripts/om-fwupgradecfg-gen.sh +@@ -7,7 +7,7 @@ + # + + usage() { +- echo "Usage: $0 " ++ echo "Usage: $0 " + rm -f $CFG_OUT + exit 1 + } +@@ -26,7 +26,7 @@ case $CE_TYPE in + FLASH_BS=262144 + MD5_SKIP_BLOCKS=1 + ;; +- OM5P|MR600|MR900) ++ OM5P|MR600|MR900|MR1750) + MAX_PART_SIZE=7808 + KERNEL_FLASH_ADDR=0xb0000 + FLASH_BS=65536 diff --git a/patches/openwrt/0050-ar71xx-enable-sysupgrade-for-the-OpenMesh-MR1750.patch b/patches/openwrt/0050-ar71xx-enable-sysupgrade-for-the-OpenMesh-MR1750.patch new file mode 100644 index 00000000..dc595593 --- /dev/null +++ b/patches/openwrt/0050-ar71xx-enable-sysupgrade-for-the-OpenMesh-MR1750.patch @@ -0,0 +1,55 @@ +From: Sven Eckelmann +Date: Mon, 14 Sep 2015 20:11:24 +0000 +Subject: ar71xx: enable sysupgrade for the OpenMesh MR1750 + +Signed-off-by: Sven Eckelmann + +Backport of r46929 + +Forwarded: https://patchwork.ozlabs.org/patch/624176/ + +diff --git a/target/linux/ar71xx/base-files/lib/upgrade/openmesh.sh b/target/linux/ar71xx/base-files/lib/upgrade/openmesh.sh +index 547116e..9ca0f5b 100644 +--- a/target/linux/ar71xx/base-files/lib/upgrade/openmesh.sh ++++ b/target/linux/ar71xx/base-files/lib/upgrade/openmesh.sh +@@ -72,6 +72,11 @@ platform_check_image_openmesh() + echo "Invalid image board target ($img_board_target) for this platform: $board. Use the correct image for this platform" + return 1 + ;; ++ MR1750) ++ [ "$board" = "mr1750" ] && break ++ echo "Invalid image board target ($img_board_target) for this platform: $board. Use the correct image for this platform" ++ return 1 ++ ;; + MR600) + [ "$board" = "mr600" ] && break + [ "$board" = "mr600v2" ] && break +@@ -157,7 +162,7 @@ platform_do_upgrade_openmesh() + kernel_start_addr1=0x9f1c0000 + kernel_start_addr2=0x9f8c0000 + ;; +- OM5P|MR600|MR900) ++ OM5P|MR600|MR900|MR1750) + block_size=$((64 * 1024)) + total_size=7995392 + kernel_start_addr1=0x9f0b0000 +diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh +index 0e9833d..ac060ea 100755 +--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh ++++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh +@@ -296,6 +296,7 @@ platform_check_image() { + + return 0; + ;; ++ mr1750 | \ + mr600 | \ + mr600v2 | \ + mr900 | \ +@@ -528,6 +529,7 @@ platform_do_upgrade() { + tew-673gru) + platform_do_upgrade_dir825b "$ARGV" + ;; ++ mr1750 | \ + mr600 | \ + mr600v2 | \ + mr900 | \ diff --git a/patches/openwrt/0051-package-om-watchdog-add-OpenMesh-MR1750-support.patch b/patches/openwrt/0051-package-om-watchdog-add-OpenMesh-MR1750-support.patch new file mode 100644 index 00000000..e16fb3ef --- /dev/null +++ b/patches/openwrt/0051-package-om-watchdog-add-OpenMesh-MR1750-support.patch @@ -0,0 +1,23 @@ +From: Sven Eckelmann +Date: Mon, 14 Sep 2015 20:11:35 +0000 +Subject: package/om-watchdog: add OpenMesh MR1750 support + +Signed-off-by: Sven Eckelmann + +Backport of r46930 + +Forwarded: https://patchwork.ozlabs.org/patch/624177/ + +diff --git a/package/kernel/om-watchdog/files/om-watchdog.init b/package/kernel/om-watchdog/files/om-watchdog.init +index 135fef7..c792968 100644 +--- a/package/kernel/om-watchdog/files/om-watchdog.init ++++ b/package/kernel/om-watchdog/files/om-watchdog.init +@@ -25,7 +25,7 @@ boot() { + "mr600v2") + service_start /sbin/om-watchdog 15 + ;; +- "mr900"|"mr900v2") ++ "mr900"|"mr900v2"|"mr1750") + service_start /sbin/om-watchdog 16 + ;; + esac diff --git a/patches/openwrt/0052-package-uboot-envtools-add-OpenMesh-MR1750-support.patch b/patches/openwrt/0052-package-uboot-envtools-add-OpenMesh-MR1750-support.patch new file mode 100644 index 00000000..8e975a1c --- /dev/null +++ b/patches/openwrt/0052-package-uboot-envtools-add-OpenMesh-MR1750-support.patch @@ -0,0 +1,22 @@ +From: Sven Eckelmann +Date: Mon, 14 Sep 2015 20:11:43 +0000 +Subject: package/uboot-envtools: add OpenMesh MR1750 support + +Signed-off-by: Sven Eckelmann + +Backport of r46931 + +Forwarded: https://patchwork.ozlabs.org/patch/624178/ + +diff --git a/package/boot/uboot-envtools/files/ar71xx b/package/boot/uboot-envtools/files/ar71xx +index ec8541c..ef00f17 100644 +--- a/package/boot/uboot-envtools/files/ar71xx ++++ b/package/boot/uboot-envtools/files/ar71xx +@@ -21,6 +21,7 @@ carambola2 | \ + eap300v2 | \ + hornet-ub | \ + hornet-ub-x2 | \ ++mr1750 | \ + mr600 | \ + mr600v2 | \ + mr900 | \ diff --git a/patches/openwrt/0053-ar71xx-create-profile-and-build-image-for-the-OpenMe.patch b/patches/openwrt/0053-ar71xx-create-profile-and-build-image-for-the-OpenMe.patch new file mode 100644 index 00000000..2a166e16 --- /dev/null +++ b/patches/openwrt/0053-ar71xx-create-profile-and-build-image-for-the-OpenMe.patch @@ -0,0 +1,57 @@ +From: Sven Eckelmann +Date: Mon, 14 Sep 2015 20:11:51 +0000 +Subject: ar71xx: create profile and build image for the OpenMesh MR1750 board + +Signed-off-by: Sven Eckelmann + +Backport of r46932 + +Forwarded: https://patchwork.ozlabs.org/patch/624179/ + +diff --git a/target/linux/ar71xx/generic/profiles/openmesh.mk b/target/linux/ar71xx/generic/profiles/openmesh.mk +index 41b462e..06cf135 100644 +--- a/target/linux/ar71xx/generic/profiles/openmesh.mk ++++ b/target/linux/ar71xx/generic/profiles/openmesh.mk +@@ -49,9 +49,20 @@ endef + + $(eval $(call Profile,MR900)) + ++define Profile/MR1750 ++ NAME:=OpenMesh MR1750 ++ PACKAGES:=kmod-ath9k kmod-ath10k ath10k-firmware-qca988x ++endef ++ ++define Profile/MR1750/Description ++ Package set optimized for the OpenMesh MR1750. ++endef ++ ++$(eval $(call Profile,MR1750)) ++ + define Profile/OPENMESH + NAME:=OpenMesh products +- PACKAGES:=kmod-ath9k om-watchdog ++ PACKAGES:=kmod-ath9k kmod-ath10k om-watchdog + endef + + define Profile/OPENMESH/Description +diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile +index f91e20e..b74aa45 100644 +--- a/target/linux/ar71xx/image/Makefile ++++ b/target/linux/ar71xx/image/Makefile +@@ -2045,6 +2045,7 @@ $(eval $(call SingleProfile,OpenMesh,squashfs-only,OM2P,om2p,,,,OM2P)) + $(eval $(call SingleProfile,OpenMesh,squashfs-only,OM5P,om5p,,,,OM5P)) + $(eval $(call SingleProfile,OpenMesh,squashfs-only,MR600,mr600,,,,MR600)) + $(eval $(call SingleProfile,OpenMesh,squashfs-only,MR900,mr900,,,,MR900)) ++$(eval $(call SingleProfile,OpenMesh,squashfs-only,MR1750,mr1750,,,,MR1750)) + + $(eval $(call SingleProfile,PB4X,128k,ALL0305,all0305,ALL0305,ttyS0,115200)) + $(eval $(call SingleProfile,PB4X,128k,EAP7660D,eap7660d,EAP7660D,ttyS0,115200)) +@@ -2138,7 +2139,7 @@ $(eval $(call MultiProfile,AP121,AP121_2M AP121_4M)) + $(eval $(call MultiProfile,DIR615IX,DIR615I1 DIR615I3)) + $(eval $(call MultiProfile,AP136,AP136_010 AP136_020)) + $(eval $(call MultiProfile,EWDORIN, EWDORINAP EWDORINRT EWDORIN16M)) +-$(eval $(call MultiProfile,OPENMESH,OM2P OM5P MR600 MR900)) ++$(eval $(call MultiProfile,OPENMESH,OM2P OM5P MR600 MR900 MR1750)) + $(eval $(call MultiProfile,TEW652BRP,TEW652BRP_FW TEW652BRP_RECOVERY)) + $(eval $(call MultiProfile,TLMR3220,TLMR3220V1)) + $(eval $(call MultiProfile,TLMR3420,TLMR3420V1)) diff --git a/patches/openwrt/0054-ar71xx-Extend-the-list-of-bits-in-QCA955X_GMAC_REG_E.patch b/patches/openwrt/0054-ar71xx-Extend-the-list-of-bits-in-QCA955X_GMAC_REG_E.patch new file mode 100644 index 00000000..efe4b609 --- /dev/null +++ b/patches/openwrt/0054-ar71xx-Extend-the-list-of-bits-in-QCA955X_GMAC_REG_E.patch @@ -0,0 +1,47 @@ +From: Sven Eckelmann +Date: Wed, 16 Mar 2016 09:27:01 +0000 +Subject: ar71xx: Extend the list of bits in QCA955X_GMAC_REG_ETH_CFG + +Signed-off-by: Sven Eckelmann + +Backport of r49027 + +Forwarded: https://patchwork.ozlabs.org/patch/624180/ + +diff --git a/target/linux/ar71xx/patches-3.18/601-MIPS-ath79-add-more-register-defines.patch b/target/linux/ar71xx/patches-3.18/601-MIPS-ath79-add-more-register-defines.patch +index 8bf7658..797977f 100644 +--- a/target/linux/ar71xx/patches-3.18/601-MIPS-ath79-add-more-register-defines.patch ++++ b/target/linux/ar71xx/patches-3.18/601-MIPS-ath79-add-more-register-defines.patch +@@ -207,7 +207,7 @@ + #define AR934X_GPIO_REG_FUNC 0x6c + + #define AR71XX_GPIO_COUNT 16 +-@@ -560,4 +663,153 @@ ++@@ -560,4 +663,170 @@ + #define AR934X_SRIF_DPLL2_OUTDIV_SHIFT 13 + #define AR934X_SRIF_DPLL2_OUTDIV_MASK 0x7 + +@@ -358,6 +358,23 @@ + +#define QCA955X_GMAC_REG_ETH_CFG 0x00 + + + +#define QCA955X_ETH_CFG_RGMII_EN BIT(0) +++#define QCA955X_ETH_CFG_MII_GE0 BIT(1) +++#define QCA955X_ETH_CFG_GMII_GE0 BIT(2) +++#define QCA955X_ETH_CFG_MII_GE0_MASTER BIT(3) +++#define QCA955X_ETH_CFG_MII_GE0_SLAVE BIT(4) +++#define QCA955X_ETH_CFG_GE0_ERR_EN BIT(5) + +#define QCA955X_ETH_CFG_GE0_SGMII BIT(6) +++#define QCA955X_ETH_CFG_RMII_GE0 BIT(10) +++#define QCA955X_ETH_CFG_MII_CNTL_SPEED BIT(11) +++#define QCA955X_ETH_CFG_RMII_GE0_MASTER BIT(12) +++#define QCA955X_ETH_CFG_RXD_DELAY_MASK 0x3 +++#define QCA955X_ETH_CFG_RXD_DELAY_SHIFT 14 +++#define QCA955X_ETH_CFG_RDV_DELAY BIT(16) +++#define QCA955X_ETH_CFG_RDV_DELAY_MASK 0x3 +++#define QCA955X_ETH_CFG_RDV_DELAY_SHIFT 16 +++#define QCA955X_ETH_CFG_TXD_DELAY_MASK 0x3 +++#define QCA955X_ETH_CFG_TXD_DELAY_SHIFT 18 +++#define QCA955X_ETH_CFG_TXE_DELAY_MASK 0x3 +++#define QCA955X_ETH_CFG_TXE_DELAY_SHIFT 20 + + + #endif /* __ASM_MACH_AR71XX_REGS_H */ diff --git a/patches/openwrt/0055-ar71xx-Use-_eth_cfg-helper-for-Open-Mesh-MR900-board.patch b/patches/openwrt/0055-ar71xx-Use-_eth_cfg-helper-for-Open-Mesh-MR900-board.patch new file mode 100644 index 00000000..43a876d2 --- /dev/null +++ b/patches/openwrt/0055-ar71xx-Use-_eth_cfg-helper-for-Open-Mesh-MR900-board.patch @@ -0,0 +1,49 @@ +From: Sven Eckelmann +Date: Tue, 7 Jul 2015 13:47:39 +0000 +Subject: ar71xx: Use *_eth_cfg helper for Open Mesh MR900 boards + +Signed-off-by: Sven Eckelmann + +Backport of r46241 + +Forwarded: https://patchwork.ozlabs.org/patch/624181/ + +diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-mr900.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-mr900.c +index fe3e1fa..9c3164d 100644 +--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-mr900.c ++++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-mr900.c +@@ -94,24 +94,6 @@ static struct gpio_keys_button mr900_gpio_keys[] __initdata = { + }, + }; + +- +-static void __init mr900_gmac_setup(void) +-{ +- void __iomem *base; +- u32 t; +- +- base = ioremap(QCA955X_GMAC_BASE, QCA955X_GMAC_SIZE); +- +- t = __raw_readl(base + QCA955X_GMAC_REG_ETH_CFG); +- +- t &= ~(QCA955X_ETH_CFG_RGMII_EN | QCA955X_ETH_CFG_GE0_SGMII); +- t |= QCA955X_ETH_CFG_RGMII_EN; +- +- __raw_writel(t, base + QCA955X_GMAC_REG_ETH_CFG); +- +- iounmap(base); +-} +- + static void __init mr900_setup(void) + { + u8 *art = (u8 *)KSEG1ADDR(0x1fff0000); +@@ -141,8 +123,7 @@ static void __init mr900_setup(void) + } + pdata->use_eeprom = true; + +- mr900_gmac_setup(); +- ++ ath79_setup_qca955x_eth_cfg(QCA955X_ETH_CFG_RGMII_EN); + ath79_register_mdio(0, 0x0); + + ath79_init_mac(ath79_eth0_data.mac_addr, art + MR900_MAC0_OFFSET, 0); diff --git a/patches/openwrt/0056-ar71xx-Allow-to-use-ath79_gpio_output_select-on-QCA9.patch b/patches/openwrt/0056-ar71xx-Allow-to-use-ath79_gpio_output_select-on-QCA9.patch new file mode 100644 index 00000000..137aa9d4 --- /dev/null +++ b/patches/openwrt/0056-ar71xx-Allow-to-use-ath79_gpio_output_select-on-QCA9.patch @@ -0,0 +1,79 @@ +From: Sven Eckelmann +Date: Fri, 24 Jul 2015 09:10:00 +0000 +Subject: ar71xx: Allow to use ath79_gpio_output_select on QCA955x + +Signed-off-by: Sven Eckelmann + +Backport of r46459 + +Forwarded: https://patchwork.ozlabs.org/patch/624182/ + +diff --git a/target/linux/ar71xx/patches-3.18/739-MIPS-ath79-add-gpio-func-register-for-QCA955x-SoC.patch b/target/linux/ar71xx/patches-3.18/739-MIPS-ath79-add-gpio-func-register-for-QCA955x-SoC.patch +new file mode 100644 +index 0000000..e71b6e2 +--- /dev/null ++++ b/target/linux/ar71xx/patches-3.18/739-MIPS-ath79-add-gpio-func-register-for-QCA955x-SoC.patch +@@ -0,0 +1,63 @@ ++--- a/arch/mips/ath79/gpio.c +++++ b/arch/mips/ath79/gpio.c ++@@ -187,15 +187,30 @@ void __init ath79_gpio_output_select(uns ++ { ++ void __iomem *base = ath79_gpio_base; ++ unsigned long flags; ++- unsigned int reg; +++ unsigned int reg, reg_base; +++ unsigned long gpio_count; ++ u32 t, s; ++ ++- BUG_ON(!soc_is_ar934x() && !soc_is_qca953x() && !soc_is_qca956x()); +++ if (soc_is_ar934x()) { +++ gpio_count = AR934X_GPIO_COUNT; +++ reg_base = AR934X_GPIO_REG_OUT_FUNC0; +++ } else if (soc_is_qca953x()) { +++ gpio_count = QCA953X_GPIO_COUNT; +++ reg_base = QCA953X_GPIO_REG_OUT_FUNC0; +++ } else if (soc_is_qca955x()) { +++ gpio_count = QCA955X_GPIO_COUNT; +++ reg_base = QCA955X_GPIO_REG_OUT_FUNC0; +++ } else if (soc_is_qca956x()) { +++ gpio_count = QCA956X_GPIO_COUNT; +++ reg_base = QCA956X_GPIO_REG_OUT_FUNC0; +++ } else { +++ BUG(); +++ } ++ ++- if (gpio >= AR934X_GPIO_COUNT) +++ if (gpio >= gpio_count) ++ return; ++ ++- reg = AR934X_GPIO_REG_OUT_FUNC0 + 4 * (gpio / 4); +++ reg = reg_base + 4 * (gpio / 4); ++ s = 8 * (gpio % 4); ++ ++ spin_lock_irqsave(&ath79_gpio_lock, flags); ++--- a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h +++++ b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h ++@@ -875,6 +875,14 @@ ++ #define QCA953X_GPIO_OUT_MUX_LED_LINK4 44 ++ #define QCA953X_GPIO_OUT_MUX_LED_LINK5 45 ++ +++#define QCA955X_GPIO_REG_OUT_FUNC0 0x2c +++#define QCA955X_GPIO_REG_OUT_FUNC1 0x30 +++#define QCA955X_GPIO_REG_OUT_FUNC2 0x34 +++#define QCA955X_GPIO_REG_OUT_FUNC3 0x38 +++#define QCA955X_GPIO_REG_OUT_FUNC4 0x3c +++#define QCA955X_GPIO_REG_OUT_FUNC5 0x40 +++#define QCA955X_GPIO_REG_FUNC 0x6c +++ ++ #define QCA956X_GPIO_REG_OUT_FUNC0 0x2c ++ #define QCA956X_GPIO_REG_OUT_FUNC1 0x30 ++ #define QCA956X_GPIO_REG_OUT_FUNC2 0x34 ++@@ -1014,6 +1022,8 @@ ++ #define AR934X_GPIO_OUT_EXT_LNA0 46 ++ #define AR934X_GPIO_OUT_EXT_LNA1 47 ++ +++#define QCA955X_GPIO_OUT_GPIO 0 +++ ++ /* ++ * MII_CTRL block ++ */ diff --git a/patches/openwrt/0057-ar71xx-Add-support-for-ath79_gpio_function_-on-QCA95.patch b/patches/openwrt/0057-ar71xx-Add-support-for-ath79_gpio_function_-on-QCA95.patch new file mode 100644 index 00000000..23b42cb6 --- /dev/null +++ b/patches/openwrt/0057-ar71xx-Add-support-for-ath79_gpio_function_-on-QCA95.patch @@ -0,0 +1,32 @@ +From: Sven Eckelmann +Date: Wed, 23 Mar 2016 12:52:27 +0000 +Subject: ar71xx: Add support for ath79_gpio_function_* on QCA955X + +Signed-off-by: Sven Eckelmann + +Backport of r49074 + +Forwarded: https://patchwork.ozlabs.org/patch/624183/ + +diff --git a/target/linux/ar71xx/patches-3.18/739-MIPS-ath79-add-gpio-func-register-for-QCA955x-SoC.patch b/target/linux/ar71xx/patches-3.18/739-MIPS-ath79-add-gpio-func-register-for-QCA955x-SoC.patch +index e71b6e2..0e87357 100644 +--- a/target/linux/ar71xx/patches-3.18/739-MIPS-ath79-add-gpio-func-register-for-QCA955x-SoC.patch ++++ b/target/linux/ar71xx/patches-3.18/739-MIPS-ath79-add-gpio-func-register-for-QCA955x-SoC.patch +@@ -1,6 +1,16 @@ + --- a/arch/mips/ath79/gpio.c + +++ b/arch/mips/ath79/gpio.c +-@@ -187,15 +187,30 @@ void __init ath79_gpio_output_select(uns ++@@ -146,7 +146,8 @@ static void __iomem *ath79_gpio_get_func ++ if (soc_is_ar71xx() || ++ soc_is_ar724x() || ++ soc_is_ar913x() || ++- soc_is_ar933x()) +++ soc_is_ar933x() || +++ soc_is_qca955x()) ++ reg = AR71XX_GPIO_REG_FUNC; ++ else if (soc_is_ar934x() || ++ soc_is_qca953x() || ++@@ -187,15 +188,30 @@ void __init ath79_gpio_output_select(uns + { + void __iomem *base = ath79_gpio_base; + unsigned long flags; diff --git a/patches/openwrt/0058-ar71xx-Add-QCA955X-GPIO-mux-and-function-definitions.patch b/patches/openwrt/0058-ar71xx-Add-QCA955X-GPIO-mux-and-function-definitions.patch new file mode 100644 index 00000000..ee3c3674 --- /dev/null +++ b/patches/openwrt/0058-ar71xx-Add-QCA955X-GPIO-mux-and-function-definitions.patch @@ -0,0 +1,159 @@ +From: Sven Eckelmann +Date: Wed, 23 Mar 2016 12:52:31 +0000 +Subject: ar71xx: Add QCA955X GPIO mux and function definitions + +Signed-off-by: Sven Eckelmann + +Backport of r49075 + +Forwarded: https://patchwork.ozlabs.org/patch/624184/ + +diff --git a/target/linux/ar71xx/patches-3.18/601-MIPS-ath79-add-more-register-defines.patch b/target/linux/ar71xx/patches-3.18/601-MIPS-ath79-add-more-register-defines.patch +index 797977f..0126f6a 100644 +--- a/target/linux/ar71xx/patches-3.18/601-MIPS-ath79-add-more-register-defines.patch ++++ b/target/linux/ar71xx/patches-3.18/601-MIPS-ath79-add-more-register-defines.patch +@@ -194,7 +194,7 @@ + #define AR933X_BOOTSTRAP_REF_CLK_40 BIT(0) + + #define AR934X_BOOTSTRAP_SW_OPTION8 BIT(23) +-@@ -529,6 +626,12 @@ ++@@ -529,8 +626,22 @@ + #define AR71XX_GPIO_REG_INT_ENABLE 0x24 + #define AR71XX_GPIO_REG_FUNC 0x28 + +@@ -206,8 +206,18 @@ + +#define AR934X_GPIO_REG_OUT_FUNC5 0x40 + #define AR934X_GPIO_REG_FUNC 0x6c + +++#define QCA955X_GPIO_REG_OUT_FUNC0 0x2c +++#define QCA955X_GPIO_REG_OUT_FUNC1 0x30 +++#define QCA955X_GPIO_REG_OUT_FUNC2 0x34 +++#define QCA955X_GPIO_REG_OUT_FUNC3 0x38 +++#define QCA955X_GPIO_REG_OUT_FUNC4 0x3c +++#define QCA955X_GPIO_REG_OUT_FUNC5 0x40 +++#define QCA955X_GPIO_REG_FUNC 0x6c +++ + #define AR71XX_GPIO_COUNT 16 +-@@ -560,4 +663,170 @@ ++ #define AR7240_GPIO_COUNT 18 ++ #define AR7241_GPIO_COUNT 20 ++@@ -560,4 +671,235 @@ + #define AR934X_SRIF_DPLL2_OUTDIV_SHIFT 13 + #define AR934X_SRIF_DPLL2_OUTDIV_MASK 0x7 + +@@ -288,6 +298,71 @@ + +#define AR934X_GPIO_OUT_EXT_LNA0 46 + +#define AR934X_GPIO_OUT_EXT_LNA1 47 + + +++#define QCA955X_GPIO_FUNC_CLK_OBS7_EN BIT(9) +++#define QCA955X_GPIO_FUNC_CLK_OBS6_EN BIT(8) +++#define QCA955X_GPIO_FUNC_CLK_OBS5_EN BIT(7) +++#define QCA955X_GPIO_FUNC_CLK_OBS4_EN BIT(6) +++#define QCA955X_GPIO_FUNC_CLK_OBS3_EN BIT(5) +++#define QCA955X_GPIO_FUNC_CLK_OBS2_EN BIT(4) +++#define QCA955X_GPIO_FUNC_CLK_OBS1_EN BIT(3) +++#define QCA955X_GPIO_FUNC_JTAG_DISABLE BIT(1) +++ +++#define QCA955X_GPIO_OUT_GPIO 0 +++#define QCA955X_MII_EXT_MDI 1 +++#define QCA955X_SLIC_DATA_OUT 3 +++#define QCA955X_SLIC_PCM_FS 4 +++#define QCA955X_SLIC_PCM_CLK 5 +++#define QCA955X_SPI_CLK 8 +++#define QCA955X_SPI_CS_0 9 +++#define QCA955X_SPI_CS_1 10 +++#define QCA955X_SPI_CS_2 11 +++#define QCA955X_SPI_MISO 12 +++#define QCA955X_I2S_CLK 13 +++#define QCA955X_I2S_WS 14 +++#define QCA955X_I2S_SD 15 +++#define QCA955X_I2S_MCK 16 +++#define QCA955X_SPDIF_OUT 17 +++#define QCA955X_UART1_TD 18 +++#define QCA955X_UART1_RTS 19 +++#define QCA955X_UART1_RD 20 +++#define QCA955X_UART1_CTS 21 +++#define QCA955X_UART0_SOUT 22 +++#define QCA955X_SPDIF2_OUT 23 +++#define QCA955X_LED_SGMII_SPEED0 24 +++#define QCA955X_LED_SGMII_SPEED1 25 +++#define QCA955X_LED_SGMII_DUPLEX 26 +++#define QCA955X_LED_SGMII_LINK_UP 27 +++#define QCA955X_SGMII_SPEED0_INVERT 28 +++#define QCA955X_SGMII_SPEED1_INVERT 29 +++#define QCA955X_SGMII_DUPLEX_INVERT 30 +++#define QCA955X_SGMII_LINK_UP_INVERT 31 +++#define QCA955X_GE1_MII_MDO 32 +++#define QCA955X_GE1_MII_MDC 33 +++#define QCA955X_SWCOM2 38 +++#define QCA955X_SWCOM3 39 +++#define QCA955X_MAC2_GPIO 40 +++#define QCA955X_MAC3_GPIO 41 +++#define QCA955X_ATT_LED 42 +++#define QCA955X_PWR_LED 43 +++#define QCA955X_TX_FRAME 44 +++#define QCA955X_RX_CLEAR_EXTERNAL 45 +++#define QCA955X_LED_NETWORK_EN 46 +++#define QCA955X_LED_POWER_EN 47 +++#define QCA955X_WMAC_GLUE_WOW 68 +++#define QCA955X_RX_CLEAR_EXTENSION 70 +++#define QCA955X_CP_NAND_CS1 73 +++#define QCA955X_USB_SUSPEND 74 +++#define QCA955X_ETH_TX_ERR 75 +++#define QCA955X_DDR_DQ_OE 76 +++#define QCA955X_CLKREQ_N_EP 77 +++#define QCA955X_CLKREQ_N_RC 78 +++#define QCA955X_CLK_OBS0 79 +++#define QCA955X_CLK_OBS1 80 +++#define QCA955X_CLK_OBS2 81 +++#define QCA955X_CLK_OBS3 82 +++#define QCA955X_CLK_OBS4 83 +++#define QCA955X_CLK_OBS5 84 +++ + +/* + + * MII_CTRL block + + */ +diff --git a/target/linux/ar71xx/patches-3.18/739-MIPS-ath79-add-gpio-func-register-for-QCA955x-SoC.patch b/target/linux/ar71xx/patches-3.18/739-MIPS-ath79-add-gpio-func-register-for-QCA955x-SoC.patch +index 0e87357..8a54859 100644 +--- a/target/linux/ar71xx/patches-3.18/739-MIPS-ath79-add-gpio-func-register-for-QCA955x-SoC.patch ++++ b/target/linux/ar71xx/patches-3.18/739-MIPS-ath79-add-gpio-func-register-for-QCA955x-SoC.patch +@@ -37,37 +37,12 @@ + + } + + - if (gpio >= AR934X_GPIO_COUNT) ++- return; + + if (gpio >= gpio_count) +- return; +++ return; + + - reg = AR934X_GPIO_REG_OUT_FUNC0 + 4 * (gpio / 4); + + reg = reg_base + 4 * (gpio / 4); + s = 8 * (gpio % 4); + + spin_lock_irqsave(&ath79_gpio_lock, flags); +---- a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h +-+++ b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h +-@@ -875,6 +875,14 @@ +- #define QCA953X_GPIO_OUT_MUX_LED_LINK4 44 +- #define QCA953X_GPIO_OUT_MUX_LED_LINK5 45 +- +-+#define QCA955X_GPIO_REG_OUT_FUNC0 0x2c +-+#define QCA955X_GPIO_REG_OUT_FUNC1 0x30 +-+#define QCA955X_GPIO_REG_OUT_FUNC2 0x34 +-+#define QCA955X_GPIO_REG_OUT_FUNC3 0x38 +-+#define QCA955X_GPIO_REG_OUT_FUNC4 0x3c +-+#define QCA955X_GPIO_REG_OUT_FUNC5 0x40 +-+#define QCA955X_GPIO_REG_FUNC 0x6c +-+ +- #define QCA956X_GPIO_REG_OUT_FUNC0 0x2c +- #define QCA956X_GPIO_REG_OUT_FUNC1 0x30 +- #define QCA956X_GPIO_REG_OUT_FUNC2 0x34 +-@@ -1014,6 +1022,8 @@ +- #define AR934X_GPIO_OUT_EXT_LNA0 46 +- #define AR934X_GPIO_OUT_EXT_LNA1 47 +- +-+#define QCA955X_GPIO_OUT_GPIO 0 +-+ +- /* +- * MII_CTRL block +- */ diff --git a/patches/openwrt/0059-ar71xx-Use-PHY-fixups-for-Open-Mesh-MR900.patch b/patches/openwrt/0059-ar71xx-Use-PHY-fixups-for-Open-Mesh-MR900.patch new file mode 100644 index 00000000..6a32c80b --- /dev/null +++ b/patches/openwrt/0059-ar71xx-Use-PHY-fixups-for-Open-Mesh-MR900.patch @@ -0,0 +1,78 @@ +From: Sven Eckelmann +Date: Wed, 16 Mar 2016 09:27:11 +0000 +Subject: ar71xx: Use PHY fixups for Open Mesh MR900 + +The delays of PHY/MAC on the MR900 are done by u-boot and OpenWrt in +different ways. u-boot only modifies the ETH_CFG of the QCA955x based on +the link speed. But OpenWrt can only modify the PHY delays based on the +link speed. + +This can lead to communication problems when u-boot initializes the ETH_CFG +for a specific link speed (e.g. 10BASE-T) but then OpenWrt the sets the PHY +delays to an incompatible value. + +Instead reset the ETH_CFG delay bits of the QCA955x to a specific value and +only rely on the AT803x PHY settings. + +Signed-off-by: Sven Eckelmann + +Backport of r49030 + +Forwarded: https://patchwork.ozlabs.org/patch/624185/ + +diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-mr900.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-mr900.c +index 9c3164d..3634bf0 100644 +--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-mr900.c ++++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-mr900.c +@@ -23,6 +23,7 @@ + #include + + #include ++#include + + #include "common.h" + #include "dev-ap9x-pci.h" +@@ -94,15 +95,30 @@ static struct gpio_keys_button mr900_gpio_keys[] __initdata = { + }, + }; + ++static struct at803x_platform_data mr900_at803x_data = { ++ .disable_smarteee = 1, ++ .enable_rgmii_rx_delay = 1, ++ .enable_rgmii_tx_delay = 0, ++ .fixup_rgmii_tx_delay = 1, ++}; ++ ++static struct mdio_board_info mr900_mdio0_info[] = { ++ { ++ .bus_id = "ag71xx-mdio.0", ++ .phy_addr = 5, ++ .platform_data = &mr900_at803x_data, ++ }, ++}; ++ + static void __init mr900_setup(void) + { + u8 *art = (u8 *)KSEG1ADDR(0x1fff0000); + u8 mac[6], pcie_mac[6]; + struct ath9k_platform_data *pdata; + +- ath79_eth0_pll_data.pll_1000 = 0xbe000101; +- ath79_eth0_pll_data.pll_100 = 0x80000101; +- ath79_eth0_pll_data.pll_10 = 0x80001313; ++ ath79_eth0_pll_data.pll_1000 = 0xae000000; ++ ath79_eth0_pll_data.pll_100 = 0xa0000101; ++ ath79_eth0_pll_data.pll_10 = 0xa0001313; + + ath79_register_m25p80(NULL); + +@@ -126,6 +142,9 @@ static void __init mr900_setup(void) + ath79_setup_qca955x_eth_cfg(QCA955X_ETH_CFG_RGMII_EN); + ath79_register_mdio(0, 0x0); + ++ mdiobus_register_board_info(mr900_mdio0_info, ++ ARRAY_SIZE(mr900_mdio0_info)); ++ + ath79_init_mac(ath79_eth0_data.mac_addr, art + MR900_MAC0_OFFSET, 0); + + /* GMAC0 is connected to the RMGII interface */ diff --git a/patches/openwrt/0060-ar71xx-Use-PHY-fixups-for-Open-Mesh-MR1750.patch b/patches/openwrt/0060-ar71xx-Use-PHY-fixups-for-Open-Mesh-MR1750.patch new file mode 100644 index 00000000..50ff879c --- /dev/null +++ b/patches/openwrt/0060-ar71xx-Use-PHY-fixups-for-Open-Mesh-MR1750.patch @@ -0,0 +1,77 @@ +From: Sven Eckelmann +Date: Wed, 16 Mar 2016 09:27:14 +0000 +Subject: ar71xx: Use PHY fixups for Open Mesh MR1750 + +The delays of PHY/MAC on the MR1750 are done by u-boot and OpenWrt in +different ways. u-boot only modifies the ETH_CFG of the QCA955x based on +the link speed. But OpenWrt can only modify the PHY delays based on the +link speed. + +This can lead to communication problems when u-boot initializes the ETH_CFG +for a specific link speed (e.g. 10BASE-T) but then OpenWrt the sets the PHY +delays to an incompatible value. + +Instead reset the ETH_CFG delay bits of the QCA955x to a specific value and +only rely on the AT803x PHY settings. + +Signed-off-by: Sven Eckelmann + +Backport of r49031 + +Forwarded: https://patchwork.ozlabs.org/patch/624186/ + +diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-mr1750.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-mr1750.c +index 8ace02f..f9e45bd 100644 +--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-mr1750.c ++++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-mr1750.c +@@ -22,6 +22,7 @@ + #include + + #include ++#include + + #include "common.h" + #include "dev-ap9x-pci.h" +@@ -92,14 +93,29 @@ static struct gpio_keys_button mr1750_gpio_keys[] __initdata = { + }, + }; + ++static struct at803x_platform_data mr1750_at803x_data = { ++ .disable_smarteee = 1, ++ .enable_rgmii_rx_delay = 1, ++ .enable_rgmii_tx_delay = 0, ++ .fixup_rgmii_tx_delay = 1, ++}; ++ ++static struct mdio_board_info mr1750_mdio0_info[] = { ++ { ++ .bus_id = "ag71xx-mdio.0", ++ .phy_addr = 5, ++ .platform_data = &mr1750_at803x_data, ++ }, ++}; ++ + static void __init mr1750_setup(void) + { + u8 *art = (u8 *)KSEG1ADDR(0x1fff0000); + u8 mac[6]; + +- ath79_eth0_pll_data.pll_1000 = 0xbe000101; +- ath79_eth0_pll_data.pll_100 = 0x80000101; +- ath79_eth0_pll_data.pll_10 = 0x80001313; ++ ath79_eth0_pll_data.pll_1000 = 0xae000000; ++ ath79_eth0_pll_data.pll_100 = 0xa0000101; ++ ath79_eth0_pll_data.pll_10 = 0xa0001313; + + ath79_register_m25p80(NULL); + +@@ -116,6 +132,9 @@ static void __init mr1750_setup(void) + ath79_setup_qca955x_eth_cfg(QCA955X_ETH_CFG_RGMII_EN); + ath79_register_mdio(0, 0x0); + ++ mdiobus_register_board_info(mr1750_mdio0_info, ++ ARRAY_SIZE(mr1750_mdio0_info)); ++ + ath79_init_mac(ath79_eth0_data.mac_addr, art + MR1750_MAC0_OFFSET, 0); + + /* GMAC0 is connected to the RMGII interface */ diff --git a/patches/openwrt/0061-ar71xx-Use-private-version-of-ath79_setup_qca955x_et.patch b/patches/openwrt/0061-ar71xx-Use-private-version-of-ath79_setup_qca955x_et.patch new file mode 100644 index 00000000..3567a32f --- /dev/null +++ b/patches/openwrt/0061-ar71xx-Use-private-version-of-ath79_setup_qca955x_et.patch @@ -0,0 +1,58 @@ +From: Sven Eckelmann +Date: Wed, 23 Mar 2016 12:52:09 +0000 +Subject: ar71xx: Use private version of ath79_setup_qca955x_eth_cfg for MR900 + +The MR900 must unset some bits in ETH_CFG which were set by u-boot to work +correctly under OpenWrt. But the global function +ath79_setup_qca955x_eth_cfg will not unset all of them to increase the +backward compatiblity with older mach-* files. A private (simplified) +version for MR900 can be used instead. + +Signed-off-by: Sven Eckelmann + +Backport of r49069 + +Forwarded: https://patchwork.ozlabs.org/patch/624187/ + +diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-mr900.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-mr900.c +index 3634bf0..b439f58 100644 +--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-mr900.c ++++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-mr900.c +@@ -110,6 +110,28 @@ static struct mdio_board_info mr900_mdio0_info[] = { + }, + }; + ++static void __init mr900_setup_qca955x_eth_cfg(u32 mask, ++ unsigned int rxd, ++ unsigned int rxdv, ++ unsigned int txd, ++ unsigned int txe) ++{ ++ void __iomem *base; ++ u32 t; ++ ++ base = ioremap(QCA955X_GMAC_BASE, QCA955X_GMAC_SIZE); ++ ++ t = mask; ++ t |= rxd << QCA955X_ETH_CFG_RXD_DELAY_SHIFT; ++ t |= rxdv << QCA955X_ETH_CFG_RDV_DELAY_SHIFT; ++ t |= txd << QCA955X_ETH_CFG_TXD_DELAY_SHIFT; ++ t |= txe << QCA955X_ETH_CFG_TXE_DELAY_SHIFT; ++ ++ __raw_writel(t, base + QCA955X_GMAC_REG_ETH_CFG); ++ ++ iounmap(base); ++} ++ + static void __init mr900_setup(void) + { + u8 *art = (u8 *)KSEG1ADDR(0x1fff0000); +@@ -139,7 +161,7 @@ static void __init mr900_setup(void) + } + pdata->use_eeprom = true; + +- ath79_setup_qca955x_eth_cfg(QCA955X_ETH_CFG_RGMII_EN); ++ mr900_setup_qca955x_eth_cfg(QCA955X_ETH_CFG_RGMII_EN, 3, 3, 0, 0); + ath79_register_mdio(0, 0x0); + + mdiobus_register_board_info(mr900_mdio0_info, diff --git a/patches/openwrt/0062-ar71xx-Use-private-version-of-ath79_setup_qca955x_et.patch b/patches/openwrt/0062-ar71xx-Use-private-version-of-ath79_setup_qca955x_et.patch new file mode 100644 index 00000000..8ea16499 --- /dev/null +++ b/patches/openwrt/0062-ar71xx-Use-private-version-of-ath79_setup_qca955x_et.patch @@ -0,0 +1,58 @@ +From: Sven Eckelmann +Date: Wed, 23 Mar 2016 12:52:12 +0000 +Subject: ar71xx: Use private version of ath79_setup_qca955x_eth_cfg for MR1750 + +The MR1750 must unset some bits in ETH_CFG which were set by u-boot to work +correctly under OpenWrt. But the global function +ath79_setup_qca955x_eth_cfg will not unset all of them to increase the +backward compatiblity with older mach-* files. A private (simplified) +version for MR1750 can be used instead. + +Signed-off-by: Sven Eckelmann + +Backport of r49070 + +Forwarded: https://patchwork.ozlabs.org/patch/624188/ + +diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-mr1750.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-mr1750.c +index f9e45bd..e3c04e7 100644 +--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-mr1750.c ++++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-mr1750.c +@@ -108,6 +108,28 @@ static struct mdio_board_info mr1750_mdio0_info[] = { + }, + }; + ++static void __init mr1750_setup_qca955x_eth_cfg(u32 mask, ++ unsigned int rxd, ++ unsigned int rxdv, ++ unsigned int txd, ++ unsigned int txe) ++{ ++ void __iomem *base; ++ u32 t; ++ ++ base = ioremap(QCA955X_GMAC_BASE, QCA955X_GMAC_SIZE); ++ ++ t = mask; ++ t |= rxd << QCA955X_ETH_CFG_RXD_DELAY_SHIFT; ++ t |= rxdv << QCA955X_ETH_CFG_RDV_DELAY_SHIFT; ++ t |= txd << QCA955X_ETH_CFG_TXD_DELAY_SHIFT; ++ t |= txe << QCA955X_ETH_CFG_TXE_DELAY_SHIFT; ++ ++ __raw_writel(t, base + QCA955X_GMAC_REG_ETH_CFG); ++ ++ iounmap(base); ++} ++ + static void __init mr1750_setup(void) + { + u8 *art = (u8 *)KSEG1ADDR(0x1fff0000); +@@ -129,7 +151,7 @@ static void __init mr1750_setup(void) + ath79_register_wmac(art + MR1750_WMAC_CALDATA_OFFSET, mac); + ath79_register_pci(); + +- ath79_setup_qca955x_eth_cfg(QCA955X_ETH_CFG_RGMII_EN); ++ mr1750_setup_qca955x_eth_cfg(QCA955X_ETH_CFG_RGMII_EN, 3, 3, 0, 0); + ath79_register_mdio(0, 0x0); + + mdiobus_register_board_info(mr1750_mdio0_info, diff --git a/patches/openwrt/0063-scripts-om-fwupgradecfg-gen.sh-Fix-u-boot-image-md5s.patch b/patches/openwrt/0063-scripts-om-fwupgradecfg-gen.sh-Fix-u-boot-image-md5s.patch new file mode 100644 index 00000000..30658cdb --- /dev/null +++ b/patches/openwrt/0063-scripts-om-fwupgradecfg-gen.sh-Fix-u-boot-image-md5s.patch @@ -0,0 +1,43 @@ +From: Sven Eckelmann +Date: Mon, 14 Sep 2015 20:10:10 +0000 +Subject: scripts/om-fwupgradecfg-gen.sh: Fix u-boot image md5sum check + +The u-boot on Open Mesh devices checks the whole transfered image against a +md5sum. This is stored inside the option filemd5sum inside the +fwupgrade.cfg. The bootloader will not check it when this setting is +missing and could therefore write invalid images to the flash. + +Signed-off-by: Sven Eckelmann + +Backport of r46925 + +Forwarded: https://patchwork.ozlabs.org/patch/624189/ + +diff --git a/scripts/om-fwupgradecfg-gen.sh b/scripts/om-fwupgradecfg-gen.sh +index c790214..fab1582 100644 +--- a/scripts/om-fwupgradecfg-gen.sh ++++ b/scripts/om-fwupgradecfg-gen.sh +@@ -48,6 +48,7 @@ ROOTFS_FLASH_ADDR=$(addr=$(($KERNEL_FLASH_ADDR + ($KERNEL_PART_SIZE * 1024))); p + ROOTFS_SIZE=$(stat -c%s "$ROOTFS_PATH") + ROOTFS_CHECK_BLOCKS=$((($ROOTFS_SIZE / $CHECK_BS) - $MD5_SKIP_BLOCKS)) + ROOTFS_MD5=$(md5=$(dd if=$ROOTFS_PATH bs=$CHECK_BS count=$ROOTFS_CHECK_BLOCKS 2>&- | md5sum); echo ${md5%% *}) ++ROOTFS_MD5_FULL=$(md5=$(md5sum $ROOTFS_PATH); echo ${md5%% *}) + ROOTFS_CHECK_SIZE=$(printf '0x%x' $(($ROOTFS_CHECK_BLOCKS * $CHECK_BS))) + ROOTFS_PART_SIZE=$(($MAX_PART_SIZE - $KERNEL_PART_SIZE)) + +@@ -55,6 +56,7 @@ cat << EOF > $CFG_OUT + [vmlinux] + filename=kernel + md5sum=$KERNEL_MD5 ++filemd5sum=$KERNEL_MD5 + flashaddr=$KERNEL_FLASH_ADDR + checksize=0x0 + cmd_success=setenv bootseq 1,2; setenv kernel_size_1 $KERNEL_PART_SIZE; saveenv +@@ -63,6 +65,7 @@ cmd_fail=reset + [rootfs] + filename=rootfs + md5sum=$ROOTFS_MD5 ++filemd5sum=$ROOTFS_MD5_FULL + flashaddr=$ROOTFS_FLASH_ADDR + checksize=$ROOTFS_CHECK_SIZE + cmd_success=setenv bootseq 1,2; setenv kernel_size_1 $KERNEL_PART_SIZE; setenv rootfs_size_1 $ROOTFS_PART_SIZE; saveenv diff --git a/patches/openwrt/0064-scripts-om-fwupgradecfg-gen.sh-Generate-sha256sum-fo.patch b/patches/openwrt/0064-scripts-om-fwupgradecfg-gen.sh-Generate-sha256sum-fo.patch new file mode 100644 index 00000000..01bb37b5 --- /dev/null +++ b/patches/openwrt/0064-scripts-om-fwupgradecfg-gen.sh-Generate-sha256sum-fo.patch @@ -0,0 +1,50 @@ +From: Sven Eckelmann +Date: Sat, 9 Apr 2016 10:25:42 +0000 +Subject: scripts/om-fwupgradecfg-gen.sh: Generate sha256sum for uboot verification + +Future Open Mesh u-boot versions are changing the check of the image files +(vmlinux, rootfs) from md5 to sha256. Having both in them should be enough +to ensure backward and forward compatibility. + +Signed-off-by: Sven Eckelmann + +Backport of r49140 + +Forwarded: https://patchwork.ozlabs.org/patch/624190/ + +diff --git a/scripts/om-fwupgradecfg-gen.sh b/scripts/om-fwupgradecfg-gen.sh +index fab1582..e208e6d 100644 +--- a/scripts/om-fwupgradecfg-gen.sh ++++ b/scripts/om-fwupgradecfg-gen.sh +@@ -42,6 +42,7 @@ CHECK_BS=65536 + + KERNEL_SIZE=$(stat -c%s "$KERNEL_PATH") + KERNEL_MD5=$(md5=$(md5sum $KERNEL_PATH); echo ${md5%% *}) ++KERNEL_SHA256=$(openssl dgst -sha256 $KERNEL_PATH | awk '{print $2}') + KERNEL_PART_SIZE=$(size=$(($KERNEL_SIZE / $FLASH_BS)); [ $(($size * $FLASH_BS)) -lt $KERNEL_SIZE ] && size=$(($size + 1)); echo $(($size * $FLASH_BS / 1024))) + + ROOTFS_FLASH_ADDR=$(addr=$(($KERNEL_FLASH_ADDR + ($KERNEL_PART_SIZE * 1024))); printf "0x%x" $addr) +@@ -49,6 +50,7 @@ ROOTFS_SIZE=$(stat -c%s "$ROOTFS_PATH") + ROOTFS_CHECK_BLOCKS=$((($ROOTFS_SIZE / $CHECK_BS) - $MD5_SKIP_BLOCKS)) + ROOTFS_MD5=$(md5=$(dd if=$ROOTFS_PATH bs=$CHECK_BS count=$ROOTFS_CHECK_BLOCKS 2>&- | md5sum); echo ${md5%% *}) + ROOTFS_MD5_FULL=$(md5=$(md5sum $ROOTFS_PATH); echo ${md5%% *}) ++ROOTFS_SHA256_FULL=$(openssl dgst -sha256 $ROOTFS_PATH | awk '{print $2}') + ROOTFS_CHECK_SIZE=$(printf '0x%x' $(($ROOTFS_CHECK_BLOCKS * $CHECK_BS))) + ROOTFS_PART_SIZE=$(($MAX_PART_SIZE - $KERNEL_PART_SIZE)) + +@@ -57,6 +59,7 @@ cat << EOF > $CFG_OUT + filename=kernel + md5sum=$KERNEL_MD5 + filemd5sum=$KERNEL_MD5 ++filesha256sum=$KERNEL_SHA256 + flashaddr=$KERNEL_FLASH_ADDR + checksize=0x0 + cmd_success=setenv bootseq 1,2; setenv kernel_size_1 $KERNEL_PART_SIZE; saveenv +@@ -66,6 +69,7 @@ cmd_fail=reset + filename=rootfs + md5sum=$ROOTFS_MD5 + filemd5sum=$ROOTFS_MD5_FULL ++filesha256sum=$ROOTFS_SHA256_FULL + flashaddr=$ROOTFS_FLASH_ADDR + checksize=$ROOTFS_CHECK_SIZE + cmd_success=setenv bootseq 1,2; setenv kernel_size_1 $KERNEL_PART_SIZE; setenv rootfs_size_1 $ROOTFS_PART_SIZE; saveenv diff --git a/patches/openwrt/0065-ar71xx-add-kernel-support-for-the-OpenMesh-OM5P-AC-b.patch b/patches/openwrt/0065-ar71xx-add-kernel-support-for-the-OpenMesh-OM5P-AC-b.patch new file mode 100644 index 00000000..f3f8b253 --- /dev/null +++ b/patches/openwrt/0065-ar71xx-add-kernel-support-for-the-OpenMesh-OM5P-AC-b.patch @@ -0,0 +1,265 @@ +From: Sven Eckelmann +Date: Sat, 9 Apr 2016 10:25:47 +0000 +Subject: ar71xx: add kernel support for the OpenMesh OM5P-AC board + +Signed-off-by: Sven Eckelmann + +Backport of r49141 + +Forwarded: https://patchwork.ozlabs.org/patch/624191/ + +diff --git a/target/linux/ar71xx/config-3.18 b/target/linux/ar71xx/config-3.18 +index c5a3c9a..dd89357 100644 +--- a/target/linux/ar71xx/config-3.18 ++++ b/target/linux/ar71xx/config-3.18 +@@ -91,6 +91,7 @@ CONFIG_ATH79_MACH_NBG460N=y + CONFIG_ATH79_MACH_NBG6716=y + CONFIG_ATH79_MACH_OM2P=y + CONFIG_ATH79_MACH_OM5P=y ++CONFIG_ATH79_MACH_OM5P_AC=y + CONFIG_ATH79_MACH_ONION_OMEGA=y + CONFIG_ATH79_MACH_PB42=y + CONFIG_ATH79_MACH_PB44=y +diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-om5pac.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-om5pac.c +new file mode 100644 +index 0000000..f6974af +--- /dev/null ++++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-om5pac.c +@@ -0,0 +1,193 @@ ++/* ++ * OpenMesh OM5P-AC support ++ * ++ * Copyright (C) 2013 Marek Lindner ++ * Copyright (C) 2014 Sven Eckelmann ++ * ++ * 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. ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++ ++#include "common.h" ++#include "dev-ap9x-pci.h" ++#include "dev-eth.h" ++#include "dev-leds-gpio.h" ++#include "dev-m25p80.h" ++#include "dev-wmac.h" ++#include "machtypes.h" ++#include "pci.h" ++ ++#define OM5PAC_GPIO_LED_POWER 18 ++#define OM5PAC_GPIO_LED_GREEN 21 ++#define OM5PAC_GPIO_LED_RED 23 ++#define OM5PAC_GPIO_LED_YELLOW 22 ++#define OM5PAC_GPIO_LED_LAN 20 ++#define OM5PAC_GPIO_LED_WAN 19 ++#define OM5PAC_GPIO_I2C_SCL 12 ++#define OM5PAC_GPIO_I2C_SDA 11 ++ ++#define OM5PAC_KEYS_POLL_INTERVAL 20 /* msecs */ ++#define OM5PAC_KEYS_DEBOUNCE_INTERVAL (3 * OM5PAC_KEYS_POLL_INTERVAL) ++ ++#define OM5PAC_WMAC_CALDATA_OFFSET 0x1000 ++ ++static struct gpio_led om5pac_leds_gpio[] __initdata = { ++ { ++ .name = "om5pac:blue:power", ++ .gpio = OM5PAC_GPIO_LED_POWER, ++ .active_low = 1, ++ }, { ++ .name = "om5pac:red:wifi", ++ .gpio = OM5PAC_GPIO_LED_RED, ++ .active_low = 1, ++ }, { ++ .name = "om5pac:yellow:wifi", ++ .gpio = OM5PAC_GPIO_LED_YELLOW, ++ .active_low = 1, ++ }, { ++ .name = "om5pac:green:wifi", ++ .gpio = OM5PAC_GPIO_LED_GREEN, ++ .active_low = 1, ++ }, { ++ .name = "om5pac:blue:lan", ++ .gpio = OM5PAC_GPIO_LED_LAN, ++ .active_low = 1, ++ }, { ++ .name = "om5pac:blue:wan", ++ .gpio = OM5PAC_GPIO_LED_WAN, ++ .active_low = 1, ++ } ++}; ++ ++static struct flash_platform_data om5pac_flash_data = { ++ .type = "mx25l12805d", ++}; ++ ++static struct i2c_gpio_platform_data om5pac_i2c_device_platdata = { ++ .sda_pin = OM5PAC_GPIO_I2C_SDA, ++ .scl_pin = OM5PAC_GPIO_I2C_SCL, ++ .udelay = 10, ++ .sda_is_open_drain = 1, ++ .scl_is_open_drain = 1, ++}; ++ ++static struct platform_device om5pac_i2c_device = { ++ .name = "i2c-gpio", ++ .id = 0, ++ .dev = { ++ .platform_data = &om5pac_i2c_device_platdata, ++ }, ++}; ++ ++static struct i2c_board_info om5pac_i2c_devs[] __initdata = { ++ { ++ I2C_BOARD_INFO("tmp423", 0x4c), ++ }, ++}; ++ ++static struct at803x_platform_data om5pac_at803x_data = { ++ .disable_smarteee = 1, ++ .enable_rgmii_rx_delay = 1, ++ .enable_rgmii_tx_delay = 1, ++}; ++ ++static struct mdio_board_info om5pac_mdio0_info[] = { ++ { ++ .bus_id = "ag71xx-mdio.0", ++ .phy_addr = 1, ++ .platform_data = &om5pac_at803x_data, ++ }, ++ { ++ .bus_id = "ag71xx-mdio.0", ++ .phy_addr = 2, ++ .platform_data = &om5pac_at803x_data, ++ }, ++}; ++ ++static void __init om5p_ac_setup_qca955x_eth_cfg(u32 mask, ++ unsigned int rxd, ++ unsigned int rxdv, ++ unsigned int txd, ++ unsigned int txe) ++{ ++ void __iomem *base; ++ u32 t; ++ ++ base = ioremap(QCA955X_GMAC_BASE, QCA955X_GMAC_SIZE); ++ ++ t = mask; ++ t |= rxd << QCA955X_ETH_CFG_RXD_DELAY_SHIFT; ++ t |= rxdv << QCA955X_ETH_CFG_RDV_DELAY_SHIFT; ++ t |= txd << QCA955X_ETH_CFG_TXD_DELAY_SHIFT; ++ t |= txe << QCA955X_ETH_CFG_TXE_DELAY_SHIFT; ++ ++ __raw_writel(t, base + QCA955X_GMAC_REG_ETH_CFG); ++ ++ iounmap(base); ++} ++ ++static void __init om5p_ac_setup(void) ++{ ++ u8 *art = (u8 *)KSEG1ADDR(0x1fff0000); ++ u8 mac[6]; ++ ++ /* temperature sensor */ ++ platform_device_register(&om5pac_i2c_device); ++ i2c_register_board_info(0, om5pac_i2c_devs, ++ ARRAY_SIZE(om5pac_i2c_devs)); ++ ++ ath79_gpio_output_select(OM5PAC_GPIO_LED_WAN, QCA955X_GPIO_OUT_GPIO); ++ ++ ath79_register_m25p80(&om5pac_flash_data); ++ ath79_register_leds_gpio(-1, ARRAY_SIZE(om5pac_leds_gpio), ++ om5pac_leds_gpio); ++ ++ ath79_init_mac(mac, art, 0x02); ++ ath79_register_wmac(art + OM5PAC_WMAC_CALDATA_OFFSET, mac); ++ ++ om5p_ac_setup_qca955x_eth_cfg(QCA955X_ETH_CFG_RGMII_EN, 3, 3, 0, 0); ++ ath79_register_mdio(0, 0x0); ++ ++ mdiobus_register_board_info(om5pac_mdio0_info, ++ ARRAY_SIZE(om5pac_mdio0_info)); ++ ++ ath79_init_mac(ath79_eth0_data.mac_addr, art, 0x00); ++ ath79_init_mac(ath79_eth1_data.mac_addr, art, 0x01); ++ ++ /* GMAC0 is connected to the PHY1 */ ++ ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; ++ ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; ++ ath79_eth0_data.phy_mask = BIT(1); ++ ath79_eth0_pll_data.pll_1000 = 0x82000101; ++ ath79_eth0_pll_data.pll_100 = 0x80000101; ++ ath79_eth0_pll_data.pll_10 = 0x80001313; ++ ath79_register_eth(0); ++ ++ /* GMAC1 is connected to MDIO1 in SGMII mode */ ++ ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_SGMII; ++ ath79_eth1_data.mii_bus_dev = &ath79_mdio0_device.dev; ++ ath79_eth1_data.phy_mask = BIT(2); ++ ath79_eth1_pll_data.pll_1000 = 0x03000101; ++ ath79_eth1_pll_data.pll_100 = 0x80000101; ++ ath79_eth1_pll_data.pll_10 = 0x80001313; ++ ath79_eth1_data.speed = SPEED_1000; ++ ath79_eth1_data.duplex = DUPLEX_FULL; ++ ath79_register_eth(1); ++ ++ ath79_register_pci(); ++} ++ ++MIPS_MACHINE(ATH79_MACH_OM5P_AC, "OM5P-AC", "OpenMesh OM5P AC", om5p_ac_setup); +diff --git a/target/linux/ar71xx/patches-3.18/815-MIPS-ath79-add-om5pac-support.patch b/target/linux/ar71xx/patches-3.18/815-MIPS-ath79-add-om5pac-support.patch +new file mode 100644 +index 0000000..4accd03 +--- /dev/null ++++ b/target/linux/ar71xx/patches-3.18/815-MIPS-ath79-add-om5pac-support.patch +@@ -0,0 +1,38 @@ ++--- a/arch/mips/ath79/Kconfig +++++ b/arch/mips/ath79/Kconfig ++@@ -799,6 +799,15 @@ config ATH79_MACH_OM5P ++ select ATH79_DEV_M25P80 ++ select ATH79_DEV_WMAC ++ +++config ATH79_MACH_OM5P_AC +++ bool "OpenMesh OM5P-AC board support" +++ select SOC_QCA955X +++ select ATH79_DEV_AP9X_PCI if PCI +++ select ATH79_DEV_ETH +++ select ATH79_DEV_LEDS_GPIO +++ select ATH79_DEV_M25P80 +++ select ATH79_DEV_WMAC +++ ++ config ATH79_MACH_ONION_OMEGA ++ bool "ONION OMEGA support" ++ select SOC_AR933X ++--- a/arch/mips/ath79/Makefile +++++ b/arch/mips/ath79/Makefile ++@@ -100,6 +100,7 @@ obj-$(CONFIG_ATH79_MACH_MZK_W300NH) += m ++ obj-$(CONFIG_ATH79_MACH_NBG460N) += mach-nbg460n.o ++ obj-$(CONFIG_ATH79_MACH_OM2P) += mach-om2p.o ++ obj-$(CONFIG_ATH79_MACH_OM5P) += mach-om5p.o +++obj-$(CONFIG_ATH79_MACH_OM5P_AC) += mach-om5pac.o ++ obj-$(CONFIG_ATH79_MACH_ONION_OMEGA) += mach-onion-omega.o ++ obj-$(CONFIG_ATH79_MACH_PB42) += mach-pb42.o ++ obj-$(CONFIG_ATH79_MACH_PB44) += mach-pb44.o ++--- a/arch/mips/ath79/machtypes.h +++++ b/arch/mips/ath79/machtypes.h ++@@ -95,6 +95,7 @@ enum ath79_mach_type { ++ ATH79_MACH_OM2P_LC, /* OpenMesh OM2P-LC */ ++ ATH79_MACH_OM2Pv2, /* OpenMesh OM2Pv2 */ ++ ATH79_MACH_OM2P, /* OpenMesh OM2P */ +++ ATH79_MACH_OM5P_AC, /* OpenMesh OM5P-AC */ ++ ATH79_MACH_OM5P_AN, /* OpenMesh OM5P-AN */ ++ ATH79_MACH_OM5P, /* OpenMesh OM5P */ ++ ATH79_MACH_ONION_OMEGA, /* ONION OMEGA */ diff --git a/patches/openwrt/0066-ar71xx-add-user-space-support-for-the-OpenMesh-OM5P-.patch b/patches/openwrt/0066-ar71xx-add-user-space-support-for-the-OpenMesh-OM5P-.patch new file mode 100644 index 00000000..7161fdca --- /dev/null +++ b/patches/openwrt/0066-ar71xx-add-user-space-support-for-the-OpenMesh-OM5P-.patch @@ -0,0 +1,54 @@ +From: Sven Eckelmann +Date: Sat, 9 Apr 2016 10:25:51 +0000 +Subject: ar71xx: add user-space support for the OpenMesh OM5P-AC + +Signed-off-by: Sven Eckelmann + +Backport of r49142 + +Forwarded: https://patchwork.ozlabs.org/patch/624192/ + +diff --git a/target/linux/ar71xx/base-files/etc/diag.sh b/target/linux/ar71xx/base-files/etc/diag.sh +index 44d2ddf..a4051f2 100644 +--- a/target/linux/ar71xx/base-files/etc/diag.sh ++++ b/target/linux/ar71xx/base-files/etc/diag.sh +@@ -178,6 +178,9 @@ get_status_led() { + om5p-an) + status_led="om5p:blue:power" + ;; ++ om5p-ac) ++ status_led="om5pac:blue:power" ++ ;; + onion-omega) + status_led="onion:amber:system" + ;; +diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds +index c451124..9a768cd 100644 +--- a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds ++++ b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds +@@ -304,6 +304,11 @@ om5p-an) + ucidef_set_led_netdev "port2" "port2" "om5p:blue:lan" "eth1" + ;; + ++om5p-ac) ++ ucidef_set_led_netdev "port1" "port1" "om5pac:blue:lan" "eth0" ++ ucidef_set_led_netdev "port2" "port2" "om5pac:blue:wan" "eth1" ++ ;; ++ + qihoo-c301) + ucidef_set_led_wlan "wlan2g" "WLAN2G" "qihoo:red:status" "phy1tpt" + ;; +diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh +index 587d029..10b8048 100755 +--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh ++++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh +@@ -616,6 +616,9 @@ ar71xx_board_detect() { + *"OM5P AN") + name="om5p-an" + ;; ++ *"OM5P AC") ++ name="om5p-ac" ++ ;; + *"Onion Omega") + name="onion-omega" + ;; diff --git a/patches/openwrt/0067-scripts-om-fwupgradecfg-gen.sh-add-support-for-the-O.patch b/patches/openwrt/0067-scripts-om-fwupgradecfg-gen.sh-add-support-for-the-O.patch new file mode 100644 index 00000000..4b6311e2 --- /dev/null +++ b/patches/openwrt/0067-scripts-om-fwupgradecfg-gen.sh-add-support-for-the-O.patch @@ -0,0 +1,32 @@ +From: Sven Eckelmann +Date: Sat, 9 Apr 2016 10:25:54 +0000 +Subject: scripts/om-fwupgradecfg-gen.sh: add support for the OM5P-AC + +Signed-off-by: Sven Eckelmann + +Backport of r49143 + +Forwarded: https://patchwork.ozlabs.org/patch/624193/ + +diff --git a/scripts/om-fwupgradecfg-gen.sh b/scripts/om-fwupgradecfg-gen.sh +index e208e6d..6c3b74c 100644 +--- a/scripts/om-fwupgradecfg-gen.sh ++++ b/scripts/om-fwupgradecfg-gen.sh +@@ -7,7 +7,7 @@ + # + + usage() { +- echo "Usage: $0 " ++ echo "Usage: $0 " + rm -f $CFG_OUT + exit 1 + } +@@ -26,7 +26,7 @@ case $CE_TYPE in + FLASH_BS=262144 + MD5_SKIP_BLOCKS=1 + ;; +- OM5P|MR600|MR900|MR1750) ++ OM5P|OM5PAC|MR600|MR900|MR1750) + MAX_PART_SIZE=7808 + KERNEL_FLASH_ADDR=0xb0000 + FLASH_BS=65536 diff --git a/patches/openwrt/0068-ar71xx-enable-sysupgrade-for-the-OpenMesh-OM5P-AC.patch b/patches/openwrt/0068-ar71xx-enable-sysupgrade-for-the-OpenMesh-OM5P-AC.patch new file mode 100644 index 00000000..ae08198a --- /dev/null +++ b/patches/openwrt/0068-ar71xx-enable-sysupgrade-for-the-OpenMesh-OM5P-AC.patch @@ -0,0 +1,59 @@ +From: Sven Eckelmann +Date: Sat, 9 Apr 2016 10:25:57 +0000 +Subject: ar71xx: enable sysupgrade for the OpenMesh OM5P-AC + +Signed-off-by: Sven Eckelmann + +Backport of r49144 + +Forwarded: https://patchwork.ozlabs.org/patch/624194/ + +diff --git a/target/linux/ar71xx/base-files/lib/upgrade/openmesh.sh b/target/linux/ar71xx/base-files/lib/upgrade/openmesh.sh +index 9ca0f5b..1cfead9 100644 +--- a/target/linux/ar71xx/base-files/lib/upgrade/openmesh.sh ++++ b/target/linux/ar71xx/base-files/lib/upgrade/openmesh.sh +@@ -72,6 +72,11 @@ platform_check_image_openmesh() + echo "Invalid image board target ($img_board_target) for this platform: $board. Use the correct image for this platform" + return 1 + ;; ++ OM5PAC) ++ [ "$board" = "om5p-ac" ] && break ++ echo "Invalid image board target ($img_board_target) for this platform: $board. Use the correct image for this platform" ++ return 1 ++ ;; + MR1750) + [ "$board" = "mr1750" ] && break + echo "Invalid image board target ($img_board_target) for this platform: $board. Use the correct image for this platform" +@@ -162,7 +167,7 @@ platform_do_upgrade_openmesh() + kernel_start_addr1=0x9f1c0000 + kernel_start_addr2=0x9f8c0000 + ;; +- OM5P|MR600|MR900|MR1750) ++ OM5P|OM5PAC|MR600|MR900|MR1750) + block_size=$((64 * 1024)) + total_size=7995392 + kernel_start_addr1=0x9f0b0000 +diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh +index ac060ea..67c0661 100755 +--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh ++++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh +@@ -307,7 +307,8 @@ platform_check_image() { + om2p-hsv2 | \ + om2p-lc | \ + om5p | \ +- om5p-an) ++ om5p-an | \ ++ om5p-ac) + platform_check_image_openmesh "$magic_long" "$1" && return 0 + return 1 + ;; +@@ -540,7 +541,8 @@ platform_do_upgrade() { + om2p-hsv2 | \ + om2p-lc | \ + om5p | \ +- om5p-an) ++ om5p-an | \ ++ om5p-ac) + platform_do_upgrade_openmesh "$ARGV" + ;; + unifi-outdoor-plus | \ diff --git a/patches/openwrt/0069-om-watchdog-add-OpenMesh-OM5P-AC-support.patch b/patches/openwrt/0069-om-watchdog-add-OpenMesh-OM5P-AC-support.patch new file mode 100644 index 00000000..c2d2e225 --- /dev/null +++ b/patches/openwrt/0069-om-watchdog-add-OpenMesh-OM5P-AC-support.patch @@ -0,0 +1,24 @@ +From: Sven Eckelmann +Date: Sat, 9 Apr 2016 10:26:01 +0000 +Subject: om-watchdog: add OpenMesh OM5P-AC support + +Signed-off-by: Sven Eckelmann + +Backport of r49145 + +Forwarded: https://patchwork.ozlabs.org/patch/624195/ + +diff --git a/package/kernel/om-watchdog/files/om-watchdog.init b/package/kernel/om-watchdog/files/om-watchdog.init +index c792968..8cec13b 100644 +--- a/package/kernel/om-watchdog/files/om-watchdog.init ++++ b/package/kernel/om-watchdog/files/om-watchdog.init +@@ -22,6 +22,9 @@ boot() { + "om5p"|"om5p-an") + service_start /sbin/om-watchdog 11 + ;; ++ "om5p-ac") ++ service_start /sbin/om-watchdog 17 ++ ;; + "mr600v2") + service_start /sbin/om-watchdog 15 + ;; diff --git a/patches/openwrt/0070-uboot-envtools-add-OpenMesh-OM5P-AC-support.patch b/patches/openwrt/0070-uboot-envtools-add-OpenMesh-OM5P-AC-support.patch new file mode 100644 index 00000000..0d7b312e --- /dev/null +++ b/patches/openwrt/0070-uboot-envtools-add-OpenMesh-OM5P-AC-support.patch @@ -0,0 +1,22 @@ +From: Sven Eckelmann +Date: Sat, 9 Apr 2016 10:26:04 +0000 +Subject: uboot-envtools: add OpenMesh OM5P-AC support + +Signed-off-by: Sven Eckelmann + +Backport of r49146 + +Forwarded: https://patchwork.ozlabs.org/patch/624196/ + +diff --git a/package/boot/uboot-envtools/files/ar71xx b/package/boot/uboot-envtools/files/ar71xx +index ef00f17..657b25f 100644 +--- a/package/boot/uboot-envtools/files/ar71xx ++++ b/package/boot/uboot-envtools/files/ar71xx +@@ -28,6 +28,7 @@ mr900 | \ + mr900v2 | \ + nbg6716 | \ + om5p-an | \ ++om5p-ac | \ + om5p | \ + tube2h | \ + wndr3700) diff --git a/patches/openwrt/0071-ar71xx-extract-ath10k-wifi-board.bin-for-the-OpenMes.patch b/patches/openwrt/0071-ar71xx-extract-ath10k-wifi-board.bin-for-the-OpenMes.patch new file mode 100644 index 00000000..0cd9fec5 --- /dev/null +++ b/patches/openwrt/0071-ar71xx-extract-ath10k-wifi-board.bin-for-the-OpenMes.patch @@ -0,0 +1,25 @@ +From: Sven Eckelmann +Date: Sat, 9 Apr 2016 10:26:08 +0000 +Subject: ar71xx: extract ath10k wifi board.bin for the OpenMesh OM5P-AC board + +Signed-off-by: Sven Eckelmann + +Backport of r49147 + +Forwarded: https://patchwork.ozlabs.org/patch/624197/ + +diff --git a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata +index cde7aaf..c1f4b85 100644 +--- a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata ++++ b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata +@@ -96,6 +96,10 @@ case "$FIRMWARE" in + rb-911g-5hpacd) + ath10kcal_from_file "/sys/firmware/routerboot/ext_wlan_data" 20480 2116 + ;; ++ om5p-ac) ++ ath10kcal_extract "ART" 20480 2116 ++ ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) +16) ++ ;; + esac + ;; + *) diff --git a/patches/openwrt/0072-ar71xx-create-profile-and-build-image-for-the-OpenMe.patch b/patches/openwrt/0072-ar71xx-create-profile-and-build-image-for-the-OpenMe.patch new file mode 100644 index 00000000..ce03a85f --- /dev/null +++ b/patches/openwrt/0072-ar71xx-create-profile-and-build-image-for-the-OpenMe.patch @@ -0,0 +1,53 @@ +From: Sven Eckelmann +Date: Sat, 9 Apr 2016 10:26:11 +0000 +Subject: ar71xx: create profile and build image for the OpenMesh OM5P-AC board + +Signed-off-by: Sven Eckelmann + +Backport of r49148 + +Forwarded: https://patchwork.ozlabs.org/patch/624198/ + +diff --git a/target/linux/ar71xx/generic/profiles/openmesh.mk b/target/linux/ar71xx/generic/profiles/openmesh.mk +index 06cf135..64aaa24 100644 +--- a/target/linux/ar71xx/generic/profiles/openmesh.mk ++++ b/target/linux/ar71xx/generic/profiles/openmesh.mk +@@ -27,6 +27,17 @@ endef + + $(eval $(call Profile,OM5P)) + ++define Profile/OM5PAC ++ NAME:=OpenMesh OM5P-AC ++ PACKAGES:=kmod-ath9k kmod-ath10k om-watchdog ath10k-firmware-qca988x ++endef ++ ++define Profile/OM5PAC/Description ++ Package set optimized for the OpenMesh OM5P-AC. ++endef ++ ++$(eval $(call Profile,OM5PAC)) ++ + define Profile/MR600 + NAME:=OpenMesh MR600 + PACKAGES:=kmod-ath9k om-watchdog +diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile +index b74aa45..06dbb77 100644 +--- a/target/linux/ar71xx/image/Makefile ++++ b/target/linux/ar71xx/image/Makefile +@@ -2043,6 +2043,7 @@ $(eval $(call SingleProfile,Netgear,64kraw,WPN824N,wpn824n,WPN824N,ttyS0,115200, + + $(eval $(call SingleProfile,OpenMesh,squashfs-only,OM2P,om2p,,,,OM2P)) + $(eval $(call SingleProfile,OpenMesh,squashfs-only,OM5P,om5p,,,,OM5P)) ++$(eval $(call SingleProfile,OpenMesh,squashfs-only,OM5PAC,om5pac,,,,OM5PAC)) + $(eval $(call SingleProfile,OpenMesh,squashfs-only,MR600,mr600,,,,MR600)) + $(eval $(call SingleProfile,OpenMesh,squashfs-only,MR900,mr900,,,,MR900)) + $(eval $(call SingleProfile,OpenMesh,squashfs-only,MR1750,mr1750,,,,MR1750)) +@@ -2139,7 +2140,7 @@ $(eval $(call MultiProfile,AP121,AP121_2M AP121_4M)) + $(eval $(call MultiProfile,DIR615IX,DIR615I1 DIR615I3)) + $(eval $(call MultiProfile,AP136,AP136_010 AP136_020)) + $(eval $(call MultiProfile,EWDORIN, EWDORINAP EWDORINRT EWDORIN16M)) +-$(eval $(call MultiProfile,OPENMESH,OM2P OM5P MR600 MR900 MR1750)) ++$(eval $(call MultiProfile,OPENMESH,OM2P OM5P OM5PAC MR600 MR900 MR1750)) + $(eval $(call MultiProfile,TEW652BRP,TEW652BRP_FW TEW652BRP_RECOVERY)) + $(eval $(call MultiProfile,TLMR3220,TLMR3220V1)) + $(eval $(call MultiProfile,TLMR3420,TLMR3420V1)) diff --git a/patches/openwrt/0073-ar71xx-add-kernel-support-for-the-OpenMesh-OM5P-ACv2.patch b/patches/openwrt/0073-ar71xx-add-kernel-support-for-the-OpenMesh-OM5P-ACv2.patch new file mode 100644 index 00000000..d2e2cd60 --- /dev/null +++ b/patches/openwrt/0073-ar71xx-add-kernel-support-for-the-OpenMesh-OM5P-ACv2.patch @@ -0,0 +1,289 @@ +From: Sven Eckelmann +Date: Sat, 9 Apr 2016 10:26:15 +0000 +Subject: ar71xx: add kernel support for the OpenMesh OM5P-ACv2 board + +Signed-off-by: Sven Eckelmann + +Backport of r49149 + +Forwarded: https://patchwork.ozlabs.org/patch/624199/ + +diff --git a/target/linux/ar71xx/config-3.18 b/target/linux/ar71xx/config-3.18 +index dd89357..514f7d5 100644 +--- a/target/linux/ar71xx/config-3.18 ++++ b/target/linux/ar71xx/config-3.18 +@@ -92,6 +92,7 @@ CONFIG_ATH79_MACH_NBG6716=y + CONFIG_ATH79_MACH_OM2P=y + CONFIG_ATH79_MACH_OM5P=y + CONFIG_ATH79_MACH_OM5P_AC=y ++CONFIG_ATH79_MACH_OM5P_ACv2=y + CONFIG_ATH79_MACH_ONION_OMEGA=y + CONFIG_ATH79_MACH_PB42=y + CONFIG_ATH79_MACH_PB44=y +diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-om5pacv2.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-om5pacv2.c +new file mode 100644 +index 0000000..587ca32 +--- /dev/null ++++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-om5pacv2.c +@@ -0,0 +1,216 @@ ++/* ++ * OpenMesh OM5P-ACv2 support ++ * ++ * Copyright (C) 2013 Marek Lindner ++ * Copyright (C) 2014-2016 Sven Eckelmann ++ * Copyright (C) 2015 Open-Mesh - Jim Collar ++ * ++ * 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. ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++ ++#include "common.h" ++#include "dev-ap9x-pci.h" ++#include "dev-eth.h" ++#include "dev-gpio-buttons.h" ++#include "dev-leds-gpio.h" ++#include "dev-m25p80.h" ++#include "dev-wmac.h" ++#include "machtypes.h" ++#include "pci.h" ++ ++#define OM5PACV2_GPIO_LED_POWER 14 ++#define OM5PACV2_GPIO_LED_GREEN 13 ++#define OM5PACV2_GPIO_LED_RED 23 ++#define OM5PACV2_GPIO_LED_YELLOW 15 ++#define OM5PACV2_GPIO_BTN_RESET 1 ++#define OM5PACV2_GPIO_I2C_SCL 18 ++#define OM5PACV2_GPIO_I2C_SDA 19 ++#define OM5PACV2_GPIO_PA_DCDC 2 ++#define OM5PACV2_GPIO_PA_HIGH 16 ++ ++#define OM5PACV2_KEYS_POLL_INTERVAL 20 /* msecs */ ++#define OM5PACV2_KEYS_DEBOUNCE_INTERVAL (3 * OM5PACV2_KEYS_POLL_INTERVAL) ++ ++#define OM5PACV2_WMAC_CALDATA_OFFSET 0x1000 ++ ++static struct gpio_led om5pacv2_leds_gpio[] __initdata = { ++ { ++ .name = "om5pac:blue:power", ++ .gpio = OM5PACV2_GPIO_LED_POWER, ++ .active_low = 1, ++ }, { ++ .name = "om5pac:red:wifi", ++ .gpio = OM5PACV2_GPIO_LED_RED, ++ .active_low = 1, ++ }, { ++ .name = "om5pac:yellow:wifi", ++ .gpio = OM5PACV2_GPIO_LED_YELLOW, ++ .active_low = 1, ++ }, { ++ .name = "om5pac:green:wifi", ++ .gpio = OM5PACV2_GPIO_LED_GREEN, ++ .active_low = 1, ++ } ++}; ++ ++static struct gpio_keys_button om5pacv2_gpio_keys[] __initdata = { ++ { ++ .desc = "reset", ++ .type = EV_KEY, ++ .code = KEY_RESTART, ++ .debounce_interval = OM5PACV2_KEYS_DEBOUNCE_INTERVAL, ++ .gpio = OM5PACV2_GPIO_BTN_RESET, ++ .active_low = 1, ++ } ++}; ++ ++static struct i2c_gpio_platform_data om5pacv2_i2c_device_platdata = { ++ .sda_pin = OM5PACV2_GPIO_I2C_SDA, ++ .scl_pin = OM5PACV2_GPIO_I2C_SCL, ++ .udelay = 10, ++ .sda_is_open_drain = 1, ++ .scl_is_open_drain = 1, ++}; ++ ++static struct platform_device om5pacv2_i2c_device = { ++ .name = "i2c-gpio", ++ .id = 0, ++ .dev = { ++ .platform_data = &om5pacv2_i2c_device_platdata, ++ }, ++}; ++ ++static struct i2c_board_info om5pacv2_i2c_devs[] __initdata = { ++ { ++ I2C_BOARD_INFO("tmp423", 0x4e), ++ }, ++}; ++ ++static struct flash_platform_data om5pacv2_flash_data = { ++ .type = "mx25l12805d", ++}; ++ ++static struct at803x_platform_data om5pacv2_an_at803x_data = { ++ .disable_smarteee = 1, ++ .enable_rgmii_rx_delay = 1, ++ .enable_rgmii_tx_delay = 1, ++}; ++ ++static struct at803x_platform_data om5pacv2_an_at8031_data = { ++ .disable_smarteee = 1, ++ .enable_rgmii_rx_delay = 1, ++ .enable_rgmii_tx_delay = 1, ++}; ++ ++static struct mdio_board_info om5pacv2_an_mdio0_info[] = { ++ { ++ .bus_id = "ag71xx-mdio.0", ++ .phy_addr = 4, ++ .platform_data = &om5pacv2_an_at803x_data, ++ }, ++ { ++ .bus_id = "ag71xx-mdio.1", ++ .phy_addr = 1, ++ .platform_data = &om5pacv2_an_at8031_data, ++ }, ++}; ++ ++static void __init om5p_acv2_setup_qca955x_eth_cfg(u32 mask, ++ unsigned int rxd, ++ unsigned int rxdv, ++ unsigned int txd, ++ unsigned int txe) ++{ ++ void __iomem *base; ++ u32 t; ++ ++ base = ioremap(QCA955X_GMAC_BASE, QCA955X_GMAC_SIZE); ++ ++ t = mask; ++ t |= rxd << QCA955X_ETH_CFG_RXD_DELAY_SHIFT; ++ t |= rxdv << QCA955X_ETH_CFG_RDV_DELAY_SHIFT; ++ t |= txd << QCA955X_ETH_CFG_TXD_DELAY_SHIFT; ++ t |= txe << QCA955X_ETH_CFG_TXE_DELAY_SHIFT; ++ ++ __raw_writel(t, base + QCA955X_GMAC_REG_ETH_CFG); ++ ++ iounmap(base); ++} ++ ++static void __init om5p_acv2_setup(void) ++{ ++ u8 *art = (u8 *)KSEG1ADDR(0x1fff0000); ++ u8 mac[6]; ++ ++ /* power amplifier high power, 4.2V at RFFM4203/4503 instead of 3.3 */ ++ ath79_gpio_function_enable(QCA955X_GPIO_FUNC_JTAG_DISABLE); ++ ath79_gpio_output_select(OM5PACV2_GPIO_PA_DCDC, QCA955X_GPIO_OUT_GPIO); ++ ath79_gpio_output_select(OM5PACV2_GPIO_PA_HIGH, QCA955X_GPIO_OUT_GPIO); ++ gpio_request_one(OM5PACV2_GPIO_PA_DCDC, GPIOF_OUT_INIT_HIGH, ++ "PA DC/DC"); ++ gpio_request_one(OM5PACV2_GPIO_PA_HIGH, GPIOF_OUT_INIT_HIGH, "PA HIGH"); ++ ++ /* temperature sensor */ ++ platform_device_register(&om5pacv2_i2c_device); ++ i2c_register_board_info(0, om5pacv2_i2c_devs, ++ ARRAY_SIZE(om5pacv2_i2c_devs)); ++ ++ ath79_register_m25p80(&om5pacv2_flash_data); ++ ath79_register_leds_gpio(-1, ARRAY_SIZE(om5pacv2_leds_gpio), ++ om5pacv2_leds_gpio); ++ ath79_register_gpio_keys_polled(-1, OM5PACV2_KEYS_POLL_INTERVAL, ++ ARRAY_SIZE(om5pacv2_gpio_keys), ++ om5pacv2_gpio_keys); ++ ++ ath79_init_mac(mac, art, 0x02); ++ ath79_register_wmac(art + OM5PACV2_WMAC_CALDATA_OFFSET, mac); ++ ++ om5p_acv2_setup_qca955x_eth_cfg(QCA955X_ETH_CFG_RGMII_EN, 2, 2, 0, 0); ++ ath79_register_mdio(0, 0x0); ++ ath79_register_mdio(1, 0x0); ++ ++ mdiobus_register_board_info(om5pacv2_an_mdio0_info, ++ ARRAY_SIZE(om5pacv2_an_mdio0_info)); ++ ++ ath79_init_mac(ath79_eth0_data.mac_addr, art, 0x00); ++ ath79_init_mac(ath79_eth1_data.mac_addr, art, 0x01); ++ ++ /* GMAC0 is connected to the PHY4 */ ++ ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; ++ ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; ++ ath79_eth0_data.phy_mask = BIT(4); ++ ath79_eth0_pll_data.pll_1000 = 0x82000101; ++ ath79_eth0_pll_data.pll_100 = 0x80000101; ++ ath79_eth0_pll_data.pll_10 = 0x80001313; ++ ath79_register_eth(0); ++ ++ /* GMAC1 is connected to MDIO1 in SGMII mode */ ++ ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_SGMII; ++ ath79_eth1_data.mii_bus_dev = &ath79_mdio1_device.dev; ++ ath79_eth1_data.phy_mask = BIT(1); ++ ath79_eth1_pll_data.pll_1000 = 0x03000101; ++ ath79_eth1_pll_data.pll_100 = 0x80000101; ++ ath79_eth1_pll_data.pll_10 = 0x80001313; ++ ath79_eth1_data.speed = SPEED_1000; ++ ath79_eth1_data.duplex = DUPLEX_FULL; ++ ath79_register_eth(1); ++ ++ ath79_register_pci(); ++} ++ ++MIPS_MACHINE(ATH79_MACH_OM5P_ACv2, "OM5P-ACv2", "OpenMesh OM5P ACv2", om5p_acv2_setup); +diff --git a/target/linux/ar71xx/patches-3.18/816-MIPS-ath79-add-om5pacv-support.patch b/target/linux/ar71xx/patches-3.18/816-MIPS-ath79-add-om5pacv-support.patch +new file mode 100644 +index 0000000..fbbf171 +--- /dev/null ++++ b/target/linux/ar71xx/patches-3.18/816-MIPS-ath79-add-om5pacv-support.patch +@@ -0,0 +1,39 @@ ++--- a/arch/mips/ath79/Kconfig +++++ b/arch/mips/ath79/Kconfig ++@@ -808,6 +808,16 @@ config ATH79_MACH_OM5P_AC ++ select ATH79_DEV_M25P80 ++ select ATH79_DEV_WMAC ++ +++config ATH79_MACH_OM5P_ACv2 +++ bool "OpenMesh OM5P-ACv2 board support" +++ select SOC_QCA955X +++ select ATH79_DEV_AP9X_PCI if PCI +++ select ATH79_DEV_ETH +++ select ATH79_DEV_GPIO_BUTTONS +++ select ATH79_DEV_LEDS_GPIO +++ select ATH79_DEV_M25P80 +++ select ATH79_DEV_WMAC +++ ++ config ATH79_MACH_ONION_OMEGA ++ bool "ONION OMEGA support" ++ select SOC_AR933X ++--- a/arch/mips/ath79/Makefile +++++ b/arch/mips/ath79/Makefile ++@@ -101,6 +101,7 @@ obj-$(CONFIG_ATH79_MACH_NBG460N) += mach ++ obj-$(CONFIG_ATH79_MACH_OM2P) += mach-om2p.o ++ obj-$(CONFIG_ATH79_MACH_OM5P) += mach-om5p.o ++ obj-$(CONFIG_ATH79_MACH_OM5P_AC) += mach-om5pac.o +++obj-$(CONFIG_ATH79_MACH_OM5P_ACv2) += mach-om5pacv2.o ++ obj-$(CONFIG_ATH79_MACH_ONION_OMEGA) += mach-onion-omega.o ++ obj-$(CONFIG_ATH79_MACH_PB42) += mach-pb42.o ++ obj-$(CONFIG_ATH79_MACH_PB44) += mach-pb44.o ++--- a/arch/mips/ath79/machtypes.h +++++ b/arch/mips/ath79/machtypes.h ++@@ -96,6 +96,7 @@ enum ath79_mach_type { ++ ATH79_MACH_OM2Pv2, /* OpenMesh OM2Pv2 */ ++ ATH79_MACH_OM2P, /* OpenMesh OM2P */ ++ ATH79_MACH_OM5P_AC, /* OpenMesh OM5P-AC */ +++ ATH79_MACH_OM5P_ACv2, /* OpenMesh OM5P-ACv2 */ ++ ATH79_MACH_OM5P_AN, /* OpenMesh OM5P-AN */ ++ ATH79_MACH_OM5P, /* OpenMesh OM5P */ ++ ATH79_MACH_ONION_OMEGA, /* ONION OMEGA */ diff --git a/patches/openwrt/0074-ar71xx-add-user-space-support-for-the-OpenMesh-OM5P-.patch b/patches/openwrt/0074-ar71xx-add-user-space-support-for-the-OpenMesh-OM5P-.patch new file mode 100644 index 00000000..2ea0cb6a --- /dev/null +++ b/patches/openwrt/0074-ar71xx-add-user-space-support-for-the-OpenMesh-OM5P-.patch @@ -0,0 +1,38 @@ +From: Sven Eckelmann +Date: Sat, 9 Apr 2016 10:26:18 +0000 +Subject: ar71xx: add user-space support for the OpenMesh OM5P-ACv2 + +Signed-off-by: Sven Eckelmann + +Backport of r49150 + +Forwarded: https://patchwork.ozlabs.org/patch/624200/ + +diff --git a/target/linux/ar71xx/base-files/etc/diag.sh b/target/linux/ar71xx/base-files/etc/diag.sh +index a4051f2..d4d8b4e 100644 +--- a/target/linux/ar71xx/base-files/etc/diag.sh ++++ b/target/linux/ar71xx/base-files/etc/diag.sh +@@ -178,7 +178,8 @@ get_status_led() { + om5p-an) + status_led="om5p:blue:power" + ;; +- om5p-ac) ++ om5p-ac | \ ++ om5p-acv2) + status_led="om5pac:blue:power" + ;; + onion-omega) +diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh +index 10b8048..fbf76c8 100755 +--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh ++++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh +@@ -619,6 +619,9 @@ ar71xx_board_detect() { + *"OM5P AC") + name="om5p-ac" + ;; ++ *"OM5P ACv2") ++ name="om5p-acv2" ++ ;; + *"Onion Omega") + name="onion-omega" + ;; diff --git a/patches/openwrt/0075-ar71xx-enable-sysupgrade-for-the-OpenMesh-OM5P-ACv2.patch b/patches/openwrt/0075-ar71xx-enable-sysupgrade-for-the-OpenMesh-OM5P-ACv2.patch new file mode 100644 index 00000000..0c4cf031 --- /dev/null +++ b/patches/openwrt/0075-ar71xx-enable-sysupgrade-for-the-OpenMesh-OM5P-ACv2.patch @@ -0,0 +1,46 @@ +From: Sven Eckelmann +Date: Sat, 9 Apr 2016 10:26:22 +0000 +Subject: ar71xx: enable sysupgrade for the OpenMesh OM5P-ACv2 + +Signed-off-by: Sven Eckelmann + +Backport of r49151 + +Forwarded: https://patchwork.ozlabs.org/patch/624201/ + +diff --git a/target/linux/ar71xx/base-files/lib/upgrade/openmesh.sh b/target/linux/ar71xx/base-files/lib/upgrade/openmesh.sh +index 1cfead9..209cdaa 100644 +--- a/target/linux/ar71xx/base-files/lib/upgrade/openmesh.sh ++++ b/target/linux/ar71xx/base-files/lib/upgrade/openmesh.sh +@@ -74,6 +74,7 @@ platform_check_image_openmesh() + ;; + OM5PAC) + [ "$board" = "om5p-ac" ] && break ++ [ "$board" = "om5p-acv2" ] && break + echo "Invalid image board target ($img_board_target) for this platform: $board. Use the correct image for this platform" + return 1 + ;; +diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh +index 67c0661..4a4c476 100755 +--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh ++++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh +@@ -308,7 +308,8 @@ platform_check_image() { + om2p-lc | \ + om5p | \ + om5p-an | \ +- om5p-ac) ++ om5p-ac | \ ++ om5p-acv2) + platform_check_image_openmesh "$magic_long" "$1" && return 0 + return 1 + ;; +@@ -542,7 +543,8 @@ platform_do_upgrade() { + om2p-lc | \ + om5p | \ + om5p-an | \ +- om5p-ac) ++ om5p-ac | \ ++ om5p-acv2) + platform_do_upgrade_openmesh "$ARGV" + ;; + unifi-outdoor-plus | \ diff --git a/patches/openwrt/0076-om-watchdog-add-OpenMesh-OM5P-ACv2-support.patch b/patches/openwrt/0076-om-watchdog-add-OpenMesh-OM5P-ACv2-support.patch new file mode 100644 index 00000000..b3c8c8fc --- /dev/null +++ b/patches/openwrt/0076-om-watchdog-add-OpenMesh-OM5P-ACv2-support.patch @@ -0,0 +1,23 @@ +From: Sven Eckelmann +Date: Sat, 9 Apr 2016 10:26:25 +0000 +Subject: om-watchdog: add OpenMesh OM5P-ACv2 support + +Signed-off-by: Sven Eckelmann + +Backport of r49152 + +Forwarded: https://patchwork.ozlabs.org/patch/624202/ + +diff --git a/package/kernel/om-watchdog/files/om-watchdog.init b/package/kernel/om-watchdog/files/om-watchdog.init +index 8cec13b..6b96966 100644 +--- a/package/kernel/om-watchdog/files/om-watchdog.init ++++ b/package/kernel/om-watchdog/files/om-watchdog.init +@@ -13,7 +13,7 @@ boot() { + local board=$(ar71xx_board_name) + + case "$board" in +- "om2p"|"om2p-hs"|"om2p-hsv2") ++ "om2p"|"om2p-hs"|"om2p-hsv2"|"om5p-acv2") + service_start /sbin/om-watchdog 12 + ;; + "om2pv2"|"om2p-lc") diff --git a/patches/openwrt/0077-uboot-envtools-add-OpenMesh-OM5P-ACv2-support.patch b/patches/openwrt/0077-uboot-envtools-add-OpenMesh-OM5P-ACv2-support.patch new file mode 100644 index 00000000..dd61c6fb --- /dev/null +++ b/patches/openwrt/0077-uboot-envtools-add-OpenMesh-OM5P-ACv2-support.patch @@ -0,0 +1,22 @@ +From: Sven Eckelmann +Date: Sat, 9 Apr 2016 10:26:28 +0000 +Subject: uboot-envtools: add OpenMesh OM5P-ACv2 support + +Signed-off-by: Sven Eckelmann + +Backport of r49153 + +Forwarded: https://patchwork.ozlabs.org/patch/624203/ + +diff --git a/package/boot/uboot-envtools/files/ar71xx b/package/boot/uboot-envtools/files/ar71xx +index 657b25f..9071c11 100644 +--- a/package/boot/uboot-envtools/files/ar71xx ++++ b/package/boot/uboot-envtools/files/ar71xx +@@ -29,6 +29,7 @@ mr900v2 | \ + nbg6716 | \ + om5p-an | \ + om5p-ac | \ ++om5p-acv2 | \ + om5p | \ + tube2h | \ + wndr3700) diff --git a/patches/openwrt/0078-ar71xx-extract-ath10k-wifi-board.bin-for-the-OpenMes.patch b/patches/openwrt/0078-ar71xx-extract-ath10k-wifi-board.bin-for-the-OpenMes.patch new file mode 100644 index 00000000..90b634ce --- /dev/null +++ b/patches/openwrt/0078-ar71xx-extract-ath10k-wifi-board.bin-for-the-OpenMes.patch @@ -0,0 +1,24 @@ +From: Sven Eckelmann +Date: Sat, 9 Apr 2016 10:26:31 +0000 +Subject: ar71xx: extract ath10k wifi board.bin for the OpenMesh OM5P-ACv2 board + +Signed-off-by: Sven Eckelmann + +Backport of r49154 + +Forwarded: https://patchwork.ozlabs.org/patch/624204/ + +diff --git a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata +index c1f4b85..d925a85 100644 +--- a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata ++++ b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata +@@ -71,7 +71,8 @@ case "$FIRMWARE" in + ath10kcal_extract "caldata" 20480 2116 + ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) +1) + ;; +- mr1750) ++ mr1750 | \ ++ om5p-acv2) + ath10kcal_extract "ART" 20480 2116 + ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) +16) + ;; diff --git a/patches/openwrt/0079-ar71xx-add-OM5P-ACv2-to-the-OM5P-AC-profile.patch b/patches/openwrt/0079-ar71xx-add-OM5P-ACv2-to-the-OM5P-AC-profile.patch new file mode 100644 index 00000000..d98a115f --- /dev/null +++ b/patches/openwrt/0079-ar71xx-add-OM5P-ACv2-to-the-OM5P-AC-profile.patch @@ -0,0 +1,29 @@ +From: Sven Eckelmann +Date: Sat, 9 Apr 2016 10:26:34 +0000 +Subject: ar71xx: add OM5P-ACv2 to the OM5P-AC profile + +Signed-off-by: Sven Eckelmann + +Backport of r49155 + +Forwarded: https://patchwork.ozlabs.org/patch/624205/ + +diff --git a/target/linux/ar71xx/generic/profiles/openmesh.mk b/target/linux/ar71xx/generic/profiles/openmesh.mk +index 64aaa24..c0919ed 100644 +--- a/target/linux/ar71xx/generic/profiles/openmesh.mk ++++ b/target/linux/ar71xx/generic/profiles/openmesh.mk +@@ -28,12 +28,12 @@ endef + $(eval $(call Profile,OM5P)) + + define Profile/OM5PAC +- NAME:=OpenMesh OM5P-AC ++ NAME:=OpenMesh OM5P-AC/OM5P-ACv2 + PACKAGES:=kmod-ath9k kmod-ath10k om-watchdog ath10k-firmware-qca988x + endef + + define Profile/OM5PAC/Description +- Package set optimized for the OpenMesh OM5P-AC. ++ Package set optimized for the OpenMesh OM5P-AC/OM5P-ACv2. + endef + + $(eval $(call Profile,OM5PAC)) diff --git a/patches/openwrt/0080-libjson-c-Add-support-for-custom-format-strings-for-doubles.patch b/patches/openwrt/0080-libjson-c-Add-support-for-custom-format-strings-for-doubles.patch new file mode 100644 index 00000000..690d3ebb --- /dev/null +++ b/patches/openwrt/0080-libjson-c-Add-support-for-custom-format-strings-for-doubles.patch @@ -0,0 +1,108 @@ +From: Jan-Philipp Litza +Date: Fri, 6 May 2016 16:44:29 +0200 +Subject: libjson-c: Add support for custom format strings for doubles + +diff --git a/package/libs/libjson-c/patches/002-custom-format-string.patch b/package/libs/libjson-c/patches/002-custom-format-string.patch +new file mode 100644 +index 0000000..2f454c5 +--- /dev/null ++++ b/package/libs/libjson-c/patches/002-custom-format-string.patch +@@ -0,0 +1,98 @@ ++From 21dc5dc92bd56f5f4dc2c90b9ea6bf1e1407714e Mon Sep 17 00:00:00 2001 ++From: Jan-Philipp Litza ++Date: Fri, 6 May 2016 16:12:44 +0200 ++Subject: [PATCH] Export json_object_double_to_json_string() and use custom ++ format string ++BCC: janphilipp@litza.de ++ ++--- ++ json_object.c | 12 ++++++------ ++ json_object.h | 28 ++++++++++++++++++++++++++++ ++ 2 files changed, 34 insertions(+), 6 deletions(-) ++ ++diff --git a/json_object.c b/json_object.c ++index 7d60884..46701e7 100644 ++--- a/json_object.c +++++ b/json_object.c ++@@ -55,7 +55,6 @@ static struct json_object* json_object_new(enum json_type o_type); ++ static json_object_to_json_string_fn json_object_object_to_json_string; ++ static json_object_to_json_string_fn json_object_boolean_to_json_string; ++ static json_object_to_json_string_fn json_object_int_to_json_string; ++-static json_object_to_json_string_fn json_object_double_to_json_string; ++ static json_object_to_json_string_fn json_object_string_to_json_string; ++ static json_object_to_json_string_fn json_object_array_to_json_string; ++ ++@@ -644,10 +643,10 @@ int64_t json_object_get_int64(const struct json_object *jso) ++ ++ /* json_object_double */ ++ ++-static int json_object_double_to_json_string(struct json_object* jso, ++- struct printbuf *pb, ++- int level, ++- int flags) +++int json_object_double_to_json_string(struct json_object* jso, +++ struct printbuf *pb, +++ int level, +++ int flags) ++ { ++ char buf[128], *p, *q; ++ int size; ++@@ -663,7 +662,8 @@ static int json_object_double_to_json_string(struct json_object* jso, ++ else ++ size = snprintf(buf, sizeof(buf), "-Infinity"); ++ else ++- size = snprintf(buf, sizeof(buf), "%.17g", jso->o.c_double); +++ size = snprintf(buf, sizeof(buf), +++ jso->_userdata ? (const char*) jso->_userdata : "%.17g", jso->o.c_double); ++ ++ p = strchr(buf, ','); ++ if (p) { ++diff --git a/json_object.h b/json_object.h ++index 2bce454..a89de44 100644 ++--- a/json_object.h +++++ b/json_object.h ++@@ -614,6 +614,9 @@ extern int64_t json_object_get_int64(const struct json_object *obj); ++ /* double type methods */ ++ ++ /** Create a new empty json_object of type json_type_double +++ * +++ * @see json_object_double_to_json_string() for how to set a custom format string. +++ * ++ * @param d the double ++ * @returns a json_object of type json_type_double ++ */ ++@@ -642,6 +645,31 @@ extern struct json_object* json_object_new_double(double d); ++ */ ++ extern struct json_object* json_object_new_double_s(double d, const char *ds); ++ +++ +++/** Serialize a json_object of type json_type_double to a string. +++ * +++ * This function isn't meant to be called directly. Instead, you can set a +++ * custom format string for the serialization of this double using the +++ * following call (where "%.17g" actually is the default): +++ * +++ * @code +++ * jso = json_object_new_double(d); +++ * json_object_set_serializer(jso, json_object_double_to_json_string, +++ * "%.17g", NULL); +++ * @endcode +++ * +++ * @see printf(3) man page for format strings +++ * +++ * @param jso The json_type_double object that is serialized. +++ * @param pb The destination buffer. +++ * @param level Ignored. +++ * @param flags Ignored. +++ */ +++extern int json_object_double_to_json_string(struct json_object* jso, +++ struct printbuf *pb, +++ int level, +++ int flags); +++ ++ /** Get the double floating point value of a json_object ++ * ++ * The type is coerced to a double if the passed object is not a double. ++-- ++2.7.4 ++ diff --git a/patches/packages/openwrt/0002-node-add-python-host-to-HOST_BUILD_DEPENDS-as-well.patch b/patches/packages/openwrt/0001-node-add-python-host-to-HOST_BUILD_DEPENDS-as-well.patch similarity index 100% rename from patches/packages/openwrt/0002-node-add-python-host-to-HOST_BUILD_DEPENDS-as-well.patch rename to patches/packages/openwrt/0001-node-add-python-host-to-HOST_BUILD_DEPENDS-as-well.patch diff --git a/patches/packages/openwrt/0003-lua-cjson-add-host-build-support.patch b/patches/packages/openwrt/0002-lua-cjson-add-host-build-support.patch similarity index 100% rename from patches/packages/openwrt/0003-lua-cjson-add-host-build-support.patch rename to patches/packages/openwrt/0002-lua-cjson-add-host-build-support.patch diff --git a/patches/packages/openwrt/0001-libuecc-update-to-v6.patch b/patches/packages/openwrt/0003-libuecc-update-to-v7.patch similarity index 67% rename from patches/packages/openwrt/0001-libuecc-update-to-v6.patch rename to patches/packages/openwrt/0003-libuecc-update-to-v7.patch index b83a6c6a..379e0a27 100644 --- a/patches/packages/openwrt/0001-libuecc-update-to-v6.patch +++ b/patches/packages/openwrt/0003-libuecc-update-to-v7.patch @@ -1,27 +1,34 @@ From: Matthias Schiffer Date: Sun, 25 Oct 2015 17:11:30 +0100 -Subject: libuecc: update to v6 +Subject: libuecc: update to v7 Signed-off-by: Matthias Schiffer diff --git a/libs/libuecc/Makefile b/libs/libuecc/Makefile -index 63b6ebe..fb26933 100644 +index 63b6ebe..c1ba53f 100644 --- a/libs/libuecc/Makefile +++ b/libs/libuecc/Makefile +@@ -1,5 +1,5 @@ + # +-# Copyright (C) 2012-2015 OpenWrt.org ++# Copyright (C) 2012-2016 OpenWrt.org + # + # This is free software, licensed under the GNU General Public License v2. + # See /LICENSE for more information. @@ -8,13 +8,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=libuecc -PKG_VERSION:=5 -+PKG_VERSION:=6 ++PKG_VERSION:=7 PKG_RELEASE:=1 PKG_MAINTAINER:=Matthias Schiffer PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz -PKG_SOURCE_URL:=https://projects.universe-factory.net/attachments/download/80 -PKG_MD5SUM:=cd03c947931c2f4b0eea0bf45654bd34 -+PKG_SOURCE_URL:=https://projects.universe-factory.net/attachments/download/83 -+PKG_MD5SUM:=cba68339ff46482ec4090303de18fff4 ++PKG_SOURCE_URL:=https://projects.universe-factory.net/attachments/download/85 ++PKG_MD5SUM:=5cd543cb8e7bce83a22c07a0579c95a1 PKG_LICENSE:=BSD-2-Clause PKG_LICENSE_FILES:=COPYRIGHT diff --git a/patches/packages/openwrt/0004-fastd-update-to-v18.patch b/patches/packages/openwrt/0004-fastd-update-to-v18.patch new file mode 100644 index 00000000..fd947214 --- /dev/null +++ b/patches/packages/openwrt/0004-fastd-update-to-v18.patch @@ -0,0 +1,88 @@ +From: Matthias Schiffer +Date: Tue, 29 Mar 2016 00:24:00 +0200 +Subject: fastd: update to v18 + +Signed-off-by: Matthias Schiffer + +diff --git a/net/fastd/Config.in b/net/fastd/Config.in +index 5820b97..3350eb3 100644 +--- a/net/fastd/Config.in ++++ b/net/fastd/Config.in +@@ -74,6 +74,12 @@ config FASTD_ENABLE_MAC_UHASH + default y + + ++config FASTD_WITH_CAPABILITIES ++ bool "Enable POSIX capability support" ++ depends on PACKAGE_fastd ++ default n ++ ++ + config FASTD_WITH_CMDLINE_USER + bool "Include support for setting user/group related options on the command line" + depends on PACKAGE_fastd +diff --git a/net/fastd/Makefile b/net/fastd/Makefile +index 027f549..5c550d8 100644 +--- a/net/fastd/Makefile ++++ b/net/fastd/Makefile +@@ -8,13 +8,13 @@ + include $(TOPDIR)/rules.mk + + PKG_NAME:=fastd +-PKG_VERSION:=17 ++PKG_VERSION:=18 + PKG_RELEASE:=1 + + PKG_MAINTAINER:=Matthias Schiffer + PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz +-PKG_SOURCE_URL:=https://projects.universe-factory.net/attachments/download/81 +-PKG_MD5SUM:=bad4f1948702f418b799578f83a0edb8 ++PKG_SOURCE_URL:=https://projects.universe-factory.net/attachments/download/86 ++PKG_MD5SUM:=e53236d3049f64f7955ad9556da099eb + + PKG_LICENSE:=BSD-2-Clause + PKG_LICENSE_FILES:=COPYRIGHT +@@ -34,6 +34,7 @@ PKG_CONFIG_DEPENDS:=\ + CONFIG_FASTD_ENABLE_CIPHER_SALSA2012 \ + CONFIG_FASTD_ENABLE_MAC_GHASH \ + CONFIG_FASTD_ENABLE_MAC_UHASH \ ++ CONFIG_FASTD_WITH_CAPABILITIES \ + CONFIG_FASTD_WITH_CMDLINE_USER \ + CONFIG_FASTD_WITH_CMDLINE_LOGGING \ + CONFIG_FASTD_WITH_CMDLINE_OPERATION \ +@@ -50,7 +51,7 @@ include $(INCLUDE_DIR)/cmake.mk + define Package/fastd + SECTION:=net + CATEGORY:=Network +- DEPENDS:=+kmod-tun +librt +libpthread +FASTD_WITH_STATUS_SOCKET:libjson-c ++ DEPENDS:=+kmod-tun +librt +libpthread +FASTD_WITH_STATUS_SOCKET:libjson-c +FASTD_WITH_CAPABILITIES:libcap + TITLE:=Fast and Secure Tunneling Daemon + URL:=https://projects.universe-factory.net/projects/fastd + SUBMENU:=VPN +@@ -79,13 +80,13 @@ CMAKE_OPTIONS += \ + -DWITH_CIPHER_SALSA2012:BOOL=FALSE \ + -DWITH_MAC_GHASH:BOOL=FALSE \ + -DWITH_MAC_UHASH:BOOL=FALSE \ ++ -DWITH_CAPABILITIES:BOOL=FALSE \ + -DWITH_CMDLINE_USER:BOOL=FALSE \ + -DWITH_CMDLINE_LOGGING:BOOL=FALSE \ + -DWITH_CMDLINE_OPERATION:BOOL=FALSE \ + -DWITH_CMDLINE_COMMANDS:BOOL=FALSE \ + -DWITH_DYNAMIC_PEERS:BOOL=FALSE \ + -DWITH_STATUS_SOCKET:BOOL=FALSE \ +- -DWITH_CAPABILITIES:BOOL=FALSE \ + -DENABLE_SYSTEMD:BOOL=FALSE \ + -DENABLE_LIBSODIUM:BOOL=FALSE \ + -DENABLE_LTO:BOOL=TRUE +@@ -150,6 +151,11 @@ CMAKE_OPTIONS += -DWITH_MAC_UHASH:BOOL=TRUE + endif + + ++ifeq ($(CONFIG_FASTD_WITH_CAPABILITIES),y) ++CMAKE_OPTIONS += -DWITH_CAPABILITIES:BOOL=TRUE ++endif ++ ++ + ifeq ($(CONFIG_FASTD_WITH_CMDLINE_USER),y) + CMAKE_OPTIONS += -DWITH_CMDLINE_USER:BOOL=TRUE + endif diff --git a/patches/packages/openwrt/0005-node-update-to-v0.12.14.patch b/patches/packages/openwrt/0005-node-update-to-v0.12.14.patch new file mode 100644 index 00000000..9b03cee4 --- /dev/null +++ b/patches/packages/openwrt/0005-node-update-to-v0.12.14.patch @@ -0,0 +1,36 @@ +From: Matthias Schiffer +Date: Mon, 9 May 2016 15:57:18 +0200 +Subject: node: update to v0.12.14 + +While we're at it, also enable parallel builds. + +Signed-off-by: Matthias Schiffer + +diff --git a/lang/node/Makefile b/lang/node/Makefile +index 243c8a5..e6fe843 100644 +--- a/lang/node/Makefile ++++ b/lang/node/Makefile +@@ -8,17 +8,21 @@ + include $(TOPDIR)/rules.mk + + PKG_NAME:=node +-PKG_VERSION:=v0.12.7 ++PKG_VERSION:=v0.12.14 + PKG_RELEASE:=1 + +-PKG_SOURCE:=node-$(PKG_VERSION).tar.gz ++PKG_SOURCE:=node-$(PKG_VERSION).tar.xz + PKG_SOURCE_URL:=http://nodejs.org/dist/${PKG_VERSION} ++PKG_MD5SUM:=27f1a2cf00af32cbfe9401ca4b1a805f + + HOST_BUILD_DEPENDS:=python/host + PKG_BUILD_DEPENDS:=python/host + PKG_INSTALL:=1 + PKG_USE_MIPS16:=0 + ++HOST_BUILD_PARALLEL:=1 ++PKG_BUILD_PARALLEL:=1 ++ + PKG_MAINTAINER:=John Crispin + PKG_LICENSE:= + diff --git a/patches/packages/openwrt/0006-node-fix-undefined-behaviour-leading-to-broken-code-with-GCC-6.patch b/patches/packages/openwrt/0006-node-fix-undefined-behaviour-leading-to-broken-code-with-GCC-6.patch new file mode 100644 index 00000000..ae5162e2 --- /dev/null +++ b/patches/packages/openwrt/0006-node-fix-undefined-behaviour-leading-to-broken-code-with-GCC-6.patch @@ -0,0 +1,80 @@ +From: Matthias Schiffer +Date: Mon, 9 May 2016 16:21:57 +0200 +Subject: node: fix undefined behaviour leading to broken code with GCC 6 + +Fixes segfaults occuring in the node host build when GCC 6 is used. + +Backport of upstream commit 96198d5bc710a4e3ca49eeeb3b3fa7b8cb61547d. + +Signed-off-by: Matthias Schiffer + +diff --git a/lang/node/patches/004-gcc6-undefined-behaviour.patch b/lang/node/patches/004-gcc6-undefined-behaviour.patch +new file mode 100644 +index 0000000..dbbbcf0 +--- /dev/null ++++ b/lang/node/patches/004-gcc6-undefined-behaviour.patch +@@ -0,0 +1,64 @@ ++diff --git a/deps/v8/src/heap/incremental-marking.cc b/deps/v8/src/heap/incremental-marking.cc ++index c922e83..2ead8be 100644 ++--- a/deps/v8/src/heap/incremental-marking.cc +++++ b/deps/v8/src/heap/incremental-marking.cc ++@@ -379,7 +379,7 @@ void IncrementalMarking::DeactivateIncrementalWriteBarrier() { ++ DeactivateIncrementalWriteBarrierForSpace(heap_->new_space()); ++ ++ LargePage* lop = heap_->lo_space()->first_page(); ++- while (lop->is_valid()) { +++ while (LargePage::IsValid(lop)) { ++ SetOldSpacePageFlags(lop, false, false); ++ lop = lop->next_page(); ++ } ++@@ -414,7 +414,7 @@ void IncrementalMarking::ActivateIncrementalWriteBarrier() { ++ ActivateIncrementalWriteBarrier(heap_->new_space()); ++ ++ LargePage* lop = heap_->lo_space()->first_page(); ++- while (lop->is_valid()) { +++ while (LargePage::IsValid(lop)) { ++ SetOldSpacePageFlags(lop, true, is_compacting_); ++ lop = lop->next_page(); ++ } ++diff --git a/deps/v8/src/heap/spaces-inl.h b/deps/v8/src/heap/spaces-inl.h ++index 56c2bad..1a45096 100644 ++--- a/deps/v8/src/heap/spaces-inl.h +++++ b/deps/v8/src/heap/spaces-inl.h ++@@ -148,7 +148,7 @@ Page* Page::Initialize(Heap* heap, MemoryChunk* chunk, Executability executable, ++ ++ bool PagedSpace::Contains(Address addr) { ++ Page* p = Page::FromAddress(addr); ++- if (!p->is_valid()) return false; +++ if (!Page::IsValid(p)) return false; ++ return p->owner() == this; ++ } ++ ++diff --git a/deps/v8/src/heap/spaces.cc b/deps/v8/src/heap/spaces.cc ++index e197f5a..2fe10eb 100644 ++--- a/deps/v8/src/heap/spaces.cc +++++ b/deps/v8/src/heap/spaces.cc ++@@ -2918,7 +2918,7 @@ LargePage* LargeObjectSpace::FindPage(Address a) { ++ if (e != NULL) { ++ DCHECK(e->value != NULL); ++ LargePage* page = reinterpret_cast(e->value); ++- DCHECK(page->is_valid()); +++ DCHECK(LargePage::IsValid(page)); ++ if (page->Contains(a)) { ++ return page; ++ } ++diff --git a/deps/v8/src/heap/spaces.h b/deps/v8/src/heap/spaces.h ++index 312d75f..1054672 100644 ++--- a/deps/v8/src/heap/spaces.h +++++ b/deps/v8/src/heap/spaces.h ++@@ -283,9 +283,9 @@ class MemoryChunk { ++ // Only works for addresses in pointer spaces, not data or code spaces. ++ static inline MemoryChunk* FromAnyPointerAddress(Heap* heap, Address addr); ++ ++- Address address() { return reinterpret_cast
(this); } +++ static bool IsValid(MemoryChunk* chunk) { return chunk != nullptr; } ++ ++- bool is_valid() { return address() != NULL; } +++ Address address() { return reinterpret_cast
(this); } ++ ++ MemoryChunk* next_chunk() const { ++ return reinterpret_cast(base::Acquire_Load(&next_chunk_)); diff --git a/scripts/patch.sh b/scripts/patch.sh index b89d6eb4..90d2de7b 100755 --- a/scripts/patch.sh +++ b/scripts/patch.sh @@ -6,11 +6,13 @@ shopt -s nullglob . "$GLUONDIR"/scripts/modules.sh for module in $GLUON_MODULES; do + echo "--- Patching module '$module' ---" + cd "$GLUONDIR"/$module git checkout -B patching base for patch in "$GLUONDIR"/patches/$module/*.patch; do - if ! git -c user.name='Gluon Patch Manager' -c user.email='gluon@void.example.com' am --whitespace=nowarn --committer-date-is-author-date "$patch"; then + if ! git -c user.name='Gluon Patch Manager' -c user.email='gluon@void.example.com' -c commit.gpgsign=false am --whitespace=nowarn --committer-date-is-author-date "$patch"; then git am --abort git checkout patched git branch -D patching diff --git a/scripts/unpatch.sh b/scripts/unpatch.sh deleted file mode 100755 index 1f0f6f12..00000000 --- a/scripts/unpatch.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -set -e - -. "$GLUONDIR"/scripts/modules.sh - -for module in $GLUON_MODULES; do - cd "$GLUONDIR"/$module - git checkout base -done diff --git a/scripts/update-patches.sh b/scripts/update-patches.sh index 4c9eaa95..cfdeb58e 100755 --- a/scripts/update-patches.sh +++ b/scripts/update-patches.sh @@ -6,6 +6,8 @@ shopt -s nullglob . "$GLUONDIR"/scripts/modules.sh for module in $GLUON_MODULES; do + echo "--- Updating patches for module '$module' ---" + rm -f "$GLUONDIR"/patches/$module/*.patch mkdir -p "$GLUONDIR"/patches/$module diff --git a/scripts/update.sh b/scripts/update.sh index fa5f4316..86c69628 100755 --- a/scripts/update.sh +++ b/scripts/update.sh @@ -5,6 +5,7 @@ set -e . "$GLUONDIR"/scripts/modules.sh for module in $GLUON_MODULES; do + echo "--- Updating module '$module' ---" var=$(echo $module | tr '[:lower:]/' '[:upper:]_') eval repo=\${${var}_REPO} eval branch=\${${var}_BRANCH} diff --git a/targets/ar71xx-generic/profiles.mk b/targets/ar71xx-generic/profiles.mk index 916f7b4c..55d4b1b0 100644 --- a/targets/ar71xx-generic/profiles.mk +++ b/targets/ar71xx-generic/profiles.mk @@ -27,10 +27,11 @@ $(eval $(call GluonModel,TLWA7510,tl-wa7510n,tp-link-tl-wa7510n-v1)) $(eval $(call GluonProfile,TLWR703)) $(eval $(call GluonModel,TLWR703,tl-wr703n-v1,tp-link-tl-wr703n-v1)) -# TL-WR710N v1, v2 +# TL-WR710N v1, v2, v2.1 $(eval $(call GluonProfile,TLWR710)) $(eval $(call GluonModel,TLWR710,tl-wr710n-v1,tp-link-tl-wr710n-v1)) $(eval $(call GluonModel,TLWR710,tl-wr710n-v2,tp-link-tl-wr710n-v2)) +$(eval $(call GluonModel,TLWR710,tl-wr710n-v2.1,tp-link-tl-wr710n-v2.1)) # TL-WR740N v1, v3, v4, v5 $(eval $(call GluonProfile,TLWR740)) @@ -56,7 +57,7 @@ $(eval $(call GluonProfile,TLWA801)) $(eval $(call GluonModel,TLWA801,tl-wa801nd-v1,tp-link-tl-wa801n-nd-v1)) $(eval $(call GluonModel,TLWA801,tl-wa801nd-v2,tp-link-tl-wa801n-nd-v2)) -# TL-WR841N/ND v3, v5, v7, v8, v9 +# TL-WR841N/ND v3, v5, v7, v8, v9, v10, v11 $(eval $(call GluonProfile,TLWR841)) $(eval $(call GluonModel,TLWR841,tl-wr841nd-v3,tp-link-tl-wr841n-nd-v3)) $(eval $(call GluonModel,TLWR841,tl-wr841nd-v5,tp-link-tl-wr841n-nd-v5)) @@ -64,6 +65,7 @@ $(eval $(call GluonModel,TLWR841,tl-wr841nd-v7,tp-link-tl-wr841n-nd-v7)) $(eval $(call GluonModel,TLWR841,tl-wr841n-v8,tp-link-tl-wr841n-nd-v8)) $(eval $(call GluonModel,TLWR841,tl-wr841n-v9,tp-link-tl-wr841n-nd-v9)) $(eval $(call GluonModel,TLWR841,tl-wr841n-v10,tp-link-tl-wr841n-nd-v10)) +$(eval $(call GluonModel,TLWR841,tl-wr841n-v11,tp-link-tl-wr841n-nd-v11)) # TL-WR842N/ND v1, v2 $(eval $(call GluonProfile,TLWR842)) @@ -115,11 +117,14 @@ $(eval $(call GluonModel,TLWA850,tl-wa850re-v1,tp-link-tl-wa850re-v1)) $(eval $(call GluonProfile,TLWA860)) $(eval $(call GluonModel,TLWA860,tl-wa860re-v1,tp-link-tl-wa860re-v1)) -# TL-WA901N/ND v1, v2, v3 +# TL-WA901N/ND v1, v2, v3, v4 $(eval $(call GluonProfile,TLWA901)) $(eval $(call GluonModel,TLWA901,tl-wa901nd-v1,tp-link-tl-wa901n-nd-v1)) $(eval $(call GluonModel,TLWA901,tl-wa901nd-v2,tp-link-tl-wa901n-nd-v2)) $(eval $(call GluonModel,TLWA901,tl-wa901nd-v3,tp-link-tl-wa901n-nd-v3)) +ifneq ($(BROKEN),) +$(eval $(call GluonModel,TLWA901,tl-wa901nd-v4,tp-link-tl-wa901n-nd-v4)) # BROKEN: untested +endif # TL-MR13U v1 $(eval $(call GluonProfile,TLMR13U)) @@ -148,14 +153,14 @@ $(eval $(call GluonModel,TLMR3420,tl-mr3420-v2,tp-link-tl-mr3420-v2)) $(eval $(call GluonProfile,TLWR2543)) $(eval $(call GluonModel,TLWR2543,tl-wr2543-v1,tp-link-tl-wr2543n-nd-v1)) -ifeq ($(BROKEN),1) +ifneq ($(BROKEN),) # Archer C5 v1, C7 v2 $(eval $(call GluonProfile,ARCHERC7,kmod-ath10k ath10k-firmware-qca988x-ct)) $(eval $(call GluonModel,ARCHERC7,archer-c5,tp-link-archer-c5-v1)) # BROKEN: ath10k $(eval $(call GluonModel,ARCHERC7,archer-c7-v2,tp-link-archer-c7-v2)) # BROKEN: ath10k endif -## Ubiquiti (everything) +## Ubiquiti (almost everything) $(eval $(call GluonProfile,UBNT)) $(eval $(call GluonModel,UBNT,ubnt-air-gateway,ubiquiti-airgateway)) $(eval $(call GluonModel,UBNT,ubnt-airrouter,ubiquiti-airrouter)) @@ -175,15 +180,26 @@ $(eval $(call GluonModelAlias,UBNT,ubiquiti-nanostation-m,ubiquiti-nanostation-m $(eval $(call GluonModel,UBNT,ubnt-loco-m-xw,ubiquiti-loco-m-xw)) $(eval $(call GluonModel,UBNT,ubnt-nano-m-xw,ubiquiti-nanostation-m-xw)) +$(eval $(call GluonModel,UBNT,ubnt-rocket-m-xw,ubiquiti-rocket-m-xw)) $(eval $(call GluonModel,UBNT,ubnt-uap-pro,ubiquiti-unifi-ap-pro)) $(eval $(call GluonModel,UBNT,ubnt-unifi,ubiquiti-unifi)) $(eval $(call GluonModel,UBNT,ubnt-unifi-outdoor,ubiquiti-unifiap-outdoor)) $(eval $(call GluonModel,UBNT,ubnt-unifi-outdoor-plus,ubiquiti-unifiap-outdoor+)) -ifeq ($(BROKEN),1) +ifneq ($(BROKEN),) $(eval $(call GluonModel,UBNT,ubnt-ls-sr71,ubiquiti-ls-sr71)) # BROKEN: Untested endif +# Ubiquiti (ath10k) +ifneq ($(BROKEN),) +$(eval $(call GluonProfile,UBNTUNIFIACLITE,kmod-ath10k ath10k-firmware-qca988x-ct)) +$(eval $(call GluonProfileFactorySuffix,UBNTUNIFIACLITE)) +$(eval $(call GluonModel,UBNTUNIFIACLITE,ubnt-unifiac-lite,ubiquiti-unifi-ac-lite)) # BROKEN: untested, ath10k + +$(eval $(call GluonProfile,UBNTUNIFIACPRO,kmod-ath10k ath10k-firmware-qca988x-ct)) +$(eval $(call GluonProfileFactorySuffix,UBNTUNIFIACPRO)) +$(eval $(call GluonModel,UBNTUNIFIACPRO,ubnt-unifiac-pro,ubiquiti-unifi-ac-pro)) # BROKEN: ath10k +endif ## D-Link @@ -244,7 +260,7 @@ $(eval $(call GluonProfileFactorySuffix,WNDR3700,-squashfs-factory,.img)) $(eval $(call GluonModel,WNDR3700,wndr3700,netgear-wndr3700)) $(eval $(call GluonModel,WNDR3700,wndr3700v2,netgear-wndr3700v2)) $(eval $(call GluonModel,WNDR3700,wndr3800,netgear-wndr3800)) -ifeq ($(BROKEN),1) +ifneq ($(BROKEN),) $(eval $(call GluonModel,WNDR3700,wndrmac,netgear-wndrmac)) # BROKEN: untested endif $(eval $(call GluonModel,WNDR3700,wndrmacv2,netgear-wndrmacv2)) @@ -278,3 +294,66 @@ $(eval $(call GluonModel,MYNETN750,mynet-n750,wd-my-net-n750)) # Omega $(eval $(call GluonProfile,OMEGA)) $(eval $(call GluonModel,OMEGA,onion-omega,onion-omega)) + +## OpenMesh + +# MR1750 +$(eval $(call GluonProfile,MR1750,om-watchdog uboot-envtools kmod-ath10k ath10k-firmware-qca988x-ct)) +$(eval $(call GluonModel,MR1750,mr1750,openmesh-mr1750)) + +# MR600 +$(eval $(call GluonProfile,MR600,om-watchdog uboot-envtools)) +$(eval $(call GluonModel,MR600,mr600,openmesh-mr600)) +$(eval $(call GluonModelAlias,MR600,openmesh-mr600,openmesh-mr600v2)) + +# MR900 +$(eval $(call GluonProfile,MR900,om-watchdog uboot-envtools)) +$(eval $(call GluonModel,MR900,mr900,openmesh-mr900)) +$(eval $(call GluonModelAlias,MR900,openmesh-mr900,openmesh-mr900v2)) + +# OM2P +$(eval $(call GluonProfile,OM2P,om-watchdog uboot-envtools)) +$(eval $(call GluonModel,OM2P,om2p,openmesh-om2p)) +$(eval $(call GluonModelAlias,OM2P,openmesh-om2p,openmesh-om2pv2)) +$(eval $(call GluonModelAlias,OM2P,openmesh-om2p,openmesh-om2p-hs)) +$(eval $(call GluonModelAlias,OM2P,openmesh-om2p,openmesh-om2p-hsv2)) +$(eval $(call GluonModelAlias,OM2P,openmesh-om2p,openmesh-om2p-lc)) + +# OM5P +$(eval $(call GluonProfile,OM5P,om-watchdog uboot-envtools)) +$(eval $(call GluonModel,OM5P,om5p,openmesh-om5p)) +$(eval $(call GluonModelAlias,OM5P,openmesh-om5p,openmesh-om5p-an)) + +# OM5P-AC +$(eval $(call GluonProfile,OM5PAC,om-watchdog uboot-envtools kmod-ath10k ath10k-firmware-qca988x-ct)) +$(eval $(call GluonModel,OM5PAC,om5pac,openmesh-om5p-ac)) +$(eval $(call GluonModelAlias,OM5PAC,openmesh-om5p-ac,openmesh-om5p-acv2)) + +## ALFA + +# Hornet-UB +$(eval $(call GluonProfile,HORNETUB)) +$(eval $(call GluonModel,HORNETUB,hornet-ub,alfa-hornet-ub)) +$(eval $(call GluonModelAlias,HORNETUB,alfa-hornet-ub,alfa-ap121)) +$(eval $(call GluonModelAlias,HORNETUB,alfa-hornet-ub,alfa-ap121u)) + +## Meraki + +# Meraki MR12/MR62 +$(eval $(call GluonProfile,MR12,rssileds)) +$(eval $(call GluonProfileFactorySuffix,MR12)) +$(eval $(call GluonModel,MR12,mr12,meraki-mr12)) +$(eval $(call GluonModelAlias,MR12,meraki-mr12,meraki-mr62)) + +# Meraki MR16/MR66 +$(eval $(call GluonProfile,MR16,rssileds)) +$(eval $(call GluonProfileFactorySuffix,MR16)) +$(eval $(call GluonModel,MR16,mr16,meraki-mr16)) +$(eval $(call GluonModelAlias,MR16,meraki-mr16,meraki-mr66)) + +## 8devices + +# Carambola 2 +$(eval $(call GluonProfile,CARAMBOLA2)) +$(eval $(call GluonModel,CARAMBOLA2,carambola2,8devices-carambola2-board)) +$(eval $(call GluonProfileFactorySuffix,CARAMBOLA2))