Browse Source

Merge branch 'master' of git+ssh://openadk.org/git/openadk

Waldemar Brodkorb 10 years ago
parent
commit
a2c7fc5c3b
63 changed files with 4109 additions and 2010 deletions
  1. 9 5
      mk/modules.mk
  2. 8 0
      mk/vars.mk
  3. 19 20
      package/automake/Makefile
  4. 2 1
      package/busybox/Makefile
  5. 6 1
      package/bzip2/Makefile
  6. 33 0
      package/cdrkit/Makefile
  7. 466 0
      package/cdrkit/patches/patch-Makefile
  8. 10 0
      package/cdrkit/patches/patch-include_xconfig_h_in
  9. 2 2
      package/cmake/Makefile
  10. 2 2
      package/curl/Makefile
  11. 3 3
      package/kexec-tools/Makefile
  12. 12 6
      package/libcap/Makefile
  13. 31 29
      package/libcap/patches/patch-Make_Rules
  14. 25 0
      package/libcap/patches/patch-Makefile
  15. 35 4
      package/libcap/patches/patch-libcap_Makefile
  16. 0 10
      package/libcap/patches/patch-pam_cap_Makefile
  17. 2 4
      package/ltrace/Makefile
  18. 2 2
      package/lvm/Makefile
  19. 2 0
      package/pam/Makefile
  20. 3 3
      package/php/Makefile
  21. 2 2
      package/samba/Makefile
  22. 3 3
      package/sox/Makefile
  23. 6 7
      package/squid/Makefile
  24. 0 72
      package/squid/patches/patch-acinclude_lib-checks_m4
  25. 11 0
      package/squid/patches/patch-configure_ac
  26. 7 7
      package/squid/patches/patch-lib_rfcnb_rfcnb-io_c
  27. 14 0
      package/squid/patches/patch-libltdl_aclocal_m4
  28. 5 5
      package/squid/patches/patch-src_Makefile_am
  29. 1 0
      package/u-boot/files/fw_env.config
  30. 5 0
      package/u-boot/files/uboot_print_env
  31. 5 0
      package/u-boot/files/uboot_set_env
  32. 13 0
      package/u-boot/patches/patch-arch_arm_lib_bootm_c
  33. 11 0
      package/u-boot/patches/patch-common_cmd_bootmenu_c
  34. 44 0
      package/u-boot/patches/patch-include_configs_rpi_h
  35. 11 0
      package/u-boot/patches/patch-include_env_default_h
  36. 11 0
      package/u-boot/patches/patch-tools_env_fw_env_h
  37. 2 2
      package/xterm/Makefile
  38. 0 11
      package/xterm/patches/patch-xterm_h
  39. 3252 0
      target/arm/solidrun-imx6/patches/3.18.8/solidrun-imx6-wlan.patch
  40. 24 9
      target/config/Config.in.cpu
  41. 0 4
      target/linux/config/Config.in.block
  42. 0 14
      target/linux/config/Config.in.crypto
  43. 0 1
      target/linux/config/Config.in.debug
  44. 0 4
      target/linux/config/Config.in.fs
  45. 0 4
      target/linux/config/Config.in.fsnet
  46. 0 3
      target/linux/config/Config.in.graphics
  47. 0 2
      target/linux/config/Config.in.input
  48. 0 14
      target/linux/config/Config.in.ipsec
  49. 0 1
      target/linux/config/Config.in.ipvs
  50. 4 0
      target/linux/config/Config.in.kernel
  51. 0 1
      target/linux/config/Config.in.netfilter.core
  52. 0 1
      target/linux/config/Config.in.netfilter.ebt
  53. 0 6
      target/linux/config/Config.in.netfilter.ip4
  54. 2 2
      toolchain/elf2flt/Makefile.inc
  55. 1 0
      toolchain/glibc/Makefile.inc
  56. 3 3
      toolchain/uclibc-ng/Makefile
  57. 0 106
      toolchain/uclibc/patches/0.9.34-git/0001-fix-linuxthreads-for-coldfire-nommu.patch
  58. 0 27
      toolchain/uclibc/patches/0.9.34-git/0001-test-disable-posix_fallocate64-for-small-embedded-sy.patch
  59. 0 1347
      toolchain/uclibc/patches/0.9.34-git/0003-linuxthreads-remove-unused-s390-code.patch
  60. 0 51
      toolchain/uclibc/patches/0.9.34-git/0004-disable-tests-if-HAVE_SHARED-is-not-set.patch
  61. 0 28
      toolchain/uclibc/patches/0.9.34-git/0005-disable-tests-for-arc-as-long-as-binutils-is-buggy.patch
  62. 0 170
      toolchain/uclibc/patches/0.9.34-git/0006-arm-add-RESET_PID-in-the-clone-impl.patch
  63. 0 11
      toolchain/uclibc/patches/0.9.34-git/0007-enable-cancellation-stuff-for-libc_a.patch

+ 9 - 5
mk/modules.mk

@@ -473,13 +473,13 @@ $(eval $(call KMOD_template,NF_CONNTRACK,nf-conntrack,\
 	$(MODULES_DIR)/kernel/net/netfilter/xt_conntrack \
 ,41))
 
-$(eval $(call KMOD_template,NETFILTER_XT_NAT,netfilter-xt-nat,\
-	$(MODULES_DIR)/kernel/net/netfilter/xt_nat \
-,40))
-
 $(eval $(call KMOD_template,NF_NAT,nf-nat,\
 	$(MODULES_DIR)/kernel/net/netfilter/nf_nat \
-,45))
+,42))
+
+$(eval $(call KMOD_template,NETFILTER_XT_NAT,netfilter-xt-nat,\
+	$(MODULES_DIR)/kernel/net/netfilter/xt_nat \
+,43))
 
 $(eval $(call KMOD_template,NF_CONNTRACK_IPV4,nf-conntrack-ipv4,\
 	$(MODULES_DIR)/kernel/net/ipv4/netfilter/nf_defrag_ipv4 \
@@ -488,6 +488,7 @@ $(eval $(call KMOD_template,NF_CONNTRACK_IPV4,nf-conntrack-ipv4,\
 
 $(eval $(call KMOD_template,NF_NAT_IPV4,nf-nat-ipv4,\
 	$(MODULES_DIR)/kernel/net/ipv4/netfilter/nf_nat_ipv4 \
+	$(MODULES_DIR)/kernel/net/ipv4/netfilter/nf_nat_masquerade_ipv4 \
 ,50))
 
 $(eval $(call KMOD_template,IP_NF_NAT,ip-nf-nat,\
@@ -588,6 +589,7 @@ $(eval $(call KMOD_template,IP_NF_FILTER,ip-nf-filter,\
 ,55))
 
 $(eval $(call KMOD_template,IP_NF_TARGET_REJECT,ip-nf-target-reject,\
+	$(MODULES_DIR)/kernel/net/ipv4/netfilter/nf_reject_ipv4 \
 	$(MODULES_DIR)/kernel/net/ipv4/netfilter/ipt_REJECT \
 ,60))
 
@@ -677,6 +679,7 @@ $(eval $(call KMOD_template,IP6_NF_FILTER,ip6-nf-filter,\
 ,55))
 
 $(eval $(call KMOD_template,IP6_NF_TARGET_REJECT,ip6-nf-target-reject,\
+	$(MODULES_DIR)/kernel/net/ipv6/netfilter/nf_reject_ipv6 \
 	$(MODULES_DIR)/kernel/net/ipv6/netfilter/ip6t_REJECT \
 ,60))
 
@@ -1099,6 +1102,7 @@ $(eval $(call KMOD_template,RPCSEC_GSS_KRB5,rpcsec-gss-krb5,\
 ,26))
 
 $(eval $(call KMOD_template,LOCKD,lockd,\
+	$(MODULES_DIR)/kernel/fs/nfs_common/grace \
 	$(MODULES_DIR)/kernel/fs/lockd/lockd \
 ,27))
 

+ 8 - 0
mk/vars.mk

@@ -11,9 +11,16 @@ BUILD_USER=		$(shell id -un)
 BUILD_GROUP=		$(shell id -gn)
 ifeq ($(ADK_TARGET_ABI),)
 ADK_SUFFIX:=		_${ADK_TARGET_SYSTEM}_${ADK_TARGET_LIBC}_${ADK_TARGET_CPU_ARCH}
+ifeq ($(ADK_TARGET_WITH_MMU),)
+ADK_SUFFIX:=		_${ADK_TARGET_SYSTEM}_${ADK_TARGET_LIBC}_${ADK_TARGET_CPU_ARCH}_nommu
+endif
+else
+ifeq ($(ADK_TARGET_WITH_MMU),)
+ADK_SUFFIX:=		_${ADK_TARGET_SYSTEM}_${ADK_TARGET_LIBC}_${ADK_TARGET_CPU_ARCH}_${ADK_TARGET_ABI}_nommu
 else
 ADK_SUFFIX:=		_${ADK_TARGET_SYSTEM}_${ADK_TARGET_LIBC}_${ADK_TARGET_CPU_ARCH}_${ADK_TARGET_ABI}
 endif
+endif
 
 # some global dirs
 BASE_DIR:=		$(ADK_TOPDIR)
@@ -148,6 +155,7 @@ endif
 ifeq ($(ADK_TARGET_ARCH_ARM),y)
 ifeq ($(ADK_TARGET_BINFMT_FLAT),y)
 TARGET_CFLAGS+=		-Wl,-elf2flt
+TARGET_CXXFLAGS+=	-Wl,-elf2flt
 endif
 endif
 

+ 19 - 20
package/automake/Makefile

@@ -1,39 +1,38 @@
 # This file is part of the OpenADK project. OpenADK is copyrighted
 # material, please see the LICENCE file in the top-level directory.
 
-include ${ADK_TOPDIR}/rules.mk
+include $(ADK_TOPDIR)/rules.mk
 
 PKG_NAME:=		automake
-PKG_VERSION:=		1.14.1
+PKG_VERSION:=		1.15
 PKG_RELEASE:=		1
-PKG_EXTRAVER:=		1.14
-PKG_HASH:=		a9b4f04b8b69cac2e832a38a718943aa976dbdad0097211f8b3448afdacf0669
+PKG_HASH:=		9908c75aabd49d13661d6dcb1bc382252d22cc77bf733a2d55e87f2aa2db8636
 PKG_DESCR:=		tool for automatically generating makefiles
 PKG_SECTION:=		dev/tools
 PKG_BUILDDEP:=		m4-host autoconf-host autoconf
 HOST_BUILDDEP:=		autoconf-host
 PKG_URL:=		http://www.gnu.org/software/automake/
-PKG_SITES:=		${MASTER_SITE_GNU:=automake/}
+PKG_SITES:=		$(MASTER_SITE_GNU:=automake/)
 PKG_OPTS:=		noscripts
 
-include ${ADK_TOPDIR}/mk/host.mk
-include ${ADK_TOPDIR}/mk/package.mk
+include $(ADK_TOPDIR)/mk/host.mk
+include $(ADK_TOPDIR)/mk/package.mk
 
-$(eval $(call HOST_template,AUTOMAKE,automake,${PKG_VERSION}-${PKG_RELEASE}))
-$(eval $(call PKG_template,AUTOMAKE,automake,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION},${PKG_OPTS}))
+$(eval $(call HOST_template,AUTOMAKE,automake,$(PKG_VERSION)-$(PKG_RELEASE)))
+$(eval $(call PKG_template,AUTOMAKE,automake,$(PKG_VERSION)-$(PKG_RELEASE),$(PKG_DEPENDS),$(PKG_DESCR),$(PKG_SECTION),$(PKG_OPTS)))
 
 XAKE_FLAGS+=		PERL="/usr/bin/perl"
 
 automake-install:
-	${INSTALL_DIR} ${IDIR_AUTOMAKE}/usr/bin
-	${INSTALL_BIN} ${WRKINST}/usr/bin/automake ${IDIR_AUTOMAKE}/usr/bin
-	${INSTALL_BIN} ${WRKINST}/usr/bin/aclocal ${IDIR_AUTOMAKE}/usr/bin
-	${INSTALL_DIR} ${IDIR_AUTOMAKE}/usr/share/aclocal-${PKG_EXTRAVER}
-	${CP} ${WRKINST}/usr/share/aclocal-${PKG_EXTRAVER} \
-		${IDIR_AUTOMAKE}/usr/share
-	${INSTALL_DIR} ${IDIR_AUTOMAKE}/usr/share/automake-${PKG_EXTRAVER}
-	${CP} ${WRKINST}/usr/share/automake-${PKG_EXTRAVER} \
-		${IDIR_AUTOMAKE}/usr/share
+	$(INSTALL_DIR) $(IDIR_AUTOMAKE)/usr/bin
+	$(INSTALL_BIN) $(WRKINST)/usr/bin/automake $(IDIR_AUTOMAKE)/usr/bin
+	$(INSTALL_BIN) $(WRKINST)/usr/bin/aclocal $(IDIR_AUTOMAKE)/usr/bin
+	$(INSTALL_DIR) $(IDIR_AUTOMAKE)/usr/share/aclocal-$(PKG_VERSION)
+	$(CP) $(WRKINST)/usr/share/aclocal-$(PKG_VERSION) \
+		$(IDIR_AUTOMAKE)/usr/share
+	$(INSTALL_DIR) $(IDIR_AUTOMAKE)/usr/share/automake-$(PKG_VERSION)
+	$(CP) $(WRKINST)/usr/share/automake-$(PKG_VERSION) \
+		$(IDIR_AUTOMAKE)/usr/share
 
-include ${ADK_TOPDIR}/mk/host-bottom.mk
-include ${ADK_TOPDIR}/mk/pkg-bottom.mk
+include $(ADK_TOPDIR)/mk/host-bottom.mk
+include $(ADK_TOPDIR)/mk/pkg-bottom.mk

+ 2 - 1
package/busybox/Makefile

@@ -28,7 +28,8 @@ BB_MAKE_FLAGS:=		V=1 \
 			IPKG_ARCH="${ADK_TARGET_CPU_ARCH}" \
 			HOSTCC="${CC_FOR_BUILD}" \
 			HOSTCFLAGS="$(CFLAGS_FOR_BUILD)" \
-			CROSS_COMPILE="$(TARGET_CROSS)"
+			CROSS_COMPILE="$(TARGET_CROSS)" \
+			SKIP_STRIP=y
 
 do-configure:
 	# get all symbols from top level config

+ 6 - 1
package/bzip2/Makefile

@@ -39,6 +39,7 @@ BIN_FILE:=		bzip2-shared
 else
 BIN_FILE:=		bzip2
 endif
+
 CONFIG_STYLE:=		manual
 TARGET_CFLAGS+=		-fPIC 
 XAKE_FLAGS+=		PREFIX=${WRKINST}/usr CROSS_COMPILE=1
@@ -52,6 +53,11 @@ bzip2-hostinstall:
 	${INSTALL_DIR} ${STAGING_HOST_DIR}/usr/bin
 	$(INSTALL_BIN) ${WRKBUILD}/bzip2 ${STAGING_HOST_DIR}/usr/bin/bzip2
 
+do-install:
+	${INSTALL_DIR} $(STAGING_TARGET_DIR)/usr/include
+	$(CP) $(WRKBUILD)/bzlib.h $(STAGING_TARGET_DIR)/usr/include
+	$(CP) ${WRKBUILD}/libbz2.a ${STAGING_TARGET_DIR}/usr/lib
+
 libbz2-install:
 	${INSTALL_DIR} ${IDIR_LIBBZ2}/usr/lib
 	$(CP) ${WRKBUILD}/libbz2.so* \
@@ -59,7 +65,6 @@ libbz2-install:
 	$(CP) ${WRKBUILD}/libbz2.so* \
 		${STAGING_TARGET_DIR}/usr/lib
 	(cd ${STAGING_TARGET_DIR}/usr/lib; ln -sf libbz2.so.1.0.6 libbz2.so)
-	$(CP) $(WRKBUILD)/bzlib.h $(STAGING_TARGET_DIR)/usr/include
 	${INSTALL_DIR} $(IDIR_LIBBZ2_DEV)/usr/include
 	$(CP) $(WRKBUILD)/bzlib.h $(IDIR_LIBBZ2_DEV)/usr/include
 

+ 33 - 0
package/cdrkit/Makefile

@@ -0,0 +1,33 @@
+# This file is part of the OpenADK project. OpenADK is copyrighted
+# material, please see the LICENCE file in the top-level directory.
+
+include $(ADK_TOPDIR)/rules.mk
+
+PKG_NAME:=		cdrkit
+PKG_VERSION:=		1.1.11
+PKG_RELEASE:=		1
+PKG_HASH:=		d1c030756ecc182defee9fe885638c1785d35a2c2a297b4604c0e0dcc78e47da
+PKG_DESCR:=		cd burning kit
+PKG_SECTION:=		sys/hw
+PKG_DEPENDS:=		libmagic zlib libbz2 libcap
+PKG_BUILDDEP:=		cmake-host file zlib bzip2 libcap
+PKG_SITES:=		http://snapshot.debian.org/archive/debian/20141023T043132Z/pool/main/c/cdrkit/
+
+PKG_BUILDDEP_UCLIBC:=	libiconv-tiny
+PKG_BUILDDEP_UCLIBC_NG:=libiconv-tiny
+
+DISTFILES:=             $(PKG_NAME)_$(PKG_VERSION).orig.tar.gz
+
+include $(ADK_TOPDIR)/mk/package.mk
+
+$(eval $(call PKG_template,CDRKIT,cdrkit,$(PKG_VERSION)-$(PKG_RELEASE),$(PKG_DEPENDS),$(PKG_DESCR),$(PKG_SECTION)))
+
+CONFIG_STYLE:=          cmake
+CMAKE_FLAGS+=		-DUSE_LIBC_NLS=1 -DUSE_LIBXNET=0 -DUSE_LIBNLS=0
+
+cdrkit-install:
+	$(INSTALL_DIR) $(IDIR_CDRKIT)/usr/bin
+	$(INSTALL_BIN) $(WRKINST)/usr/bin/* \
+		$(IDIR_CDRKIT)/usr/bin
+
+include $(ADK_TOPDIR)/mk/pkg-bottom.mk

+ 466 - 0
package/cdrkit/patches/patch-Makefile

@@ -0,0 +1,466 @@
+--- cdrkit-1.1.11.orig/Makefile	2007-05-06 12:23:54.000000000 +0200
++++ cdrkit-1.1.11/Makefile	2015-02-25 10:54:08.000000000 +0100
+@@ -1,72 +1,409 @@
+-ifneq ($(CFLAGS),)
+-CMAKETWEAKS += ( cd build ; cmake .. -DCMAKE_C_FLAGS="$(CFLAGS)" ) || exit 1; 
+-endif
++# CMAKE generated file: DO NOT EDIT!
++# Generated by "Unix Makefiles" Generator, CMake Version 3.1
+ 
+-ifneq ($(LDFLAGS),)
+-CMAKETWEAKS += (cd build ; cmake .. -DCMAKE_EXE_LINKER_FLAGS:STRING="$(LDFLAGS)" -DCMAKE_MODULE_LINKER_FLAGS:STRING="$(LDFLAGS)" -DCMAKE_SHARED_LINKER_FLAGS:STRING="$(LDFLAGS)" ) || exit 1; 
+-endif
++# Default target executed when no arguments are given to make.
++default_target: all
++.PHONY : default_target
+ 
+-ifneq ($(PREFIX),)
+-CMAKETWEAKS += ( cd build ;  cmake .. -DCMAKE_INSTALL_PREFIX="$(PREFIX)") || exit 1; 
+-endif
++# Allow only one "make -f Makefile2" at a time, but pass parallelism.
++.NOTPARALLEL:
++.PHONY : .NOTPARALLEL
+ 
+-ifneq ($(MANSUBDIR),)
+-CMAKETWEAKS += ( cd build ;  cmake .. -DMANSUBDIR="$(MANSUBDIR)" ) || exit 1; 
+-endif
++#=============================================================================
++# Special targets provided by cmake.
+ 
+-default_target: all
++# Disable implicit rules so canonical targets will work.
++.SUFFIXES:
+ 
+-DISTNAME=cdrkit-$(shell cat VERSION)
+-DEBSRCNAME=cdrkit_$(shell cat VERSION | sed -e "s,pre,~pre,").orig.tar.gz
++# Remove some rules from gmake that .SUFFIXES does not remove.
++SUFFIXES =
+ 
+-build/Makefile:
+-	@-mkdir build 2>/dev/null
+-	cd build && cmake ..
++.SUFFIXES: .hpux_make_needs_suffix_list
+ 
+-cmakepurge:
+-	rm -rf install_manifest.txt progress.make CMakeFiles CMakeCache.txt cmake_install.cmake 
+-	rm -rf */install_manifest.txt */progress.make */CMakeFiles */CMakeCache.txt */cmake_install.cmake 
+-	rm -rf */*/install_manifest.txt */*/progress.make */*/CMakeFiles */*/CMakeCache.txt */*/cmake_install.cmake 
+-	rm */Makefile */*/Makefile
++# Suppress display of executed commands.
++$(VERBOSE).SILENT:
++
++# A target that is always out of date.
++cmake_force:
++.PHONY : cmake_force
++
++#=============================================================================
++# Set environment variables for the build.
++
++# The shell in which to execute make rules.
++SHELL = /bin/sh
++
++# The CMake executable.
++CMAKE_COMMAND = /home/wbx/adk/host_x86_64-linux-gnu/usr/bin/cmake
++
++# The command to remove a file.
++RM = /home/wbx/adk/host_x86_64-linux-gnu/usr/bin/cmake -E remove -f
+ 
++# Escaping for special characters.
++EQUALS = =
++
++# The top-level source directory on which CMake was run.
++CMAKE_SOURCE_DIR = /home/wbx/adk/build_qemu-arm_uclibc-ng_arm_eabihf/w-cdrkit-1.1.11-1/cdrkit-1.1.11
++
++# The top-level build directory on which CMake was run.
++CMAKE_BINARY_DIR = /home/wbx/adk/build_qemu-arm_uclibc-ng_arm_eabihf/w-cdrkit-1.1.11-1/cdrkit-1.1.11
++
++#=============================================================================
++# Targets provided globally by CMake.
++
++# Special rule for the target install/strip
++install/strip: preinstall
++	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Installing the project stripped..."
++	/home/wbx/adk/host_x86_64-linux-gnu/usr/bin/cmake -DCMAKE_INSTALL_DO_STRIP=1 -P cmake_install.cmake
++.PHONY : install/strip
++
++# Special rule for the target install/strip
++install/strip/fast: install/strip
++.PHONY : install/strip/fast
++
++# Special rule for the target edit_cache
++edit_cache:
++	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake cache editor..."
++	/home/wbx/adk/host_x86_64-linux-gnu/usr/bin/ccmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
++.PHONY : edit_cache
++
++# Special rule for the target edit_cache
++edit_cache/fast: edit_cache
++.PHONY : edit_cache/fast
++
++# Special rule for the target rebuild_cache
++rebuild_cache:
++	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake to regenerate build system..."
++	/home/wbx/adk/host_x86_64-linux-gnu/usr/bin/cmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
++.PHONY : rebuild_cache
++
++# Special rule for the target rebuild_cache
++rebuild_cache/fast: rebuild_cache
++.PHONY : rebuild_cache/fast
++
++# Special rule for the target install
++install: preinstall
++	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Install the project..."
++	/home/wbx/adk/host_x86_64-linux-gnu/usr/bin/cmake -P cmake_install.cmake
++.PHONY : install
++
++# Special rule for the target install
++install/fast: preinstall/fast
++	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Install the project..."
++	/home/wbx/adk/host_x86_64-linux-gnu/usr/bin/cmake -P cmake_install.cmake
++.PHONY : install/fast
++
++# Special rule for the target list_install_components
++list_install_components:
++	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Available install components are: \"Unspecified\""
++.PHONY : list_install_components
++
++# Special rule for the target list_install_components
++list_install_components/fast: list_install_components
++.PHONY : list_install_components/fast
++
++# Special rule for the target install/local
++install/local: preinstall
++	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Installing only the local directory..."
++	/home/wbx/adk/host_x86_64-linux-gnu/usr/bin/cmake -DCMAKE_INSTALL_LOCAL_ONLY=1 -P cmake_install.cmake
++.PHONY : install/local
++
++# Special rule for the target install/local
++install/local/fast: install/local
++.PHONY : install/local/fast
++
++# The main all target
++all: cmake_check_build_system
++	$(CMAKE_COMMAND) -E cmake_progress_start /home/wbx/adk/build_qemu-arm_uclibc-ng_arm_eabihf/w-cdrkit-1.1.11-1/cdrkit-1.1.11/CMakeFiles /home/wbx/adk/build_qemu-arm_uclibc-ng_arm_eabihf/w-cdrkit-1.1.11-1/cdrkit-1.1.11/CMakeFiles/progress.marks
++	$(MAKE) -f CMakeFiles/Makefile2 all
++	$(CMAKE_COMMAND) -E cmake_progress_start /home/wbx/adk/build_qemu-arm_uclibc-ng_arm_eabihf/w-cdrkit-1.1.11-1/cdrkit-1.1.11/CMakeFiles 0
++.PHONY : all
++
++# The main clean target
+ clean:
+-	rm -rf build
++	$(MAKE) -f CMakeFiles/Makefile2 clean
++.PHONY : clean
+ 
+-tarball:
+-#	if test "$(shell svn status | grep -v -i make)" ; then echo Uncommited files found. Run \"svn status\" to display them. ; exit 1 ; fi
+-	@if test -f ../$(DISTNAME).tar.gz ; then echo ../$(DISTNAME).tar.gz exists, not overwritting ; exit 1; fi
+-	-svn up
+-	rm -rf tmp
+-	mkdir tmp
+-	svn export . tmp/$(DISTNAME)
+-	rm -rf tmp/$(DISTNAME)/debian
+-	tar -f - -c -C tmp $(DISTNAME) | gzip -9 > ../$(DISTNAME).tar.gz
+-	rm -rf tmp
+-	test -e /etc/debian_version && ln -f ../$(DISTNAME).tar.gz ../$(DEBSRCNAME) || true
+-	test -e ../tarballs && ln -f ../$(DISTNAME).tar.gz ../tarballs/$(DEBSRCNAME) || true
++# The main clean target
++clean/fast: clean
++.PHONY : clean/fast
+ 
+-tarball-remove:
+-	rm -f ../$(DISTNAME).tar.gz ../tarballs/$(DEBSRCNAME) ../$(DEBSRCNAME)
++# Prepare targets for installation.
++preinstall: all
++	$(MAKE) -f CMakeFiles/Makefile2 preinstall
++.PHONY : preinstall
+ 
+-SVNBASE=$(shell svn info | grep URL: | cut -f2 -d' ' | xargs dirname)
+-release: tarball
+-	svn ci
+-	svn cp $(SVNBASE)/trunk $(SVNBASE)/tags/release_$(shell cat VERSION)
++# Prepare targets for installation.
++preinstall/fast:
++	$(MAKE) -f CMakeFiles/Makefile2 preinstall
++.PHONY : preinstall/fast
+ 
+-#%::
+-#	$(MAKE) $(MAKE_FLAGS) build/Makefile
+-#	$(CMAKETWEAKS)
+-#	$(MAKE) -C build $(MAKE_FLAGS) $@
++# clear depends
++depend:
++	$(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1
++.PHONY : depend
+ 
+-# needs to be explicite, for PHONY and install (AKA INSTALL) file on cygwin
+-install: build/Makefile
+-	$(CMAKETWEAKS)
+-	$(MAKE) -C build $(MAKE_FLAGS) $@
++#=============================================================================
++# Target rules for targets named devdump
+ 
+-all: build/Makefile
+-	$(CMAKETWEAKS)
+-	$(MAKE) -C build $(MAKE_FLAGS) $@
++# Build rule for target.
++devdump: cmake_check_build_system
++	$(MAKE) -f CMakeFiles/Makefile2 devdump
++.PHONY : devdump
+ 
+-.PHONY: install all
++# fast build rule for target.
++devdump/fast:
++	$(MAKE) -f genisoimage/CMakeFiles/devdump.dir/build.make genisoimage/CMakeFiles/devdump.dir/build
++.PHONY : devdump/fast
+ 
++#=============================================================================
++# Target rules for targets named genisoimage
++
++# Build rule for target.
++genisoimage: cmake_check_build_system
++	$(MAKE) -f CMakeFiles/Makefile2 genisoimage
++.PHONY : genisoimage
++
++# fast build rule for target.
++genisoimage/fast:
++	$(MAKE) -f genisoimage/CMakeFiles/genisoimage.dir/build.make genisoimage/CMakeFiles/genisoimage.dir/build
++.PHONY : genisoimage/fast
++
++#=============================================================================
++# Target rules for targets named isodebug
++
++# Build rule for target.
++isodebug: cmake_check_build_system
++	$(MAKE) -f CMakeFiles/Makefile2 isodebug
++.PHONY : isodebug
++
++# fast build rule for target.
++isodebug/fast:
++	$(MAKE) -f genisoimage/CMakeFiles/isodebug.dir/build.make genisoimage/CMakeFiles/isodebug.dir/build
++.PHONY : isodebug/fast
++
++#=============================================================================
++# Target rules for targets named isodump
++
++# Build rule for target.
++isodump: cmake_check_build_system
++	$(MAKE) -f CMakeFiles/Makefile2 isodump
++.PHONY : isodump
++
++# fast build rule for target.
++isodump/fast:
++	$(MAKE) -f genisoimage/CMakeFiles/isodump.dir/build.make genisoimage/CMakeFiles/isodump.dir/build
++.PHONY : isodump/fast
++
++#=============================================================================
++# Target rules for targets named isoinfo
++
++# Build rule for target.
++isoinfo: cmake_check_build_system
++	$(MAKE) -f CMakeFiles/Makefile2 isoinfo
++.PHONY : isoinfo
++
++# fast build rule for target.
++isoinfo/fast:
++	$(MAKE) -f genisoimage/CMakeFiles/isoinfo.dir/build.make genisoimage/CMakeFiles/isoinfo.dir/build
++.PHONY : isoinfo/fast
++
++#=============================================================================
++# Target rules for targets named isovfy
++
++# Build rule for target.
++isovfy: cmake_check_build_system
++	$(MAKE) -f CMakeFiles/Makefile2 isovfy
++.PHONY : isovfy
++
++# fast build rule for target.
++isovfy/fast:
++	$(MAKE) -f genisoimage/CMakeFiles/isovfy.dir/build.make genisoimage/CMakeFiles/isovfy.dir/build
++.PHONY : isovfy/fast
++
++#=============================================================================
++# Target rules for targets named wodim
++
++# Build rule for target.
++wodim: cmake_check_build_system
++	$(MAKE) -f CMakeFiles/Makefile2 wodim
++.PHONY : wodim
++
++# fast build rule for target.
++wodim/fast:
++	$(MAKE) -f wodim/CMakeFiles/wodim.dir/build.make wodim/CMakeFiles/wodim.dir/build
++.PHONY : wodim/fast
++
++#=============================================================================
++# Target rules for targets named wodimstuff
++
++# Build rule for target.
++wodimstuff: cmake_check_build_system
++	$(MAKE) -f CMakeFiles/Makefile2 wodimstuff
++.PHONY : wodimstuff
++
++# fast build rule for target.
++wodimstuff/fast:
++	$(MAKE) -f wodim/CMakeFiles/wodimstuff.dir/build.make wodim/CMakeFiles/wodimstuff.dir/build
++.PHONY : wodimstuff/fast
++
++#=============================================================================
++# Target rules for targets named edc
++
++# Build rule for target.
++edc: cmake_check_build_system
++	$(MAKE) -f CMakeFiles/Makefile2 edc
++.PHONY : edc
++
++# fast build rule for target.
++edc/fast:
++	$(MAKE) -f libedc/CMakeFiles/edc.dir/build.make libedc/CMakeFiles/edc.dir/build
++.PHONY : edc/fast
++
++#=============================================================================
++# Target rules for targets named hfs_iso
++
++# Build rule for target.
++hfs_iso: cmake_check_build_system
++	$(MAKE) -f CMakeFiles/Makefile2 hfs_iso
++.PHONY : hfs_iso
++
++# fast build rule for target.
++hfs_iso/fast:
++	$(MAKE) -f libhfs_iso/CMakeFiles/hfs_iso.dir/build.make libhfs_iso/CMakeFiles/hfs_iso.dir/build
++.PHONY : hfs_iso/fast
++
++#=============================================================================
++# Target rules for targets named paranoia
++
++# Build rule for target.
++paranoia: cmake_check_build_system
++	$(MAKE) -f CMakeFiles/Makefile2 paranoia
++.PHONY : paranoia
++
++# fast build rule for target.
++paranoia/fast:
++	$(MAKE) -f libparanoia/CMakeFiles/paranoia.dir/build.make libparanoia/CMakeFiles/paranoia.dir/build
++.PHONY : paranoia/fast
++
++#=============================================================================
++# Target rules for targets named icedax
++
++# Build rule for target.
++icedax: cmake_check_build_system
++	$(MAKE) -f CMakeFiles/Makefile2 icedax
++.PHONY : icedax
++
++# fast build rule for target.
++icedax/fast:
++	$(MAKE) -f icedax/CMakeFiles/icedax.dir/build.make icedax/CMakeFiles/icedax.dir/build
++.PHONY : icedax/fast
++
++#=============================================================================
++# Target rules for targets named usal
++
++# Build rule for target.
++usal: cmake_check_build_system
++	$(MAKE) -f CMakeFiles/Makefile2 usal
++.PHONY : usal
++
++# fast build rule for target.
++usal/fast:
++	$(MAKE) -f libusal/CMakeFiles/usal.dir/build.make libusal/CMakeFiles/usal.dir/build
++.PHONY : usal/fast
++
++#=============================================================================
++# Target rules for targets named rols
++
++# Build rule for target.
++rols: cmake_check_build_system
++	$(MAKE) -f CMakeFiles/Makefile2 rols
++.PHONY : rols
++
++# fast build rule for target.
++rols/fast:
++	$(MAKE) -f librols/CMakeFiles/rols.dir/build.make librols/CMakeFiles/rols.dir/build
++.PHONY : rols/fast
++
++#=============================================================================
++# Target rules for targets named unls
++
++# Build rule for target.
++unls: cmake_check_build_system
++	$(MAKE) -f CMakeFiles/Makefile2 unls
++.PHONY : unls
++
++# fast build rule for target.
++unls/fast:
++	$(MAKE) -f libunls/CMakeFiles/unls.dir/build.make libunls/CMakeFiles/unls.dir/build
++.PHONY : unls/fast
++
++#=============================================================================
++# Target rules for targets named readom
++
++# Build rule for target.
++readom: cmake_check_build_system
++	$(MAKE) -f CMakeFiles/Makefile2 readom
++.PHONY : readom
++
++# fast build rule for target.
++readom/fast:
++	$(MAKE) -f readom/CMakeFiles/readom.dir/build.make readom/CMakeFiles/readom.dir/build
++.PHONY : readom/fast
++
++#=============================================================================
++# Target rules for targets named netscsid
++
++# Build rule for target.
++netscsid: cmake_check_build_system
++	$(MAKE) -f CMakeFiles/Makefile2 netscsid
++.PHONY : netscsid
++
++# fast build rule for target.
++netscsid/fast:
++	$(MAKE) -f netscsid/CMakeFiles/netscsid.dir/build.make netscsid/CMakeFiles/netscsid.dir/build
++.PHONY : netscsid/fast
++
++# Help Target
++help:
++	@echo "The following are some of the valid targets for this Makefile:"
++	@echo "... all (the default if no target is provided)"
++	@echo "... clean"
++	@echo "... depend"
++	@echo "... install/strip"
++	@echo "... edit_cache"
++	@echo "... rebuild_cache"
++	@echo "... install"
++	@echo "... list_install_components"
++	@echo "... install/local"
++	@echo "... isodebug"
++	@echo "... genisoimage"
++	@echo "... isodump"
++	@echo "... isoinfo"
++	@echo "... devdump"
++	@echo "... isovfy"
++	@echo "... wodimstuff"
++	@echo "... wodim"
++	@echo "... edc"
++	@echo "... hfs_iso"
++	@echo "... paranoia"
++	@echo "... icedax"
++	@echo "... usal"
++	@echo "... rols"
++	@echo "... unls"
++	@echo "... readom"
++	@echo "... netscsid"
++.PHONY : help
++
++
++
++#=============================================================================
++# Special targets to cleanup operation of make.
++
++# Special rule to run CMake to check the build system integrity.
++# No rule that depends on this can have commands that come from listfiles
++# because they might be regenerated.
++cmake_check_build_system:
++	$(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0
++.PHONY : cmake_check_build_system
+ 

+ 10 - 0
package/cdrkit/patches/patch-include_xconfig_h_in

@@ -0,0 +1,10 @@
+--- cdrkit-1.1.11.orig/include/xconfig.h.in	2006-12-02 12:10:05.000000000 +0100
++++ cdrkit-1.1.11/include/xconfig.h.in	2015-02-21 21:20:01.000000000 +0100
+@@ -187,7 +187,6 @@
+  *	they are placed before the large file tests.
+  */
+ 
+-#define HAVE_RCMD 1		/* rcmd() is present in libc/libsocket */
+ #define HAVE_SOCKET 1		/* socket() is present in libc/libsocket */
+ #define HAVE_SOCKETPAIR 1		/* socketpair() is present in libc/libsocket */
+ #define HAVE_GETSERVBYNAME 1	/* getservbyname() is present in libc/libsocket */

+ 2 - 2
package/cmake/Makefile

@@ -4,9 +4,9 @@
 include $(ADK_TOPDIR)/rules.mk
 
 PKG_NAME:=		cmake
-PKG_VERSION:=		3.1.2
+PKG_VERSION:=		3.1.3
 PKG_RELEASE:=		1
-PKG_HASH:=		2b210f7d867a1e716c1895357ebe63c7b9ae61fdb5f2d300ab2f01795f085b35
+PKG_HASH:=		45f4d3fa8a2f61cc092ae461aac4cac1bab4ac6706f98274ea7f314dd315c6d0
 PKG_DESCR:=		build utility
 PKG_SECTION:=		dev/tools
 PKG_URL:=		http://www.cmake.org/

+ 2 - 2
package/curl/Makefile

@@ -4,9 +4,9 @@
 include ${ADK_TOPDIR}/rules.mk
 
 PKG_NAME:=		curl
-PKG_VERSION:=		7.40.0
+PKG_VERSION:=		7.41.0
 PKG_RELEASE:=		1
-PKG_HASH:=		c2e0705a13e53f8f924d1eaeb2ab94f59a9e162007c489b9ab0c96238bddf84b
+PKG_HASH:=		58c9f7cb1be9c26e6a2fd9326c14e054780dc4bb74b590a1d47fb3788a31535d
 PKG_DESCR:=		client-side url transfer tool
 PKG_SECTION:=		net/http
 PKG_DEPENDS:=		libcurl

+ 3 - 3
package/kexec-tools/Makefile

@@ -4,9 +4,9 @@
 include $(ADK_TOPDIR)/rules.mk
 
 PKG_NAME:=		kexec-tools
-PKG_VERSION:=		2.0.8
-PKG_RELEASE:=		2
-PKG_HASH:=		f3abe96fa0793e63936725a4471429f070039a1e81e605deb378747194a50c47
+PKG_VERSION:=		2.0.9
+PKG_RELEASE:=		1
+PKG_HASH:=		8ae34a9ceb76350954e1e1e3ca9ab51da15862bd5f2fd14392208e60fb454f71
 PKG_DESCR:=		kernel exec tools
 PKG_SECTION:=		sys/misc
 PKG_DEPENDS:=		zlib

+ 12 - 6
package/libcap/Makefile

@@ -4,25 +4,31 @@
 include $(ADK_TOPDIR)/rules.mk
 
 PKG_NAME:=		libcap
-PKG_VERSION:=		2.22
-PKG_RELEASE:=		3
+PKG_VERSION:=		2.24
+PKG_RELEASE:=		1
 PKG_HASH:=		73ebbd4877b5f69dd28b72098e510c5b318bc480f8201c4061ac98b78c04050f
 PKG_DESCR:=		capabilities library
 PKG_SECTION:=		libs/misc
-PKG_BUILDDEP:=		pam
 PKG_URL:=		http://www.friedhoff.org/posixfilecaps.html
-PKG_SITES:=		http://openadk.org/distfiles/
+PKG_SITES:=		https://www.kernel.org/pub/linux/libs/security/linux-privs/libcap2/
 PKG_OPTS:=		dev
 
-DISTFILES:=             ${PKG_NAME}-${PKG_VERSION}.tar.bz2
-
 include $(ADK_TOPDIR)/mk/package.mk
 
 $(eval $(call PKG_template,LIBCAP,libcap,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION},${PKG_OPTS}))
 
+# for Darwin hosts
 CPPFLAGS_FOR_BUILD+=	-I$(STAGING_TARGET_DIR)/usr/include
 CONFIG_STYLE:=		manual
 
+ifeq ($(ADK_TARGET_USE_STATIC_LIBS),y)
+ALL_TARGET:=		static progs
+INSTALL_TARGET:=	install-static
+else
+ALL_TARGET:=		shared progs
+INSTALL_TARGET:=	install-shared
+endif
+
 libcap-install:
 	$(INSTALL_DIR) $(IDIR_LIBCAP)/usr/lib
 	$(CP) $(WRKINST)/usr/lib/libcap*.so* \

+ 31 - 29
package/libcap/patches/patch-Make_Rules

@@ -1,59 +1,61 @@
---- libcap-2.22.orig/Make.Rules	2011-07-25 04:18:23.000000000 +0200
-+++ libcap-2.22/Make.Rules	2013-11-08 16:22:41.000000000 +0100
-@@ -12,10 +12,6 @@ FAKEROOT=$(DESTDIR)
+--- libcap-2.24.orig/Make.Rules	2014-01-06 02:16:21.000000000 +0100
++++ libcap-2.24/Make.Rules	2015-02-26 14:01:28.000000000 +0100
+@@ -12,22 +12,12 @@ FAKEROOT=$(DESTDIR)
  # These choices are motivated by the fact that getcap and setcap are
  # administrative operations that could be needed to recover a system.
  
 -ifndef lib
--lib=$(shell ldd /usr/bin/ld|fgrep ld-linux|cut -d/ -f2)
+-lib=$(shell ldd /usr/bin/ld|egrep "ld-linux|ld.so"|cut -d/ -f2)
 -endif
 -
- ifdef prefix
- exec_prefix=$(prefix)
- lib_prefix=$(exec_prefix)
-@@ -23,7 +19,7 @@ inc_prefix=$(lib_prefix)
- man_prefix=$(prefix)/share
- else
+-ifdef prefix
+-exec_prefix=$(prefix)
+-lib_prefix=$(exec_prefix)
+-inc_prefix=$(lib_prefix)
+-man_prefix=$(prefix)/share
+-else
++lib=lib
  prefix=/usr
 -exec_prefix=
-+exec_prefix=/usr
++exec_prefix=$(prefix)
  lib_prefix=$(exec_prefix)
  inc_prefix=$(prefix)
  man_prefix=$(prefix)/share
-@@ -34,7 +30,7 @@ endif
- MANDIR=$(FAKEROOT)$(man_prefix)/man
- SBINDIR=$(FAKEROOT)$(exec_prefix)/sbin
- INCDIR=$(FAKEROOT)$(inc_prefix)/include
--LIBDIR=$(FAKEROOT)$(lib_prefix)/$(lib)
-+LIBDIR=$(FAKEROOT)$(lib_prefix)/lib
+-endif
  
- # common defines for libcap
- LIBTITLE=libcap
-@@ -47,12 +43,13 @@ MINOR=22
- KERNEL_HEADERS := $(topdir)/libcap/include
- IPATH += -fPIC -I$(topdir)/libcap/include -I$(KERNEL_HEADERS)
+ # Target directories
+ 
+@@ -48,28 +38,28 @@ MINOR=24
+ KERNEL_HEADERS := $(topdir)/libcap/include/uapi
+ IPATH += -fPIC -I$(KERNEL_HEADERS) -I$(topdir)/libcap/include
  
 -CC := gcc
 -CFLAGS := -O2 -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
 +CC ?= gcc
-+CFLAGS ?= -O2 
-+CFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
++CFLAGS ?= -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
  BUILD_CC := $(CC)
  BUILD_CFLAGS := $(CFLAGS) $(IPATH)
 -AR := ar
 -RANLIB := ranlib
+-DEBUG = -g #-DDEBUG
 +AR ?= ar
 +RANLIB ?= ranlib
- DEBUG = -g #-DDEBUG
++DEBUG = 
  WARNINGS=-Wall -Wwrite-strings \
          -Wpointer-arith -Wcast-qual -Wcast-align \
-@@ -64,11 +61,11 @@ LDFLAGS := #-g
+         -Wstrict-prototypes -Wmissing-prototypes \
+         -Wnested-externs -Winline -Wshadow
+-LD=$(CC) -Wl,-x -shared
+-LDFLAGS := #-g
++LD=$(CC) -shared
++LDFLAGS ?= #-g
+ 
  SYSTEM_HEADERS = /usr/include
  INCS=$(topdir)/libcap/include/sys/capability.h
  LDFLAGS += -L$(topdir)/libcap
--CFLAGS += -Dlinux $(WARNINGS) $(DEBUG)
-+CFLAGS += -Dlinux $(WARNINGS)
- PAM_CAP := $(shell if [ -f /usr/include/security/pam_modules.h ]; then echo yes ; else echo no ; fi)
+ CFLAGS += -Dlinux $(WARNINGS) $(DEBUG)
+-PAM_CAP := $(shell if [ -f /usr/include/security/pam_modules.h ]; then echo yes ; else echo no ; fi)
++PAM_CAP := no
  INDENT := $(shell if [ -n "$(which indent 2>/dev/null)" ]; then echo "| indent -kr" ; fi)
  DYNAMIC := $(shell if [ ! -d "$(topdir)/.git" ]; then echo yes; fi)
 -LIBATTR := yes

+ 25 - 0
package/libcap/patches/patch-Makefile

@@ -0,0 +1,25 @@
+--- libcap-2.24.orig/Makefile	2013-12-27 19:17:17.000000000 +0100
++++ libcap-2.24/Makefile	2015-02-26 20:36:58.000000000 +0100
+@@ -16,6 +16,22 @@ endif
+ 	$(MAKE) -C progs $@
+ 	$(MAKE) -C doc $@
+ 
++progs:
++	$(MAKE) -C progs all
++
++shared:
++	$(MAKE) -C libcap shared
++
++static:
++	$(MAKE) -C libcap static
++
++install-shared:
++	$(MAKE) -C libcap install-shared
++
++install-static:
++	$(MAKE) -C libcap install-static
++
++
+ all-here:
+ 
+ install-here:

+ 35 - 4
package/libcap/patches/patch-libcap_Makefile

@@ -1,7 +1,17 @@
---- libcap-2.22.orig/libcap/Makefile	2010-08-09 00:26:04.000000000 +0200
-+++ libcap-2.22/libcap/Makefile	2013-10-28 10:46:10.000000000 +0100
-@@ -33,7 +33,7 @@ INCLUDE_GPERF_OUTPUT = -include $(GPERF_
- endif
+--- libcap-2.24.orig/libcap/Makefile	2014-01-06 01:55:03.000000000 +0100
++++ libcap-2.24/libcap/Makefile	2015-02-26 20:34:47.000000000 +0100
+@@ -28,6 +28,9 @@ GPERF_OUTPUT = _caps_output.gperf
+ 
+ all: $(MINLIBNAME) $(STALIBNAME) libcap.pc
+ 
++static: $(STALIBNAME)
++shared: $(MINLIBNAME)
++
+ ifeq ($(shell gperf --version > /dev/null 2>&1 && echo yes),yes)
+ USE_GPERF_OUTPUT = $(GPERF_OUTPUT)
+ INCLUDE_GPERF_OUTPUT = -include $(GPERF_OUTPUT)
+@@ -43,7 +46,7 @@ libcap.pc: libcap.pc.in
+ 		$< >$@
  
  _makenames: _makenames.c cap_names.list.h
 -	$(BUILD_CC) $(BUILD_CFLAGS) $< -o $@
@@ -9,3 +19,24 @@
  
  cap_names.h: _makenames
  	./_makenames > cap_names.h
+@@ -70,6 +73,20 @@ $(MINLIBNAME): $(OBJS)
+ cap_text.o: cap_text.c $(USE_GPERF_OUTPUT) $(INCLS)
+ 	$(CC) $(CFLAGS) $(IPATH) $(INCLUDE_GPERF_OUTPUT) -c $< -o $@
+ 
++install-shared: install-headers
++	mkdir -p -m 0755 $(LIBDIR)
++	install -m 0644 $(MINLIBNAME) $(LIBDIR)/$(MINLIBNAME)
++	ln -sf $(MINLIBNAME) $(LIBDIR)/$(MAJLIBNAME)
++	ln -sf $(MAJLIBNAME) $(LIBDIR)/$(LIBNAME)
++
++install-static: install-headers
++	mkdir -p -m 0755 $(LIBDIR)
++	install -m 0644 $(STALIBNAME) $(LIBDIR)/$(STALIBNAME)
++
++install-headers:
++	mkdir -p -m 0755 $(INCDIR)/sys
++	install -m 0644 include/sys/capability.h $(INCDIR)/sys
++
+ install: all
+ 	mkdir -p -m 0755 $(INCDIR)/sys
+ 	install -m 0644 include/sys/capability.h $(INCDIR)/sys

+ 0 - 10
package/libcap/patches/patch-pam_cap_Makefile

@@ -1,10 +0,0 @@
---- libcap-2.22.orig/pam_cap/Makefile	2010-08-09 02:08:01.000000000 +0200
-+++ libcap-2.22/pam_cap/Makefile	2013-11-08 16:29:05.000000000 +0100
-@@ -10,7 +10,6 @@ include ../Make.Rules
- LDLIBS += -L../libcap -lcap
- 
- all: pam_cap.so
--	$(MAKE) testcompile
- 
- install: all
- 	mkdir -p -m 0755 $(LIBDIR)/security

+ 2 - 4
package/ltrace/Makefile

@@ -4,16 +4,14 @@
 include $(ADK_TOPDIR)/rules.mk
 
 PKG_NAME:=		ltrace
-PKG_VERSION:=		0.7.4
-# git from 24.05.2014
+PKG_VERSION:=		c18a46eff706e956c4dc755144d752dc163a1145
 PKG_RELEASE:=		1
-PKG_HASH:=		7fb662d3a918b96804a5c0a4b34c75985856e91079ddc89eca6dc87366834e3d
 PKG_DESCR:=		intercepts and records dynamic library calls 
 PKG_SECTION:=		app/debug
 PKG_DEPENDS:=		libelf
 PKG_BUILDDEP:=		libelf
 PKG_URL:=		http://ltrace.org/
-PKG_SITES:=		http://openadk.org/distfiles/
+PKG_SITES:=		git://git.debian.org/git/collab-maint/ltrace.git
 
 include $(ADK_TOPDIR)/mk/package.mk
 

+ 2 - 2
package/lvm/Makefile

@@ -4,9 +4,9 @@
 include ${ADK_TOPDIR}/rules.mk
 
 PKG_NAME:=		lvm
-PKG_VERSION:=		2.02.114
+PKG_VERSION:=		2.02.116
 PKG_RELEASE:=		1
-PKG_HASH:=		de9cb0acfb9c5a6afa6184160c9e066f19043677f91a72c741d153efcd2874a5
+PKG_HASH:=		2479d6ea61c405efcfcd8a78390d00c1d2e9c92c0262f3ed599f2c0fb6f0b767
 PKG_DESCR:=		logical volume management
 PKG_SECTION:=		sys/fs
 PKG_DEPENDS:=		libdevmapper libncurses

+ 2 - 0
package/pam/Makefile

@@ -15,6 +15,8 @@ PKG_SITES:=		http://www.linux-pam.org/library/
 PKG_OPTS:=		dev
 PKG_BB:=		1
 
+PKG_CFLINE_PAM:=	depends on !ADK_TARGET_USE_STATIC_LIBS
+
 DISTFILES:=		Linux-PAM-$(PKG_VERSION).tar.gz
 WRKDIST=                ${WRKDIR}/Linux-PAM-${PKG_VERSION}
 

+ 3 - 3
package/php/Makefile

@@ -4,9 +4,9 @@
 include $(ADK_TOPDIR)/rules.mk
 
 PKG_NAME:=		php
-PKG_VERSION:=		5.6.3
-PKG_RELEASE:=		2
-PKG_HASH:=		fad244506cc7f10fe56aba8129b3c39a4f9316d9544a4fba932c3f81fc2244b5
+PKG_VERSION:=		5.6.5
+PKG_RELEASE:=		1
+PKG_HASH:=		c5ef4abaef8c1ea66dcfd5a075a2f357b666aff5c5b686fca7c78c1cfd64e996
 PKG_DESCR:=		php language interpreter
 PKG_SECTION:=		dev/lang
 PKG_DEPENDS:=		libpthread librt

+ 2 - 2
package/samba/Makefile

@@ -4,9 +4,9 @@
 include ${ADK_TOPDIR}/rules.mk
 
 PKG_NAME:=		samba
-PKG_VERSION:=		3.6.24
+PKG_VERSION:=		3.6.25
 PKG_RELEASE:=		1
-PKG_HASH:=		11d0bd04b734731970259efc6692b8e749ff671a9b56d8cc5fa98c192ab234a7
+PKG_HASH:=		8f2c8a7f2bd89b0dfd228ed917815852f7c625b2bc0936304ac3ed63aaf83751
 PKG_DESCR:=		smb file and print server
 PKG_SECTION:=		net/fs
 PKG_BUILDDEP:=		gettext-tiny util-linux popt

+ 3 - 3
package/sox/Makefile

@@ -4,9 +4,9 @@
 include $(ADK_TOPDIR)/rules.mk
 
 PKG_NAME:=		sox
-PKG_VERSION:=		14.4.1
-PKG_RELEASE:=		2
-PKG_HASH:=		9a8c2c6fe51e608da346a157e111508a957af9e3ecf3de26781d36e9a67fa89b
+PKG_VERSION:=		14.4.2
+PKG_RELEASE:=		1
+PKG_HASH:=		b45f598643ffbd8e363ff24d61166ccec4836fea6d3888881b8df53e3bb55f6c
 PKG_DESCR:=		swiss army knife of sound processing programs
 PKG_SECTION:=		mm/audio
 PKG_BUILDDEP:=		zlib ncurses

+ 6 - 7
package/squid/Makefile

@@ -4,15 +4,15 @@
 include ${ADK_TOPDIR}/rules.mk
 
 PKG_NAME:=		squid
-PKG_VERSION:=		3.4.6
+PKG_VERSION:=		3.5.2
 PKG_RELEASE:=		1
-PKG_HASH:=		9ef26cd638c65afa750637b3669057c052890f10c686eb0218eb0d39b4199bc0
+PKG_HASH:=		5af2e16f279466f9fb89c2fef6c09b6824a7e3e7996c9f1c2bc16e7daddd751f
 PKG_DESCR:=		web and cache proxy
 PKG_SECTION:=		net/proxy
-PKG_DEPENDS:=		libopenssl libpthread libstdcxx libltdl
-PKG_BUILDDEP:=		openssl libtool
+PKG_DEPENDS:=		libpthread libstdcxx libltdl
+PKG_BUILDDEP:=		libtool
 PKG_URL:=		http://www.squid-cache.org/
-PKG_SITES:=		http://www.squid-cache.org/Versions/v3/3.4/
+PKG_SITES:=		http://www.squid-cache.org/Versions/v3/3.5/
 
 PKG_SUBPKGS:=		SQUID SQUID_MOD_BASIC_AUTH_GETPWNAM SQUID_MOD_BASIC_AUTH_NCSA
 PKG_SUBPKGS+=		SQUID_MOD_BASIC_AUTH_SMB SQUID_MOD_DIGEST_AUTH_FILE
@@ -147,7 +147,6 @@ CONFIGURE_ARGS+=	--datadir=/usr/share/squid \
 			--disable-debug-cbdata \
 			--enable-kill-parent-hack \
 			--enable-arp-acl \
-			--enable-ssl \
 			--enable-err-languages=English \
 			--enable-default-err-language=English \
 			--enable-linux-netfilter \
@@ -159,11 +158,11 @@ CONFIGURE_ARGS+=	--datadir=/usr/share/squid \
 			--without-libcap \
 			--disable-snmp \
 			--disable-esi \
+			--disable-ssl \
 			--disable-htcp \
 			--disable-wccp \
 			--disable-wccpv2 \
 			--enable-useragent-log \
-			--with-openssl=${STAGING_TARGET_DIR}/usr \
 			--without-krb5-config \
 			--enable-negotiate-auth-helpers=no \
 			--enable-auth \

+ 0 - 72
package/squid/patches/patch-acinclude_lib-checks_m4

@@ -1,72 +0,0 @@
---- squid-3.4.4.orig/acinclude/lib-checks.m4	2014-03-09 10:40:56.000000000 +0100
-+++ squid-3.4.4/acinclude/lib-checks.m4	2014-03-11 19:44:28.088928982 +0100
-@@ -95,69 +95,6 @@ AC_DEFUN([SQUID_CHECK_LIBIPHLPAPI],[
-   SQUID_STATE_ROLLBACK(iphlpapi)
- ])
- 
--dnl Checks whether the OpenSSL SSL_get_certificate crashes squid and if a
--dnl workaround can be used instead of using the SSL_get_certificate
--AC_DEFUN([SQUID_CHECK_OPENSSL_GETCERTIFICATE_WORKS],[
--  AH_TEMPLATE(SQUID_SSLGETCERTIFICATE_BUGGY, "Define to 1 if the SSL_get_certificate crashes squid")
--  AH_TEMPLATE(SQUID_USE_SSLGETCERTIFICATE_HACK, "Define to 1 to use squid workaround for SSL_get_certificate")
--  SQUID_STATE_SAVE(check_SSL_get_certificate)
--  LIBS="$SSLLIB $LIBS"
--  if test "x$SSLLIBDIR" != "x"; then
--     LIBS="$LIBS -Wl,-rpath -Wl,$SSLLIBDIR"
--  fi
--
--  AC_MSG_CHECKING(whether the SSL_get_certificate is buggy)
--  AC_RUN_IFELSE([
--  AC_LANG_PROGRAM(
--    [
--     #include <openssl/ssl.h>
--     #include <openssl/err.h>
--    ],
--    [
--    SSLeay_add_ssl_algorithms();
--    SSL_CTX *sslContext = SSL_CTX_new(SSLv3_method());
--    SSL *ssl = SSL_new(sslContext);
--    X509* cert = SSL_get_certificate(ssl);
--    return 0;
--    ])
--  ],
--  [
--   AC_MSG_RESULT([no])
--  ],
--  [
--   AC_DEFINE(SQUID_SSLGETCERTIFICATE_BUGGY, 1)
--   AC_MSG_RESULT([yes])
--  ],
--  [])
--
--  AC_MSG_CHECKING(whether the workaround for SSL_get_certificate works)
--  AC_RUN_IFELSE([
--  AC_LANG_PROGRAM(
--    [
--     #include <openssl/ssl.h>
--     #include <openssl/err.h>
--    ],
--    [
--    SSLeay_add_ssl_algorithms();
--    SSL_CTX *sslContext = SSL_CTX_new(SSLv3_method());
--    X509 ***pCert = (X509 ***)sslContext->cert;
--    X509 *sslCtxCert = pCert && *pCert ? **pCert : (X509 *)0x1;
--    if (sslCtxCert != NULL)
--        return 1;
--    return 0;
--    ])
--  ],
--  [
--   AC_MSG_RESULT([yes])
--   AC_DEFINE(SQUID_USE_SSLGETCERTIFICATE_HACK, 1)
--  ],
--  [
--   AC_MSG_RESULT([no])
--  ],
--[])
--
--SQUID_STATE_ROLLBACK(check_SSL_get_certificate)
--])
- 
- dnl Checks whether the  SSL_CTX_new and similar functions require 
- dnl a const 'SSL_METHOD *' argument

+ 11 - 0
package/squid/patches/patch-configure_ac

@@ -0,0 +1,11 @@
+--- squid-3.5.2.orig/configure.ac	2015-02-18 06:18:57.000000000 -0600
++++ squid-3.5.2/configure.ac	2015-02-20 13:01:31.755039271 -0600
+@@ -1343,7 +1343,7 @@ if test "x$with_openssl" = "xyes"; then
+     AC_DEFINE(USE_OPENSSL,1,[OpenSSL support is available])
+ 
+     # check for other specific broken implementations
+-    SQUID_CHECK_OPENSSL_GETCERTIFICATE_WORKS
++    #SQUID_CHECK_OPENSSL_GETCERTIFICATE_WORKS
+     SQUID_CHECK_OPENSSL_CONST_SSL_METHOD
+     SQUID_CHECK_OPENSSL_TXTDB
+     SQUID_CHECK_OPENSSL_HELLO_OVERWRITE_HACK

+ 7 - 7
package/squid/patches/patch-lib_rfcnb_rfcnb-io_c

@@ -1,11 +1,11 @@
---- squid-3.4.4.orig/lib/rfcnb/rfcnb-io.c	2014-03-09 10:40:56.000000000 +0100
-+++ squid-3.4.4/lib/rfcnb/rfcnb-io.c	2014-03-27 09:28:30.000000000 +0100
-@@ -30,7 +30,7 @@
- #include "rfcnb/rfcnb-util.h"
- #include "rfcnb/std-includes.h"
+--- squid-3.5.2.orig/lib/rfcnb/rfcnb-io.c	2015-02-18 06:17:02.000000000 -0600
++++ squid-3.5.2/lib/rfcnb/rfcnb-io.c	2015-02-20 00:33:21.015450265 -0600
+@@ -40,7 +40,7 @@
+ #include <string.h>
+ #endif
  #include <sys/uio.h>
 -#include <sys/signal.h>
 +#include <signal.h>
  
- #if HAVE_STRING_H
- #include <string.h>
+ int RFCNB_Timeout = 0;          /* Timeout in seconds ... */
+ 

+ 14 - 0
package/squid/patches/patch-libltdl_aclocal_m4

@@ -0,0 +1,14 @@
+--- squid-3.5.2.orig/libltdl/aclocal.m4	2015-02-18 06:17:49.000000000 -0600
++++ squid-3.5.2/libltdl/aclocal.m4	2015-02-23 15:31:16.264583929 -0600
+@@ -486,9 +486,9 @@ _AM_IF_OPTION([no-define],,
+ # Some tools Automake needs.
+ AC_REQUIRE([AM_SANITY_CHECK])dnl
+ AC_REQUIRE([AC_ARG_PROGRAM])dnl
+-AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
++AM_MISSING_PROG([ACLOCAL], [aclocal])
+ AM_MISSING_PROG([AUTOCONF], [autoconf])
+-AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
++AM_MISSING_PROG([AUTOMAKE], [automake])
+ AM_MISSING_PROG([AUTOHEADER], [autoheader])
+ AM_MISSING_PROG([MAKEINFO], [makeinfo])
+ AC_REQUIRE([AM_PROG_INSTALL_SH])dnl

+ 5 - 5
package/squid/patches/patch-src_Makefile_am

@@ -1,11 +1,11 @@
---- squid-3.4.4.orig/src/Makefile.am	2014-03-09 10:40:56.000000000 +0100
-+++ squid-3.4.4/src/Makefile.am	2014-03-12 09:46:23.001434141 +0100
-@@ -981,7 +981,7 @@ cache_cf.o: cf_parser.cci
+--- squid-3.5.2.orig/src/Makefile.am	2015-02-18 06:17:02.000000000 -0600
++++ squid-3.5.2/src/Makefile.am	2015-02-23 15:32:32.084583233 -0600
+@@ -970,7 +970,7 @@ cache_cf.o: cf_parser.cci
  
  # cf_gen builds the configuration files.
  cf_gen$(EXEEXT): $(cf_gen_SOURCES) $(cf_gen_DEPENDENCIES) cf_gen_defines.cci
--	$(HOSTCXX) -o $@ $(srcdir)/cf_gen.cc -I$(srcdir) -I$(top_builddir)/include/ -I$(top_builddir)/src
-+	$(CXX_FOR_BUILD) -o $@ $(srcdir)/cf_gen.cc -I$(srcdir) -I$(top_builddir)/include/ -I$(top_builddir)/src
+-	$(BUILDCXX) $(BUILDCXXFLAGS) -o $@ $(srcdir)/cf_gen.cc -I$(srcdir) -I$(top_builddir)/include/ -I$(top_builddir)/src
++	$(CXX_FOR_BUILD) $(CXXFLAGS_FOR_BUILD) -o $@ $(srcdir)/cf_gen.cc -I$(srcdir) -I$(top_builddir)/include/ -I$(top_builddir)/src
  
  # squid.conf.default is built by cf_gen when making cf_parser.cci
  squid.conf.default squid.conf.documented: cf_parser.cci

+ 1 - 0
package/u-boot/files/fw_env.config

@@ -0,0 +1 @@
+/mnt/uboot.env      0x0000          0x4000

+ 5 - 0
package/u-boot/files/uboot_print_env

@@ -0,0 +1,5 @@
+#!/bin/sh
+
+mount -r /dev/mmcblk0p1 /mnt
+fw_printenv "$@"
+umount /mnt

+ 5 - 0
package/u-boot/files/uboot_set_env

@@ -0,0 +1,5 @@
+#!/bin/sh
+
+mount /dev/mmcblk0p1 /mnt
+fw_setenv "$@"
+umount /mnt

+ 13 - 0
package/u-boot/patches/patch-arch_arm_lib_bootm_c

@@ -0,0 +1,13 @@
+--- u-boot-d8bec60c1b0de7770f9b56ad092ab9be801d99af.orig/arch/arm/lib/bootm.c	2015-01-06 09:00:23.000000000 +0100
++++ u-boot-d8bec60c1b0de7770f9b56ad092ab9be801d99af/arch/arm/lib/bootm.c	2015-01-07 18:11:45.971158851 +0100
+@@ -70,8 +70,8 @@ void arch_lmb_reserve(struct lmb *lmb)
+  */
+ static void announce_and_cleanup(int fake)
+ {
+-	printf("\nStarting kernel ...%s\n\n", fake ?
+-		"(fake run for tracing)" : "");
++	//printf("\nStarting kernel ...%s\n\n", fake ?
++	//	"(fake run for tracing)" : "");
+ 	bootstage_mark_name(BOOTSTAGE_ID_BOOTM_HANDOFF, "start_kernel");
+ #ifdef CONFIG_BOOTSTAGE_FDT
+ 	bootstage_fdt_add_report();

+ 11 - 0
package/u-boot/patches/patch-common_cmd_bootmenu_c

@@ -0,0 +1,11 @@
+--- u-boot-d8bec60c1b0de7770f9b56ad092ab9be801d99af.orig/common/cmd_bootmenu.c	2015-01-06 09:00:23.000000000 +0100
++++ u-boot-d8bec60c1b0de7770f9b56ad092ab9be801d99af/common/cmd_bootmenu.c	2015-01-07 17:51:11.947152887 +0100
+@@ -423,7 +423,7 @@ cleanup:
+ 	}
+ 
+ 	if (title && command) {
+-		debug("Starting entry '%s'\n", title);
++		//debug("Starting entry '%s'\n", title);
+ 		free(title);
+ 		run_command(command, 0);
+ 		free(command);

+ 44 - 0
package/u-boot/patches/patch-include_configs_rpi_h

@@ -0,0 +1,44 @@
+--- u-boot-d8bec60c1b0de7770f9b56ad092ab9be801d99af.orig/include/configs/rpi.h	2015-01-06 09:00:23.000000000 +0100
++++ u-boot-d8bec60c1b0de7770f9b56ad092ab9be801d99af/include/configs/rpi.h	2015-01-07 18:05:13.563156954 +0100
+@@ -19,6 +19,8 @@
+ 
+ #include <linux/sizes.h>
+ 
++#undef DEBUG
++
+ /* Architecture, CPU, etc.*/
+ #define CONFIG_SYS_GENERIC_BOARD
+ #define CONFIG_BCM2835
+@@ -96,7 +98,7 @@
+ /* Console UART */
+ #define CONFIG_PL01X_SERIAL
+ #define CONFIG_CONS_INDEX		0
+-#define CONFIG_BAUDRATE			115200
++#define CONFIG_BAUDRATE			9600
+ 
+ /* Console configuration */
+ #define CONFIG_SYS_CBSIZE		1024
+@@ -117,7 +119,7 @@
+ 
+ /* Shell */
+ #define CONFIG_SYS_MAXARGS		8
+-#define CONFIG_SYS_PROMPT		"U-Boot> "
++#define CONFIG_SYS_PROMPT		"CONET-Boot> "
+ #define CONFIG_COMMAND_HISTORY
+ 
+ /* Commands */
+@@ -185,9 +187,12 @@
+ 
+ #define CONFIG_EXTRA_ENV_SETTINGS \
+ 	ENV_DEVICE_SETTINGS \
+-	ENV_MEM_LAYOUT_SETTINGS \
+-	BOOTENV
++	ENV_MEM_LAYOUT_SETTINGS
+ 
+ #define CONFIG_BOOTDELAY 2
++#define CONFIG_CMD_BOOTMENU
++#define CONFIG_MENU
++#define CONFIG_AUTOBOOT_KEYED
++#define CONFIG_MENU_SHOW
+ 
+ #endif

+ 11 - 0
package/u-boot/patches/patch-include_env_default_h

@@ -0,0 +1,11 @@
+--- u-boot-2015.01.orig/include/env_default.h	2015-01-12 15:39:08.000000000 +0100
++++ u-boot-2015.01/include/env_default.h	2015-02-16 10:23:23.123639584 +0100
+@@ -8,6 +8,8 @@
+  * SPDX-License-Identifier:	GPL-2.0+
+  */
+ 
++#include <generated/autoconf.h>
++
+ #include <env_callback.h>
+ 
+ #ifdef DEFAULT_ENV_INSTANCE_EMBEDDED

+ 11 - 0
package/u-boot/patches/patch-tools_env_fw_env_h

@@ -0,0 +1,11 @@
+--- u-boot-d8bec60c1b0de7770f9b56ad092ab9be801d99af.orig/tools/env/fw_env.h	2015-01-06 09:00:23.000000000 +0100
++++ u-boot-d8bec60c1b0de7770f9b56ad092ab9be801d99af/tools/env/fw_env.h	2015-01-07 13:13:44.399072426 +0100
+@@ -14,6 +14,8 @@
+ #include <config.h>
+ #endif
+ 
++#include <generated/autoconf.h>
++
+ /*
+  * To build the utility with the static configuration
+  * comment out the next line.

+ 2 - 2
package/xterm/Makefile

@@ -4,9 +4,9 @@
 include $(ADK_TOPDIR)/rules.mk
 
 PKG_NAME:=		xterm
-PKG_VERSION:=		306
+PKG_VERSION:=		314
 PKG_RELEASE:=		1
-PKG_HASH:=		6a09f60d126603604d0c801e3f5000e4af87b309e8e1d3c0735be50b6d13bdaa
+PKG_HASH:=		1dbf1e93796c1b71b22b84e82eb58bcf20a14a7f365158819f3b4dbb29fe93f0
 PKG_DESCR:=		terminal emulator
 PKG_SECTION:=		x11/apps
 PKG_DEPENDS:=		libxaw libxt libncurses libxft fontconfig

+ 0 - 11
package/xterm/patches/patch-xterm_h

@@ -1,11 +0,0 @@
---- xterm-297.orig/xterm.h	2013-09-10 12:55:04.000000000 +0200
-+++ xterm-297/xterm.h	2013-10-30 17:19:53.000000000 +0100
-@@ -99,7 +99,7 @@
- #define HAVE_PUTENV 1
- #endif
- 
--#if defined(CSRG_BASED) || defined(__GNU__)
-+#if defined(CSRG_BASED) || defined(__linux__)
- #define USE_POSIX_TERMIOS 1
- #endif
- 

+ 3252 - 0
target/arm/solidrun-imx6/patches/3.18.8/solidrun-imx6-wlan.patch

@@ -0,0 +1,3252 @@
+diff -Nur linux-3.18.8.orig/arch/arm/boot/dts/imx6qdl-cubox-i.dtsi linux-3.18.8/arch/arm/boot/dts/imx6qdl-cubox-i.dtsi
+--- linux-3.18.8.orig/arch/arm/boot/dts/imx6qdl-cubox-i.dtsi	2015-02-27 02:49:36.000000000 +0100
++++ linux-3.18.8/arch/arm/boot/dts/imx6qdl-cubox-i.dtsi	2015-03-02 03:23:14.000000000 +0100
+@@ -170,6 +170,28 @@
+ 				MX6QDL_PAD_SD2_DAT3__SD2_DATA3 0x13059
+ 			>;
+ 		};
++
++		pinctrl_cubox_i_usdhc2_100mhz: cubox-i-usdhc2-100mhz {
++			fsl,pins = <
++				MX6QDL_PAD_SD2_CMD__SD2_CMD    0x170b9
++				MX6QDL_PAD_SD2_CLK__SD2_CLK    0x100b9
++				MX6QDL_PAD_SD2_DAT0__SD2_DATA0 0x170b9
++				MX6QDL_PAD_SD2_DAT1__SD2_DATA1 0x170b9
++				MX6QDL_PAD_SD2_DAT2__SD2_DATA2 0x170b9
++				MX6QDL_PAD_SD2_DAT3__SD2_DATA3 0x130b9
++			>;
++		};
++
++		pinctrl_cubox_i_usdhc2_200mhz: cubox-i-usdhc2-200mhz {
++			fsl,pins = <
++				MX6QDL_PAD_SD2_CMD__SD2_CMD    0x170f9
++				MX6QDL_PAD_SD2_CLK__SD2_CLK    0x100f9
++				MX6QDL_PAD_SD2_DAT0__SD2_DATA0 0x170f9
++				MX6QDL_PAD_SD2_DAT1__SD2_DATA1 0x170f9
++				MX6QDL_PAD_SD2_DAT2__SD2_DATA2 0x170f9
++				MX6QDL_PAD_SD2_DAT3__SD2_DATA3 0x130f9
++			>;
++		};
+ 	};
+ };
+ 
+@@ -194,8 +216,10 @@
+ };
+ 
+ &usdhc2 {
+-	pinctrl-names = "default";
++	pinctrl-names = "default", "state_100mhz", "state_200mhz";
+ 	pinctrl-0 = <&pinctrl_cubox_i_usdhc2_aux &pinctrl_cubox_i_usdhc2>;
++	pinctrl-1 = <&pinctrl_cubox_i_usdhc2_aux &pinctrl_cubox_i_usdhc2_100mhz>;
++	pinctrl-2 = <&pinctrl_cubox_i_usdhc2_aux &pinctrl_cubox_i_usdhc2_200mhz>;
+ 	vmmc-supply = <&reg_3p3v>;
+ 	cd-gpios = <&gpio1 4 0>;
+ 	status = "okay";
+diff -Nur linux-3.18.8.orig/arch/arm/boot/dts/imx6qdl-microsom.dtsi linux-3.18.8/arch/arm/boot/dts/imx6qdl-microsom.dtsi
+--- linux-3.18.8.orig/arch/arm/boot/dts/imx6qdl-microsom.dtsi	2015-02-27 02:49:36.000000000 +0100
++++ linux-3.18.8/arch/arm/boot/dts/imx6qdl-microsom.dtsi	2015-03-02 02:58:12.000000000 +0100
+@@ -1,15 +1,95 @@
+ /*
+  * Copyright (C) 2013,2014 Russell King
+  */
++#include <dt-bindings/gpio/gpio.h>
++/ {
++	regulators {
++		compatible = "simple-bus";
++
++		reg_brcm_osc: brcm-osc-reg {
++			compatible = "regulator-fixed";
++			enable-active-high;
++			gpio = <&gpio5 5 0>;
++			pinctrl-names = "default";
++			pinctrl-0 = <&pinctrl_microsom_brcm_osc_reg>;
++			regulator-name = "brcm_osc_reg";
++			regulator-min-microvolt = <3300000>;
++			regulator-max-microvolt = <3300000>;
++			regulator-always-on;
++			regulator-boot-on;
++		};
++
++		reg_brcm: brcm-reg {
++			compatible = "regulator-fixed";
++			enable-active-high;
++			gpio = <&gpio3 19 0>;
++			pinctrl-names = "default";
++			pinctrl-0 = <&pinctrl_microsom_brcm_reg>;
++			regulator-name = "brcm_reg";
++			regulator-min-microvolt = <3300000>;
++			regulator-max-microvolt = <3300000>;
++			startup-delay-us = <200000>;
++		};
++	};
++};
+ 
+ &iomuxc {
+ 	microsom {
++		pinctrl_microsom_brcm_bt: microsom-brcm-bt {
++			fsl,pins = <
++				MX6QDL_PAD_CSI0_DAT14__GPIO6_IO00	0x40013070
++				MX6QDL_PAD_CSI0_DAT15__GPIO6_IO01	0x40013070
++				MX6QDL_PAD_CSI0_DAT18__GPIO6_IO04	0x40013070
++			>;
++		};
++
++		pinctrl_microsom_brcm_osc_reg: microsom-brcm-osc-reg {
++			fsl,pins = <
++				MX6QDL_PAD_DISP0_DAT11__GPIO5_IO05	0x40013070
++			>;
++		};
++
++		pinctrl_microsom_brcm_reg: microsom-brcm-reg {
++			fsl,pins = <
++				MX6QDL_PAD_EIM_D19__GPIO3_IO19		0x40013070
++			>;
++		};
++
++		pinctrl_microsom_brcm_wifi: microsom-brcm-wifi {
++			fsl,pins = <
++				MX6QDL_PAD_GPIO_8__XTALOSC_REF_CLK_32K	0x1b0b0
++				MX6QDL_PAD_CSI0_DATA_EN__GPIO5_IO20	0x40013070
++				MX6QDL_PAD_CSI0_DAT8__GPIO5_IO26	0x40013070
++				MX6QDL_PAD_CSI0_DAT9__GPIO5_IO27	0x40013070
++			>;
++		};
++
+ 		pinctrl_microsom_uart1: microsom-uart1 {
+ 			fsl,pins = <
+ 				MX6QDL_PAD_CSI0_DAT10__UART1_TX_DATA	0x1b0b1
+ 				MX6QDL_PAD_CSI0_DAT11__UART1_RX_DATA	0x1b0b1
+ 			>;
+ 		};
++
++		pinctrl_microsom_uart4_1: microsom-uart4 {
++			fsl,pins = <
++				MX6QDL_PAD_CSI0_DAT12__UART4_TX_DATA 0x1b0b1
++				MX6QDL_PAD_CSI0_DAT13__UART4_RX_DATA 0x1b0b1
++				MX6QDL_PAD_CSI0_DAT16__UART4_RTS_B 0x1b0b1
++				MX6QDL_PAD_CSI0_DAT17__UART4_CTS_B 0x1b0b1
++			>;
++		};
++
++		pinctrl_microsom_usdhc1: microsom-usdhc1 {
++			fsl,pins = <
++				MX6QDL_PAD_SD1_CMD__SD1_CMD    0x17059
++				MX6QDL_PAD_SD1_CLK__SD1_CLK    0x10059
++				MX6QDL_PAD_SD1_DAT0__SD1_DATA0 0x17059
++				MX6QDL_PAD_SD1_DAT1__SD1_DATA1 0x17059
++				MX6QDL_PAD_SD1_DAT2__SD1_DATA2 0x17059
++				MX6QDL_PAD_SD1_DAT3__SD1_DATA3 0x17059
++			>;
++		};
+ 	};
+ };
+ 
+@@ -18,3 +98,23 @@
+ 	pinctrl-0 = <&pinctrl_microsom_uart1>;
+ 	status = "okay";
+ };
++
++/* UART4 - Connected to optional BRCM Wifi/BT/FM */
++&uart4 {
++	pinctrl-names = "default";
++	pinctrl-0 = <&pinctrl_microsom_brcm_bt &pinctrl_microsom_uart4_1>;
++	fsl,uart-has-rtscts;
++	status = "okay";
++};
++
++/* USDHC1 - Connected to optional BRCM Wifi/BT/FM */
++&usdhc1 {
++	card-external-vcc-supply = <&reg_brcm>;
++	card-reset-gpios = <&gpio5 26 GPIO_ACTIVE_LOW>, <&gpio6 0 GPIO_ACTIVE_LOW>;
++	keep-power-in-suspend;
++	non-removable;
++	pinctrl-names = "default";
++	pinctrl-0 = <&pinctrl_microsom_brcm_wifi &pinctrl_microsom_usdhc1>;
++	vmmc-supply = <&reg_brcm>;
++	status = "okay";
++};
+diff -Nur linux-3.18.8.orig/Documentation/devicetree/bindings/mmc/mmc.txt linux-3.18.8/Documentation/devicetree/bindings/mmc/mmc.txt
+--- linux-3.18.8.orig/Documentation/devicetree/bindings/mmc/mmc.txt	2015-02-27 02:49:36.000000000 +0100
++++ linux-3.18.8/Documentation/devicetree/bindings/mmc/mmc.txt	2015-03-02 03:25:33.000000000 +0100
+@@ -5,6 +5,8 @@
+ Interpreted by the OF core:
+ - reg: Registers location and length.
+ - interrupts: Interrupts used by the MMC controller.
++- clocks: Clocks needed for the host controller, if any.
++- clock-names: Goes with clocks above.
+ 
+ Card detection:
+ If no property below is supplied, host native card detect is used.
+@@ -43,6 +45,15 @@
+ - dsr: Value the card's (optional) Driver Stage Register (DSR) should be
+   programmed with. Valid range: [0 .. 0xffff].
+ 
++Card power and reset control:
++The following properties can be specified for cases where the MMC
++peripheral needs additional reset, regulator and clock lines. It is for
++example common for WiFi/BT adapters to have these separate from the main
++MMC bus:
++  - card-reset-gpios: Specify GPIOs for card reset (reset active low)
++  - card-external-vcc-supply: Regulator to drive (independent) card VCC
++  - clock with name "card_ext_clock": External clock provided to the card
++
+ *NOTE* on CD and WP polarity. To use common for all SD/MMC host controllers line
+ polarity properties, we have to fix the meaning of the "normal" and "inverted"
+ line levels. We choose to follow the SDHCI standard, which specifies both those
+diff -Nur linux-3.18.8.orig/drivers/mmc/core/core.c linux-3.18.8/drivers/mmc/core/core.c
+--- linux-3.18.8.orig/drivers/mmc/core/core.c	2015-02-27 02:49:36.000000000 +0100
++++ linux-3.18.8/drivers/mmc/core/core.c	2015-03-02 03:25:33.000000000 +0100
+@@ -13,11 +13,13 @@
+ #include <linux/module.h>
+ #include <linux/init.h>
+ #include <linux/interrupt.h>
++#include <linux/clk.h>
+ #include <linux/completion.h>
+ #include <linux/device.h>
+ #include <linux/delay.h>
+ #include <linux/pagemap.h>
+ #include <linux/err.h>
++#include <linux/gpio/consumer.h>
+ #include <linux/leds.h>
+ #include <linux/scatterlist.h>
+ #include <linux/log2.h>
+@@ -1507,6 +1509,43 @@
+ 	mmc_host_clk_release(host);
+ }
+ 
++static void mmc_card_power_up(struct mmc_host *host)
++{
++	int i;
++	struct gpio_desc **gds = host->card_reset_gpios;
++
++	for (i = 0; i < ARRAY_SIZE(host->card_reset_gpios); i++) {
++		if (gds[i]) {
++			dev_dbg(host->parent, "Asserting reset line %d", i);
++			gpiod_set_value(gds[i], 1);
++		}
++	}
++
++	if (host->card_regulator) {
++		dev_dbg(host->parent, "Enabling external regulator");
++		if (regulator_enable(host->card_regulator))
++			dev_err(host->parent, "Failed to enable external regulator");
++	}
++
++	if (host->card_clk) {
++		dev_dbg(host->parent, "Enabling external clock");
++		clk_prepare_enable(host->card_clk);
++	}
++
++	/* 2ms delay to let clocks and power settle */
++	mmc_delay(20);
++
++	for (i = 0; i < ARRAY_SIZE(host->card_reset_gpios); i++) {
++		if (gds[i]) {
++			dev_dbg(host->parent, "Deasserting reset line %d", i);
++			gpiod_set_value(gds[i], 0);
++		}
++	}
++
++	/* 2ms delay to after reset release */
++	mmc_delay(20);
++}
++
+ /*
+  * Apply power to the MMC stack.  This is a two-stage process.
+  * First, we enable power to the card without the clock running.
+@@ -1523,6 +1562,9 @@
+ 	if (host->ios.power_mode == MMC_POWER_ON)
+ 		return;
+ 
++	/* Power up the card/module first, if needed */
++	mmc_card_power_up(host);
++
+ 	mmc_host_clk_hold(host);
+ 
+ 	host->ios.vdd = fls(ocr) - 1;
+diff -Nur linux-3.18.8.orig/drivers/mmc/core/host.c linux-3.18.8/drivers/mmc/core/host.c
+--- linux-3.18.8.orig/drivers/mmc/core/host.c	2015-02-27 02:49:36.000000000 +0100
++++ linux-3.18.8/drivers/mmc/core/host.c	2015-03-02 03:26:23.000000000 +0100
+@@ -12,14 +12,18 @@
+  *  MMC host class device management
+  */
+ 
++#include <linux/kernel.h>
++#include <linux/clk.h>
+ #include <linux/device.h>
+ #include <linux/err.h>
++#include <linux/gpio/consumer.h>
+ #include <linux/idr.h>
+ #include <linux/of.h>
+ #include <linux/of_gpio.h>
+ #include <linux/pagemap.h>
+ #include <linux/export.h>
+ #include <linux/leds.h>
++#include <linux/regulator/consumer.h>
+ #include <linux/slab.h>
+ #include <linux/suspend.h>
+ 
+@@ -466,6 +470,66 @@
+ 
+ EXPORT_SYMBOL(mmc_of_parse);
+ 
++static int mmc_of_parse_child(struct mmc_host *host)
++{
++	struct device_node *np;
++	struct clk *clk;
++	int i;
++
++	if (!host->parent || !host->parent->of_node)
++		return 0;
++
++	np = host->parent->of_node;
++
++	host->card_regulator = regulator_get(host->parent, "card-external-vcc");
++	if (IS_ERR(host->card_regulator)) {
++		if (PTR_ERR(host->card_regulator) == -EPROBE_DEFER)
++			return PTR_ERR(host->card_regulator);
++		host->card_regulator = NULL;
++	}
++
++	/* Parse card power/reset/clock control */
++	if (of_find_property(np, "card-reset-gpios", NULL)) {
++		struct gpio_desc *gpd;
++		int level = 0;
++
++		/*
++		 * If the regulator is enabled, then we can hold the
++		 * card in reset with an active high resets.  Otherwise,
++		 * hold the resets low.
++		 */
++		if (host->card_regulator && regulator_is_enabled(host->card_regulator))
++			level = 1;
++
++		for (i = 0; i < ARRAY_SIZE(host->card_reset_gpios); i++) {
++			gpd = devm_gpiod_get_index(host->parent, "card-reset", i);
++			if (IS_ERR(gpd)) {
++				if (PTR_ERR(gpd) == -EPROBE_DEFER)
++					return PTR_ERR(gpd);
++				break;
++			}
++			gpiod_direction_output(gpd, gpiod_is_active_low(gpd) | level);
++			host->card_reset_gpios[i] = gpd;
++		}
++
++		gpd = devm_gpiod_get_index(host->parent, "card-reset", ARRAY_SIZE(host->card_reset_gpios));
++		if (!IS_ERR(gpd)) {
++			dev_warn(host->parent, "More reset gpios than we can handle");
++			gpiod_put(gpd);
++		}
++	}
++
++	clk = of_clk_get_by_name(np, "card_ext_clock");
++	if (IS_ERR(clk)) {
++		if (PTR_ERR(clk) == -EPROBE_DEFER)
++			return PTR_ERR(clk);
++		clk = NULL;
++	}
++	host->card_clk = clk;
++
++	return 0;
++}
++
+ /**
+  *	mmc_alloc_host - initialise the per-host structure.
+  *	@extra: sizeof private data structure
+@@ -545,6 +609,10 @@
+ {
+ 	int err;
+ 
++	err = mmc_of_parse_child(host);
++	if (err)
++		return err;
++
+ 	WARN_ON((host->caps & MMC_CAP_SDIO_IRQ) &&
+ 		!host->ops->enable_sdio_irq);
+ 
+diff -Nur linux-3.18.8.orig/drivers/mmc/host/dw_mmc.c linux-3.18.8/drivers/mmc/host/dw_mmc.c
+--- linux-3.18.8.orig/drivers/mmc/host/dw_mmc.c	2015-02-27 02:49:36.000000000 +0100
++++ linux-3.18.8/drivers/mmc/host/dw_mmc.c	2015-03-02 03:25:56.000000000 +0100
+@@ -2211,6 +2211,8 @@
+ 	if (!mmc)
+ 		return -ENOMEM;
+ 
++	mmc_of_parse(mmc);
++
+ 	slot = mmc_priv(mmc);
+ 	slot->id = id;
+ 	slot->mmc = mmc;
+diff -Nur linux-3.18.8.orig/drivers/mmc/host/dw_mmc.c.orig linux-3.18.8/drivers/mmc/host/dw_mmc.c.orig
+--- linux-3.18.8.orig/drivers/mmc/host/dw_mmc.c.orig	1970-01-01 01:00:00.000000000 +0100
++++ linux-3.18.8/drivers/mmc/host/dw_mmc.c.orig	2015-02-27 02:49:36.000000000 +0100
+@@ -0,0 +1,2855 @@
++/*
++ * Synopsys DesignWare Multimedia Card Interface driver
++ *  (Based on NXP driver for lpc 31xx)
++ *
++ * Copyright (C) 2009 NXP Semiconductors
++ * Copyright (C) 2009, 2010 Imagination Technologies Ltd.
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License as published by
++ * the Free Software Foundation; either version 2 of the License, or
++ * (at your option) any later version.
++ */
++
++#include <linux/blkdev.h>
++#include <linux/clk.h>
++#include <linux/debugfs.h>
++#include <linux/device.h>
++#include <linux/dma-mapping.h>
++#include <linux/err.h>
++#include <linux/init.h>
++#include <linux/interrupt.h>
++#include <linux/ioport.h>
++#include <linux/module.h>
++#include <linux/platform_device.h>
++#include <linux/seq_file.h>
++#include <linux/slab.h>
++#include <linux/stat.h>
++#include <linux/delay.h>
++#include <linux/irq.h>
++#include <linux/mmc/host.h>
++#include <linux/mmc/mmc.h>
++#include <linux/mmc/sd.h>
++#include <linux/mmc/sdio.h>
++#include <linux/mmc/dw_mmc.h>
++#include <linux/bitops.h>
++#include <linux/regulator/consumer.h>
++#include <linux/workqueue.h>
++#include <linux/of.h>
++#include <linux/of_gpio.h>
++#include <linux/mmc/slot-gpio.h>
++
++#include "dw_mmc.h"
++
++/* Common flag combinations */
++#define DW_MCI_DATA_ERROR_FLAGS	(SDMMC_INT_DRTO | SDMMC_INT_DCRC | \
++				 SDMMC_INT_HTO | SDMMC_INT_SBE  | \
++				 SDMMC_INT_EBE)
++#define DW_MCI_CMD_ERROR_FLAGS	(SDMMC_INT_RTO | SDMMC_INT_RCRC | \
++				 SDMMC_INT_RESP_ERR)
++#define DW_MCI_ERROR_FLAGS	(DW_MCI_DATA_ERROR_FLAGS | \
++				 DW_MCI_CMD_ERROR_FLAGS  | SDMMC_INT_HLE)
++#define DW_MCI_SEND_STATUS	1
++#define DW_MCI_RECV_STATUS	2
++#define DW_MCI_DMA_THRESHOLD	16
++
++#define DW_MCI_FREQ_MAX	200000000	/* unit: HZ */
++#define DW_MCI_FREQ_MIN	400000		/* unit: HZ */
++
++#ifdef CONFIG_MMC_DW_IDMAC
++#define IDMAC_INT_CLR		(SDMMC_IDMAC_INT_AI | SDMMC_IDMAC_INT_NI | \
++				 SDMMC_IDMAC_INT_CES | SDMMC_IDMAC_INT_DU | \
++				 SDMMC_IDMAC_INT_FBE | SDMMC_IDMAC_INT_RI | \
++				 SDMMC_IDMAC_INT_TI)
++
++struct idmac_desc {
++	u32		des0;	/* Control Descriptor */
++#define IDMAC_DES0_DIC	BIT(1)
++#define IDMAC_DES0_LD	BIT(2)
++#define IDMAC_DES0_FD	BIT(3)
++#define IDMAC_DES0_CH	BIT(4)
++#define IDMAC_DES0_ER	BIT(5)
++#define IDMAC_DES0_CES	BIT(30)
++#define IDMAC_DES0_OWN	BIT(31)
++
++	u32		des1;	/* Buffer sizes */
++#define IDMAC_SET_BUFFER1_SIZE(d, s) \
++	((d)->des1 = ((d)->des1 & 0x03ffe000) | ((s) & 0x1fff))
++
++	u32		des2;	/* buffer 1 physical address */
++
++	u32		des3;	/* buffer 2 physical address */
++};
++#endif /* CONFIG_MMC_DW_IDMAC */
++
++static bool dw_mci_reset(struct dw_mci *host);
++
++#if defined(CONFIG_DEBUG_FS)
++static int dw_mci_req_show(struct seq_file *s, void *v)
++{
++	struct dw_mci_slot *slot = s->private;
++	struct mmc_request *mrq;
++	struct mmc_command *cmd;
++	struct mmc_command *stop;
++	struct mmc_data	*data;
++
++	/* Make sure we get a consistent snapshot */
++	spin_lock_bh(&slot->host->lock);
++	mrq = slot->mrq;
++
++	if (mrq) {
++		cmd = mrq->cmd;
++		data = mrq->data;
++		stop = mrq->stop;
++
++		if (cmd)
++			seq_printf(s,
++				   "CMD%u(0x%x) flg %x rsp %x %x %x %x err %d\n",
++				   cmd->opcode, cmd->arg, cmd->flags,
++				   cmd->resp[0], cmd->resp[1], cmd->resp[2],
++				   cmd->resp[2], cmd->error);
++		if (data)
++			seq_printf(s, "DATA %u / %u * %u flg %x err %d\n",
++				   data->bytes_xfered, data->blocks,
++				   data->blksz, data->flags, data->error);
++		if (stop)
++			seq_printf(s,
++				   "CMD%u(0x%x) flg %x rsp %x %x %x %x err %d\n",
++				   stop->opcode, stop->arg, stop->flags,
++				   stop->resp[0], stop->resp[1], stop->resp[2],
++				   stop->resp[2], stop->error);
++	}
++
++	spin_unlock_bh(&slot->host->lock);
++
++	return 0;
++}
++
++static int dw_mci_req_open(struct inode *inode, struct file *file)
++{
++	return single_open(file, dw_mci_req_show, inode->i_private);
++}
++
++static const struct file_operations dw_mci_req_fops = {
++	.owner		= THIS_MODULE,
++	.open		= dw_mci_req_open,
++	.read		= seq_read,
++	.llseek		= seq_lseek,
++	.release	= single_release,
++};
++
++static int dw_mci_regs_show(struct seq_file *s, void *v)
++{
++	seq_printf(s, "STATUS:\t0x%08x\n", SDMMC_STATUS);
++	seq_printf(s, "RINTSTS:\t0x%08x\n", SDMMC_RINTSTS);
++	seq_printf(s, "CMD:\t0x%08x\n", SDMMC_CMD);
++	seq_printf(s, "CTRL:\t0x%08x\n", SDMMC_CTRL);
++	seq_printf(s, "INTMASK:\t0x%08x\n", SDMMC_INTMASK);
++	seq_printf(s, "CLKENA:\t0x%08x\n", SDMMC_CLKENA);
++
++	return 0;
++}
++
++static int dw_mci_regs_open(struct inode *inode, struct file *file)
++{
++	return single_open(file, dw_mci_regs_show, inode->i_private);
++}
++
++static const struct file_operations dw_mci_regs_fops = {
++	.owner		= THIS_MODULE,
++	.open		= dw_mci_regs_open,
++	.read		= seq_read,
++	.llseek		= seq_lseek,
++	.release	= single_release,
++};
++
++static void dw_mci_init_debugfs(struct dw_mci_slot *slot)
++{
++	struct mmc_host	*mmc = slot->mmc;
++	struct dw_mci *host = slot->host;
++	struct dentry *root;
++	struct dentry *node;
++
++	root = mmc->debugfs_root;
++	if (!root)
++		return;
++
++	node = debugfs_create_file("regs", S_IRUSR, root, host,
++				   &dw_mci_regs_fops);
++	if (!node)
++		goto err;
++
++	node = debugfs_create_file("req", S_IRUSR, root, slot,
++				   &dw_mci_req_fops);
++	if (!node)
++		goto err;
++
++	node = debugfs_create_u32("state", S_IRUSR, root, (u32 *)&host->state);
++	if (!node)
++		goto err;
++
++	node = debugfs_create_x32("pending_events", S_IRUSR, root,
++				  (u32 *)&host->pending_events);
++	if (!node)
++		goto err;
++
++	node = debugfs_create_x32("completed_events", S_IRUSR, root,
++				  (u32 *)&host->completed_events);
++	if (!node)
++		goto err;
++
++	return;
++
++err:
++	dev_err(&mmc->class_dev, "failed to initialize debugfs for slot\n");
++}
++#endif /* defined(CONFIG_DEBUG_FS) */
++
++static void mci_send_cmd(struct dw_mci_slot *slot, u32 cmd, u32 arg);
++
++static u32 dw_mci_prepare_command(struct mmc_host *mmc, struct mmc_command *cmd)
++{
++	struct mmc_data	*data;
++	struct dw_mci_slot *slot = mmc_priv(mmc);
++	struct dw_mci *host = slot->host;
++	const struct dw_mci_drv_data *drv_data = slot->host->drv_data;
++	u32 cmdr;
++	cmd->error = -EINPROGRESS;
++
++	cmdr = cmd->opcode;
++
++	if (cmd->opcode == MMC_STOP_TRANSMISSION ||
++	    cmd->opcode == MMC_GO_IDLE_STATE ||
++	    cmd->opcode == MMC_GO_INACTIVE_STATE ||
++	    (cmd->opcode == SD_IO_RW_DIRECT &&
++	     ((cmd->arg >> 9) & 0x1FFFF) == SDIO_CCCR_ABORT))
++		cmdr |= SDMMC_CMD_STOP;
++	else if (cmd->opcode != MMC_SEND_STATUS && cmd->data)
++		cmdr |= SDMMC_CMD_PRV_DAT_WAIT;
++
++	if (cmd->opcode == SD_SWITCH_VOLTAGE) {
++		u32 clk_en_a;
++
++		/* Special bit makes CMD11 not die */
++		cmdr |= SDMMC_CMD_VOLT_SWITCH;
++
++		/* Change state to continue to handle CMD11 weirdness */
++		WARN_ON(slot->host->state != STATE_SENDING_CMD);
++		slot->host->state = STATE_SENDING_CMD11;
++
++		/*
++		 * We need to disable low power mode (automatic clock stop)
++		 * while doing voltage switch so we don't confuse the card,
++		 * since stopping the clock is a specific part of the UHS
++		 * voltage change dance.
++		 *
++		 * Note that low power mode (SDMMC_CLKEN_LOW_PWR) will be
++		 * unconditionally turned back on in dw_mci_setup_bus() if it's
++		 * ever called with a non-zero clock.  That shouldn't happen
++		 * until the voltage change is all done.
++		 */
++		clk_en_a = mci_readl(host, CLKENA);
++		clk_en_a &= ~(SDMMC_CLKEN_LOW_PWR << slot->id);
++		mci_writel(host, CLKENA, clk_en_a);
++		mci_send_cmd(slot, SDMMC_CMD_UPD_CLK |
++			     SDMMC_CMD_PRV_DAT_WAIT, 0);
++	}
++
++	if (cmd->flags & MMC_RSP_PRESENT) {
++		/* We expect a response, so set this bit */
++		cmdr |= SDMMC_CMD_RESP_EXP;
++		if (cmd->flags & MMC_RSP_136)
++			cmdr |= SDMMC_CMD_RESP_LONG;
++	}
++
++	if (cmd->flags & MMC_RSP_CRC)
++		cmdr |= SDMMC_CMD_RESP_CRC;
++
++	data = cmd->data;
++	if (data) {
++		cmdr |= SDMMC_CMD_DAT_EXP;
++		if (data->flags & MMC_DATA_STREAM)
++			cmdr |= SDMMC_CMD_STRM_MODE;
++		if (data->flags & MMC_DATA_WRITE)
++			cmdr |= SDMMC_CMD_DAT_WR;
++	}
++
++	if (drv_data && drv_data->prepare_command)
++		drv_data->prepare_command(slot->host, &cmdr);
++
++	return cmdr;
++}
++
++static u32 dw_mci_prep_stop_abort(struct dw_mci *host, struct mmc_command *cmd)
++{
++	struct mmc_command *stop;
++	u32 cmdr;
++
++	if (!cmd->data)
++		return 0;
++
++	stop = &host->stop_abort;
++	cmdr = cmd->opcode;
++	memset(stop, 0, sizeof(struct mmc_command));
++
++	if (cmdr == MMC_READ_SINGLE_BLOCK ||
++	    cmdr == MMC_READ_MULTIPLE_BLOCK ||
++	    cmdr == MMC_WRITE_BLOCK ||
++	    cmdr == MMC_WRITE_MULTIPLE_BLOCK) {
++		stop->opcode = MMC_STOP_TRANSMISSION;
++		stop->arg = 0;
++		stop->flags = MMC_RSP_R1B | MMC_CMD_AC;
++	} else if (cmdr == SD_IO_RW_EXTENDED) {
++		stop->opcode = SD_IO_RW_DIRECT;
++		stop->arg |= (1 << 31) | (0 << 28) | (SDIO_CCCR_ABORT << 9) |
++			     ((cmd->arg >> 28) & 0x7);
++		stop->flags = MMC_RSP_SPI_R5 | MMC_RSP_R5 | MMC_CMD_AC;
++	} else {
++		return 0;
++	}
++
++	cmdr = stop->opcode | SDMMC_CMD_STOP |
++		SDMMC_CMD_RESP_CRC | SDMMC_CMD_RESP_EXP;
++
++	return cmdr;
++}
++
++static void dw_mci_start_command(struct dw_mci *host,
++				 struct mmc_command *cmd, u32 cmd_flags)
++{
++	host->cmd = cmd;
++	dev_vdbg(host->dev,
++		 "start command: ARGR=0x%08x CMDR=0x%08x\n",
++		 cmd->arg, cmd_flags);
++
++	mci_writel(host, CMDARG, cmd->arg);
++	wmb();
++
++	mci_writel(host, CMD, cmd_flags | SDMMC_CMD_START);
++}
++
++static inline void send_stop_abort(struct dw_mci *host, struct mmc_data *data)
++{
++	struct mmc_command *stop = data->stop ? data->stop : &host->stop_abort;
++	dw_mci_start_command(host, stop, host->stop_cmdr);
++}
++
++/* DMA interface functions */
++static void dw_mci_stop_dma(struct dw_mci *host)
++{
++	if (host->using_dma) {
++		host->dma_ops->stop(host);
++		host->dma_ops->cleanup(host);
++	}
++
++	/* Data transfer was stopped by the interrupt handler */
++	set_bit(EVENT_XFER_COMPLETE, &host->pending_events);
++}
++
++static int dw_mci_get_dma_dir(struct mmc_data *data)
++{
++	if (data->flags & MMC_DATA_WRITE)
++		return DMA_TO_DEVICE;
++	else
++		return DMA_FROM_DEVICE;
++}
++
++#ifdef CONFIG_MMC_DW_IDMAC
++static void dw_mci_dma_cleanup(struct dw_mci *host)
++{
++	struct mmc_data *data = host->data;
++
++	if (data)
++		if (!data->host_cookie)
++			dma_unmap_sg(host->dev,
++				     data->sg,
++				     data->sg_len,
++				     dw_mci_get_dma_dir(data));
++}
++
++static void dw_mci_idmac_reset(struct dw_mci *host)
++{
++	u32 bmod = mci_readl(host, BMOD);
++	/* Software reset of DMA */
++	bmod |= SDMMC_IDMAC_SWRESET;
++	mci_writel(host, BMOD, bmod);
++}
++
++static void dw_mci_idmac_stop_dma(struct dw_mci *host)
++{
++	u32 temp;
++
++	/* Disable and reset the IDMAC interface */
++	temp = mci_readl(host, CTRL);
++	temp &= ~SDMMC_CTRL_USE_IDMAC;
++	temp |= SDMMC_CTRL_DMA_RESET;
++	mci_writel(host, CTRL, temp);
++
++	/* Stop the IDMAC running */
++	temp = mci_readl(host, BMOD);
++	temp &= ~(SDMMC_IDMAC_ENABLE | SDMMC_IDMAC_FB);
++	temp |= SDMMC_IDMAC_SWRESET;
++	mci_writel(host, BMOD, temp);
++}
++
++static void dw_mci_idmac_complete_dma(struct dw_mci *host)
++{
++	struct mmc_data *data = host->data;
++
++	dev_vdbg(host->dev, "DMA complete\n");
++
++	host->dma_ops->cleanup(host);
++
++	/*
++	 * If the card was removed, data will be NULL. No point in trying to
++	 * send the stop command or waiting for NBUSY in this case.
++	 */
++	if (data) {
++		set_bit(EVENT_XFER_COMPLETE, &host->pending_events);
++		tasklet_schedule(&host->tasklet);
++	}
++}
++
++static void dw_mci_translate_sglist(struct dw_mci *host, struct mmc_data *data,
++				    unsigned int sg_len)
++{
++	int i;
++	struct idmac_desc *desc = host->sg_cpu;
++
++	for (i = 0; i < sg_len; i++, desc++) {
++		unsigned int length = sg_dma_len(&data->sg[i]);
++		u32 mem_addr = sg_dma_address(&data->sg[i]);
++
++		/* Set the OWN bit and disable interrupts for this descriptor */
++		desc->des0 = IDMAC_DES0_OWN | IDMAC_DES0_DIC | IDMAC_DES0_CH;
++
++		/* Buffer length */
++		IDMAC_SET_BUFFER1_SIZE(desc, length);
++
++		/* Physical address to DMA to/from */
++		desc->des2 = mem_addr;
++	}
++
++	/* Set first descriptor */
++	desc = host->sg_cpu;
++	desc->des0 |= IDMAC_DES0_FD;
++
++	/* Set last descriptor */
++	desc = host->sg_cpu + (i - 1) * sizeof(struct idmac_desc);
++	desc->des0 &= ~(IDMAC_DES0_CH | IDMAC_DES0_DIC);
++	desc->des0 |= IDMAC_DES0_LD;
++
++	wmb();
++}
++
++static void dw_mci_idmac_start_dma(struct dw_mci *host, unsigned int sg_len)
++{
++	u32 temp;
++
++	dw_mci_translate_sglist(host, host->data, sg_len);
++
++	/* Select IDMAC interface */
++	temp = mci_readl(host, CTRL);
++	temp |= SDMMC_CTRL_USE_IDMAC;
++	mci_writel(host, CTRL, temp);
++
++	wmb();
++
++	/* Enable the IDMAC */
++	temp = mci_readl(host, BMOD);
++	temp |= SDMMC_IDMAC_ENABLE | SDMMC_IDMAC_FB;
++	mci_writel(host, BMOD, temp);
++
++	/* Start it running */
++	mci_writel(host, PLDMND, 1);
++}
++
++static int dw_mci_idmac_init(struct dw_mci *host)
++{
++	struct idmac_desc *p;
++	int i;
++
++	/* Number of descriptors in the ring buffer */
++	host->ring_size = PAGE_SIZE / sizeof(struct idmac_desc);
++
++	/* Forward link the descriptor list */
++	for (i = 0, p = host->sg_cpu; i < host->ring_size - 1; i++, p++)
++		p->des3 = host->sg_dma + (sizeof(struct idmac_desc) * (i + 1));
++
++	/* Set the last descriptor as the end-of-ring descriptor */
++	p->des3 = host->sg_dma;
++	p->des0 = IDMAC_DES0_ER;
++
++	dw_mci_idmac_reset(host);
++
++	/* Mask out interrupts - get Tx & Rx complete only */
++	mci_writel(host, IDSTS, IDMAC_INT_CLR);
++	mci_writel(host, IDINTEN, SDMMC_IDMAC_INT_NI | SDMMC_IDMAC_INT_RI |
++		   SDMMC_IDMAC_INT_TI);
++
++	/* Set the descriptor base address */
++	mci_writel(host, DBADDR, host->sg_dma);
++	return 0;
++}
++
++static const struct dw_mci_dma_ops dw_mci_idmac_ops = {
++	.init = dw_mci_idmac_init,
++	.start = dw_mci_idmac_start_dma,
++	.stop = dw_mci_idmac_stop_dma,
++	.complete = dw_mci_idmac_complete_dma,
++	.cleanup = dw_mci_dma_cleanup,
++};
++#endif /* CONFIG_MMC_DW_IDMAC */
++
++static int dw_mci_pre_dma_transfer(struct dw_mci *host,
++				   struct mmc_data *data,
++				   bool next)
++{
++	struct scatterlist *sg;
++	unsigned int i, sg_len;
++
++	if (!next && data->host_cookie)
++		return data->host_cookie;
++
++	/*
++	 * We don't do DMA on "complex" transfers, i.e. with
++	 * non-word-aligned buffers or lengths. Also, we don't bother
++	 * with all the DMA setup overhead for short transfers.
++	 */
++	if (data->blocks * data->blksz < DW_MCI_DMA_THRESHOLD)
++		return -EINVAL;
++
++	if (data->blksz & 3)
++		return -EINVAL;
++
++	for_each_sg(data->sg, sg, data->sg_len, i) {
++		if (sg->offset & 3 || sg->length & 3)
++			return -EINVAL;
++	}
++
++	sg_len = dma_map_sg(host->dev,
++			    data->sg,
++			    data->sg_len,
++			    dw_mci_get_dma_dir(data));
++	if (sg_len == 0)
++		return -EINVAL;
++
++	if (next)
++		data->host_cookie = sg_len;
++
++	return sg_len;
++}
++
++static void dw_mci_pre_req(struct mmc_host *mmc,
++			   struct mmc_request *mrq,
++			   bool is_first_req)
++{
++	struct dw_mci_slot *slot = mmc_priv(mmc);
++	struct mmc_data *data = mrq->data;
++
++	if (!slot->host->use_dma || !data)
++		return;
++
++	if (data->host_cookie) {
++		data->host_cookie = 0;
++		return;
++	}
++
++	if (dw_mci_pre_dma_transfer(slot->host, mrq->data, 1) < 0)
++		data->host_cookie = 0;
++}
++
++static void dw_mci_post_req(struct mmc_host *mmc,
++			    struct mmc_request *mrq,
++			    int err)
++{
++	struct dw_mci_slot *slot = mmc_priv(mmc);
++	struct mmc_data *data = mrq->data;
++
++	if (!slot->host->use_dma || !data)
++		return;
++
++	if (data->host_cookie)
++		dma_unmap_sg(slot->host->dev,
++			     data->sg,
++			     data->sg_len,
++			     dw_mci_get_dma_dir(data));
++	data->host_cookie = 0;
++}
++
++static void dw_mci_adjust_fifoth(struct dw_mci *host, struct mmc_data *data)
++{
++#ifdef CONFIG_MMC_DW_IDMAC
++	unsigned int blksz = data->blksz;
++	const u32 mszs[] = {1, 4, 8, 16, 32, 64, 128, 256};
++	u32 fifo_width = 1 << host->data_shift;
++	u32 blksz_depth = blksz / fifo_width, fifoth_val;
++	u32 msize = 0, rx_wmark = 1, tx_wmark, tx_wmark_invers;
++	int idx = (sizeof(mszs) / sizeof(mszs[0])) - 1;
++
++	tx_wmark = (host->fifo_depth) / 2;
++	tx_wmark_invers = host->fifo_depth - tx_wmark;
++
++	/*
++	 * MSIZE is '1',
++	 * if blksz is not a multiple of the FIFO width
++	 */
++	if (blksz % fifo_width) {
++		msize = 0;
++		rx_wmark = 1;
++		goto done;
++	}
++
++	do {
++		if (!((blksz_depth % mszs[idx]) ||
++		     (tx_wmark_invers % mszs[idx]))) {
++			msize = idx;
++			rx_wmark = mszs[idx] - 1;
++			break;
++		}
++	} while (--idx > 0);
++	/*
++	 * If idx is '0', it won't be tried
++	 * Thus, initial values are uesed
++	 */
++done:
++	fifoth_val = SDMMC_SET_FIFOTH(msize, rx_wmark, tx_wmark);
++	mci_writel(host, FIFOTH, fifoth_val);
++#endif
++}
++
++static void dw_mci_ctrl_rd_thld(struct dw_mci *host, struct mmc_data *data)
++{
++	unsigned int blksz = data->blksz;
++	u32 blksz_depth, fifo_depth;
++	u16 thld_size;
++
++	WARN_ON(!(data->flags & MMC_DATA_READ));
++
++	/*
++	 * CDTHRCTL doesn't exist prior to 240A (in fact that register offset is
++	 * in the FIFO region, so we really shouldn't access it).
++	 */
++	if (host->verid < DW_MMC_240A)
++		return;
++
++	if (host->timing != MMC_TIMING_MMC_HS200 &&
++	    host->timing != MMC_TIMING_UHS_SDR104)
++		goto disable;
++
++	blksz_depth = blksz / (1 << host->data_shift);
++	fifo_depth = host->fifo_depth;
++
++	if (blksz_depth > fifo_depth)
++		goto disable;
++
++	/*
++	 * If (blksz_depth) >= (fifo_depth >> 1), should be 'thld_size <= blksz'
++	 * If (blksz_depth) <  (fifo_depth >> 1), should be thld_size = blksz
++	 * Currently just choose blksz.
++	 */
++	thld_size = blksz;
++	mci_writel(host, CDTHRCTL, SDMMC_SET_RD_THLD(thld_size, 1));
++	return;
++
++disable:
++	mci_writel(host, CDTHRCTL, SDMMC_SET_RD_THLD(0, 0));
++}
++
++static int dw_mci_submit_data_dma(struct dw_mci *host, struct mmc_data *data)
++{
++	int sg_len;
++	u32 temp;
++
++	host->using_dma = 0;
++
++	/* If we don't have a channel, we can't do DMA */
++	if (!host->use_dma)
++		return -ENODEV;
++
++	sg_len = dw_mci_pre_dma_transfer(host, data, 0);
++	if (sg_len < 0) {
++		host->dma_ops->stop(host);
++		return sg_len;
++	}
++
++	host->using_dma = 1;
++
++	dev_vdbg(host->dev,
++		 "sd sg_cpu: %#lx sg_dma: %#lx sg_len: %d\n",
++		 (unsigned long)host->sg_cpu, (unsigned long)host->sg_dma,
++		 sg_len);
++
++	/*
++	 * Decide the MSIZE and RX/TX Watermark.
++	 * If current block size is same with previous size,
++	 * no need to update fifoth.
++	 */
++	if (host->prev_blksz != data->blksz)
++		dw_mci_adjust_fifoth(host, data);
++
++	/* Enable the DMA interface */
++	temp = mci_readl(host, CTRL);
++	temp |= SDMMC_CTRL_DMA_ENABLE;
++	mci_writel(host, CTRL, temp);
++
++	/* Disable RX/TX IRQs, let DMA handle it */
++	temp = mci_readl(host, INTMASK);
++	temp  &= ~(SDMMC_INT_RXDR | SDMMC_INT_TXDR);
++	mci_writel(host, INTMASK, temp);
++
++	host->dma_ops->start(host, sg_len);
++
++	return 0;
++}
++
++static void dw_mci_submit_data(struct dw_mci *host, struct mmc_data *data)
++{
++	u32 temp;
++
++	data->error = -EINPROGRESS;
++
++	WARN_ON(host->data);
++	host->sg = NULL;
++	host->data = data;
++
++	if (data->flags & MMC_DATA_READ) {
++		host->dir_status = DW_MCI_RECV_STATUS;
++		dw_mci_ctrl_rd_thld(host, data);
++	} else {
++		host->dir_status = DW_MCI_SEND_STATUS;
++	}
++
++	if (dw_mci_submit_data_dma(host, data)) {
++		int flags = SG_MITER_ATOMIC;
++		if (host->data->flags & MMC_DATA_READ)
++			flags |= SG_MITER_TO_SG;
++		else
++			flags |= SG_MITER_FROM_SG;
++
++		sg_miter_start(&host->sg_miter, data->sg, data->sg_len, flags);
++		host->sg = data->sg;
++		host->part_buf_start = 0;
++		host->part_buf_count = 0;
++
++		mci_writel(host, RINTSTS, SDMMC_INT_TXDR | SDMMC_INT_RXDR);
++		temp = mci_readl(host, INTMASK);
++		temp |= SDMMC_INT_TXDR | SDMMC_INT_RXDR;
++		mci_writel(host, INTMASK, temp);
++
++		temp = mci_readl(host, CTRL);
++		temp &= ~SDMMC_CTRL_DMA_ENABLE;
++		mci_writel(host, CTRL, temp);
++
++		/*
++		 * Use the initial fifoth_val for PIO mode.
++		 * If next issued data may be transfered by DMA mode,
++		 * prev_blksz should be invalidated.
++		 */
++		mci_writel(host, FIFOTH, host->fifoth_val);
++		host->prev_blksz = 0;
++	} else {
++		/*
++		 * Keep the current block size.
++		 * It will be used to decide whether to update
++		 * fifoth register next time.
++		 */
++		host->prev_blksz = data->blksz;
++	}
++}
++
++static void mci_send_cmd(struct dw_mci_slot *slot, u32 cmd, u32 arg)
++{
++	struct dw_mci *host = slot->host;
++	unsigned long timeout = jiffies + msecs_to_jiffies(500);
++	unsigned int cmd_status = 0;
++
++	mci_writel(host, CMDARG, arg);
++	wmb();
++	mci_writel(host, CMD, SDMMC_CMD_START | cmd);
++
++	while (time_before(jiffies, timeout)) {
++		cmd_status = mci_readl(host, CMD);
++		if (!(cmd_status & SDMMC_CMD_START))
++			return;
++	}
++	dev_err(&slot->mmc->class_dev,
++		"Timeout sending command (cmd %#x arg %#x status %#x)\n",
++		cmd, arg, cmd_status);
++}
++
++static void dw_mci_setup_bus(struct dw_mci_slot *slot, bool force_clkinit)
++{
++	struct dw_mci *host = slot->host;
++	unsigned int clock = slot->clock;
++	u32 div;
++	u32 clk_en_a;
++	u32 sdmmc_cmd_bits = SDMMC_CMD_UPD_CLK | SDMMC_CMD_PRV_DAT_WAIT;
++
++	/* We must continue to set bit 28 in CMD until the change is complete */
++	if (host->state == STATE_WAITING_CMD11_DONE)
++		sdmmc_cmd_bits |= SDMMC_CMD_VOLT_SWITCH;
++
++	if (!clock) {
++		mci_writel(host, CLKENA, 0);
++		mci_send_cmd(slot, sdmmc_cmd_bits, 0);
++	} else if (clock != host->current_speed || force_clkinit) {
++		div = host->bus_hz / clock;
++		if (host->bus_hz % clock && host->bus_hz > clock)
++			/*
++			 * move the + 1 after the divide to prevent
++			 * over-clocking the card.
++			 */
++			div += 1;
++
++		div = (host->bus_hz != clock) ? DIV_ROUND_UP(div, 2) : 0;
++
++		if ((clock << div) != slot->__clk_old || force_clkinit)
++			dev_info(&slot->mmc->class_dev,
++				 "Bus speed (slot %d) = %dHz (slot req %dHz, actual %dHZ div = %d)\n",
++				 slot->id, host->bus_hz, clock,
++				 div ? ((host->bus_hz / div) >> 1) :
++				 host->bus_hz, div);
++
++		/* disable clock */
++		mci_writel(host, CLKENA, 0);
++		mci_writel(host, CLKSRC, 0);
++
++		/* inform CIU */
++		mci_send_cmd(slot, sdmmc_cmd_bits, 0);
++
++		/* set clock to desired speed */
++		mci_writel(host, CLKDIV, div);
++
++		/* inform CIU */
++		mci_send_cmd(slot, sdmmc_cmd_bits, 0);
++
++		/* enable clock; only low power if no SDIO */
++		clk_en_a = SDMMC_CLKEN_ENABLE << slot->id;
++		if (!(mci_readl(host, INTMASK) & SDMMC_INT_SDIO(slot->id)))
++			clk_en_a |= SDMMC_CLKEN_LOW_PWR << slot->id;
++		mci_writel(host, CLKENA, clk_en_a);
++
++		/* inform CIU */
++		mci_send_cmd(slot, sdmmc_cmd_bits, 0);
++
++		/* keep the clock with reflecting clock dividor */
++		slot->__clk_old = clock << div;
++	}
++
++	host->current_speed = clock;
++
++	/* Set the current slot bus width */
++	mci_writel(host, CTYPE, (slot->ctype << slot->id));
++}
++
++static void __dw_mci_start_request(struct dw_mci *host,
++				   struct dw_mci_slot *slot,
++				   struct mmc_command *cmd)
++{
++	struct mmc_request *mrq;
++	struct mmc_data	*data;
++	u32 cmdflags;
++
++	mrq = slot->mrq;
++
++	host->cur_slot = slot;
++	host->mrq = mrq;
++
++	host->pending_events = 0;
++	host->completed_events = 0;
++	host->cmd_status = 0;
++	host->data_status = 0;
++	host->dir_status = 0;
++
++	data = cmd->data;
++	if (data) {
++		mci_writel(host, TMOUT, 0xFFFFFFFF);
++		mci_writel(host, BYTCNT, data->blksz*data->blocks);
++		mci_writel(host, BLKSIZ, data->blksz);
++	}
++
++	cmdflags = dw_mci_prepare_command(slot->mmc, cmd);
++
++	/* this is the first command, send the initialization clock */
++	if (test_and_clear_bit(DW_MMC_CARD_NEED_INIT, &slot->flags))
++		cmdflags |= SDMMC_CMD_INIT;
++
++	if (data) {
++		dw_mci_submit_data(host, data);
++		wmb();
++	}
++
++	dw_mci_start_command(host, cmd, cmdflags);
++
++	if (mrq->stop)
++		host->stop_cmdr = dw_mci_prepare_command(slot->mmc, mrq->stop);
++	else
++		host->stop_cmdr = dw_mci_prep_stop_abort(host, cmd);
++}
++
++static void dw_mci_start_request(struct dw_mci *host,
++				 struct dw_mci_slot *slot)
++{
++	struct mmc_request *mrq = slot->mrq;
++	struct mmc_command *cmd;
++
++	cmd = mrq->sbc ? mrq->sbc : mrq->cmd;
++	__dw_mci_start_request(host, slot, cmd);
++}
++
++/* must be called with host->lock held */
++static void dw_mci_queue_request(struct dw_mci *host, struct dw_mci_slot *slot,
++				 struct mmc_request *mrq)
++{
++	dev_vdbg(&slot->mmc->class_dev, "queue request: state=%d\n",
++		 host->state);
++
++	slot->mrq = mrq;
++
++	if (host->state == STATE_WAITING_CMD11_DONE) {
++		dev_warn(&slot->mmc->class_dev,
++			 "Voltage change didn't complete\n");
++		/*
++		 * this case isn't expected to happen, so we can
++		 * either crash here or just try to continue on
++		 * in the closest possible state
++		 */
++		host->state = STATE_IDLE;
++	}
++
++	if (host->state == STATE_IDLE) {
++		host->state = STATE_SENDING_CMD;
++		dw_mci_start_request(host, slot);
++	} else {
++		list_add_tail(&slot->queue_node, &host->queue);
++	}
++}
++
++static void dw_mci_request(struct mmc_host *mmc, struct mmc_request *mrq)
++{
++	struct dw_mci_slot *slot = mmc_priv(mmc);
++	struct dw_mci *host = slot->host;
++
++	WARN_ON(slot->mrq);
++
++	/*
++	 * The check for card presence and queueing of the request must be
++	 * atomic, otherwise the card could be removed in between and the
++	 * request wouldn't fail until another card was inserted.
++	 */
++	spin_lock_bh(&host->lock);
++
++	if (!test_bit(DW_MMC_CARD_PRESENT, &slot->flags)) {
++		spin_unlock_bh(&host->lock);
++		mrq->cmd->error = -ENOMEDIUM;
++		mmc_request_done(mmc, mrq);
++		return;
++	}
++
++	dw_mci_queue_request(host, slot, mrq);
++
++	spin_unlock_bh(&host->lock);
++}
++
++static void dw_mci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
++{
++	struct dw_mci_slot *slot = mmc_priv(mmc);
++	const struct dw_mci_drv_data *drv_data = slot->host->drv_data;
++	u32 regs;
++	int ret;
++
++	switch (ios->bus_width) {
++	case MMC_BUS_WIDTH_4:
++		slot->ctype = SDMMC_CTYPE_4BIT;
++		break;
++	case MMC_BUS_WIDTH_8:
++		slot->ctype = SDMMC_CTYPE_8BIT;
++		break;
++	default:
++		/* set default 1 bit mode */
++		slot->ctype = SDMMC_CTYPE_1BIT;
++	}
++
++	regs = mci_readl(slot->host, UHS_REG);
++
++	/* DDR mode set */
++	if (ios->timing == MMC_TIMING_MMC_DDR52)
++		regs |= ((0x1 << slot->id) << 16);
++	else
++		regs &= ~((0x1 << slot->id) << 16);
++
++	mci_writel(slot->host, UHS_REG, regs);
++	slot->host->timing = ios->timing;
++
++	/*
++	 * Use mirror of ios->clock to prevent race with mmc
++	 * core ios update when finding the minimum.
++	 */
++	slot->clock = ios->clock;
++
++	if (drv_data && drv_data->set_ios)
++		drv_data->set_ios(slot->host, ios);
++
++	/* Slot specific timing and width adjustment */
++	dw_mci_setup_bus(slot, false);
++
++	if (slot->host->state == STATE_WAITING_CMD11_DONE && ios->clock != 0)
++		slot->host->state = STATE_IDLE;
++
++	switch (ios->power_mode) {
++	case MMC_POWER_UP:
++		if (!IS_ERR(mmc->supply.vmmc)) {
++			ret = mmc_regulator_set_ocr(mmc, mmc->supply.vmmc,
++					ios->vdd);
++			if (ret) {
++				dev_err(slot->host->dev,
++					"failed to enable vmmc regulator\n");
++				/*return, if failed turn on vmmc*/
++				return;
++			}
++		}
++		if (!IS_ERR(mmc->supply.vqmmc) && !slot->host->vqmmc_enabled) {
++			ret = regulator_enable(mmc->supply.vqmmc);
++			if (ret < 0)
++				dev_err(slot->host->dev,
++					"failed to enable vqmmc regulator\n");
++			else
++				slot->host->vqmmc_enabled = true;
++		}
++		set_bit(DW_MMC_CARD_NEED_INIT, &slot->flags);
++		regs = mci_readl(slot->host, PWREN);
++		regs |= (1 << slot->id);
++		mci_writel(slot->host, PWREN, regs);
++		break;
++	case MMC_POWER_OFF:
++		if (!IS_ERR(mmc->supply.vmmc))
++			mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, 0);
++
++		if (!IS_ERR(mmc->supply.vqmmc) && slot->host->vqmmc_enabled) {
++			regulator_disable(mmc->supply.vqmmc);
++			slot->host->vqmmc_enabled = false;
++		}
++
++		regs = mci_readl(slot->host, PWREN);
++		regs &= ~(1 << slot->id);
++		mci_writel(slot->host, PWREN, regs);
++		break;
++	default:
++		break;
++	}
++}
++
++static int dw_mci_card_busy(struct mmc_host *mmc)
++{
++	struct dw_mci_slot *slot = mmc_priv(mmc);
++	u32 status;
++
++	/*
++	 * Check the busy bit which is low when DAT[3:0]
++	 * (the data lines) are 0000
++	 */
++	status = mci_readl(slot->host, STATUS);
++
++	return !!(status & SDMMC_STATUS_BUSY);
++}
++
++static int dw_mci_switch_voltage(struct mmc_host *mmc, struct mmc_ios *ios)
++{
++	struct dw_mci_slot *slot = mmc_priv(mmc);
++	struct dw_mci *host = slot->host;
++	u32 uhs;
++	u32 v18 = SDMMC_UHS_18V << slot->id;
++	int min_uv, max_uv;
++	int ret;
++
++	/*
++	 * Program the voltage.  Note that some instances of dw_mmc may use
++	 * the UHS_REG for this.  For other instances (like exynos) the UHS_REG
++	 * does no harm but you need to set the regulator directly.  Try both.
++	 */
++	uhs = mci_readl(host, UHS_REG);
++	if (ios->signal_voltage == MMC_SIGNAL_VOLTAGE_330) {
++		min_uv = 2700000;
++		max_uv = 3600000;
++		uhs &= ~v18;
++	} else {
++		min_uv = 1700000;
++		max_uv = 1950000;
++		uhs |= v18;
++	}
++	if (!IS_ERR(mmc->supply.vqmmc)) {
++		ret = regulator_set_voltage(mmc->supply.vqmmc, min_uv, max_uv);
++
++		if (ret) {
++			dev_err(&mmc->class_dev,
++					 "Regulator set error %d: %d - %d\n",
++					 ret, min_uv, max_uv);
++			return ret;
++		}
++	}
++	mci_writel(host, UHS_REG, uhs);
++
++	return 0;
++}
++
++static int dw_mci_get_ro(struct mmc_host *mmc)
++{
++	int read_only;
++	struct dw_mci_slot *slot = mmc_priv(mmc);
++	int gpio_ro = mmc_gpio_get_ro(mmc);
++
++	/* Use platform get_ro function, else try on board write protect */
++	if ((slot->quirks & DW_MCI_SLOT_QUIRK_NO_WRITE_PROTECT) ||
++			(slot->host->quirks & DW_MCI_QUIRK_NO_WRITE_PROTECT))
++		read_only = 0;
++	else if (!IS_ERR_VALUE(gpio_ro))
++		read_only = gpio_ro;
++	else
++		read_only =
++			mci_readl(slot->host, WRTPRT) & (1 << slot->id) ? 1 : 0;
++
++	dev_dbg(&mmc->class_dev, "card is %s\n",
++		read_only ? "read-only" : "read-write");
++
++	return read_only;
++}
++
++static int dw_mci_get_cd(struct mmc_host *mmc)
++{
++	int present;
++	struct dw_mci_slot *slot = mmc_priv(mmc);
++	struct dw_mci_board *brd = slot->host->pdata;
++	struct dw_mci *host = slot->host;
++	int gpio_cd = mmc_gpio_get_cd(mmc);
++
++	/* Use platform get_cd function, else try onboard card detect */
++	if (brd->quirks & DW_MCI_QUIRK_BROKEN_CARD_DETECTION)
++		present = 1;
++	else if (!IS_ERR_VALUE(gpio_cd))
++		present = gpio_cd;
++	else
++		present = (mci_readl(slot->host, CDETECT) & (1 << slot->id))
++			== 0 ? 1 : 0;
++
++	spin_lock_bh(&host->lock);
++	if (present) {
++		set_bit(DW_MMC_CARD_PRESENT, &slot->flags);
++		dev_dbg(&mmc->class_dev, "card is present\n");
++	} else {
++		clear_bit(DW_MMC_CARD_PRESENT, &slot->flags);
++		dev_dbg(&mmc->class_dev, "card is not present\n");
++	}
++	spin_unlock_bh(&host->lock);
++
++	return present;
++}
++
++/*
++ * Disable lower power mode.
++ *
++ * Low power mode will stop the card clock when idle.  According to the
++ * description of the CLKENA register we should disable low power mode
++ * for SDIO cards if we need SDIO interrupts to work.
++ *
++ * This function is fast if low power mode is already disabled.
++ */
++static void dw_mci_disable_low_power(struct dw_mci_slot *slot)
++{
++	struct dw_mci *host = slot->host;
++	u32 clk_en_a;
++	const u32 clken_low_pwr = SDMMC_CLKEN_LOW_PWR << slot->id;
++
++	clk_en_a = mci_readl(host, CLKENA);
++
++	if (clk_en_a & clken_low_pwr) {
++		mci_writel(host, CLKENA, clk_en_a & ~clken_low_pwr);
++		mci_send_cmd(slot, SDMMC_CMD_UPD_CLK |
++			     SDMMC_CMD_PRV_DAT_WAIT, 0);
++	}
++}
++
++static void dw_mci_enable_sdio_irq(struct mmc_host *mmc, int enb)
++{
++	struct dw_mci_slot *slot = mmc_priv(mmc);
++	struct dw_mci *host = slot->host;
++	u32 int_mask;
++
++	/* Enable/disable Slot Specific SDIO interrupt */
++	int_mask = mci_readl(host, INTMASK);
++	if (enb) {
++		/*
++		 * Turn off low power mode if it was enabled.  This is a bit of
++		 * a heavy operation and we disable / enable IRQs a lot, so
++		 * we'll leave low power mode disabled and it will get
++		 * re-enabled again in dw_mci_setup_bus().
++		 */
++		dw_mci_disable_low_power(slot);
++
++		mci_writel(host, INTMASK,
++			   (int_mask | SDMMC_INT_SDIO(slot->id)));
++	} else {
++		mci_writel(host, INTMASK,
++			   (int_mask & ~SDMMC_INT_SDIO(slot->id)));
++	}
++}
++
++static int dw_mci_execute_tuning(struct mmc_host *mmc, u32 opcode)
++{
++	struct dw_mci_slot *slot = mmc_priv(mmc);
++	struct dw_mci *host = slot->host;
++	const struct dw_mci_drv_data *drv_data = host->drv_data;
++	struct dw_mci_tuning_data tuning_data;
++	int err = -ENOSYS;
++
++	if (opcode == MMC_SEND_TUNING_BLOCK_HS200) {
++		if (mmc->ios.bus_width == MMC_BUS_WIDTH_8) {
++			tuning_data.blk_pattern = tuning_blk_pattern_8bit;
++			tuning_data.blksz = sizeof(tuning_blk_pattern_8bit);
++		} else if (mmc->ios.bus_width == MMC_BUS_WIDTH_4) {
++			tuning_data.blk_pattern = tuning_blk_pattern_4bit;
++			tuning_data.blksz = sizeof(tuning_blk_pattern_4bit);
++		} else {
++			return -EINVAL;
++		}
++	} else if (opcode == MMC_SEND_TUNING_BLOCK) {
++		tuning_data.blk_pattern = tuning_blk_pattern_4bit;
++		tuning_data.blksz = sizeof(tuning_blk_pattern_4bit);
++	} else {
++		dev_err(host->dev,
++			"Undefined command(%d) for tuning\n", opcode);
++		return -EINVAL;
++	}
++
++	if (drv_data && drv_data->execute_tuning)
++		err = drv_data->execute_tuning(slot, opcode, &tuning_data);
++	return err;
++}
++
++static const struct mmc_host_ops dw_mci_ops = {
++	.request		= dw_mci_request,
++	.pre_req		= dw_mci_pre_req,
++	.post_req		= dw_mci_post_req,
++	.set_ios		= dw_mci_set_ios,
++	.get_ro			= dw_mci_get_ro,
++	.get_cd			= dw_mci_get_cd,
++	.enable_sdio_irq	= dw_mci_enable_sdio_irq,
++	.execute_tuning		= dw_mci_execute_tuning,
++	.card_busy		= dw_mci_card_busy,
++	.start_signal_voltage_switch = dw_mci_switch_voltage,
++
++};
++
++static void dw_mci_request_end(struct dw_mci *host, struct mmc_request *mrq)
++	__releases(&host->lock)
++	__acquires(&host->lock)
++{
++	struct dw_mci_slot *slot;
++	struct mmc_host	*prev_mmc = host->cur_slot->mmc;
++
++	WARN_ON(host->cmd || host->data);
++
++	host->cur_slot->mrq = NULL;
++	host->mrq = NULL;
++	if (!list_empty(&host->queue)) {
++		slot = list_entry(host->queue.next,
++				  struct dw_mci_slot, queue_node);
++		list_del(&slot->queue_node);
++		dev_vdbg(host->dev, "list not empty: %s is next\n",
++			 mmc_hostname(slot->mmc));
++		host->state = STATE_SENDING_CMD;
++		dw_mci_start_request(host, slot);
++	} else {
++		dev_vdbg(host->dev, "list empty\n");
++
++		if (host->state == STATE_SENDING_CMD11)
++			host->state = STATE_WAITING_CMD11_DONE;
++		else
++			host->state = STATE_IDLE;
++	}
++
++	spin_unlock(&host->lock);
++	mmc_request_done(prev_mmc, mrq);
++	spin_lock(&host->lock);
++}
++
++static int dw_mci_command_complete(struct dw_mci *host, struct mmc_command *cmd)
++{
++	u32 status = host->cmd_status;
++
++	host->cmd_status = 0;
++
++	/* Read the response from the card (up to 16 bytes) */
++	if (cmd->flags & MMC_RSP_PRESENT) {
++		if (cmd->flags & MMC_RSP_136) {
++			cmd->resp[3] = mci_readl(host, RESP0);
++			cmd->resp[2] = mci_readl(host, RESP1);
++			cmd->resp[1] = mci_readl(host, RESP2);
++			cmd->resp[0] = mci_readl(host, RESP3);
++		} else {
++			cmd->resp[0] = mci_readl(host, RESP0);
++			cmd->resp[1] = 0;
++			cmd->resp[2] = 0;
++			cmd->resp[3] = 0;
++		}
++	}
++
++	if (status & SDMMC_INT_RTO)
++		cmd->error = -ETIMEDOUT;
++	else if ((cmd->flags & MMC_RSP_CRC) && (status & SDMMC_INT_RCRC))
++		cmd->error = -EILSEQ;
++	else if (status & SDMMC_INT_RESP_ERR)
++		cmd->error = -EIO;
++	else
++		cmd->error = 0;
++
++	if (cmd->error) {
++		/* newer ip versions need a delay between retries */
++		if (host->quirks & DW_MCI_QUIRK_RETRY_DELAY)
++			mdelay(20);
++	}
++
++	return cmd->error;
++}
++
++static int dw_mci_data_complete(struct dw_mci *host, struct mmc_data *data)
++{
++	u32 status = host->data_status;
++
++	if (status & DW_MCI_DATA_ERROR_FLAGS) {
++		if (status & SDMMC_INT_DRTO) {
++			data->error = -ETIMEDOUT;
++		} else if (status & SDMMC_INT_DCRC) {
++			data->error = -EILSEQ;
++		} else if (status & SDMMC_INT_EBE) {
++			if (host->dir_status ==
++				DW_MCI_SEND_STATUS) {
++				/*
++				 * No data CRC status was returned.
++				 * The number of bytes transferred
++				 * will be exaggerated in PIO mode.
++				 */
++				data->bytes_xfered = 0;
++				data->error = -ETIMEDOUT;
++			} else if (host->dir_status ==
++					DW_MCI_RECV_STATUS) {
++				data->error = -EIO;
++			}
++		} else {
++			/* SDMMC_INT_SBE is included */
++			data->error = -EIO;
++		}
++
++		dev_dbg(host->dev, "data error, status 0x%08x\n", status);
++
++		/*
++		 * After an error, there may be data lingering
++		 * in the FIFO
++		 */
++		dw_mci_reset(host);
++	} else {
++		data->bytes_xfered = data->blocks * data->blksz;
++		data->error = 0;
++	}
++
++	return data->error;
++}
++
++static void dw_mci_tasklet_func(unsigned long priv)
++{
++	struct dw_mci *host = (struct dw_mci *)priv;
++	struct mmc_data	*data;
++	struct mmc_command *cmd;
++	struct mmc_request *mrq;
++	enum dw_mci_state state;
++	enum dw_mci_state prev_state;
++	unsigned int err;
++
++	spin_lock(&host->lock);
++
++	state = host->state;
++	data = host->data;
++	mrq = host->mrq;
++
++	do {
++		prev_state = state;
++
++		switch (state) {
++		case STATE_IDLE:
++		case STATE_WAITING_CMD11_DONE:
++			break;
++
++		case STATE_SENDING_CMD11:
++		case STATE_SENDING_CMD:
++			if (!test_and_clear_bit(EVENT_CMD_COMPLETE,
++						&host->pending_events))
++				break;
++
++			cmd = host->cmd;
++			host->cmd = NULL;
++			set_bit(EVENT_CMD_COMPLETE, &host->completed_events);
++			err = dw_mci_command_complete(host, cmd);
++			if (cmd == mrq->sbc && !err) {
++				prev_state = state = STATE_SENDING_CMD;
++				__dw_mci_start_request(host, host->cur_slot,
++						       mrq->cmd);
++				goto unlock;
++			}
++
++			if (cmd->data && err) {
++				dw_mci_stop_dma(host);
++				send_stop_abort(host, data);
++				state = STATE_SENDING_STOP;
++				break;
++			}
++
++			if (!cmd->data || err) {
++				dw_mci_request_end(host, mrq);
++				goto unlock;
++			}
++
++			prev_state = state = STATE_SENDING_DATA;
++			/* fall through */
++
++		case STATE_SENDING_DATA:
++			/*
++			 * We could get a data error and never a transfer
++			 * complete so we'd better check for it here.
++			 *
++			 * Note that we don't really care if we also got a
++			 * transfer complete; stopping the DMA and sending an
++			 * abort won't hurt.
++			 */
++			if (test_and_clear_bit(EVENT_DATA_ERROR,
++					       &host->pending_events)) {
++				dw_mci_stop_dma(host);
++				send_stop_abort(host, data);
++				state = STATE_DATA_ERROR;
++				break;
++			}
++
++			if (!test_and_clear_bit(EVENT_XFER_COMPLETE,
++						&host->pending_events))
++				break;
++
++			set_bit(EVENT_XFER_COMPLETE, &host->completed_events);
++
++			/*
++			 * Handle an EVENT_DATA_ERROR that might have shown up
++			 * before the transfer completed.  This might not have
++			 * been caught by the check above because the interrupt
++			 * could have gone off between the previous check and
++			 * the check for transfer complete.
++			 *
++			 * Technically this ought not be needed assuming we
++			 * get a DATA_COMPLETE eventually (we'll notice the
++			 * error and end the request), but it shouldn't hurt.
++			 *
++			 * This has the advantage of sending the stop command.
++			 */
++			if (test_and_clear_bit(EVENT_DATA_ERROR,
++					       &host->pending_events)) {
++				dw_mci_stop_dma(host);
++				send_stop_abort(host, data);
++				state = STATE_DATA_ERROR;
++				break;
++			}
++			prev_state = state = STATE_DATA_BUSY;
++
++			/* fall through */
++
++		case STATE_DATA_BUSY:
++			if (!test_and_clear_bit(EVENT_DATA_COMPLETE,
++						&host->pending_events))
++				break;
++
++			host->data = NULL;
++			set_bit(EVENT_DATA_COMPLETE, &host->completed_events);
++			err = dw_mci_data_complete(host, data);
++
++			if (!err) {
++				if (!data->stop || mrq->sbc) {
++					if (mrq->sbc && data->stop)
++						data->stop->error = 0;
++					dw_mci_request_end(host, mrq);
++					goto unlock;
++				}
++
++				/* stop command for open-ended transfer*/
++				if (data->stop)
++					send_stop_abort(host, data);
++			} else {
++				/*
++				 * If we don't have a command complete now we'll
++				 * never get one since we just reset everything;
++				 * better end the request.
++				 *
++				 * If we do have a command complete we'll fall
++				 * through to the SENDING_STOP command and
++				 * everything will be peachy keen.
++				 */
++				if (!test_bit(EVENT_CMD_COMPLETE,
++					      &host->pending_events)) {
++					host->cmd = NULL;
++					dw_mci_request_end(host, mrq);
++					goto unlock;
++				}
++			}
++
++			/*
++			 * If err has non-zero,
++			 * stop-abort command has been already issued.
++			 */
++			prev_state = state = STATE_SENDING_STOP;
++
++			/* fall through */
++
++		case STATE_SENDING_STOP:
++			if (!test_and_clear_bit(EVENT_CMD_COMPLETE,
++						&host->pending_events))
++				break;
++
++			/* CMD error in data command */
++			if (mrq->cmd->error && mrq->data)
++				dw_mci_reset(host);
++
++			host->cmd = NULL;
++			host->data = NULL;
++
++			if (mrq->stop)
++				dw_mci_command_complete(host, mrq->stop);
++			else
++				host->cmd_status = 0;
++
++			dw_mci_request_end(host, mrq);
++			goto unlock;
++
++		case STATE_DATA_ERROR:
++			if (!test_and_clear_bit(EVENT_XFER_COMPLETE,
++						&host->pending_events))
++				break;
++
++			state = STATE_DATA_BUSY;
++			break;
++		}
++	} while (state != prev_state);
++
++	host->state = state;
++unlock:
++	spin_unlock(&host->lock);
++
++}
++
++/* push final bytes to part_buf, only use during push */
++static void dw_mci_set_part_bytes(struct dw_mci *host, void *buf, int cnt)
++{
++	memcpy((void *)&host->part_buf, buf, cnt);
++	host->part_buf_count = cnt;
++}
++
++/* append bytes to part_buf, only use during push */
++static int dw_mci_push_part_bytes(struct dw_mci *host, void *buf, int cnt)
++{
++	cnt = min(cnt, (1 << host->data_shift) - host->part_buf_count);
++	memcpy((void *)&host->part_buf + host->part_buf_count, buf, cnt);
++	host->part_buf_count += cnt;
++	return cnt;
++}
++
++/* pull first bytes from part_buf, only use during pull */
++static int dw_mci_pull_part_bytes(struct dw_mci *host, void *buf, int cnt)
++{
++	cnt = min(cnt, (int)host->part_buf_count);
++	if (cnt) {
++		memcpy(buf, (void *)&host->part_buf + host->part_buf_start,
++		       cnt);
++		host->part_buf_count -= cnt;
++		host->part_buf_start += cnt;
++	}
++	return cnt;
++}
++
++/* pull final bytes from the part_buf, assuming it's just been filled */
++static void dw_mci_pull_final_bytes(struct dw_mci *host, void *buf, int cnt)
++{
++	memcpy(buf, &host->part_buf, cnt);
++	host->part_buf_start = cnt;
++	host->part_buf_count = (1 << host->data_shift) - cnt;
++}
++
++static void dw_mci_push_data16(struct dw_mci *host, void *buf, int cnt)
++{
++	struct mmc_data *data = host->data;
++	int init_cnt = cnt;
++
++	/* try and push anything in the part_buf */
++	if (unlikely(host->part_buf_count)) {
++		int len = dw_mci_push_part_bytes(host, buf, cnt);
++		buf += len;
++		cnt -= len;
++		if (host->part_buf_count == 2) {
++			mci_writew(host, DATA(host->data_offset),
++					host->part_buf16);
++			host->part_buf_count = 0;
++		}
++	}
++#ifndef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
++	if (unlikely((unsigned long)buf & 0x1)) {
++		while (cnt >= 2) {
++			u16 aligned_buf[64];
++			int len = min(cnt & -2, (int)sizeof(aligned_buf));
++			int items = len >> 1;
++			int i;
++			/* memcpy from input buffer into aligned buffer */
++			memcpy(aligned_buf, buf, len);
++			buf += len;
++			cnt -= len;
++			/* push data from aligned buffer into fifo */
++			for (i = 0; i < items; ++i)
++				mci_writew(host, DATA(host->data_offset),
++						aligned_buf[i]);
++		}
++	} else
++#endif
++	{
++		u16 *pdata = buf;
++		for (; cnt >= 2; cnt -= 2)
++			mci_writew(host, DATA(host->data_offset), *pdata++);
++		buf = pdata;
++	}
++	/* put anything remaining in the part_buf */
++	if (cnt) {
++		dw_mci_set_part_bytes(host, buf, cnt);
++		 /* Push data if we have reached the expected data length */
++		if ((data->bytes_xfered + init_cnt) ==
++		    (data->blksz * data->blocks))
++			mci_writew(host, DATA(host->data_offset),
++				   host->part_buf16);
++	}
++}
++
++static void dw_mci_pull_data16(struct dw_mci *host, void *buf, int cnt)
++{
++#ifndef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
++	if (unlikely((unsigned long)buf & 0x1)) {
++		while (cnt >= 2) {
++			/* pull data from fifo into aligned buffer */
++			u16 aligned_buf[64];
++			int len = min(cnt & -2, (int)sizeof(aligned_buf));
++			int items = len >> 1;
++			int i;
++			for (i = 0; i < items; ++i)
++				aligned_buf[i] = mci_readw(host,
++						DATA(host->data_offset));
++			/* memcpy from aligned buffer into output buffer */
++			memcpy(buf, aligned_buf, len);
++			buf += len;
++			cnt -= len;
++		}
++	} else
++#endif
++	{
++		u16 *pdata = buf;
++		for (; cnt >= 2; cnt -= 2)
++			*pdata++ = mci_readw(host, DATA(host->data_offset));
++		buf = pdata;
++	}
++	if (cnt) {
++		host->part_buf16 = mci_readw(host, DATA(host->data_offset));
++		dw_mci_pull_final_bytes(host, buf, cnt);
++	}
++}
++
++static void dw_mci_push_data32(struct dw_mci *host, void *buf, int cnt)
++{
++	struct mmc_data *data = host->data;
++	int init_cnt = cnt;
++
++	/* try and push anything in the part_buf */
++	if (unlikely(host->part_buf_count)) {
++		int len = dw_mci_push_part_bytes(host, buf, cnt);
++		buf += len;
++		cnt -= len;
++		if (host->part_buf_count == 4) {
++			mci_writel(host, DATA(host->data_offset),
++					host->part_buf32);
++			host->part_buf_count = 0;
++		}
++	}
++#ifndef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
++	if (unlikely((unsigned long)buf & 0x3)) {
++		while (cnt >= 4) {
++			u32 aligned_buf[32];
++			int len = min(cnt & -4, (int)sizeof(aligned_buf));
++			int items = len >> 2;
++			int i;
++			/* memcpy from input buffer into aligned buffer */
++			memcpy(aligned_buf, buf, len);
++			buf += len;
++			cnt -= len;
++			/* push data from aligned buffer into fifo */
++			for (i = 0; i < items; ++i)
++				mci_writel(host, DATA(host->data_offset),
++						aligned_buf[i]);
++		}
++	} else
++#endif
++	{
++		u32 *pdata = buf;
++		for (; cnt >= 4; cnt -= 4)
++			mci_writel(host, DATA(host->data_offset), *pdata++);
++		buf = pdata;
++	}
++	/* put anything remaining in the part_buf */
++	if (cnt) {
++		dw_mci_set_part_bytes(host, buf, cnt);
++		 /* Push data if we have reached the expected data length */
++		if ((data->bytes_xfered + init_cnt) ==
++		    (data->blksz * data->blocks))
++			mci_writel(host, DATA(host->data_offset),
++				   host->part_buf32);
++	}
++}
++
++static void dw_mci_pull_data32(struct dw_mci *host, void *buf, int cnt)
++{
++#ifndef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
++	if (unlikely((unsigned long)buf & 0x3)) {
++		while (cnt >= 4) {
++			/* pull data from fifo into aligned buffer */
++			u32 aligned_buf[32];
++			int len = min(cnt & -4, (int)sizeof(aligned_buf));
++			int items = len >> 2;
++			int i;
++			for (i = 0; i < items; ++i)
++				aligned_buf[i] = mci_readl(host,
++						DATA(host->data_offset));
++			/* memcpy from aligned buffer into output buffer */
++			memcpy(buf, aligned_buf, len);
++			buf += len;
++			cnt -= len;
++		}
++	} else
++#endif
++	{
++		u32 *pdata = buf;
++		for (; cnt >= 4; cnt -= 4)
++			*pdata++ = mci_readl(host, DATA(host->data_offset));
++		buf = pdata;
++	}
++	if (cnt) {
++		host->part_buf32 = mci_readl(host, DATA(host->data_offset));
++		dw_mci_pull_final_bytes(host, buf, cnt);
++	}
++}
++
++static void dw_mci_push_data64(struct dw_mci *host, void *buf, int cnt)
++{
++	struct mmc_data *data = host->data;
++	int init_cnt = cnt;
++
++	/* try and push anything in the part_buf */
++	if (unlikely(host->part_buf_count)) {
++		int len = dw_mci_push_part_bytes(host, buf, cnt);
++		buf += len;
++		cnt -= len;
++
++		if (host->part_buf_count == 8) {
++			mci_writeq(host, DATA(host->data_offset),
++					host->part_buf);
++			host->part_buf_count = 0;
++		}
++	}
++#ifndef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
++	if (unlikely((unsigned long)buf & 0x7)) {
++		while (cnt >= 8) {
++			u64 aligned_buf[16];
++			int len = min(cnt & -8, (int)sizeof(aligned_buf));
++			int items = len >> 3;
++			int i;
++			/* memcpy from input buffer into aligned buffer */
++			memcpy(aligned_buf, buf, len);
++			buf += len;
++			cnt -= len;
++			/* push data from aligned buffer into fifo */
++			for (i = 0; i < items; ++i)
++				mci_writeq(host, DATA(host->data_offset),
++						aligned_buf[i]);
++		}
++	} else
++#endif
++	{
++		u64 *pdata = buf;
++		for (; cnt >= 8; cnt -= 8)
++			mci_writeq(host, DATA(host->data_offset), *pdata++);
++		buf = pdata;
++	}
++	/* put anything remaining in the part_buf */
++	if (cnt) {
++		dw_mci_set_part_bytes(host, buf, cnt);
++		/* Push data if we have reached the expected data length */
++		if ((data->bytes_xfered + init_cnt) ==
++		    (data->blksz * data->blocks))
++			mci_writeq(host, DATA(host->data_offset),
++				   host->part_buf);
++	}
++}
++
++static void dw_mci_pull_data64(struct dw_mci *host, void *buf, int cnt)
++{
++#ifndef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
++	if (unlikely((unsigned long)buf & 0x7)) {
++		while (cnt >= 8) {
++			/* pull data from fifo into aligned buffer */
++			u64 aligned_buf[16];
++			int len = min(cnt & -8, (int)sizeof(aligned_buf));
++			int items = len >> 3;
++			int i;
++			for (i = 0; i < items; ++i)
++				aligned_buf[i] = mci_readq(host,
++						DATA(host->data_offset));
++			/* memcpy from aligned buffer into output buffer */
++			memcpy(buf, aligned_buf, len);
++			buf += len;
++			cnt -= len;
++		}
++	} else
++#endif
++	{
++		u64 *pdata = buf;
++		for (; cnt >= 8; cnt -= 8)
++			*pdata++ = mci_readq(host, DATA(host->data_offset));
++		buf = pdata;
++	}
++	if (cnt) {
++		host->part_buf = mci_readq(host, DATA(host->data_offset));
++		dw_mci_pull_final_bytes(host, buf, cnt);
++	}
++}
++
++static void dw_mci_pull_data(struct dw_mci *host, void *buf, int cnt)
++{
++	int len;
++
++	/* get remaining partial bytes */
++	len = dw_mci_pull_part_bytes(host, buf, cnt);
++	if (unlikely(len == cnt))
++		return;
++	buf += len;
++	cnt -= len;
++
++	/* get the rest of the data */
++	host->pull_data(host, buf, cnt);
++}
++
++static void dw_mci_read_data_pio(struct dw_mci *host, bool dto)
++{
++	struct sg_mapping_iter *sg_miter = &host->sg_miter;
++	void *buf;
++	unsigned int offset;
++	struct mmc_data	*data = host->data;
++	int shift = host->data_shift;
++	u32 status;
++	unsigned int len;
++	unsigned int remain, fcnt;
++
++	do {
++		if (!sg_miter_next(sg_miter))
++			goto done;
++
++		host->sg = sg_miter->piter.sg;
++		buf = sg_miter->addr;
++		remain = sg_miter->length;
++		offset = 0;
++
++		do {
++			fcnt = (SDMMC_GET_FCNT(mci_readl(host, STATUS))
++					<< shift) + host->part_buf_count;
++			len = min(remain, fcnt);
++			if (!len)
++				break;
++			dw_mci_pull_data(host, (void *)(buf + offset), len);
++			data->bytes_xfered += len;
++			offset += len;
++			remain -= len;
++		} while (remain);
++
++		sg_miter->consumed = offset;
++		status = mci_readl(host, MINTSTS);
++		mci_writel(host, RINTSTS, SDMMC_INT_RXDR);
++	/* if the RXDR is ready read again */
++	} while ((status & SDMMC_INT_RXDR) ||
++		 (dto && SDMMC_GET_FCNT(mci_readl(host, STATUS))));
++
++	if (!remain) {
++		if (!sg_miter_next(sg_miter))
++			goto done;
++		sg_miter->consumed = 0;
++	}
++	sg_miter_stop(sg_miter);
++	return;
++
++done:
++	sg_miter_stop(sg_miter);
++	host->sg = NULL;
++	smp_wmb();
++	set_bit(EVENT_XFER_COMPLETE, &host->pending_events);
++}
++
++static void dw_mci_write_data_pio(struct dw_mci *host)
++{
++	struct sg_mapping_iter *sg_miter = &host->sg_miter;
++	void *buf;
++	unsigned int offset;
++	struct mmc_data	*data = host->data;
++	int shift = host->data_shift;
++	u32 status;
++	unsigned int len;
++	unsigned int fifo_depth = host->fifo_depth;
++	unsigned int remain, fcnt;
++
++	do {
++		if (!sg_miter_next(sg_miter))
++			goto done;
++
++		host->sg = sg_miter->piter.sg;
++		buf = sg_miter->addr;
++		remain = sg_miter->length;
++		offset = 0;
++
++		do {
++			fcnt = ((fifo_depth -
++				 SDMMC_GET_FCNT(mci_readl(host, STATUS)))
++					<< shift) - host->part_buf_count;
++			len = min(remain, fcnt);
++			if (!len)
++				break;
++			host->push_data(host, (void *)(buf + offset), len);
++			data->bytes_xfered += len;
++			offset += len;
++			remain -= len;
++		} while (remain);
++
++		sg_miter->consumed = offset;
++		status = mci_readl(host, MINTSTS);
++		mci_writel(host, RINTSTS, SDMMC_INT_TXDR);
++	} while (status & SDMMC_INT_TXDR); /* if TXDR write again */
++
++	if (!remain) {
++		if (!sg_miter_next(sg_miter))
++			goto done;
++		sg_miter->consumed = 0;
++	}
++	sg_miter_stop(sg_miter);
++	return;
++
++done:
++	sg_miter_stop(sg_miter);
++	host->sg = NULL;
++	smp_wmb();
++	set_bit(EVENT_XFER_COMPLETE, &host->pending_events);
++}
++
++static void dw_mci_cmd_interrupt(struct dw_mci *host, u32 status)
++{
++	if (!host->cmd_status)
++		host->cmd_status = status;
++
++	smp_wmb();
++
++	set_bit(EVENT_CMD_COMPLETE, &host->pending_events);
++	tasklet_schedule(&host->tasklet);
++}
++
++static irqreturn_t dw_mci_interrupt(int irq, void *dev_id)
++{
++	struct dw_mci *host = dev_id;
++	u32 pending;
++	int i;
++
++	pending = mci_readl(host, MINTSTS); /* read-only mask reg */
++
++	/*
++	 * DTO fix - version 2.10a and below, and only if internal DMA
++	 * is configured.
++	 */
++	if (host->quirks & DW_MCI_QUIRK_IDMAC_DTO) {
++		if (!pending &&
++		    ((mci_readl(host, STATUS) >> 17) & 0x1fff))
++			pending |= SDMMC_INT_DATA_OVER;
++	}
++
++	if (pending) {
++		/* Check volt switch first, since it can look like an error */
++		if ((host->state == STATE_SENDING_CMD11) &&
++		    (pending & SDMMC_INT_VOLT_SWITCH)) {
++			mci_writel(host, RINTSTS, SDMMC_INT_VOLT_SWITCH);
++			pending &= ~SDMMC_INT_VOLT_SWITCH;
++			dw_mci_cmd_interrupt(host, pending);
++		}
++
++		if (pending & DW_MCI_CMD_ERROR_FLAGS) {
++			mci_writel(host, RINTSTS, DW_MCI_CMD_ERROR_FLAGS);
++			host->cmd_status = pending;
++			smp_wmb();
++			set_bit(EVENT_CMD_COMPLETE, &host->pending_events);
++		}
++
++		if (pending & DW_MCI_DATA_ERROR_FLAGS) {
++			/* if there is an error report DATA_ERROR */
++			mci_writel(host, RINTSTS, DW_MCI_DATA_ERROR_FLAGS);
++			host->data_status = pending;
++			smp_wmb();
++			set_bit(EVENT_DATA_ERROR, &host->pending_events);
++			tasklet_schedule(&host->tasklet);
++		}
++
++		if (pending & SDMMC_INT_DATA_OVER) {
++			mci_writel(host, RINTSTS, SDMMC_INT_DATA_OVER);
++			if (!host->data_status)
++				host->data_status = pending;
++			smp_wmb();
++			if (host->dir_status == DW_MCI_RECV_STATUS) {
++				if (host->sg != NULL)
++					dw_mci_read_data_pio(host, true);
++			}
++			set_bit(EVENT_DATA_COMPLETE, &host->pending_events);
++			tasklet_schedule(&host->tasklet);
++		}
++
++		if (pending & SDMMC_INT_RXDR) {
++			mci_writel(host, RINTSTS, SDMMC_INT_RXDR);
++			if (host->dir_status == DW_MCI_RECV_STATUS && host->sg)
++				dw_mci_read_data_pio(host, false);
++		}
++
++		if (pending & SDMMC_INT_TXDR) {
++			mci_writel(host, RINTSTS, SDMMC_INT_TXDR);
++			if (host->dir_status == DW_MCI_SEND_STATUS && host->sg)
++				dw_mci_write_data_pio(host);
++		}
++
++		if (pending & SDMMC_INT_CMD_DONE) {
++			mci_writel(host, RINTSTS, SDMMC_INT_CMD_DONE);
++			dw_mci_cmd_interrupt(host, pending);
++		}
++
++		if (pending & SDMMC_INT_CD) {
++			mci_writel(host, RINTSTS, SDMMC_INT_CD);
++			queue_work(host->card_workqueue, &host->card_work);
++		}
++
++		/* Handle SDIO Interrupts */
++		for (i = 0; i < host->num_slots; i++) {
++			struct dw_mci_slot *slot = host->slot[i];
++			if (pending & SDMMC_INT_SDIO(i)) {
++				mci_writel(host, RINTSTS, SDMMC_INT_SDIO(i));
++				mmc_signal_sdio_irq(slot->mmc);
++			}
++		}
++
++	}
++
++#ifdef CONFIG_MMC_DW_IDMAC
++	/* Handle DMA interrupts */
++	pending = mci_readl(host, IDSTS);
++	if (pending & (SDMMC_IDMAC_INT_TI | SDMMC_IDMAC_INT_RI)) {
++		mci_writel(host, IDSTS, SDMMC_IDMAC_INT_TI | SDMMC_IDMAC_INT_RI);
++		mci_writel(host, IDSTS, SDMMC_IDMAC_INT_NI);
++		host->dma_ops->complete(host);
++	}
++#endif
++
++	return IRQ_HANDLED;
++}
++
++static void dw_mci_work_routine_card(struct work_struct *work)
++{
++	struct dw_mci *host = container_of(work, struct dw_mci, card_work);
++	int i;
++
++	for (i = 0; i < host->num_slots; i++) {
++		struct dw_mci_slot *slot = host->slot[i];
++		struct mmc_host *mmc = slot->mmc;
++		struct mmc_request *mrq;
++		int present;
++
++		present = dw_mci_get_cd(mmc);
++		while (present != slot->last_detect_state) {
++			dev_dbg(&slot->mmc->class_dev, "card %s\n",
++				present ? "inserted" : "removed");
++
++			spin_lock_bh(&host->lock);
++
++			/* Card change detected */
++			slot->last_detect_state = present;
++
++			/* Clean up queue if present */
++			mrq = slot->mrq;
++			if (mrq) {
++				if (mrq == host->mrq) {
++					host->data = NULL;
++					host->cmd = NULL;
++
++					switch (host->state) {
++					case STATE_IDLE:
++					case STATE_WAITING_CMD11_DONE:
++						break;
++					case STATE_SENDING_CMD11:
++					case STATE_SENDING_CMD:
++						mrq->cmd->error = -ENOMEDIUM;
++						if (!mrq->data)
++							break;
++						/* fall through */
++					case STATE_SENDING_DATA:
++						mrq->data->error = -ENOMEDIUM;
++						dw_mci_stop_dma(host);
++						break;
++					case STATE_DATA_BUSY:
++					case STATE_DATA_ERROR:
++						if (mrq->data->error == -EINPROGRESS)
++							mrq->data->error = -ENOMEDIUM;
++						/* fall through */
++					case STATE_SENDING_STOP:
++						if (mrq->stop)
++							mrq->stop->error = -ENOMEDIUM;
++						break;
++					}
++
++					dw_mci_request_end(host, mrq);
++				} else {
++					list_del(&slot->queue_node);
++					mrq->cmd->error = -ENOMEDIUM;
++					if (mrq->data)
++						mrq->data->error = -ENOMEDIUM;
++					if (mrq->stop)
++						mrq->stop->error = -ENOMEDIUM;
++
++					spin_unlock(&host->lock);
++					mmc_request_done(slot->mmc, mrq);
++					spin_lock(&host->lock);
++				}
++			}
++
++			/* Power down slot */
++			if (present == 0)
++				dw_mci_reset(host);
++
++			spin_unlock_bh(&host->lock);
++
++			present = dw_mci_get_cd(mmc);
++		}
++
++		mmc_detect_change(slot->mmc,
++			msecs_to_jiffies(host->pdata->detect_delay_ms));
++	}
++}
++
++#ifdef CONFIG_OF
++/* given a slot id, find out the device node representing that slot */
++static struct device_node *dw_mci_of_find_slot_node(struct device *dev, u8 slot)
++{
++	struct device_node *np;
++	const __be32 *addr;
++	int len;
++
++	if (!dev || !dev->of_node)
++		return NULL;
++
++	for_each_child_of_node(dev->of_node, np) {
++		addr = of_get_property(np, "reg", &len);
++		if (!addr || (len < sizeof(int)))
++			continue;
++		if (be32_to_cpup(addr) == slot)
++			return np;
++	}
++	return NULL;
++}
++
++static struct dw_mci_of_slot_quirks {
++	char *quirk;
++	int id;
++} of_slot_quirks[] = {
++	{
++		.quirk	= "disable-wp",
++		.id	= DW_MCI_SLOT_QUIRK_NO_WRITE_PROTECT,
++	},
++};
++
++static int dw_mci_of_get_slot_quirks(struct device *dev, u8 slot)
++{
++	struct device_node *np = dw_mci_of_find_slot_node(dev, slot);
++	int quirks = 0;
++	int idx;
++
++	/* get quirks */
++	for (idx = 0; idx < ARRAY_SIZE(of_slot_quirks); idx++)
++		if (of_get_property(np, of_slot_quirks[idx].quirk, NULL)) {
++			dev_warn(dev, "Slot quirk %s is deprecated\n",
++					of_slot_quirks[idx].quirk);
++			quirks |= of_slot_quirks[idx].id;
++		}
++
++	return quirks;
++}
++#else /* CONFIG_OF */
++static int dw_mci_of_get_slot_quirks(struct device *dev, u8 slot)
++{
++	return 0;
++}
++#endif /* CONFIG_OF */
++
++static int dw_mci_init_slot(struct dw_mci *host, unsigned int id)
++{
++	struct mmc_host *mmc;
++	struct dw_mci_slot *slot;
++	const struct dw_mci_drv_data *drv_data = host->drv_data;
++	int ctrl_id, ret;
++	u32 freq[2];
++
++	mmc = mmc_alloc_host(sizeof(struct dw_mci_slot), host->dev);
++	if (!mmc)
++		return -ENOMEM;
++
++	slot = mmc_priv(mmc);
++	slot->id = id;
++	slot->mmc = mmc;
++	slot->host = host;
++	host->slot[id] = slot;
++
++	slot->quirks = dw_mci_of_get_slot_quirks(host->dev, slot->id);
++
++	mmc->ops = &dw_mci_ops;
++	if (of_property_read_u32_array(host->dev->of_node,
++				       "clock-freq-min-max", freq, 2)) {
++		mmc->f_min = DW_MCI_FREQ_MIN;
++		mmc->f_max = DW_MCI_FREQ_MAX;
++	} else {
++		mmc->f_min = freq[0];
++		mmc->f_max = freq[1];
++	}
++
++	/*if there are external regulators, get them*/
++	ret = mmc_regulator_get_supply(mmc);
++	if (ret == -EPROBE_DEFER)
++		goto err_host_allocated;
++
++	if (!mmc->ocr_avail)
++		mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34;
++
++	if (host->pdata->caps)
++		mmc->caps = host->pdata->caps;
++
++	if (host->pdata->pm_caps)
++		mmc->pm_caps = host->pdata->pm_caps;
++
++	if (host->dev->of_node) {
++		ctrl_id = of_alias_get_id(host->dev->of_node, "mshc");
++		if (ctrl_id < 0)
++			ctrl_id = 0;
++	} else {
++		ctrl_id = to_platform_device(host->dev)->id;
++	}
++	if (drv_data && drv_data->caps)
++		mmc->caps |= drv_data->caps[ctrl_id];
++
++	if (host->pdata->caps2)
++		mmc->caps2 = host->pdata->caps2;
++
++	ret = mmc_of_parse(mmc);
++	if (ret)
++		goto err_host_allocated;
++
++	if (host->pdata->blk_settings) {
++		mmc->max_segs = host->pdata->blk_settings->max_segs;
++		mmc->max_blk_size = host->pdata->blk_settings->max_blk_size;
++		mmc->max_blk_count = host->pdata->blk_settings->max_blk_count;
++		mmc->max_req_size = host->pdata->blk_settings->max_req_size;
++		mmc->max_seg_size = host->pdata->blk_settings->max_seg_size;
++	} else {
++		/* Useful defaults if platform data is unset. */
++#ifdef CONFIG_MMC_DW_IDMAC
++		mmc->max_segs = host->ring_size;
++		mmc->max_blk_size = 65536;
++		mmc->max_blk_count = host->ring_size;
++		mmc->max_seg_size = 0x1000;
++		mmc->max_req_size = mmc->max_seg_size * mmc->max_blk_count;
++#else
++		mmc->max_segs = 64;
++		mmc->max_blk_size = 65536; /* BLKSIZ is 16 bits */
++		mmc->max_blk_count = 512;
++		mmc->max_req_size = mmc->max_blk_size * mmc->max_blk_count;
++		mmc->max_seg_size = mmc->max_req_size;
++#endif /* CONFIG_MMC_DW_IDMAC */
++	}
++
++	if (dw_mci_get_cd(mmc))
++		set_bit(DW_MMC_CARD_PRESENT, &slot->flags);
++	else
++		clear_bit(DW_MMC_CARD_PRESENT, &slot->flags);
++
++	ret = mmc_add_host(mmc);
++	if (ret)
++		goto err_host_allocated;
++
++#if defined(CONFIG_DEBUG_FS)
++	dw_mci_init_debugfs(slot);
++#endif
++
++	/* Card initially undetected */
++	slot->last_detect_state = 0;
++
++	return 0;
++
++err_host_allocated:
++	mmc_free_host(mmc);
++	return ret;
++}
++
++static void dw_mci_cleanup_slot(struct dw_mci_slot *slot, unsigned int id)
++{
++	/* Debugfs stuff is cleaned up by mmc core */
++	mmc_remove_host(slot->mmc);
++	slot->host->slot[id] = NULL;
++	mmc_free_host(slot->mmc);
++}
++
++static void dw_mci_init_dma(struct dw_mci *host)
++{
++	/* Alloc memory for sg translation */
++	host->sg_cpu = dmam_alloc_coherent(host->dev, PAGE_SIZE,
++					  &host->sg_dma, GFP_KERNEL);
++	if (!host->sg_cpu) {
++		dev_err(host->dev, "%s: could not alloc DMA memory\n",
++			__func__);
++		goto no_dma;
++	}
++
++	/* Determine which DMA interface to use */
++#ifdef CONFIG_MMC_DW_IDMAC
++	host->dma_ops = &dw_mci_idmac_ops;
++	dev_info(host->dev, "Using internal DMA controller.\n");
++#endif
++
++	if (!host->dma_ops)
++		goto no_dma;
++
++	if (host->dma_ops->init && host->dma_ops->start &&
++	    host->dma_ops->stop && host->dma_ops->cleanup) {
++		if (host->dma_ops->init(host)) {
++			dev_err(host->dev, "%s: Unable to initialize "
++				"DMA Controller.\n", __func__);
++			goto no_dma;
++		}
++	} else {
++		dev_err(host->dev, "DMA initialization not found.\n");
++		goto no_dma;
++	}
++
++	host->use_dma = 1;
++	return;
++
++no_dma:
++	dev_info(host->dev, "Using PIO mode.\n");
++	host->use_dma = 0;
++	return;
++}
++
++static bool dw_mci_ctrl_reset(struct dw_mci *host, u32 reset)
++{
++	unsigned long timeout = jiffies + msecs_to_jiffies(500);
++	u32 ctrl;
++
++	ctrl = mci_readl(host, CTRL);
++	ctrl |= reset;
++	mci_writel(host, CTRL, ctrl);
++
++	/* wait till resets clear */
++	do {
++		ctrl = mci_readl(host, CTRL);
++		if (!(ctrl & reset))
++			return true;
++	} while (time_before(jiffies, timeout));
++
++	dev_err(host->dev,
++		"Timeout resetting block (ctrl reset %#x)\n",
++		ctrl & reset);
++
++	return false;
++}
++
++static bool dw_mci_reset(struct dw_mci *host)
++{
++	u32 flags = SDMMC_CTRL_RESET | SDMMC_CTRL_FIFO_RESET;
++	bool ret = false;
++
++	/*
++	 * Reseting generates a block interrupt, hence setting
++	 * the scatter-gather pointer to NULL.
++	 */
++	if (host->sg) {
++		sg_miter_stop(&host->sg_miter);
++		host->sg = NULL;
++	}
++
++	if (host->use_dma)
++		flags |= SDMMC_CTRL_DMA_RESET;
++
++	if (dw_mci_ctrl_reset(host, flags)) {
++		/*
++		 * In all cases we clear the RAWINTS register to clear any
++		 * interrupts.
++		 */
++		mci_writel(host, RINTSTS, 0xFFFFFFFF);
++
++		/* if using dma we wait for dma_req to clear */
++		if (host->use_dma) {
++			unsigned long timeout = jiffies + msecs_to_jiffies(500);
++			u32 status;
++			do {
++				status = mci_readl(host, STATUS);
++				if (!(status & SDMMC_STATUS_DMA_REQ))
++					break;
++				cpu_relax();
++			} while (time_before(jiffies, timeout));
++
++			if (status & SDMMC_STATUS_DMA_REQ) {
++				dev_err(host->dev,
++					"%s: Timeout waiting for dma_req to "
++					"clear during reset\n", __func__);
++				goto ciu_out;
++			}
++
++			/* when using DMA next we reset the fifo again */
++			if (!dw_mci_ctrl_reset(host, SDMMC_CTRL_FIFO_RESET))
++				goto ciu_out;
++		}
++	} else {
++		/* if the controller reset bit did clear, then set clock regs */
++		if (!(mci_readl(host, CTRL) & SDMMC_CTRL_RESET)) {
++			dev_err(host->dev, "%s: fifo/dma reset bits didn't "
++				"clear but ciu was reset, doing clock update\n",
++				__func__);
++			goto ciu_out;
++		}
++	}
++
++#if IS_ENABLED(CONFIG_MMC_DW_IDMAC)
++	/* It is also recommended that we reset and reprogram idmac */
++	dw_mci_idmac_reset(host);
++#endif
++
++	ret = true;
++
++ciu_out:
++	/* After a CTRL reset we need to have CIU set clock registers  */
++	mci_send_cmd(host->cur_slot, SDMMC_CMD_UPD_CLK, 0);
++
++	return ret;
++}
++
++#ifdef CONFIG_OF
++static struct dw_mci_of_quirks {
++	char *quirk;
++	int id;
++} of_quirks[] = {
++	{
++		.quirk	= "broken-cd",
++		.id	= DW_MCI_QUIRK_BROKEN_CARD_DETECTION,
++	}, {
++		.quirk	= "disable-wp",
++		.id	= DW_MCI_QUIRK_NO_WRITE_PROTECT,
++	},
++};
++
++static struct dw_mci_board *dw_mci_parse_dt(struct dw_mci *host)
++{
++	struct dw_mci_board *pdata;
++	struct device *dev = host->dev;
++	struct device_node *np = dev->of_node;
++	const struct dw_mci_drv_data *drv_data = host->drv_data;
++	int idx, ret;
++	u32 clock_frequency;
++
++	pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
++	if (!pdata) {
++		dev_err(dev, "could not allocate memory for pdata\n");
++		return ERR_PTR(-ENOMEM);
++	}
++
++	/* find out number of slots supported */
++	if (of_property_read_u32(dev->of_node, "num-slots",
++				&pdata->num_slots)) {
++		dev_info(dev, "num-slots property not found, "
++				"assuming 1 slot is available\n");
++		pdata->num_slots = 1;
++	}
++
++	/* get quirks */
++	for (idx = 0; idx < ARRAY_SIZE(of_quirks); idx++)
++		if (of_get_property(np, of_quirks[idx].quirk, NULL))
++			pdata->quirks |= of_quirks[idx].id;
++
++	if (of_property_read_u32(np, "fifo-depth", &pdata->fifo_depth))
++		dev_info(dev, "fifo-depth property not found, using "
++				"value of FIFOTH register as default\n");
++
++	of_property_read_u32(np, "card-detect-delay", &pdata->detect_delay_ms);
++
++	if (!of_property_read_u32(np, "clock-frequency", &clock_frequency))
++		pdata->bus_hz = clock_frequency;
++
++	if (drv_data && drv_data->parse_dt) {
++		ret = drv_data->parse_dt(host);
++		if (ret)
++			return ERR_PTR(ret);
++	}
++
++	if (of_find_property(np, "supports-highspeed", NULL))
++		pdata->caps |= MMC_CAP_SD_HIGHSPEED | MMC_CAP_MMC_HIGHSPEED;
++
++	return pdata;
++}
++
++#else /* CONFIG_OF */
++static struct dw_mci_board *dw_mci_parse_dt(struct dw_mci *host)
++{
++	return ERR_PTR(-EINVAL);
++}
++#endif /* CONFIG_OF */
++
++int dw_mci_probe(struct dw_mci *host)
++{
++	const struct dw_mci_drv_data *drv_data = host->drv_data;
++	int width, i, ret = 0;
++	u32 fifo_size;
++	int init_slots = 0;
++
++	if (!host->pdata) {
++		host->pdata = dw_mci_parse_dt(host);
++		if (IS_ERR(host->pdata)) {
++			dev_err(host->dev, "platform data not available\n");
++			return -EINVAL;
++		}
++	}
++
++	if (host->pdata->num_slots > 1) {
++		dev_err(host->dev,
++			"Platform data must supply num_slots.\n");
++		return -ENODEV;
++	}
++
++	host->biu_clk = devm_clk_get(host->dev, "biu");
++	if (IS_ERR(host->biu_clk)) {
++		dev_dbg(host->dev, "biu clock not available\n");
++	} else {
++		ret = clk_prepare_enable(host->biu_clk);
++		if (ret) {
++			dev_err(host->dev, "failed to enable biu clock\n");
++			return ret;
++		}
++	}
++
++	host->ciu_clk = devm_clk_get(host->dev, "ciu");
++	if (IS_ERR(host->ciu_clk)) {
++		dev_dbg(host->dev, "ciu clock not available\n");
++		host->bus_hz = host->pdata->bus_hz;
++	} else {
++		ret = clk_prepare_enable(host->ciu_clk);
++		if (ret) {
++			dev_err(host->dev, "failed to enable ciu clock\n");
++			goto err_clk_biu;
++		}
++
++		if (host->pdata->bus_hz) {
++			ret = clk_set_rate(host->ciu_clk, host->pdata->bus_hz);
++			if (ret)
++				dev_warn(host->dev,
++					 "Unable to set bus rate to %uHz\n",
++					 host->pdata->bus_hz);
++		}
++		host->bus_hz = clk_get_rate(host->ciu_clk);
++	}
++
++	if (!host->bus_hz) {
++		dev_err(host->dev,
++			"Platform data must supply bus speed\n");
++		ret = -ENODEV;
++		goto err_clk_ciu;
++	}
++
++	if (drv_data && drv_data->init) {
++		ret = drv_data->init(host);
++		if (ret) {
++			dev_err(host->dev,
++				"implementation specific init failed\n");
++			goto err_clk_ciu;
++		}
++	}
++
++	if (drv_data && drv_data->setup_clock) {
++		ret = drv_data->setup_clock(host);
++		if (ret) {
++			dev_err(host->dev,
++				"implementation specific clock setup failed\n");
++			goto err_clk_ciu;
++		}
++	}
++
++	host->quirks = host->pdata->quirks;
++
++	spin_lock_init(&host->lock);
++	INIT_LIST_HEAD(&host->queue);
++
++	/*
++	 * Get the host data width - this assumes that HCON has been set with
++	 * the correct values.
++	 */
++	i = (mci_readl(host, HCON) >> 7) & 0x7;
++	if (!i) {
++		host->push_data = dw_mci_push_data16;
++		host->pull_data = dw_mci_pull_data16;
++		width = 16;
++		host->data_shift = 1;
++	} else if (i == 2) {
++		host->push_data = dw_mci_push_data64;
++		host->pull_data = dw_mci_pull_data64;
++		width = 64;
++		host->data_shift = 3;
++	} else {
++		/* Check for a reserved value, and warn if it is */
++		WARN((i != 1),
++		     "HCON reports a reserved host data width!\n"
++		     "Defaulting to 32-bit access.\n");
++		host->push_data = dw_mci_push_data32;
++		host->pull_data = dw_mci_pull_data32;
++		width = 32;
++		host->data_shift = 2;
++	}
++
++	/* Reset all blocks */
++	if (!dw_mci_ctrl_reset(host, SDMMC_CTRL_ALL_RESET_FLAGS))
++		return -ENODEV;
++
++	host->dma_ops = host->pdata->dma_ops;
++	dw_mci_init_dma(host);
++
++	/* Clear the interrupts for the host controller */
++	mci_writel(host, RINTSTS, 0xFFFFFFFF);
++	mci_writel(host, INTMASK, 0); /* disable all mmc interrupt first */
++
++	/* Put in max timeout */
++	mci_writel(host, TMOUT, 0xFFFFFFFF);
++
++	/*
++	 * FIFO threshold settings  RxMark  = fifo_size / 2 - 1,
++	 *                          Tx Mark = fifo_size / 2 DMA Size = 8
++	 */
++	if (!host->pdata->fifo_depth) {
++		/*
++		 * Power-on value of RX_WMark is FIFO_DEPTH-1, but this may
++		 * have been overwritten by the bootloader, just like we're
++		 * about to do, so if you know the value for your hardware, you
++		 * should put it in the platform data.
++		 */
++		fifo_size = mci_readl(host, FIFOTH);
++		fifo_size = 1 + ((fifo_size >> 16) & 0xfff);
++	} else {
++		fifo_size = host->pdata->fifo_depth;
++	}
++	host->fifo_depth = fifo_size;
++	host->fifoth_val =
++		SDMMC_SET_FIFOTH(0x2, fifo_size / 2 - 1, fifo_size / 2);
++	mci_writel(host, FIFOTH, host->fifoth_val);
++
++	/* disable clock to CIU */
++	mci_writel(host, CLKENA, 0);
++	mci_writel(host, CLKSRC, 0);
++
++	/*
++	 * In 2.40a spec, Data offset is changed.
++	 * Need to check the version-id and set data-offset for DATA register.
++	 */
++	host->verid = SDMMC_GET_VERID(mci_readl(host, VERID));
++	dev_info(host->dev, "Version ID is %04x\n", host->verid);
++
++	if (host->verid < DW_MMC_240A)
++		host->data_offset = DATA_OFFSET;
++	else
++		host->data_offset = DATA_240A_OFFSET;
++
++	tasklet_init(&host->tasklet, dw_mci_tasklet_func, (unsigned long)host);
++	host->card_workqueue = alloc_workqueue("dw-mci-card",
++			WQ_MEM_RECLAIM, 1);
++	if (!host->card_workqueue) {
++		ret = -ENOMEM;
++		goto err_dmaunmap;
++	}
++	INIT_WORK(&host->card_work, dw_mci_work_routine_card);
++	ret = devm_request_irq(host->dev, host->irq, dw_mci_interrupt,
++			       host->irq_flags, "dw-mci", host);
++	if (ret)
++		goto err_workqueue;
++
++	if (host->pdata->num_slots)
++		host->num_slots = host->pdata->num_slots;
++	else
++		host->num_slots = ((mci_readl(host, HCON) >> 1) & 0x1F) + 1;
++
++	/*
++	 * Enable interrupts for command done, data over, data empty, card det,
++	 * receive ready and error such as transmit, receive timeout, crc error
++	 */
++	mci_writel(host, RINTSTS, 0xFFFFFFFF);
++	mci_writel(host, INTMASK, SDMMC_INT_CMD_DONE | SDMMC_INT_DATA_OVER |
++		   SDMMC_INT_TXDR | SDMMC_INT_RXDR |
++		   DW_MCI_ERROR_FLAGS | SDMMC_INT_CD);
++	mci_writel(host, CTRL, SDMMC_CTRL_INT_ENABLE); /* Enable mci interrupt */
++
++	dev_info(host->dev, "DW MMC controller at irq %d, "
++		 "%d bit host data width, "
++		 "%u deep fifo\n",
++		 host->irq, width, fifo_size);
++
++	/* We need at least one slot to succeed */
++	for (i = 0; i < host->num_slots; i++) {
++		ret = dw_mci_init_slot(host, i);
++		if (ret)
++			dev_dbg(host->dev, "slot %d init failed\n", i);
++		else
++			init_slots++;
++	}
++
++	if (init_slots) {
++		dev_info(host->dev, "%d slots initialized\n", init_slots);
++	} else {
++		dev_dbg(host->dev, "attempted to initialize %d slots, "
++					"but failed on all\n", host->num_slots);
++		goto err_workqueue;
++	}
++
++	if (host->quirks & DW_MCI_QUIRK_IDMAC_DTO)
++		dev_info(host->dev, "Internal DMAC interrupt fix enabled.\n");
++
++	return 0;
++
++err_workqueue:
++	destroy_workqueue(host->card_workqueue);
++
++err_dmaunmap:
++	if (host->use_dma && host->dma_ops->exit)
++		host->dma_ops->exit(host);
++
++err_clk_ciu:
++	if (!IS_ERR(host->ciu_clk))
++		clk_disable_unprepare(host->ciu_clk);
++
++err_clk_biu:
++	if (!IS_ERR(host->biu_clk))
++		clk_disable_unprepare(host->biu_clk);
++
++	return ret;
++}
++EXPORT_SYMBOL(dw_mci_probe);
++
++void dw_mci_remove(struct dw_mci *host)
++{
++	int i;
++
++	mci_writel(host, RINTSTS, 0xFFFFFFFF);
++	mci_writel(host, INTMASK, 0); /* disable all mmc interrupt first */
++
++	for (i = 0; i < host->num_slots; i++) {
++		dev_dbg(host->dev, "remove slot %d\n", i);
++		if (host->slot[i])
++			dw_mci_cleanup_slot(host->slot[i], i);
++	}
++
++	/* disable clock to CIU */
++	mci_writel(host, CLKENA, 0);
++	mci_writel(host, CLKSRC, 0);
++
++	destroy_workqueue(host->card_workqueue);
++
++	if (host->use_dma && host->dma_ops->exit)
++		host->dma_ops->exit(host);
++
++	if (!IS_ERR(host->ciu_clk))
++		clk_disable_unprepare(host->ciu_clk);
++
++	if (!IS_ERR(host->biu_clk))
++		clk_disable_unprepare(host->biu_clk);
++}
++EXPORT_SYMBOL(dw_mci_remove);
++
++
++
++#ifdef CONFIG_PM_SLEEP
++/*
++ * TODO: we should probably disable the clock to the card in the suspend path.
++ */
++int dw_mci_suspend(struct dw_mci *host)
++{
++	return 0;
++}
++EXPORT_SYMBOL(dw_mci_suspend);
++
++int dw_mci_resume(struct dw_mci *host)
++{
++	int i, ret;
++
++	if (!dw_mci_ctrl_reset(host, SDMMC_CTRL_ALL_RESET_FLAGS)) {
++		ret = -ENODEV;
++		return ret;
++	}
++
++	if (host->use_dma && host->dma_ops->init)
++		host->dma_ops->init(host);
++
++	/*
++	 * Restore the initial value at FIFOTH register
++	 * And Invalidate the prev_blksz with zero
++	 */
++	mci_writel(host, FIFOTH, host->fifoth_val);
++	host->prev_blksz = 0;
++
++	/* Put in max timeout */
++	mci_writel(host, TMOUT, 0xFFFFFFFF);
++
++	mci_writel(host, RINTSTS, 0xFFFFFFFF);
++	mci_writel(host, INTMASK, SDMMC_INT_CMD_DONE | SDMMC_INT_DATA_OVER |
++		   SDMMC_INT_TXDR | SDMMC_INT_RXDR |
++		   DW_MCI_ERROR_FLAGS | SDMMC_INT_CD);
++	mci_writel(host, CTRL, SDMMC_CTRL_INT_ENABLE);
++
++	for (i = 0; i < host->num_slots; i++) {
++		struct dw_mci_slot *slot = host->slot[i];
++		if (!slot)
++			continue;
++		if (slot->mmc->pm_flags & MMC_PM_KEEP_POWER) {
++			dw_mci_set_ios(slot->mmc, &slot->mmc->ios);
++			dw_mci_setup_bus(slot, true);
++		}
++	}
++	return 0;
++}
++EXPORT_SYMBOL(dw_mci_resume);
++#endif /* CONFIG_PM_SLEEP */
++
++static int __init dw_mci_init(void)
++{
++	pr_info("Synopsys Designware Multimedia Card Interface Driver\n");
++	return 0;
++}
++
++static void __exit dw_mci_exit(void)
++{
++}
++
++module_init(dw_mci_init);
++module_exit(dw_mci_exit);
++
++MODULE_DESCRIPTION("DW Multimedia Card Interface driver");
++MODULE_AUTHOR("NXP Semiconductor VietNam");
++MODULE_AUTHOR("Imagination Technologies Ltd");
++MODULE_LICENSE("GPL v2");
+diff -Nur linux-3.18.8.orig/include/linux/mmc/host.h linux-3.18.8/include/linux/mmc/host.h
+--- linux-3.18.8.orig/include/linux/mmc/host.h	2015-02-27 02:49:36.000000000 +0100
++++ linux-3.18.8/include/linux/mmc/host.h	2015-03-02 03:25:33.000000000 +0100
+@@ -305,6 +305,11 @@
+ 	unsigned long           clkgate_delay;
+ #endif
+ 
++	/* card specific properties to deal with power and reset */
++	struct regulator	*card_regulator; /* External VCC needed by the card */
++	struct gpio_desc	*card_reset_gpios[2]; /* External resets, active low */
++	struct clk		*card_clk;	/* External clock needed by the card */
++
+ 	/* host specific block data */
+ 	unsigned int		max_seg_size;	/* see blk_queue_max_segment_size */
+ 	unsigned short		max_segs;	/* see blk_queue_max_segments */

+ 24 - 9
target/config/Config.in.cpu

@@ -112,6 +112,21 @@ config ADK_CPU_GEODE
 	select ADK_TARGET_WITH_NPTL
 	select ADK_TARGET_WITH_MMU
 
+config ADK_CPU_I486
+	bool
+	select ADK_TARGET_WITH_NPTL
+	select ADK_TARGET_WITH_MMU
+
+config ADK_CPU_I586
+	bool
+	select ADK_TARGET_WITH_NPTL
+	select ADK_TARGET_WITH_MMU
+
+config ADK_CPU_I686
+	bool
+	select ADK_TARGET_WITH_NPTL
+	select ADK_TARGET_WITH_MMU
+
 config ADK_CPU_LOONGSON2F
 	bool
 	select ADK_TARGET_WITH_NPTL
@@ -280,39 +295,39 @@ config ADK_TARGET_GCC_CPU
 	string
 	default "440" if ADK_CPU_PPC_440
 	default "5208" if ADK_CPU_CF_5208
-	default "amdfam10" if ADK_CPU_AMDFAM10
 	default "arc700" if ADK_CPU_ARC700
 	default "arcv2em" if ADK_CPU_ARCv2EM
 	default "arm1176jzf-s" if ADK_CPU_ARM1176JZF_S
 	default "arm926ej-s" if ADK_CPU_ARM926EJ_S
 	default "armv8-a" if ADK_CPU_ARMV8
-	default "athlon" if ADK_CPU_ATHLON
-	default "atom" if ADK_CPU_ATOM
 	default "cortex-a7" if ADK_CPU_CORTEX_A7
 	default "cortex-a9" if ADK_CPU_CORTEX_A9
 	default "cortex-a53" if ADK_CPU_CORTEX_A53
 	default "cortex-a57" if ADK_CPU_CORTEX_A57
 	default "cortex-m3" if ADK_CPU_CORTEX_M3
 	default "cortex-m4" if ADK_CPU_CORTEX_M4
-	default "geode" if ADK_CPU_GEODE
-	default "i486" if ADK_CPU_I486
-	default "i586" if ADK_CPU_I586
-	default "i686" if ADK_CPU_I686
-	default "pentium-m" if ADK_CPU_PENTIUM_M
 	default "powerpc" if ADK_CPU_PPC
 	default "powerpc64" if ADK_CPU_PPC64
 	default "ultrasparc" if ADK_CPU_SPARC_V9
 	default "v8" if ADK_CPU_SPARC_V8
-	default "x86-64" if ADK_CPU_X86_64
 	default "xscale" if ADK_CPU_XSCALE
 
 config ADK_TARGET_GCC_ARCH
 	string
+	default "amdfam10" if ADK_CPU_AMDFAM10
+	default "athlon" if ADK_CPU_ATHLON
+	default "atom" if ADK_CPU_ATOM
+	default "geode" if ADK_CPU_GEODE
+	default "i486" if ADK_CPU_I486
+	default "i586" if ADK_CPU_I586
+	default "i686" if ADK_CPU_I686
 	default "loongson2f" if ADK_CPU_LOONGSON2F
 	default "mips32" if ADK_CPU_MIPS32
 	default "mips32r2" if ADK_CPU_MIPS32R2
 	default "mips64" if ADK_CPU_MIPS64
 	default "mips64r2" if ADK_CPU_MIPS64R2
+	default "pentium-m" if ADK_CPU_PENTIUM_M
+	default "x86-64" if ADK_CPU_X86_64
 
 config ADK_TARGET_CPU_FLAGS
 	string

+ 0 - 4
target/linux/config/Config.in.block

@@ -411,7 +411,6 @@ config ADK_KERNEL_DM_CRYPT
 	select ADK_KERNEL_CRYPTO_CBC
 	select ADK_KERNEL_CRYPTO_BLKCIPHER
 	depends on ADK_KERNEL_BLK_DEV_DM
-	default m if ADK_PACKAGE_CRYPTSETUP
 	default n
 	help
 	  This device-mapper target allows you to create a device that
@@ -439,7 +438,6 @@ config ADK_KERNEL_BLK_DEV_DRBD
 	tristate "DRBD support (Network RAID 1)"
 	select ADK_KERNEL_BLK_DEV
 	select ADK_KERNEL_CONNECTOR
-	default m if ADK_PACKAGE_DRBD
 	default n
 	help
           DRBD - http://www.drbd.org
@@ -447,8 +445,6 @@ config ADK_KERNEL_BLK_DEV_DRBD
 config ADK_KERNEL_BLK_DEV_LOOP
 	tristate "Loop mount support"
 	select ADK_KERNEL_BLK_DEV
-	default m if ADK_PACKAGE_LOSETUP
-	default m if ADK_PACKAGE_LTP
 	default n
 	help
 	  Saying Y here will allow you to use a regular file as a block

+ 0 - 14
target/linux/config/Config.in.crypto

@@ -154,9 +154,6 @@ config ADK_KERNEL_CRYPTO_CBC
 	tristate
 	select ADK_KERNEL_CRYPTO_BLKCIPHER
 	select ADK_KERNEL_CRYPTO_MANAGER
-	default m if ADK_PACKAGE_CRYPTSETUP
-	default m if ADK_PACKAGE_STRONGSWAN
-	default m if ADK_PACKAGE_OPENSWAN
 	default n
 	help
 	  CBC: Cipher Block Chaining mode
@@ -210,8 +207,6 @@ config ADK_KERNEL_CRYPTO_HMAC
 	tristate
 	select ADK_KERNEL_CRYPTO_HASH
 	select ADK_KERNEL_CRYPTO_MANAGER
-	default m if ADK_PACKAGE_STRONGSWAN
-	default m if ADK_PACKAGE_OPENSWAN
 	default n
 	help
 	  HMAC: Keyed-Hashing for Message Authentication (RFC2104).
@@ -242,8 +237,6 @@ config ADK_KERNEL_CRYPTO_MD5
 	prompt "MD5 digest algorithm"
 	tristate
 	select ADK_KERNEL_CRYPTO_HASH
-	default m if ADK_PACKAGE_STRONGSWAN
-	default m if ADK_PACKAGE_OPENSWAN
 	default n
 	help
 	  MD5 message digest algorithm (RFC1321).
@@ -252,8 +245,6 @@ config ADK_KERNEL_CRYPTO_SHA1
 	prompt "SHA1 digest algorithm"
 	tristate
 	select ADK_KERNEL_CRYPTO_HASH
-	default m if ADK_PACKAGE_STRONGSWAN
-	default m if ADK_PACKAGE_OPENSWAN
 	default n
 	help
 	  SHA-1 secure hash standard (FIPS 180-1/DFIPS 180-2).
@@ -262,7 +253,6 @@ config ADK_KERNEL_CRYPTO_SHA256
 	prompt "SHA256 digest algorithm"
 	tristate
 	select ADK_KERNEL_CRYPTO_HASH
-	default m if ADK_PACKAGE_CRYPTSETUP
 	default n
 	help
 	  SHA256 secure hash standard (DFIPS 180-2).
@@ -444,8 +434,6 @@ config ADK_KERNEL_CRYPTO_DES
 	prompt "DES and Triple DES EDE cipher algorithms"
 	tristate
 	select ADK_KERNEL_CRYPTO_ALGAPI
-	default m if ADK_PACKAGE_STRONGSWAN
-	default m if ADK_PACKAGE_OPENSWAN
 	default n
 	help
 	  DES cipher algorithm (FIPS 46-2), and Triple DES EDE (FIPS 46-3).
@@ -546,8 +534,6 @@ config ADK_KERNEL_CRYPTO_NULL
 	select ADK_KERNEL_CRYPTO_ALGAPI
 	select ADK_KERNEL_CRYPTO_BLKCIPHER
 	select ADK_KERNEL_CRYPTO_HASH
-	default m if ADK_PACKAGE_STRONGSWAN
-	default m if ADK_PACKAGE_OPENSWAN
 	default n
 	help
 	  These are 'Null' algorithms, used by IPsec, which do nothing.

+ 0 - 1
target/linux/config/Config.in.debug

@@ -123,7 +123,6 @@ config ADK_KERNEL_OPROFILE
 	tristate
 	select ADK_KERNEL_PROFILING
 	depends on !ADK_TARGET_ARCH_M68K
-	default m if ADK_PACKAGE_OPROFILE
 	default n
 	help
 	 use oprofile package to make use of the kernel support.

+ 0 - 4
target/linux/config/Config.in.fs

@@ -195,10 +195,6 @@ config ADK_KERNEL_BTRFS_FS
 config ADK_KERNEL_FUSE_FS
 	prompt "Filesystem in Userspace support"
 	tristate
-	default m if ADK_PACKAGE_DAVFS2
-	default m if ADK_PACKAGE_FUSE
-	default m if ADK_PACKAGE_NTFS_3G
-	default m if ADK_PACKAGE_WDFS
 	default n
 	help
 	  With FUSE it is possible to implement a fully functional

+ 0 - 4
target/linux/config/Config.in.fsnet

@@ -16,7 +16,6 @@ config ADK_KERNEL_CIFS
         select ADK_KERNEL_CRYPTO_DES
         select ADK_KERNEL_CRYPTO_SHA256
 	select ADK_KERNEL_NLS_UTF8
-	default m if ADK_PACKAGE_CIFS_UTILS
 	default n
 	help
 	  This is the client VFS module for the Common Internet File System
@@ -68,7 +67,6 @@ config ADK_KERNEL_NFS_FS
 	select ADK_KERNEL_SUNRPC
 	select ADK_KERNEL_LOCKD
 	select ADK_KERNEL_NETWORK_FILESYSTEMS
-	default m if ADK_PACKAGE_NFS_UTILS_CLIENT
 	default n
 	help
 	  If you are connected to some other (usually local) Unix computer
@@ -124,7 +122,6 @@ config ADK_KERNEL_NFSD
 	select ADK_KERNEL_SUNRPC
 	select ADK_KERNEL_LOCKD
 	select ADK_KERNEL_NETWORK_FILESYSTEMS
-	default m if ADK_PACKAGE_NFS_UTILS_SERVER
 	default n
 	help
 	  If you want your Linux box to act as an NFS *server*, so that other
@@ -175,7 +172,6 @@ config ADK_KERNEL_RPCSEC_GSS_KRB5
 	select ADK_KERNEL_CRYPTO_SHA1
 	select ADK_KERNEL_CRYPTO_AES
 	select ADK_KERNEL_CRYPTO_ARC4
-	default m if ADK_PACKAGE_NFS_UTILS_V4
 	default n
 	help
 

+ 0 - 3
target/linux/config/Config.in.graphics

@@ -71,7 +71,6 @@ config ADK_KERNEL_MXC_GPU_VIV
 
 config ADK_KERNEL_MXC_ASRC
  	tristate
-	default m if ADK_TARGET_SYSTEM_SOLIDRUN_IMX6
 
 config ADK_KERNEL_MXC_HDMI_CEC
  	boolean
@@ -183,7 +182,6 @@ config ADK_KERNEL_DRM_DW_HDMI_AUDIO
 	tristate
 	depends on ADK_TARGET_SYSTEM_SOLIDRUN_IMX6
 	depends on ADK_KERNEL_VERSION_3_16
-	#default m if ADK_TARGET_SYSTEM_SOLIDRUN_IMX6
  	default n
  	help
 
@@ -191,7 +189,6 @@ config ADK_KERNEL_DRM_DW_HDMI_CEC
 	tristate
 	depends on ADK_TARGET_SYSTEM_SOLIDRUN_IMX6
 	depends on ADK_KERNEL_VERSION_3_16
-	#default m if ADK_TARGET_SYSTEM_SOLIDRUN_IMX6
  	default n
  	help
 	

+ 0 - 2
target/linux/config/Config.in.input

@@ -145,8 +145,6 @@ config ADK_KERNEL_MOUSE_PS2
 config ADK_KERNEL_INPUT_EVDEV
 	tristate "Event device support"
 	select ADK_KERNEL_INPUT
-	default m if ADK_PACKAGE_XF86_INPUT_EVDEV
-	default m if ADK_PACKAGE_XF86_INPUT_EVTOUCH
 	default n
 
 endmenu

+ 0 - 14
target/linux/config/Config.in.ipsec

@@ -3,8 +3,6 @@ menu "IPSec support"
 config ADK_KERNEL_NET_KEY
 	prompt "PF_KEYv2 socket family"
 	tristate
-	default m if ADK_PACKAGE_STRONGSWAN
-	default m if ADK_PACKAGE_OPENSWAN
 	default n
 	help
 	  PF_KEYv2 socket family, compatible to KAME ones.
@@ -12,8 +10,6 @@ config ADK_KERNEL_NET_KEY
 config ADK_KERNEL_XFRM_USER
 	prompt "IPsec usertools support"
 	tristate
-	default m if ADK_PACKAGE_STRONGSWAN
-	default m if ADK_PACKAGE_OPENSWAN
 	default n
 	help
 
@@ -21,8 +17,6 @@ config ADK_KERNEL_INET_AH
 	prompt "IPsec AH support"
 	tristate
 	select ADK_KERNEL_CRYPTO_HASH
-	default m if ADK_PACKAGE_STRONGSWAN
-	default m if ADK_PACKAGE_OPENSWAN
 	default n
 	help
 	  Support for IPsec AH.
@@ -31,8 +25,6 @@ config ADK_KERNEL_INET_ESP
 	prompt "IPsec ESP support"
 	tristate
 	select ADK_KERNEL_CRYPTO_AEAD
-	default m if ADK_PACKAGE_STRONGSWAN
-	default m if ADK_PACKAGE_OPENSWAN
 	default n
 	help
 	  Support for IPsec ESP.
@@ -42,8 +34,6 @@ config ADK_KERNEL_INET_IPCOMP
 	tristate
 	select ADK_KERNEL_CRYPTO_DEFLATE
 	select ADK_KERNEL_INET_TUNNEL
-	default m if ADK_PACKAGE_STRONGSWAN
-	default m if ADK_PACKAGE_OPENSWAN
 	default n
 	help
 	  Support for IP Payload Compression Protocol (IPComp) (RFC3173),
@@ -52,8 +42,6 @@ config ADK_KERNEL_INET_IPCOMP
 config ADK_KERNEL_INET_XFRM_MODE_TRANSPORT
 	prompt "IPsec transport mode"
 	tristate
-	default m if ADK_PACKAGE_STRONGSWAN
-	default m if ADK_PACKAGE_OPENSWAN
 	default n
 	help
 	  Support for IPsec transport mode.
@@ -61,8 +49,6 @@ config ADK_KERNEL_INET_XFRM_MODE_TRANSPORT
 config ADK_KERNEL_INET_XFRM_MODE_TUNNEL
 	prompt "IPsec tunnel mode"
 	tristate
-	default m if ADK_PACKAGE_STRONGSWAN
-	default m if ADK_PACKAGE_OPENSWAN
 	default n
 	help
 	  Support for IPsec tunnel mode.

+ 0 - 1
target/linux/config/Config.in.ipvs

@@ -5,7 +5,6 @@ config ADK_KERNEL_IP_VS
 	tristate
 	select ADK_KERNEL_NETFILTER
 	select ADK_KERNEL_NF_CONNTRACK
-	default m if ADK_PACKAGE_IPVSADM
 	default n
 
 config ADK_KERNEL_IP_VS_DEBUG

+ 4 - 0
target/linux/config/Config.in.kernel

@@ -175,6 +175,10 @@ endchoice
 
 menu "Kernel options"
 
+config ADK_KERNEL_BINFMT_FLAT
+	bool
+	default y if ADK_TARGET_BINFMT_FLAT
+
 config ADK_KERNEL_MMU
 	bool
 

+ 0 - 1
target/linux/config/Config.in.netfilter.core

@@ -1,7 +1,6 @@
 config ADK_KERNEL_NF_CONNTRACK
 	tristate 'Netfilter connection tracking support'
 	select ADK_KERNEL_NETFILTER_XTABLES
-	default m if ADK_PACKAGE_IPTABLES
 	default n
 	help
 	  Connection tracking keeps a record of what packets have passed

+ 0 - 1
target/linux/config/Config.in.netfilter.ebt

@@ -2,7 +2,6 @@ config ADK_KERNEL_BRIDGE_NF_EBTABLES
 	prompt 'Ethernet Bridge tables support'
 	tristate
 	select ADK_KERNEL_BRIDGE_NETFILTER
-	default m if ADK_PACKAGE_EBTABLES
 	default n
 	help
 	  ebtables is a general, extensible frame/packet identification

+ 0 - 6
target/linux/config/Config.in.netfilter.ip4

@@ -7,7 +7,6 @@ config ADK_KERNEL_NF_NAT_IPV4
 config ADK_KERNEL_IP_NF_IPTABLES
 	tristate 'IP tables support'
 	select ADK_KERNEL_NETFILTER_XTABLES
-	default m if ADK_PACKAGE_IPTABLES
 	default n
 	help
 	  iptables is a general, extensible packet identification framework.
@@ -18,7 +17,6 @@ config ADK_KERNEL_IP_NF_IPTABLES
 config ADK_KERNEL_IP_NF_FILTER
 	tristate 'IP Packet Filtering table support'
 	depends on ADK_KERNEL_IP_NF_IPTABLES
-	default m if ADK_PACKAGE_IPTABLES
 	default n
 	help
 	  Packet filtering defines a table `filter', which has a series of
@@ -31,7 +29,6 @@ config ADK_KERNEL_IP_NF_NAT
 	select ADK_KERNEL_NF_NAT
 	select ADK_KERNEL_NF_NAT_IPV4
 	depends on ADK_KERNEL_IP_NF_IPTABLES
-	default m if ADK_PACKAGE_IPTABLES
 	default n
 	help
 
@@ -48,7 +45,6 @@ config ADK_KERNEL_NF_CONNTRACK_IPV4
 	tristate 'IP connection tracking support (required for NAT)'
 	select ADK_KERNEL_NF_CONNTRACK
 	select ADK_KERNEL_NETFILTER_XT_MATCH_CONNTRACK
-	default m if ADK_PACKAGE_IPTABLES
 	default n
 	help
 	  Connection tracking keeps a record of what packets have passed
@@ -70,7 +66,6 @@ menu "IP target support"
 config ADK_KERNEL_IP_NF_TARGET_MASQUERADE
 	tristate 'MASQUERADE target support'
 	depends on ADK_KERNEL_NF_NAT
-	default m if ADK_PACKAGE_IPTABLES
 	default n
 	help
 	  Masquerading is a special case of NAT: all outgoing connections are
@@ -82,7 +77,6 @@ config ADK_KERNEL_IP_NF_TARGET_MASQUERADE
 config ADK_KERNEL_IP_NF_TARGET_REJECT
 	tristate 'REJECT target support'
 	depends on ADK_KERNEL_IP_NF_FILTER
-	default m if ADK_PACKAGE_IPTABLES
 	default n
 	help
 	  The REJECT target allows a filtering rule to specify that an ICMP

+ 2 - 2
toolchain/elf2flt/Makefile.inc

@@ -2,7 +2,7 @@
 # material, please see the LICENCE file in the top-level directory.
 
 PKG_NAME:=		elf2flt
-PKG_VERSION:=		20150129
+PKG_VERSION:=		20150227
 PKG_RELEASE:=		1
-PKG_HASH:=		b0b9792723f380794c44db4124815f961f2cb87be156d4e2f560759f9f9f913b
+PKG_HASH:=		9369274cf244fc090ebee08ee6eee552fba1286f63be4a558dfa149dfa91fc4c
 PKG_SITES:=		http://www.openadk.org/distfiles/

+ 1 - 0
toolchain/glibc/Makefile.inc

@@ -23,6 +23,7 @@ GLIBC_CONFOPTS:=	--build=$(GNU_HOST_NAME) \
 			--host=$(GNU_TARGET_NAME) \
 			--with-headers=$(STAGING_TARGET_DIR)/usr/include \
 			--disable-sanity-checks \
+			--disable-werror \
 			--disable-nls \
 			--without-cvs \
 			--disable-profile \

+ 3 - 3
toolchain/uclibc-ng/Makefile

@@ -28,9 +28,9 @@ TARGET_CFLAGS+=		-Wa,-msoft-float
 endif
 endif
 
-ifeq (${ADK_MAKE_PARALLEL},y)
-UCLIBC_MAKEOPTS+=	-j${ADK_MAKE_JOBS}
-endif
+#ifeq (${ADK_MAKE_PARALLEL},y)
+#UCLIBC_MAKEOPTS+=	-j${ADK_MAKE_JOBS}
+#endif
 
 $(WRKBUILD)/.headers:
 	$(SED) 's,^CROSS_COMPILE=.*,CROSS_COMPILE=$(TARGET_CROSS),g' $(WRKBUILD)/Rules.mak

+ 0 - 106
toolchain/uclibc/patches/0.9.34-git/0001-fix-linuxthreads-for-coldfire-nommu.patch

@@ -1,106 +0,0 @@
-From 45064565100b67ff2f960e93d580449b720a66c9 Mon Sep 17 00:00:00 2001
-From: Waldemar Brodkorb <wbx@openadk.org>
-Date: Sat, 6 Sep 2014 01:52:10 +0200
-Subject: [PATCH] fix linuxthreads for coldfire nommu
-
-Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
----
- libpthread/linuxthreads/sysdeps/m68k/pspinlock.c     | 20 +++++++++++++++-----
- libpthread/linuxthreads/sysdeps/m68k/pt-machine.h    | 11 +++++++++--
- libpthread/linuxthreads/sysdeps/pthread/herrno-loc.c |  2 ++
- 3 files changed, 26 insertions(+), 7 deletions(-)
-
-diff --git a/libpthread/linuxthreads/sysdeps/m68k/pspinlock.c b/libpthread/linuxthreads/sysdeps/m68k/pspinlock.c
-index c26a278..af77c2a 100644
---- a/libpthread/linuxthreads/sysdeps/m68k/pspinlock.c
-+++ b/libpthread/linuxthreads/sysdeps/m68k/pspinlock.c
-@@ -27,10 +27,15 @@ __pthread_spin_lock (pthread_spinlock_t *lock)
-   unsigned int val;
- 
-   do
--    __asm__ __volatile__ ("tas %1; sne %0"
--		  : "=dm" (val), "=m" (*lock)
--		  : "m" (*lock)
--		  : "cc");
-+    __asm__ __volatile__ (
-+#if !defined(__mcoldfire__) && !defined(__mcf5200__) && !defined(__m68000)
-+		"tas %1; sne %0"
-+#else
-+		"bset #7,%1; sne %0"
-+#endif
-+		: "=dm" (val), "=m" (*lock)
-+		: "m" (*lock)
-+		: "cc");
-   while (val);
- 
-   return 0;
-@@ -43,7 +48,12 @@ __pthread_spin_trylock (pthread_spinlock_t *lock)
- {
-   unsigned int val;
- 
--  __asm__ __volatile__ ("tas %1; sne %0"
-+  __asm__ __volatile__ (
-+#if !defined(__mcoldfire__) && !defined(__mcf5200__) && !defined(__m68000)
-+		"tas %1; sne %0"
-+#else
-+		"bset #7,%1; sne %0"
-+#endif
- 		: "=dm" (val), "=m" (*lock)
- 		: "m" (*lock)
- 		: "cc");
-diff --git a/libpthread/linuxthreads/sysdeps/m68k/pt-machine.h b/libpthread/linuxthreads/sysdeps/m68k/pt-machine.h
-index e2d7bdc..1eb9fd5 100644
---- a/libpthread/linuxthreads/sysdeps/m68k/pt-machine.h
-+++ b/libpthread/linuxthreads/sysdeps/m68k/pt-machine.h
-@@ -28,12 +28,18 @@
- #endif
- 
- /* Spinlock implementation; required.  */
-+PT_EI long int testandset (int *spinlock);
- PT_EI long int
- testandset (int *spinlock)
- {
-   char ret;
- 
--  __asm__ __volatile__("tas %1; sne %0"
-+  __asm__ __volatile__(
-+#if !defined(__mcoldfire__) && !defined(__mcf5200__) && !defined(__m68000)
-+	"tas %1; sne %0"
-+#else
-+	"bset #7,%1; sne %0"
-+#endif
-        : "=dm"(ret), "=m"(*spinlock)
-        : "m"(*spinlock)
-        : "cc");
-@@ -50,6 +56,7 @@ register char * stack_pointer __asm__ ("%sp");
- 
- /* Compare-and-swap for semaphores. */
- 
-+#if !defined(__mcoldfire__) && !defined(__mcf5200__) && !defined(__mc68000)
- #define HAS_COMPARE_AND_SWAP
- PT_EI int
- __compare_and_swap (long int *p, long int oldval, long int newval)
-@@ -63,5 +70,5 @@ __compare_and_swap (long int *p, long int oldval, long int newval)
- 
-   return ret;
- }
--
-+#endif
- #endif /* pt-machine.h */
-diff --git a/libpthread/linuxthreads/sysdeps/pthread/herrno-loc.c b/libpthread/linuxthreads/sysdeps/pthread/herrno-loc.c
-index 706faef..634c752 100644
---- a/libpthread/linuxthreads/sysdeps/pthread/herrno-loc.c
-+++ b/libpthread/linuxthreads/sysdeps/pthread/herrno-loc.c
-@@ -16,7 +16,9 @@
-    <http://www.gnu.org/licenses/>.  */
- 
- #include <netdb.h>
-+#ifdef __UCLIBC_HAS_TLS__
- #include <tls.h>
-+#endif
- #include <linuxthreads/internals.h>
- #include <sysdep-cancel.h>
- 
--- 
-2.0.1
-

+ 0 - 27
toolchain/uclibc/patches/0.9.34-git/0001-test-disable-posix_fallocate64-for-small-embedded-sy.patch

@@ -1,27 +0,0 @@
-From 943ef39519a3a4aa514f1fe9431565bf691f01f2 Mon Sep 17 00:00:00 2001
-From: Waldemar Brodkorb <wbx@openadk.org>
-Date: Mon, 1 Sep 2014 21:02:19 +0200
-Subject: [PATCH 1/6] test: disable posix_fallocate64 for small embedded
- systems
-
-Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
----
- test/unistd/Makefile.in | 2 ++
- 1 file changed, 2 insertions(+)
-
-diff --git a/test/unistd/Makefile.in b/test/unistd/Makefile.in
-index ed33d9a..c884a39 100644
---- a/test/unistd/Makefile.in
-+++ b/test/unistd/Makefile.in
-@@ -25,6 +25,8 @@ else
- # reordering is not supported, behaves as if POSIXLY_CORRECT would be set
- OPTS_tstgetopt   := -a -b -cfoobar --required foobar --optional=bazbug --none --colou --color --colour random
- endif
-+# for embedded systems 4 GB disk space is not available
-+TESTS_DISABLED += tst-posix_fallocate64
- 
- # getconf.c lives in utils/
- # Testsuite cannot currently be built with O= anyway, so hardcode path here
--- 
-1.8.5.2 (Apple Git-48)
-

+ 0 - 1347
toolchain/uclibc/patches/0.9.34-git/0003-linuxthreads-remove-unused-s390-code.patch

@@ -1,1347 +0,0 @@
-From 0072d1730591edbbcee79f93d54b66ffbd57a02b Mon Sep 17 00:00:00 2001
-From: Waldemar Brodkorb <wbx@openadk.org>
-Date: Sat, 6 Sep 2014 14:45:42 +0200
-Subject: [PATCH 3/6] linuxthreads: remove unused s390 code
-
-Cleanup linuxthreads by removing unused s390 code.
-
-Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
----
- libc/stdlib/system.c                               |   3 -
- libpthread/linuxthreads/sysdeps/s390/pspinlock.c   |  90 ------------
- .../linuxthreads/sysdeps/s390/s390-32/pt-machine.h | 119 ----------------
- .../linuxthreads/sysdeps/s390/s390-64/pt-machine.h | 124 -----------------
- .../linuxthreads/sysdeps/s390/tcb-offsets.sym      |   4 -
- libpthread/linuxthreads/sysdeps/s390/tls.h         | 144 -------------------
- .../sysdeps/unix/sysv/linux/s390/bits/typesizes.h  |  71 ----------
- .../unix/sysv/linux/s390/s390-32/pt-initfini.c     | 153 ---------------------
- .../unix/sysv/linux/s390/s390-32/sysdep-cancel.h   | 136 ------------------
- .../sysdeps/unix/sysv/linux/s390/s390-32/vfork.S   |  68 ---------
- .../unix/sysv/linux/s390/s390-64/pt-initfini.c     | 136 ------------------
- .../unix/sysv/linux/s390/s390-64/pt-sigsuspend.c   |   1 -
- .../unix/sysv/linux/s390/s390-64/sysdep-cancel.h   | 115 ----------------
- .../sysdeps/unix/sysv/linux/s390/s390-64/vfork.S   |  53 -------
- 14 files changed, 1217 deletions(-)
- delete mode 100644 libpthread/linuxthreads/sysdeps/s390/pspinlock.c
- delete mode 100644 libpthread/linuxthreads/sysdeps/s390/s390-32/pt-machine.h
- delete mode 100644 libpthread/linuxthreads/sysdeps/s390/s390-64/pt-machine.h
- delete mode 100644 libpthread/linuxthreads/sysdeps/s390/tcb-offsets.sym
- delete mode 100644 libpthread/linuxthreads/sysdeps/s390/tls.h
- delete mode 100644 libpthread/linuxthreads/sysdeps/unix/sysv/linux/s390/bits/typesizes.h
- delete mode 100644 libpthread/linuxthreads/sysdeps/unix/sysv/linux/s390/s390-32/pt-initfini.c
- delete mode 100644 libpthread/linuxthreads/sysdeps/unix/sysv/linux/s390/s390-32/sysdep-cancel.h
- delete mode 100644 libpthread/linuxthreads/sysdeps/unix/sysv/linux/s390/s390-32/vfork.S
- delete mode 100644 libpthread/linuxthreads/sysdeps/unix/sysv/linux/s390/s390-64/pt-initfini.c
- delete mode 100644 libpthread/linuxthreads/sysdeps/unix/sysv/linux/s390/s390-64/pt-sigsuspend.c
- delete mode 100644 libpthread/linuxthreads/sysdeps/unix/sysv/linux/s390/s390-64/sysdep-cancel.h
- delete mode 100644 libpthread/linuxthreads/sysdeps/unix/sysv/linux/s390/s390-64/vfork.S
-
-diff --git a/libc/stdlib/system.c b/libc/stdlib/system.c
-index 8c5d25d..05b6738 100644
---- a/libc/stdlib/system.c
-+++ b/libc/stdlib/system.c
-@@ -91,9 +91,6 @@ libc_hidden_proto(waitpid)
- #elif defined __sparc__
- # define FORK() \
-   INLINE_CLONE_SYSCALL (CLONE_PARENT_SETTID | SIGCHLD, 0, &pid, NULL, NULL)
--#elif defined __s390__
--# define FORK() \
--  INLINE_SYSCALL (clone, 3, 0, CLONE_PARENT_SETTID | SIGCHLD, &pid)
- #else
- # define FORK() \
-   INLINE_SYSCALL (clone, 3, CLONE_PARENT_SETTID | SIGCHLD, 0, &pid)
-diff --git a/libpthread/linuxthreads/sysdeps/s390/pspinlock.c b/libpthread/linuxthreads/sysdeps/s390/pspinlock.c
-deleted file mode 100644
-index be75786..0000000
---- a/libpthread/linuxthreads/sysdeps/s390/pspinlock.c
-+++ /dev/null
-@@ -1,90 +0,0 @@
--/* POSIX spinlock implementation.  S/390 version.
--   Copyright (C) 2000, 2004 Free Software Foundation, Inc.
--   Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
--   This file is part of the GNU C Library.
--
--   The GNU C Library is free software; you can redistribute it and/or
--   modify it under the terms of the GNU Lesser General Public License as
--   published by the Free Software Foundation; either version 2.1 of the
--   License, or (at your option) any later version.
--
--   The GNU C Library is distributed in the hope that it will be useful,
--   but WITHOUT ANY WARRANTY; without even the implied warranty of
--   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
--   Lesser General Public License for more details.
--
--   You should have received a copy of the GNU Lesser General Public
--   License along with the GNU C Library; see the file COPYING.LIB.  If
--   not, see <http://www.gnu.org/licenses/>.  */
--
--#include <errno.h>
--#include <pthread.h>
--#include "internals.h"
--
--/* This implementation is similar to the one used in the Linux kernel.
--   But the kernel is byte instructions for the memory access.  This is
--   faster but unusable here.  The problem is that only 128
--   threads/processes could use the spinlock at the same time.  If (by
--   a design error in the program) a thread/process would hold the
--   spinlock for a time long enough to accumulate 128 waiting
--   processes, the next one will find a positive value in the spinlock
--   and assume it is unlocked.  We cannot accept that.  */
--
--int
--__pthread_spin_lock (pthread_spinlock_t *lock)
--{
--  __asm__ __volatile__("    basr  1,0\n"
--	       "0:  slr   0,0\n"
--	       "    cs    0,1,%1\n"
--	       "    jl    0b\n"
--	       : "=m" (*lock)
--	       : "m" (*lock) : "0", "1", "cc" );
--  return 0;
--}
--weak_alias (__pthread_spin_lock, pthread_spin_lock)
--
--int
--__pthread_spin_trylock (pthread_spinlock_t *lock)
--{
--  int oldval;
--
--  __asm__ __volatile__("    slr   %1,%1\n"
--	       "    basr  1,0\n"
--	       "0:  cs    %1,1,%0"
--	       : "=m" (*lock), "=&d" (oldval)
--	       : "m" (*lock) : "1", "cc" );
--  return oldval == 0 ? 0 : EBUSY;
--}
--weak_alias (__pthread_spin_trylock, pthread_spin_trylock)
--
--
--int
--__pthread_spin_unlock (pthread_spinlock_t *lock)
--{
--  __asm__ __volatile__("    xc 0(4,%0),0(%0)\n"
--	       "    bcr 15,0"
--	       : : "a" (lock) : "memory" );
--  return 0;
--}
--weak_alias (__pthread_spin_unlock, pthread_spin_unlock)
--
--
--int
--__pthread_spin_init (pthread_spinlock_t *lock, int pshared)
--{
--  /* We can ignore the `pshared' parameter.  Since we are busy-waiting
--     all processes which can access the memory location `lock' points
--     to can use the spinlock.  */
--  *lock = 0;
--  return 0;
--}
--weak_alias (__pthread_spin_init, pthread_spin_init)
--
--
--int
--__pthread_spin_destroy (pthread_spinlock_t *lock)
--{
--  /* Nothing to do.  */
--  return 0;
--}
--weak_alias (__pthread_spin_destroy, pthread_spin_destroy)
-diff --git a/libpthread/linuxthreads/sysdeps/s390/s390-32/pt-machine.h b/libpthread/linuxthreads/sysdeps/s390/s390-32/pt-machine.h
-deleted file mode 100644
-index 51505a9..0000000
---- a/libpthread/linuxthreads/sysdeps/s390/s390-32/pt-machine.h
-+++ /dev/null
-@@ -1,119 +0,0 @@
--/* Machine-dependent pthreads configuration and inline functions.
--   S390 version.
--   Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
--   Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
--   This file is part of the GNU C Library.
--
--   The GNU C Library is free software; you can redistribute it and/or
--   modify it under the terms of the GNU Lesser General Public License as
--   published by the Free Software Foundation; either version 2.1 of the
--   License, or (at your option) any later version.
--
--   The GNU C Library is distributed in the hope that it will be useful,
--   but WITHOUT ANY WARRANTY; without even the implied warranty of
--   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
--   Lesser General Public License for more details.
--
--   You should have received a copy of the GNU Lesser General Public
--   License along with the GNU C Library; see the file COPYING.LIB.  If
--   not, see <http://www.gnu.org/licenses/>.  */
--
--#ifndef _PT_MACHINE_H
--#define _PT_MACHINE_H   1
--
--#ifndef PT_EI
--# define PT_EI __extern_always_inline
--#endif
--
--extern long int testandset (int *spinlock);
--extern int __compare_and_swap (long int *p, long int oldval, long int newval);
--
--/* For multiprocessor systems, we want to ensure all memory accesses
--   are completed before we reset a lock.  On other systems, we still
--   need to make sure that the compiler has flushed everything to memory.  */
--#define MEMORY_BARRIER() __asm__ __volatile__ ("bcr 15,0" : : : "memory")
--
--/* Spinlock implementation; required.  */
--PT_EI long int
--testandset (int *spinlock)
--{
--  int ret;
--
--  __asm__ __volatile__(
--       "    la    1,%1\n"
--       "    lhi   0,1\n"
--       "    l     %0,%1\n"
--       "0:  cs    %0,0,0(1)\n"
--       "    jl    0b"
--       : "=&d" (ret), "+m" (*spinlock)
--       : : "0", "1", "cc");
--
--  return ret;
--}
--
--
--/* Get some notion of the current stack.  Need not be exactly the top
--   of the stack, just something somewhere in the current frame.  */
--#define CURRENT_STACK_FRAME  stack_pointer
--register char * stack_pointer __asm__ ("15");
--
--#ifdef __UCLIBC_HAS_TLS__
--/* Return the thread descriptor for the current thread.  */
--# define THREAD_SELF ((pthread_descr) __builtin_thread_pointer ())
--
--/* Initialize the thread-unique value.  */
--#define INIT_THREAD_SELF(descr, nr) __builtin_set_thread_pointer (descr)
--#else
--/* Return the thread descriptor for the current thread.
--   S/390 registers uses access register 0 as "thread register".  */
--#define THREAD_SELF  ({                                                       \
--  register pthread_descr __self;                                              \
--  __asm__ ("ear %0,%%a0" : "=d" (__self) );                                   \
--  __self;                                                                     \
--})
--
--/* Initialize the thread-unique value.  */
--#define INIT_THREAD_SELF(descr, nr)  ({                                       \
--  __asm__ ("sar %%a0,%0" : : "d" (descr) );                                   \
--})
--#endif
--
--/* Access to data in the thread descriptor is easy.  */
--#define THREAD_GETMEM(descr, member) \
--  ((void) sizeof (descr), THREAD_SELF->member)
--#define THREAD_GETMEM_NC(descr, member) \
--  ((void) sizeof (descr), THREAD_SELF->member)
--#define THREAD_SETMEM(descr, member, value) \
--  ((void) sizeof (descr), THREAD_SELF->member = (value))
--#define THREAD_SETMEM_NC(descr, member, value) \
--  ((void) sizeof (descr), THREAD_SELF->member = (value))
--
--/* We want the OS to assign stack addresses.  */
--#define FLOATING_STACKS 1
--
--/* Maximum size of the stack if the rlimit is unlimited.  */
--#define ARCH_STACK_MAX_SIZE     8*1024*1024
--
--/* Compare-and-swap for semaphores. */
--
--#define HAS_COMPARE_AND_SWAP
--
--PT_EI int
--__compare_and_swap(long int *p, long int oldval, long int newval)
--{
--        int retval;
--
--        __asm__ __volatile__(
--                "  la   1,%1\n"
--                "  lr   0,%2\n"
--                "  cs   0,%3,0(1)\n"
--                "  ipm  %0\n"
--                "  srl  %0,28\n"
--                "0:"
--                : "=&d" (retval), "+m" (*p)
--                : "d" (oldval) , "d" (newval)
--                : "cc", "0", "1" );
--        return retval == 0;
--}
--
--#endif /* pt-machine.h */
-diff --git a/libpthread/linuxthreads/sysdeps/s390/s390-64/pt-machine.h b/libpthread/linuxthreads/sysdeps/s390/s390-64/pt-machine.h
-deleted file mode 100644
-index 4bff85a..0000000
---- a/libpthread/linuxthreads/sysdeps/s390/s390-64/pt-machine.h
-+++ /dev/null
-@@ -1,124 +0,0 @@
--/* Machine-dependent pthreads configuration and inline functions.
--   64 bit S/390 version.
--   Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
--   Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
--   This file is part of the GNU C Library.
--
--   The GNU C Library is free software; you can redistribute it and/or
--   modify it under the terms of the GNU Lesser General Public License as
--   published by the Free Software Foundation; either version 2.1 of the
--   License, or (at your option) any later version.
--
--   The GNU C Library is distributed in the hope that it will be useful,
--   but WITHOUT ANY WARRANTY; without even the implied warranty of
--   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
--   Lesser General Public License for more details.
--
--   You should have received a copy of the GNU Lesser General Public
--   License along with the GNU C Library; see the file COPYING.LIB.  If
--   not, see <http://www.gnu.org/licenses/>.  */
--
--#ifndef _PT_MACHINE_H
--#define _PT_MACHINE_H   1
--
--#ifndef PT_EI
--# define PT_EI __extern_always_inline
--#endif
--
--extern long int testandset (int *spinlock);
--extern int __compare_and_swap (long int *p, long int oldval, long int newval);
--
--/* For multiprocessor systems, we want to ensure all memory accesses
--   are completed before we reset a lock.  On other systems, we still
--   need to make sure that the compiler has flushed everything to memory.  */
--#define MEMORY_BARRIER() __asm__ __volatile__ ("bcr 15,0" : : : "memory")
--
--/* Spinlock implementation; required.  */
--PT_EI long int
--testandset (int *spinlock)
--{
--  int ret;
--
--  __asm__ __volatile__(
--       "    la    1,%1\n"
--       "    lhi   0,1\n"
--       "    l     %0,%1\n"
--       "0:  cs    %0,0,0(1)\n"
--       "    jl    0b"
--       : "=&d" (ret), "+m" (*spinlock)
--       : : "0", "1", "cc");
--
--  return ret;
--}
--
--
--/* Get some notion of the current stack.  Need not be exactly the top
--   of the stack, just something somewhere in the current frame.  */
--#define CURRENT_STACK_FRAME  stack_pointer
--register char * stack_pointer __asm__ ("15");
--
--#ifdef __UCLIBC_HAS_TLS__
--/* Return the thread descriptor for the current thread.  */
--# define THREAD_SELF ((pthread_descr) __builtin_thread_pointer ())
--
--/* Initialize the thread-unique value.  */
--#define INIT_THREAD_SELF(descr, nr) __builtin_set_thread_pointer (descr)
--#else
--/* Return the thread descriptor for the current thread.
--   64 bit S/390 uses access register 0 and 1 as "thread register".  */
--#define THREAD_SELF  ({                                                       \
--  register pthread_descr __self;                                              \
--  __asm__ ("   ear  %0,%%a0\n"                                                \
--           "   sllg %0,%0,32\n"                                               \
--           "   ear  %0,%%a1\n"                                                \
--           : "=d" (__self) );                                                 \
--  __self;                                                                     \
--})
--
--/* Initialize the thread-unique value.  */
--#define INIT_THREAD_SELF(descr, nr)  ({                                       \
--  __asm__ ("   sar  %%a1,%0\n"                                                \
--           "   srlg 0,%0,32\n"                                                \
--           "   sar  %%a0,0\n"                                                 \
--           : : "d" (descr) : "0" );                                           \
--})
--#endif
--
--/* Access to data in the thread descriptor is easy.  */
--#define THREAD_GETMEM(descr, member) \
--  ((void) sizeof (descr), THREAD_SELF->member)
--#define THREAD_GETMEM_NC(descr, member) \
--  ((void) sizeof (descr), THREAD_SELF->member)
--#define THREAD_SETMEM(descr, member, value) \
--  ((void) sizeof (descr), THREAD_SELF->member = (value))
--#define THREAD_SETMEM_NC(descr, member, value) \
--  ((void) sizeof (descr), THREAD_SELF->member = (value))
--
--/* We want the OS to assign stack addresses.  */
--#define FLOATING_STACKS 1
--
--/* Maximum size of the stack if the rlimit is unlimited.  */
--#define ARCH_STACK_MAX_SIZE     8*1024*1024
--
--/* Compare-and-swap for semaphores. */
--
--#define HAS_COMPARE_AND_SWAP
--
--PT_EI int
--__compare_and_swap(long int *p, long int oldval, long int newval)
--{
--        int retval;
--
--        __asm__ __volatile__(
--                "  lgr  0,%2\n"
--                "  csg  0,%3,%1\n"
--                "  ipm  %0\n"
--                "  srl  %0,28\n"
--                "0:"
--                : "=&d" (retval), "+m" (*p)
--                : "d" (oldval) , "d" (newval)
--                : "cc", "0");
--        return retval == 0;
--}
--
--#endif /* pt-machine.h */
-diff --git a/libpthread/linuxthreads/sysdeps/s390/tcb-offsets.sym b/libpthread/linuxthreads/sysdeps/s390/tcb-offsets.sym
-deleted file mode 100644
-index aee6be2..0000000
---- a/libpthread/linuxthreads/sysdeps/s390/tcb-offsets.sym
-+++ /dev/null
-@@ -1,4 +0,0 @@
--#include <sysdep.h>
--#include <tls.h>
--
--MULTIPLE_THREADS_OFFSET		offsetof (tcbhead_t, multiple_threads)
-diff --git a/libpthread/linuxthreads/sysdeps/s390/tls.h b/libpthread/linuxthreads/sysdeps/s390/tls.h
-deleted file mode 100644
-index d987bdb..0000000
---- a/libpthread/linuxthreads/sysdeps/s390/tls.h
-+++ /dev/null
-@@ -1,144 +0,0 @@
--/* Definitions for thread-local data handling.  linuxthreads/s390 version.
--   Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc.
--   This file is part of the GNU C Library.
--
--   The GNU C Library is free software; you can redistribute it and/or
--   modify it under the terms of the GNU Lesser General Public
--   License as published by the Free Software Foundation; either
--   version 2.1 of the License, or (at your option) any later version.
--
--   The GNU C Library is distributed in the hope that it will be useful,
--   but WITHOUT ANY WARRANTY; without even the implied warranty of
--   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
--   Lesser General Public License for more details.
--
--   You should have received a copy of the GNU Lesser General Public
--   License along with the GNU C Library; if not, see
--   <http://www.gnu.org/licenses/>.  */
--
--#ifndef _TLS_H
--#define _TLS_H
--
--#ifndef __ASSEMBLER__
--
--# include <pt-machine.h>
--# include <stdbool.h>
--# include <stddef.h>
--
--/* Type for the dtv.  */
--typedef union dtv
--{
--  size_t counter;
--  struct
--  {
--    void *val;
--    bool is_static;
--  } pointer;
--} dtv_t;
--
--typedef struct
--{
--  void *tcb;		/* Pointer to the TCB.  Not necessary the
--			   thread descriptor used by libpthread.  */
--  dtv_t *dtv;
--  void *self;		/* Pointer to the thread descriptor.  */
--  int multiple_threads;
--} tcbhead_t;
--
--#else /* __ASSEMBLER__ */
--# include <tcb-offsets.h>
--#endif /* __ASSEMBLER__ */
--
--/* TLS is always supported if the tools support it.  There are no
--   kernel dependencies.  To avoid bothering with the TLS support code
--   at all, use configure --without-tls.
--
--   We need USE_TLS to be consistently defined, for ldsodefs.h
--   conditionals.  */
--
--#ifdef HAVE_TLS_SUPPORT
--
--/* Signal that TLS support is available.  */
--# define USE_TLS	1
--
--# ifndef __ASSEMBLER__
--/* Get system call information.  */
--#  include <sysdep.h>
--
--
--/* Get the thread descriptor definition.  */
--#  include <linuxthreads/descr.h>
--
--/* This is the size of the initial TCB.  */
--#  define TLS_INIT_TCB_SIZE sizeof (tcbhead_t)
--
--/* Alignment requirements for the initial TCB.  */
--#  define TLS_INIT_TCB_ALIGN __alignof__ (tcbhead_t)
--
--/* This is the size of the TCB.  */
--#  define TLS_TCB_SIZE sizeof (struct _pthread_descr_struct)
--
--/* Alignment requirements for the TCB.  */
--#  define TLS_TCB_ALIGN __alignof__ (struct _pthread_descr_struct)
--
--/* The TCB can have any size and the memory following the address the
--   thread pointer points to is unspecified.  Allocate the TCB there.  */
--#  define TLS_TCB_AT_TP	1
--
--
--/* Install the dtv pointer.  The pointer passed is to the element with
--   index -1 which contain the length.  */
--#  define INSTALL_DTV(descr, dtvp) \
--  ((tcbhead_t *) (descr))->dtv = (dtvp) + 1
--
--/* Install new dtv for current thread.  */
--#  define INSTALL_NEW_DTV(dtv) \
--  (((tcbhead_t *) __builtin_thread_pointer ())->dtv = (dtv))
--
--/* Return dtv of given thread descriptor.  */
--#  define GET_DTV(descr) \
--  (((tcbhead_t *) (descr))->dtv)
--
--/* Code to initially initialize the thread pointer.  This might need
--   special attention since 'errno' is not yet available and if the
--   operation can cause a failure 'errno' must not be touched.
--
--   The value of this macro is null if successful, or an error string.  */
--#  define TLS_INIT_TP(descr, secondcall)				      \
--  ({									      \
--    void *_descr = (descr);						      \
--    tcbhead_t *head = _descr;						      \
--									      \
--    head->tcb = _descr;							      \
--    /* For now the thread descriptor is at the same address.  */	      \
--    head->self = _descr;						      \
--									      \
--    __builtin_set_thread_pointer (_descr);				      \
--    NULL;								      \
--  })
--
--/* Return the address of the dtv for the current thread.  */
--#  define THREAD_DTV() \
--  (((tcbhead_t *) __builtin_thread_pointer ())->dtv)
--
--# endif /* __ASSEMBLER__ */
--
--#else	/* HAVE_TLS_SUPPORT && (FLOATING_STACKS || !IS_IN_libpthread) */
--
--# ifndef __ASSEMBLER__
--
--/* Get the thread descriptor definition.  */
--#  include <linuxthreads/descr.h>
--
--#  define NONTLS_INIT_TP \
--  do { 								\
--    static const tcbhead_t nontls_init_tp			\
--      = { .multiple_threads = 0 };				\
--    INIT_THREAD_SELF (&nontls_init_tp, 0);			\
--  } while (0)
--
--# endif /* __ASSEMBLER__ */
--
--#endif	/* HAVE_TLS_SUPPORT && (FLOATING_STACKS || !IS_IN_libpthread) */
--
--#endif	/* tls.h */
-diff --git a/libpthread/linuxthreads/sysdeps/unix/sysv/linux/s390/bits/typesizes.h b/libpthread/linuxthreads/sysdeps/unix/sysv/linux/s390/bits/typesizes.h
-deleted file mode 100644
-index 6b58825..0000000
---- a/libpthread/linuxthreads/sysdeps/unix/sysv/linux/s390/bits/typesizes.h
-+++ /dev/null
-@@ -1,71 +0,0 @@
--/* bits/typesizes.h -- underlying types for *_t.  Linux/s390 version.
--   Copyright (C) 2003 Free Software Foundation, Inc.
--   This file is part of the GNU C Library.
--
--   The GNU C Library is free software; you can redistribute it and/or
--   modify it under the terms of the GNU Lesser General Public
--   License as published by the Free Software Foundation; either
--   version 2.1 of the License, or (at your option) any later version.
--
--   The GNU C Library is distributed in the hope that it will be useful,
--   but WITHOUT ANY WARRANTY; without even the implied warranty of
--   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
--   Lesser General Public License for more details.
--
--   You should have received a copy of the GNU Lesser General Public
--   License along with the GNU C Library; if not, see
--   <http://www.gnu.org/licenses/>.  */
--
--#ifndef _BITS_TYPES_H
--# error "Never include <bits/typesizes.h> directly; use <sys/types.h> instead."
--#endif
--
--#ifndef	_BITS_TYPESIZES_H
--#define	_BITS_TYPESIZES_H	1
--
--/* See <bits/types.h> for the meaning of these macros.  This file exists so
--   that <bits/types.h> need not vary across different GNU platforms.  */
--
--#define __DEV_T_TYPE		__UQUAD_TYPE
--#define __UID_T_TYPE		__U32_TYPE
--#define __GID_T_TYPE		__U32_TYPE
--#define __INO_T_TYPE		__ULONGWORD_TYPE
--#define __INO64_T_TYPE		__UQUAD_TYPE
--#define __MODE_T_TYPE		__U32_TYPE
--#define __NLINK_T_TYPE		__UWORD_TYPE
--#define __OFF_T_TYPE		__SLONGWORD_TYPE
--#define __OFF64_T_TYPE		__SQUAD_TYPE
--#define __PID_T_TYPE		__S32_TYPE
--#define __RLIM_T_TYPE		__ULONGWORD_TYPE
--#define __RLIM64_T_TYPE		__UQUAD_TYPE
--#define	__BLKCNT_T_TYPE		__SLONGWORD_TYPE
--#define	__BLKCNT64_T_TYPE	__SQUAD_TYPE
--#define	__FSBLKCNT_T_TYPE	__ULONGWORD_TYPE
--#define	__FSBLKCNT64_T_TYPE	__UQUAD_TYPE
--#define	__FSFILCNT_T_TYPE	__ULONGWORD_TYPE
--#define	__FSFILCNT64_T_TYPE	__UQUAD_TYPE
--#define	__ID_T_TYPE		__U32_TYPE
--#define __CLOCK_T_TYPE		__SLONGWORD_TYPE
--#define __TIME_T_TYPE		__SLONGWORD_TYPE
--#define __USECONDS_T_TYPE	__U32_TYPE
--#define __SUSECONDS_T_TYPE	__SLONGWORD_TYPE
--#define __DADDR_T_TYPE		__S32_TYPE
--#define __SWBLK_T_TYPE		__SLONGWORD_TYPE
--#define __KEY_T_TYPE		__S32_TYPE
--#define __CLOCKID_T_TYPE	__S32_TYPE
--#define __TIMER_T_TYPE		__S32_TYPE
--#define __BLKSIZE_T_TYPE	__SLONGWORD_TYPE
--#define __FSID_T_TYPE		struct { int __val[2]; }
--#if defined __GNUC__ && __GNUC__ <= 2
--/* Compatibility with g++ 2.95.x.  */
--#define __SSIZE_T_TYPE		__SWORD_TYPE
--#else
--/* size_t is unsigned long int on s390 -m31.  */
--#define __SSIZE_T_TYPE		__SLONGWORD_TYPE
--#endif
--
--/* Number of descriptors that can fit in an `fd_set'.  */
--#define	__FD_SETSIZE		1024
--
--
--#endif /* bits/typesizes.h */
-diff --git a/libpthread/linuxthreads/sysdeps/unix/sysv/linux/s390/s390-32/pt-initfini.c b/libpthread/linuxthreads/sysdeps/unix/sysv/linux/s390/s390-32/pt-initfini.c
-deleted file mode 100644
-index cde4183..0000000
---- a/libpthread/linuxthreads/sysdeps/unix/sysv/linux/s390/s390-32/pt-initfini.c
-+++ /dev/null
-@@ -1,153 +0,0 @@
--/* Special .init and .fini section support for S/390.
--   Copyright (C) 2000, 2001 Free Software Foundation, Inc.
--   This file is part of the GNU C Library.
--
--   The GNU C Library is free software; you can redistribute it
--   and/or modify it under the terms of the GNU Lesser General Public
--   License as published by the Free Software Foundation; either
--   version 2.1 of the License, or (at your option) any later version.
--
--   In addition to the permissions in the GNU Lesser General Public
--   License, the Free Software Foundation gives you unlimited
--   permission to link the compiled version of this file with other
--   programs, and to distribute those programs without any restriction
--   coming from the use of this file.  (The Lesser General Public
--   License restrictions do apply in other respects; for example, they
--   cover modification of the file, and distribution when not linked
--   into another program.)
--
--   The GNU C Library is distributed in the hope that it will be
--   useful, but WITHOUT ANY WARRANTY; without even the implied warranty
--   of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
--   GNU Lesser General Public License for more details.
--
--   You should have received a copy of the GNU Lesser General Public
--   License along with the GNU C Library; see the file COPYING.LIB.  If not,
--   see <http://www.gnu.org/licenses/>.  */
--
--/* This file is compiled into assembly code which is then munged by a sed
--   script into two files: crti.s and crtn.s.
--
--   * crti.s puts a function prologue at the beginning of the
--   .init and .fini sections and defines global symbols for
--   those addresses, so they can be called as functions.
--
--   * crtn.s puts the corresponding function epilogues
--   in the .init and .fini sections. */
--
--__asm__ ("\
--\n\
--#include \"defs.h\"\n\
--\n\
--/*@HEADER_ENDS*/\n\
--\n\
--/*@TESTS_BEGIN*/\n\
--\n\
--/*@TESTS_END*/\n\
--\n\
--/*@_init_PROLOG_BEGINS*/\n\
--\n\
--	.section .init\n\
--#NO_APP\n\
--	.align 4\n\
--.globl _init\n\
--	.type	 _init,@function\n\
--_init:\n\
--#	leaf function           0\n\
--#	automatics              0\n\
--#	outgoing args           0\n\
--#	need frame pointer      0\n\
--#	call alloca             0\n\
--#	has varargs             0\n\
--#	incoming args (stack)   0\n\
--#	function length         36\n\
--	STM	6,15,24(15)\n\
--	BRAS	13,.LTN1_0\n\
--.LT1_0:\n\
--.LC13:\n\
--	.long	__pthread_initialize_minimal@PLT-.LT1_0\n\
--.LC14:\n\
--	.long	__gmon_start__@GOT\n\
--.LC15:\n\
--	.long	_GLOBAL_OFFSET_TABLE_-.LT1_0\n\
--.LTN1_0:\n\
--	LR	1,15\n\
--	AHI	15,-96\n\
--	ST	1,0(15)\n\
--	L	12,.LC15-.LT1_0(13)\n\
--	AR	12,13\n\
--	L     1,.LC13-.LT1_0(13)\n\
--	LA    1,0(1,13)\n\
--	BASR  14,1\n\
--	L     1,.LC14-.LT1_0(13)\n\
--	L     1,0(1,12)\n\
--	LTR   1,1\n\
--	JE    .L22\n\
--	BASR  14,1\n\
--.L22:\n\
--#APP\n\
--	.align 4,0x07\n\
--	END_INIT\n\
--\n\
--/*@_init_PROLOG_ENDS*/\n\
--\n\
--/*@_init_EPILOG_BEGINS*/\n\
--	.align 4\n\
--	.section .init\n\
--#NO_APP\n\
--	.align 4\n\
--	L	4,152(15)\n\
--	LM	6,15,120(15)\n\
--	BR	4\n\
--#APP\n\
--	END_INIT\n\
--\n\
--/*@_init_EPILOG_ENDS*/\n\
--\n\
--/*@_fini_PROLOG_BEGINS*/\n\
--	.section .fini\n\
--#NO_APP\n\
--	.align 4\n\
--.globl _fini\n\
--	.type	 _fini,@function\n\
--_fini:\n\
--#	leaf function           0\n\
--#	automatics              0\n\
--#	outgoing args           0\n\
--#	need frame pointer      0\n\
--#	call alloca             0\n\
--#	has varargs             0\n\
--#	incoming args (stack)   0\n\
--#	function length         30\n\
--	STM	6,15,24(15)\n\
--	BRAS	13,.LTN2_0\n\
--.LT2_0:\n\
--.LC17:\n\
--	.long	_GLOBAL_OFFSET_TABLE_-.LT2_0\n\
--.LTN2_0:\n\
--	LR	1,15\n\
--	AHI	15,-96\n\
--	ST	1,0(15)\n\
--	L	12,.LC17-.LT2_0(13)\n\
--	AR	12,13\n\
--#APP\n\
--	.align 4,0x07\n\
--	END_FINI\n\
--\n\
--/*@_fini_PROLOG_ENDS*/\n\
--\n\
--/*@_fini_EPILOG_BEGINS*/\n\
--	.align 4\n\
--	.section .fini\n\
--#NO_APP\n\
--	.align 4\n\
--	L	4,152(15)\n\
--	LM	6,15,120(15)\n\
--	BR	4\n\
--#APP\n\
--	END_FINI\n\
--\n\
--/*@_fini_EPILOG_ENDS*/\n\
--\n\
--/*@TRAILER_BEGINS*/\
--");
-diff --git a/libpthread/linuxthreads/sysdeps/unix/sysv/linux/s390/s390-32/sysdep-cancel.h b/libpthread/linuxthreads/sysdeps/unix/sysv/linux/s390/s390-32/sysdep-cancel.h
-deleted file mode 100644
-index 2431129..0000000
---- a/libpthread/linuxthreads/sysdeps/unix/sysv/linux/s390/s390-32/sysdep-cancel.h
-+++ /dev/null
-@@ -1,136 +0,0 @@
--/* Copyright (C) 2003, 2004 Free Software Foundation, Inc.
--   This file is part of the GNU C Library.
--   Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
--
--   The GNU C Library is free software; you can redistribute it and/or
--   modify it under the terms of the GNU Lesser General Public
--   License as published by the Free Software Foundation; either
--   version 2.1 of the License, or (at your option) any later version.
--
--   The GNU C Library is distributed in the hope that it will be useful,
--   but WITHOUT ANY WARRANTY; without even the implied warranty of
--   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
--   Lesser General Public License for more details.
--
--   You should have received a copy of the GNU Lesser General Public
--   License along with the GNU C Library; if not, see
--   <http://www.gnu.org/licenses/>.  */
--
--#include <sysdep.h>
--#include <tls.h>
--#ifndef __ASSEMBLER__
--# include <linuxthreads/internals.h>
--#endif
--
--#if !defined NOT_IN_libc || defined IS_IN_libpthread || defined IS_IN_librt
--
--# if !defined NOT_IN_libc || defined IS_IN_libpthread
--
--#  define PSEUDO_CANCEL(name, syscall_name, args)			      \
--L(pseudo_cancel):							      \
--	STM_##args							      \
--	stm	%r12,%r15,48(%r15);					      \
--	lr	%r14,%r15;						      \
--	ahi	%r15,-96;						      \
--	st	%r14,0(%r15);						      \
--	basr    %r13,0;							      \
--0:	l	%r1,1f-0b(%r13);					      \
--	bas	%r14,0(%r1,%r13);					      \
--	lr	%r0,%r2;						      \
--	LM_##args							      \
--	DO_CALL(syscall_name, args);					      \
--	l	%r1,2f-0b(%r13);					      \
--	lr	%r12,%r2;						      \
--	lr	%r2,%r0;						      \
--	bas	%r14,0(%r1,%r13);					      \
--	lr	%r2,%r12;						      \
--	lm	%r12,%r15,48+96(%r15);					      \
--	j	L(pseudo_check);					      \
--1:	.long	CENABLE-0b;						      \
--2:	.long	CDISABLE-0b;
--
--# else /* !libc.so && !libpthread.so */
--
--#  define PSEUDO_CANCEL(name, syscall_name, args)			      \
--L(pseudo_cancel):							      \
--	STM_##args							      \
--	stm	%r11,%r15,44(%r15);					      \
--	lr	%r14,%r15;						      \
--	ahi	%r15,-96;						      \
--	st	%r14,0(%r15);						      \
--	basr    %r13,0;							      \
--0:	l	%r12,3f-0b(%r13);					      \
--	l	%r1,1f-0b(%r13);					      \
--	la	%r12,0(%r12,%r13);					      \
--	bas	%r14,0(%r1,%r13);					      \
--	lr	%r0,%r2;						      \
--	LM_##args							      \
--	DO_CALL(syscall_name, args);					      \
--	l	%r1,2f-0b(%r13);					      \
--	lr	%r11,%r2;						      \
--	lr	%r2,%r0;						      \
--	bas	%r14,0(%r1,%r13);					      \
--	lr	%r2,%r11;						      \
--	lm	%r11,%r15,44+96(%r15);					      \
--	j	L(pseudo_check);					      \
--1:	.long	CENABLE@PLT-0b;						      \
--2:	.long	CDISABLE@PLT-0b;					      \
--3:	.long	_GLOBAL_OFFSET_TABLE_-0b;
--
--# endif
--
--# undef PSEUDO
--# define PSEUDO(name, syscall_name, args)				      \
--	.text;								      \
--PSEUDO_CANCEL(name, syscall_name, args)					      \
--ENTRY(name)								      \
--	SINGLE_THREAD_P(%r1)						      \
--	jne	L(pseudo_cancel);					      \
--	DO_CALL(syscall_name, args);					      \
--L(pseudo_check):							      \
--	lhi	%r4,-4095;						      \
--	clr	%r2,%r4;						      \
--	jnl	SYSCALL_ERROR_LABEL;					      \
--L(pseudo_end):
--
--# ifdef IS_IN_libpthread
--#  define CENABLE	__pthread_enable_asynccancel
--#  define CDISABLE	__pthread_disable_asynccancel
--# elif !defined NOT_IN_libc
--#  define CENABLE	__libc_enable_asynccancel
--#  define CDISABLE	__libc_disable_asynccancel
--# else
--#  define CENABLE	__librt_enable_asynccancel
--#  define CDISABLE	__librt_disable_asynccancel
--# endif
--
--#define STM_0		/* Nothing */
--#define STM_1		st %r2,8(%r15);
--#define STM_2		stm %r2,%r3,8(%r15);
--#define STM_3		stm %r2,%r4,8(%r15);
--#define STM_4		stm %r2,%r5,8(%r15);
--#define STM_5		stm %r2,%r5,8(%r15);
--
--#define LM_0		/* Nothing */
--#define LM_1		l %r2,8+96(%r15);
--#define LM_2		lm %r2,%r3,8+96(%r15);
--#define LM_3		lm %r2,%r4,8+96(%r15);
--#define LM_4		lm %r2,%r5,8+96(%r15);
--#define LM_5		lm %r2,%r5,8+96(%r15);
--
--# ifndef __ASSEMBLER__
--#  define SINGLE_THREAD_P \
--  __builtin_expect (THREAD_GETMEM (THREAD_SELF,				      \
--				   p_header.data.multiple_threads) == 0, 1)
--# else
--#  define SINGLE_THREAD_P(reg) \
--	ear	reg,%a0;						      \
--	icm	reg,15,MULTIPLE_THREADS_OFFSET(reg);
--# endif
--
--#elif !defined __ASSEMBLER__
--
--/* This code should never be used but we define it anyhow.  */
--# define SINGLE_THREAD_P (1)
--
--#endif
-diff --git a/libpthread/linuxthreads/sysdeps/unix/sysv/linux/s390/s390-32/vfork.S b/libpthread/linuxthreads/sysdeps/unix/sysv/linux/s390/s390-32/vfork.S
-deleted file mode 100644
-index 078c730..0000000
---- a/libpthread/linuxthreads/sysdeps/unix/sysv/linux/s390/s390-32/vfork.S
-+++ /dev/null
-@@ -1,68 +0,0 @@
--/* Copyright (C) 2003 Free Software Foundation, Inc.
--   This file is part of the GNU C Library.
--   Contributed by Martin Schwidefsky <schwidefsky@de.ibm.com>
--
--   The GNU C Library is free software; you can redistribute it and/or
--   modify it under the terms of the GNU Lesser General Public
--   License as published by the Free Software Foundation; either
--   version 2.1 of the License, or (at your option) any later version.
--
--   The GNU C Library is distributed in the hope that it will be useful,
--   but WITHOUT ANY WARRANTY; without even the implied warranty of
--   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
--   Lesser General Public License for more details.
--
--   You should have received a copy of the GNU Lesser General Public
--   License along with the GNU C Library; if not, see
--   <http://www.gnu.org/licenses/>.  */
--
--#include <sysdep-cancel.h>
--#define _ERRNO_H	1
--#include <bits/errno.h>
--
--/* Clone the calling process, but without copying the whole address space.
--   The calling process is suspended until the new process exits or is
--   replaced by a call to `execve'.  Return -1 for errors, 0 to the new process,
--   and the process ID of the new process to the old process.  */
--
--ENTRY (__vfork)
--	basr	%r1,0
--0:
--#ifdef SHARED
--	al	%r1,4f-0b(%r1)
--	l	%r1,0(%r1)
--	ltr	%r1,%r1
--#else
--	icm	%r1,15,4f-0b(%r1)
--#endif
--	jne	1f
--
--	/* Do vfork system call.  */
--	svc	SYS_ify (vfork)
--
--	/* Check for error.  */
--	lhi	%r4,-4095
--	clr	%r2,%r4
--	jnl	SYSCALL_ERROR_LABEL
--
--	/* Normal return.  */
--	br	%r14
--1:
--	basr	%r1,0
--2:
--	al	%r1,3f-2b(%r1)
--	br	%r1
--3:
--	.long	HIDDEN_JUMPTARGET(fork)-2b
--4:
--#ifdef SHARED
--	.long	__libc_pthread_functions-0b
--#else
--	.weak	pthread_create
--	.long	pthread_create
--#endif
--PSEUDO_END(__vfork)
--
--libc_hidden_def (__vfork)
--
--weak_alias (__vfork, vfork)
-diff --git a/libpthread/linuxthreads/sysdeps/unix/sysv/linux/s390/s390-64/pt-initfini.c b/libpthread/linuxthreads/sysdeps/unix/sysv/linux/s390/s390-64/pt-initfini.c
-deleted file mode 100644
-index 136ce54..0000000
---- a/libpthread/linuxthreads/sysdeps/unix/sysv/linux/s390/s390-64/pt-initfini.c
-+++ /dev/null
-@@ -1,136 +0,0 @@
--/* Special .init and .fini section support for 64 bit S/390.
--   Copyright (C) 2001 Free Software Foundation, Inc.
--   Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
--   This file is part of the GNU C Library.
--
--   The GNU C Library is free software; you can redistribute it
--   and/or modify it under the terms of the GNU Lesser General Public
--   License as published by the Free Software Foundation; either
--   version 2.1 of the License, or (at your option) any later version.
--
--   In addition to the permissions in the GNU Lesser General Public
--   License, the Free Software Foundation gives you unlimited
--   permission to link the compiled version of this file with other
--   programs, and to distribute those programs without any restriction
--   coming from the use of this file.  (The Lesser General Public
--   License restrictions do apply in other respects; for example, they
--   cover modification of the file, and distribution when not linked
--   into another program.)
--
--   The GNU C Library is distributed in the hope that it will be
--   useful, but WITHOUT ANY WARRANTY; without even the implied warranty
--   of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
--   GNU Lesser General Public License for more details.
--
--   You should have received a copy of the GNU Lesser General Public
--   License along with the GNU C Library; see the file COPYING.LIB.  If not,
--   see <http://www.gnu.org/licenses/>.  */
--
--/* This file is compiled into assembly code which is then munged by a sed
--   script into two files: crti.s and crtn.s.
--
--   * crti.s puts a function prologue at the beginning of the
--   .init and .fini sections and defines global symbols for
--   those addresses, so they can be called as functions.
--
--   * crtn.s puts the corresponding function epilogues
--   in the .init and .fini sections. */
--
--__asm__ ("\
--\n\
--#include \"defs.h\"\n\
--\n\
--/*@HEADER_ENDS*/\n\
--\n\
--/*@TESTS_BEGIN*/\n\
--\n\
--/*@TESTS_END*/\n\
--\n\
--/*@_init_PROLOG_BEGINS*/\n\
--\n\
--	.section .init\n\
--#NO_APP\n\
--	.align 4\n\
--.globl _init\n\
--	.type	 _init,@function\n\
--_init:\n\
--#	leaf function           0\n\
--#	automatics              0\n\
--#	outgoing args           0\n\
--#	need frame pointer      0\n\
--#	call alloca             0\n\
--#	has varargs             0\n\
--#	incoming args (stack)   0\n\
--#	function length         36\n\
--	STMG	6,15,48(15)\n\
--	LGR	1,15\n\
--	AGHI	15,-160\n\
--	STG	1,0(15)\n\
--	LARL	12,_GLOBAL_OFFSET_TABLE_\n\
--	BRASL	14,__pthread_initialize_minimal@PLT\n\
--	LARL	1,__gmon_start__@GOTENT\n\
--	LG	1,0(1)\n\
--	LTGR	1,1\n\
--	JE	.L22\n\
--	BASR	14,1\n\
--.L22:\n\
--#APP\n\
--	.align 4,0x07\n\
--	END_INIT\n\
--\n\
--/*@_init_PROLOG_ENDS*/\n\
--\n\
--/*@_init_EPILOG_BEGINS*/\n\
--	.align 4\n\
--	.section .init\n\
--#NO_APP\n\
--	.align 4\n\
--	LG	4,272(15)\n\
--	LMG	6,15,208(15)\n\
--	BR	4\n\
--#APP\n\
--	END_INIT\n\
--\n\
--/*@_init_EPILOG_ENDS*/\n\
--\n\
--/*@_fini_PROLOG_BEGINS*/\n\
--	.section .fini\n\
--#NO_APP\n\
--	.align 4\n\
--.globl _fini\n\
--	.type	 _fini,@function\n\
--_fini:\n\
--#	leaf function           0\n\
--#	automatics              0\n\
--#	outgoing args           0\n\
--#	need frame pointer      0\n\
--#	call alloca             0\n\
--#	has varargs             0\n\
--#	incoming args (stack)   0\n\
--#	function length         30\n\
--	STMG	6,15,48(15)\n\
--	LGR	1,15\n\
--	AGHI	15,-160\n\
--	STG	1,0(15)\n\
--	LARL	12,_GLOBAL_OFFSET_TABLE_\n\
--#APP\n\
--	.align 4,0x07\n\
--	END_FINI\n\
--\n\
--/*@_fini_PROLOG_ENDS*/\n\
--\n\
--/*@_fini_EPILOG_BEGINS*/\n\
--	.align 4\n\
--	.section .fini\n\
--#NO_APP\n\
--	.align 4\n\
--	LG	4,272(15)\n\
--	LMG	6,15,208(15)\n\
--	BR	4\n\
--#APP\n\
--	END_FINI\n\
--\n\
--/*@_fini_EPILOG_ENDS*/\n\
--\n\
--/*@TRAILER_BEGINS*/\n\
--	");
-diff --git a/libpthread/linuxthreads/sysdeps/unix/sysv/linux/s390/s390-64/pt-sigsuspend.c b/libpthread/linuxthreads/sysdeps/unix/sysv/linux/s390/s390-64/pt-sigsuspend.c
-deleted file mode 100644
-index d57283a..0000000
---- a/libpthread/linuxthreads/sysdeps/unix/sysv/linux/s390/s390-64/pt-sigsuspend.c
-+++ /dev/null
-@@ -1 +0,0 @@
--#include "../../ia64/pt-sigsuspend.c"
-diff --git a/libpthread/linuxthreads/sysdeps/unix/sysv/linux/s390/s390-64/sysdep-cancel.h b/libpthread/linuxthreads/sysdeps/unix/sysv/linux/s390/s390-64/sysdep-cancel.h
-deleted file mode 100644
-index cf3124e..0000000
---- a/libpthread/linuxthreads/sysdeps/unix/sysv/linux/s390/s390-64/sysdep-cancel.h
-+++ /dev/null
-@@ -1,115 +0,0 @@
--/* Copyright (C) 2003, 2004 Free Software Foundation, Inc.
--   This file is part of the GNU C Library.
--   Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
--
--   The GNU C Library is free software; you can redistribute it and/or
--   modify it under the terms of the GNU Lesser General Public
--   License as published by the Free Software Foundation; either
--   version 2.1 of the License, or (at your option) any later version.
--
--   The GNU C Library is distributed in the hope that it will be useful,
--   but WITHOUT ANY WARRANTY; without even the implied warranty of
--   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
--   Lesser General Public License for more details.
--
--   You should have received a copy of the GNU Lesser General Public
--   License along with the GNU C Library; if not, see
--   <http://www.gnu.org/licenses/>.  */
--
--#include <sysdep.h>
--#include <tls.h>
--#ifndef __ASSEMBLER__
--# include <linuxthreads/internals.h>
--#endif
--
--#if !defined NOT_IN_libc || defined IS_IN_libpthread || defined IS_IN_librt
--
--# undef PSEUDO
--# define PSEUDO(name, syscall_name, args)				      \
--	.text;								      \
--L(pseudo_cancel):							      \
--	STM_##args							      \
--	stmg	%r13,%r15,104(%r15);					      \
--	lgr	%r14,%r15;						      \
--	aghi	%r15,-160;						      \
--	stg	%r14,0(%r15);						      \
--	brasl	%r14,CENABLE;						      \
--	lgr	%r0,%r2;						      \
--	LM_##args							      \
--	DO_CALL(syscall_name, args);					      \
--	lgr	%r13,%r2;						      \
--	lgr	%r2,%r0;						      \
--	brasl	%r14,CDISABLE;						      \
--	lgr	%r2,%r13;						      \
--	lmg	%r13,%r15,104+160(%r15);				      \
--	j	L(pseudo_check);					      \
--ENTRY(name)								      \
--	SINGLE_THREAD_P							      \
--	jne	L(pseudo_cancel);					      \
--	DO_CALL(syscall_name, args);					      \
--L(pseudo_check):							      \
--	lghi	%r4,-4095;						      \
--	clgr	%r2,%r4;						      \
--	jgnl	SYSCALL_ERROR_LABEL;					      \
--L(pseudo_end):
--
--# ifdef IS_IN_libpthread
--#  define CENABLE	__pthread_enable_asynccancel
--#  define CDISABLE	__pthread_disable_asynccancel
--#  define __local_multiple_threads	__pthread_multiple_threads
--# elif !defined NOT_IN_libc
--#  define CENABLE	__libc_enable_asynccancel
--#  define CDISABLE	__libc_disable_asynccancel
--#  define __local_multiple_threads	__libc_multiple_threads
--# else
--#  define CENABLE	__librt_enable_asynccancel@PLT
--#  define CDISABLE	__librt_disable_asynccancel@PLT
--# endif
--
--#define STM_0		/* Nothing */
--#define STM_1		stg %r2,16(%r15);
--#define STM_2		stmg %r2,%r3,16(%r15);
--#define STM_3		stmg %r2,%r4,16(%r15);
--#define STM_4		stmg %r2,%r5,16(%r15);
--#define STM_5		stmg %r2,%r5,16(%r15);
--
--#define LM_0		/* Nothing */
--#define LM_1		lg %r2,16+160(%r15);
--#define LM_2		lmg %r2,%r3,16+160(%r15);
--#define LM_3		lmg %r2,%r4,16+160(%r15);
--#define LM_4		lmg %r2,%r5,16+160(%r15);
--#define LM_5		lmg %r2,%r5,16+160(%r15);
--
--# if !defined NOT_IN_libc || defined IS_IN_libpthread
--#  ifndef __ASSEMBLER__
--extern int __local_multiple_threads attribute_hidden;
--#   define SINGLE_THREAD_P \
--  __builtin_expect (__local_multiple_threads == 0, 1)
--#  else
--#   define SINGLE_THREAD_P \
--	larl	%r1,__local_multiple_threads;				      \
--	icm	%r0,15,0(%r1);
--#  endif
--
--# else
--
--#  ifndef __ASSEMBLER__
--#   define SINGLE_THREAD_P \
--  __builtin_expect (THREAD_GETMEM (THREAD_SELF,				      \
--				   p_header.data.multiple_threads) == 0, 1)
--#  else
--#   define SINGLE_THREAD_P \
--	ear	%r1,%a0;						      \
--	sllg	%r1,%r1,32;						      \
--	ear	%r1,%a1;						      \
--	icm	%r1,15,MULTIPLE_THREADS_OFFSET(%r1);
--#  endif
--
--# endif
--
--#elif !defined __ASSEMBLER__
--
--/* This code should never be used but we define it anyhow.  */
--# define SINGLE_THREAD_P (1)
--
--#endif
-diff --git a/libpthread/linuxthreads/sysdeps/unix/sysv/linux/s390/s390-64/vfork.S b/libpthread/linuxthreads/sysdeps/unix/sysv/linux/s390/s390-64/vfork.S
-deleted file mode 100644
-index 109d4f6..0000000
---- a/libpthread/linuxthreads/sysdeps/unix/sysv/linux/s390/s390-64/vfork.S
-+++ /dev/null
-@@ -1,53 +0,0 @@
--/* Copyright (C) 2003 Free Software Foundation, Inc.
--   This file is part of the GNU C Library.
--   Contributed by Martin Schwidefsky <schwidefsky@de.ibm.com>
--
--   The GNU C Library is free software; you can redistribute it and/or
--   modify it under the terms of the GNU Lesser General Public
--   License as published by the Free Software Foundation; either
--   version 2.1 of the License, or (at your option) any later version.
--
--   The GNU C Library is distributed in the hope that it will be useful,
--   but WITHOUT ANY WARRANTY; without even the implied warranty of
--   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
--   Lesser General Public License for more details.
--
--   You should have received a copy of the GNU Lesser General Public
--   License along with the GNU C Library; if not, see
--   <http://www.gnu.org/licenses/>.  */
--
--#include <sysdep-cancel.h>
--#define _ERRNO_H	1
--#include <bits/errno.h>
--
--/* Clone the calling process, but without copying the whole address space.
--   The calling process is suspended until the new process exits or is
--   replaced by a call to `execve'.  Return -1 for errors, 0 to the new process,
--   and the process ID of the new process to the old process.  */
--
--ENTRY (__vfork)
--#ifdef SHARED
--	larl	%r1,__libc_pthread_functions
--	lg	%r1,0(%r1)
--#else
--	.weak	pthread_create
--	larl	%r1,pthread_create
--#endif
--	ltgr	%r1,%r1
--	jgne	HIDDEN_JUMPTARGET(fork)
--
--	/* Do vfork system call.  */
--	svc	SYS_ify (vfork)
--
--	/* Check for error.  */
--	lghi	%r4,-4095
--	clgr	%r2,%r4
--	jgnl	SYSCALL_ERROR_LABEL
--
--	/* Normal return.  */
--	br	%r14
--PSEUDO_END(__vfork)
--
--libc_hidden_def (__vfork)
--
--weak_alias (__vfork, vfork)
--- 
-1.8.5.2 (Apple Git-48)
-

+ 0 - 51
toolchain/uclibc/patches/0.9.34-git/0004-disable-tests-if-HAVE_SHARED-is-not-set.patch

@@ -1,51 +0,0 @@
-From 743a46b7b12f07065465d9e49729043cf6f00394 Mon Sep 17 00:00:00 2001
-From: Waldemar Brodkorb <wbx@openadk.org>
-Date: Sun, 7 Sep 2014 16:38:14 +0200
-Subject: [PATCH 4/6] disable tests if HAVE_SHARED is not set
-
-Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
----
- test/nptl/Makefile.in | 12 ++++++------
- 1 file changed, 6 insertions(+), 6 deletions(-)
-
-diff --git a/test/nptl/Makefile.in b/test/nptl/Makefile.in
-index dd53f91..d20d2c1 100644
---- a/test/nptl/Makefile.in
-+++ b/test/nptl/Makefile.in
-@@ -38,11 +38,10 @@ TESTS := tst-align tst-align2 tst-atfork1 tst-attr1 tst-attr2 tst-attr3	\
- 	tst-cancelx12 tst-cancelx13 tst-cancelx14 tst-cancelx15 tst-cancelx16 \
- 	tst-cancelx18 tst-cancelx20 tst-cancelx21 tst-cleanupx0 tst-cleanupx1 \
- 	tst-cleanupx2 tst-cleanupx3 tst-cleanupx4 tst-cond22 tst-cond23 \
--	tst-dlsym1 tst-getpid1 tst-getpid2 tst-getpid3 tst-join6 tst-tsd6 \
-+	tst-getpid1 tst-getpid2 tst-getpid3 tst-join6 tst-tsd6 \
- 	tst-oddstacklimit tst-oncex3 tst-oncex4 tst-rwlock2a  \
--	tst-basic7 tst-fini1 tst-signal7 \
--	tst-unload tst-vfork1x tst-vfork2x tst-sem10 tst-sem11 tst-sem12 \
--	tst-typesizes tst-initializers1-c89 tst-initializers1-c99 \
-+	tst-basic7 tst-signal7 tst-vfork1x tst-vfork2x tst-sem10 tst-sem11 \
-+	tst-sem12 tst-typesizes tst-initializers1-c89 tst-initializers1-c99 \
- 	tst-initializers1-gnu89 tst-initializers1-gnu99
- 
- #
-@@ -68,7 +67,8 @@ GLIBC_TESTS_DISABLED := tst-eintr1_glibc tst-eintr2_glibc \
- 
- 
- ifeq ($(HAVE_SHARED),)
--TESTS_DISABLED += tst-tls3 tst-tls4 tst-tls5
-+TESTS_DISABLED += tst-tls3 tst-tls4 tst-tls5 tst-dlsym1 tst-fini1	\
-+		tst-unload
- else
- GLIBC_TESTS_DISABLED += tst-tls3_glibc tst-tls4_glibc tst-tls5_glibc
- endif
-@@ -109,7 +109,7 @@ LDFLAGS_tst-rwlock14 = -lrt
- LDFLAGS_tst-fini1 = -Wl,-rpath=./ tst-fini1mod.so
- LDFLAGS_tst-fini1mod.so = -Wl,-soname=tst-fini1mod.so
- LDFLAGS_tst-unload = -ldl
--LDFLAGS_tst-cancel5 := -lpthread -lpthread_nonshared
-+LDFLAGS_tst-cancel5 := -lpthread
- LDFLAGS_tst-cancel23 := -lc -lpthread
- LDFLAGS_tst-vfork1x := -lc -lpthread
- LDFLAGS_tst-vfork2x := -lc -lpthread
--- 
-1.8.5.2 (Apple Git-48)
-

+ 0 - 28
toolchain/uclibc/patches/0.9.34-git/0005-disable-tests-for-arc-as-long-as-binutils-is-buggy.patch

@@ -1,28 +0,0 @@
-From b46e40edc326638336adc91ccc2aad74c94c764b Mon Sep 17 00:00:00 2001
-From: Waldemar Brodkorb <wbx@openadk.org>
-Date: Tue, 9 Sep 2014 18:40:22 +0200
-Subject: [PATCH 5/6] disable tests for arc as long as binutils is buggy
-
-Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
----
- test/tls/Makefile.in | 4 ++++
- 1 file changed, 4 insertions(+)
-
-diff --git a/test/tls/Makefile.in b/test/tls/Makefile.in
-index 7ab4e2a..0a98337 100644
---- a/test/tls/Makefile.in
-+++ b/test/tls/Makefile.in
-@@ -12,6 +12,10 @@ ifeq ($(HAVE_SHARED),)
- TESTS_DISABLED := $(TESTS)
- endif
- 
-+ifeq ($(TARGET_ARCH),arc)
-+TESTS_DISABLED += tst-tls12 tst-tls-at-ctor
-+endif
-+
- # All these tests need tls.h, which is not installed with glibc
- GLIBC_TESTS_DISABLED := $(addsuffix _glibc,$(filter-out $(TESTS_DISABLED),$(TESTS)))
- 
--- 
-1.8.5.2 (Apple Git-48)
-

+ 0 - 170
toolchain/uclibc/patches/0.9.34-git/0006-arm-add-RESET_PID-in-the-clone-impl.patch

@@ -1,170 +0,0 @@
-From 60f9eaa155d0f7ff935da37ecdf253c5c744a3ce Mon Sep 17 00:00:00 2001
-From: Wang Yufen <wangyufen@huawei.com>
-Date: Fri, 5 Sep 2014 15:19:21 +0800
-Subject: [PATCH 6/6] arm: add RESET_PID in the clone impl
-
-Called getpid() When creating a new process with clone(), getpid() returns
-the father_process's value. It should be child_process's value.
-The reason is missing a RESET_PID in the arm clone impl.
-
-Signed-off-by: Wang Yufen <wangyufen@huawei.com>
-Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
----
- libc/sysdeps/linux/arm/clone.S  | 61 +++++++++++++++++++++++++++++++----------
- libc/sysdeps/linux/arm/sysdep.h | 36 ++++++++++++++++++++++++
- 2 files changed, 83 insertions(+), 14 deletions(-)
-
-diff --git a/libc/sysdeps/linux/arm/clone.S b/libc/sysdeps/linux/arm/clone.S
-index 03cd10e..29045ef 100644
---- a/libc/sysdeps/linux/arm/clone.S
-+++ b/libc/sysdeps/linux/arm/clone.S
-@@ -19,12 +19,17 @@
- /* clone() is even more special than fork() as it mucks with stacks
-    and invokes a function in the right context after its all over.  */
- 
-+#include <sysdep.h>
- #define _ERRNO_H
- #include <features.h>
- #include <bits/errno.h>
- #include <sys/syscall.h>
- #include <bits/arm_asm.h>
- #include <bits/arm_bx.h>
-+#include <sysdep-cancel.h>
-+
-+#define CLONE_VM      0x00000100
-+#define CLONE_THREAD  0x00010000
- 
- #if defined(__NR_clone)
- /* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg); */
-@@ -87,6 +92,8 @@ __error:
- .pool
- #else
- __clone:
-+.fnstart
-+.cantunwind
- 	@ sanity check args
- 	cmp	r0, #0
- 	IT(te, ne)
-@@ -95,32 +102,58 @@ __clone:
- 	beq	__error
- 
- 	@ insert the args onto the new stack
--	sub	r1, r1, #8
--	str	r3, [r1, #4]
--	@ save the function pointer as the 0th element
--	str	r0, [r1]
-+	str	r3, [r1, #-4]!
-+	str	r0, [r1, #-4]!
- 
- 	@ do the system call
- 	@ get flags
- 	mov	r0, r2
-+#ifdef RESET_PID
-+	mov	ip, r2
-+#endif
- 	@ new sp is already in r1
--	@ load remaining arguments off the stack
--	stmfd	sp!, {r4}
--	ldr	r2, [sp, #4]
--	ldr	r3, [sp, #8]
--	ldr	r4, [sp, #12]
--	DO_CALL (clone)
--	movs	a1, a1
--	IT(t, ne)
--	ldmnefd	sp!, {r4}
-+	push	{r4, r7}
-+	cfi_adjust_cfa_offset (8)
-+	cfi_rel_offset (r4, 0)
-+	cfi_rel_offset (r7, 4)
-+	ldr	r2, [sp, #8]
-+	ldr	r3, [sp, #12]
-+	ldr	r4, [sp, #16]
-+	ldr	r7, =SYS_ify(clone)
-+	swi	0x0
-+	cfi_endproc
-+	cmp	r0, #0
-+	beq	1f
-+	pop	{r4, r7}
- 	blt	__error
--	IT(t, ne)
- #if defined(__USE_BX__)
- 	bxne	lr
- #else
- 	movne	pc, lr
- #endif
- 
-+	cfi_startproc
-+.fnend
-+PSEUDO_END (__clone)
-+
-+1:
-+	.fnstart
-+	.cantunwind
-+#ifdef RESET_PID
-+	tst	ip, #CLONE_THREAD
-+	bne	3f
-+	GET_TLS (lr)
-+	mov	r1, r0
-+	tst	ip, #CLONE_VM
-+	ldr	r7, =SYS_ify(getpid)
-+	ite	ne
-+	movne	r0, #-1
-+	swieq	0x0
-+	NEGOFF_ADJ_BASE (r1, TID_OFFSET)
-+	str	r0, NEGOFF_OFF1 (r1, TID_OFFSET)
-+	str	r0, NEGOFF_OFF2 (r1, PID_OFFSET, TID_OFFSET)
-+3:
-+#endif
- 	@ pick the function arg and call address off the stack and execute
- 	ldr	r0, [sp, #4]
- 	mov	lr, pc
-diff --git a/libc/sysdeps/linux/arm/sysdep.h b/libc/sysdeps/linux/arm/sysdep.h
-index 64f4040..2d0a9cc 100644
---- a/libc/sysdeps/linux/arm/sysdep.h
-+++ b/libc/sysdeps/linux/arm/sysdep.h
-@@ -213,6 +213,42 @@ __local_syscall_error:						\
-    sees the right arguments.
- 
- */
-+#if __ARM_ARCH > 6 || defined (__ARM_ARCH_6K__) || defined (__ARM_ARCH_6ZK__)
-+# define ARCH_HAS_HARD_TP
-+#endif
-+
-+# ifdef __thumb2__
-+#  define NEGOFF_ADJ_BASE(R, OFF)	add R, R, $OFF
-+#  define NEGOFF_ADJ_BASE2(D, S, OFF)	add D, S, $OFF
-+#  define NEGOFF_OFF1(R, OFF)		[R]
-+#  define NEGOFF_OFF2(R, OFFA, OFFB)	[R, $((OFFA) - (OFFB))]
-+# else
-+#  define NEGOFF_ADJ_BASE(R, OFF)
-+#  define NEGOFF_ADJ_BASE2(D, S, OFF)	mov D, S
-+#  define NEGOFF_OFF1(R, OFF)		[R, $OFF]
-+#  define NEGOFF_OFF2(R, OFFA, OFFB)	[R, $OFFA]
-+# endif
-+
-+# ifdef ARCH_HAS_HARD_TP
-+/* If the cpu has cp15 available, use it.  */
-+#  define GET_TLS(TMP)		mrc p15, 0, r0, c13, c0, 3
-+# else
-+/* At this generic level we have no tricks to pull.  Call the ABI routine.  */
-+#  define GET_TLS(TMP)					\
-+	push	{ r1, r2, r3, lr };			\
-+	cfi_remember_state;				\
-+	cfi_adjust_cfa_offset (16);			\
-+	cfi_rel_offset (r1, 0);				\
-+	cfi_rel_offset (r2, 4);				\
-+	cfi_rel_offset (r3, 8);				\
-+	cfi_rel_offset (lr, 12);			\
-+	bl	__aeabi_read_tp;			\
-+	pop	{ r1, r2, r3, lr };			\
-+	cfi_restore_state
-+# endif /* ARCH_HAS_HARD_TP */
-+
-+
-+
- 
- #undef	DO_CALL
- #if defined(__ARM_EABI__)
--- 
-1.8.5.2 (Apple Git-48)
-

+ 0 - 11
toolchain/uclibc/patches/0.9.34-git/0007-enable-cancellation-stuff-for-libc_a.patch

@@ -1,11 +0,0 @@
---- a/libpthread/linuxthreads/Makefile.in.orig	2014-09-27 23:26:40.000000000 +0200
-+++ b/libpthread/linuxthreads/Makefile.in	2014-09-27 23:27:12.000000000 +0200
-@@ -65,7 +65,7 @@ CFLAGS-OMIT-libc_pthread_init.c := $(CFL
- libpthread_libc_CSRC := \
- 	forward.c libc-cancellation.c libc_pthread_init.c # alloca_cutoff.c
- libpthread_libc_OBJ  := $(patsubst %.c, $(libpthread_OUT)/%.o,$(libpthread_libc_CSRC))
--libc-static-y += $(libpthread_OUT)/libc_pthread_init.o
-+libc-static-y += $(libpthread_OUT)/libc_pthread_init.o $(libpthread_OUT)/libc-cancellation.o
- libc-shared-y += $(libpthread_libc_OBJ:.o=.oS)
- 
- libpthread-static-y += $(patsubst %,$(libpthread_OUT)/%.o,$(libpthread_static_SRC))