Browse Source

Merge branch 'v1.4'

RISCi_ATOM 6 years ago
parent
commit
98ed2a77ec
100 changed files with 1546 additions and 9877 deletions
  1. 0 1
      .gitignore
  2. 15 0
      README.md
  3. 263 0
      docs/Ben_Nanonote.md
  4. 55 0
      docs/How To Submit A Change To This Wiki.md
  5. 73 0
      docs/How_To_Build_libreCMC.md
  6. 430 0
      docs/LICENSE.md
  7. 22 0
      docs/List_of_Tested_Hardware.md
  8. 61 0
      docs/OpenVPN_Layer_2_Server.md
  9. 15 0
      docs/README.md
  10. 53 0
      docs/Router_Reset_Instructions.md
  11. 37 0
      docs/Supported_Hardware.md
  12. 42 0
      docs/TL_MR3020.md
  13. 28 0
      docs/TL_WR1043ND.md
  14. 15 0
      docs/TL_WR741ND.md
  15. 25 0
      docs/TL_WR841ND.md
  16. 41 0
      docs/TL_WR842ND.md
  17. 20 0
      docs/TPE_NWIFIROUTER2.md
  18. 25 0
      docs/TPE_R1100.md
  19. 11 0
      docs/WNDR3800.md
  20. 13 0
      docs/WZR_HP_G300NH.md
  21. 71 0
      docs/Welcome.md
  22. 15 0
      docs/embedded.md
  23. 24 0
      docs/old/Save_WiFi.md
  24. 12 0
      docs/testing.md
  25. 26 0
      docs/unbrick_with_uboot_mod.md
  26. 5 0
      include/host-build.mk
  27. 2 5
      include/kernel-version.mk
  28. 13 10
      include/kernel.mk
  29. 2 0
      include/site/darwin
  30. 2 2
      include/target.mk
  31. 1 1
      include/version.mk
  32. 1 1
      package/base-files/files/lib/functions.sh
  33. 0 62
      package/boot/apex/Makefile
  34. 0 20
      package/boot/apex/patches/001-compile_fix.patch
  35. 0 23
      package/boot/apex/patches/100-openwrt_nslu2_armeb_config.patch
  36. 0 23
      package/boot/apex/patches/120-openwrt_nslu2_16mb_armeb_config.patch
  37. 0 23
      package/boot/apex/patches/140-openwrt_fsg3_armeb_config.patch
  38. 0 22
      package/boot/apex/patches/150-limit_ram_to_64mb.patch
  39. 0 20
      package/boot/apex/patches/160-openwrt_nas100d_armeb_config.patch
  40. 0 46
      package/boot/fconfig/Makefile
  41. 0 46
      package/boot/kobs-ng/Makefile
  42. 0 23
      package/boot/kobs-ng/patches/001-compile.patch
  43. 0 45
      package/boot/kobs-ng/patches/002-add-init-size-param.patch
  44. 0 45
      package/boot/kobs-ng/patches/003-raw-mode.patch
  45. 0 27
      package/boot/kobs-ng/patches/004-fix-cal_nfc_geometry.patch
  46. 0 47
      package/boot/rbcfg/Makefile
  47. 0 14
      package/boot/rbcfg/src/Makefile
  48. 0 109
      package/boot/rbcfg/src/cyg_crc.h
  49. 0 172
      package/boot/rbcfg/src/cyg_crc32.c
  50. 0 791
      package/boot/rbcfg/src/main.c
  51. 0 75
      package/boot/rbcfg/src/rbcfg.h
  52. 5 4
      package/boot/uboot-ar71xx/Makefile
  53. 4 4
      package/boot/uboot-envtools/Makefile
  54. 0 88
      package/boot/uboot-envtools/files/ipq
  55. 0 894
      package/boot/uboot-xburst/patches/0001-qi_lb60-add-nand-spl-support.patch
  56. 0 916
      package/boot/uboot-xburst/patches/0002-qi_lb60-add-software-usbboot-support.patch
  57. 0 1664
      package/boot/uboot-xburst/patches/0003-add-mmc-support.patch
  58. 0 200
      package/boot/uboot-xburst/patches/0004-add-more-boot-options-F1-F2-F3-F4-M-S.patch
  59. 0 847
      package/boot/uboot-xburst/patches/0005-add-nanonote-lcd-support.patch
  60. 0 60
      package/boot/uboot-xburst/patches/0006-enable-silent-console.patch
  61. 0 42
      package/boot/yamonenv/Makefile
  62. 0 11
      package/boot/yamonenv/patches/001-yamonenv_mtd_partition.patch
  63. 0 125
      package/devel/binutils/Makefile
  64. 0 65
      package/devel/binutils/patches/0001-Do-not-pass-host-compiler-sanitization-flags-on-to-l.patch
  65. 0 1258
      package/devel/binutils/patches/0002-When-building-target-binaries-ensure-that-the-warnin.patch
  66. 0 94
      package/devel/gdb-arc/Makefile
  67. 0 32
      package/devel/gdb-arc/patches/100-no_extern_inline.patch
  68. 0 21
      package/devel/gdb-arc/patches/110-no_testsuite.patch
  69. 0 11
      package/devel/gdb-arc/patches/120-fix-compile-flag-mismatch.patch
  70. 0 88
      package/devel/gdb/Makefile
  71. 0 16
      package/devel/gdb/patches/001-gdb-pr14523-mips-signal-number.patch
  72. 0 53
      package/devel/gdb/patches/100-musl_fix.patch
  73. 0 79
      package/devel/perf/Makefile
  74. 0 43
      package/devel/perf/musl-compat.h
  75. 0 8
      package/devel/perf/musl-include/asm/errno.h
  76. 0 18
      package/devel/perf/musl-include/string.h
  77. 0 67
      package/devel/strace/Makefile
  78. 0 17
      package/devel/strace/patches/100-workaround--pt-reg-collisions-ppc.patch
  79. 0 63
      package/devel/trace-cmd/Makefile
  80. 0 24
      package/devel/trace-cmd/patches/110-mac80211_tracepoint.patch
  81. 0 179
      package/devel/valgrind/Makefile
  82. 0 42
      package/devel/valgrind/files/default.supp
  83. 0 11
      package/devel/valgrind/patches/100-fix_configure_check.patch
  84. 0 17
      package/devel/valgrind/patches/130-fix_arm_arch_detection.patch
  85. 0 45
      package/devel/valgrind/patches/200-musl_fix.patch
  86. 39 0
      package/firmware/linux-libre-firmware/Makefile
  87. 16 0
      package/firmware/linux-libre-firmware/qca.mk
  88. 0 30
      package/kernel/hwmon-gsc/Makefile
  89. 0 1
      package/kernel/hwmon-gsc/src/Makefile
  90. 0 308
      package/kernel/hwmon-gsc/src/gsc.c
  91. 3 4
      package/kernel/kmod-sched-cake/Makefile
  92. 1 18
      package/kernel/linux/modules/netdevices.mk
  93. 19 12
      package/kernel/mac80211/files/regdb.txt
  94. 1 9
      package/kernel/om-watchdog/Makefile
  95. 40 31
      package/kernel/om-watchdog/files/om-watchdog.init
  96. 0 33
      package/kernel/rtc-rv5c386a/Makefile
  97. 0 18
      package/kernel/rtc-rv5c386a/src/Makefile
  98. 0 613
      package/kernel/rtc-rv5c386a/src/rtc.c
  99. 0 38
      package/kernel/wrt55agv2-spidevs/Makefile
  100. 0 3
      package/kernel/wrt55agv2-spidevs/src/Kconfig

+ 0 - 1
.gitignore

@@ -29,5 +29,4 @@ git-src
 *.so
 *.swp
 *.po~
-/docs
 /package/luci/modules/luci-base/src/po2lmo

+ 15 - 0
README.md

@@ -0,0 +1,15 @@
+# libreCMC : The _libre_ Embedded GNU/Linux Distro.
+
+libreCMC is a set of fully [free](http://www.gnu.org/philosophy/free-sw.en.html) embedded Operating Systems for general purpose computers. It aims to give its users freedom and control over the software that runs on their hardware. Most of the hardware that libreCMC supports includes a wide range of routers and some small single board computers.
+
+## Useful links:
+
+* [Get libreCMC source code](/) : Checkout the latest libreCMC sources.
+
+* [Supported Hardware](/docs/Supported_Hardware.md): Devices officially supported by libreCMC.
+
+* [Router reset instructions](/docs/Router_Reset_Instructions.md) : Generic libreCMC router reset instructions.
+
+* [Report a bug or issue](/issues) : Is something broken? Did you find a non-free component or do you want to make libreCMC better? Submit an issue.
+
+* [Build Documentation](/docs/How_To_Build_libreCMC.md) : Learn how to build libreCMC for your device. 

+ 263 - 0
docs/Ben_Nanonote.md

@@ -0,0 +1,263 @@
+
+## Overview
+
+* [JZ4720](https://web.archive.org/web/20110904201104/http://en.ingenic.cn/product.aspx?ID=60) 336 MHz MIPS compatible processor from [Ingenic Semiconductor Co.](http://www.ingenic.cn)
+
+* 3.0" 320x240 pixels [[LCD|colour TFT LCD]] (40x15 character in a text console)
+
+* 32MB [[SDRAM]] 
+
+* 2GB [[NAND|NAND Flash]] Memory
+
+* 1 [[SD|microSDHC]] slot (SDIO capable)
+
+* 59 keys Keyboard
+
+* Stereo headphones connector, mono speaker and microphone [[Audio_IN_OUT|audio interfaces]].
+
+* [USB](http://wiki.qi-hardware.com/wiki/USB_host) 2.0 High-Speed Device, [Mini B](http://en.wikipedia.org/wiki/USB#Connector_types) connector
+
+* 3.7V 850mAh Li-ion Battery ( [[Compatible_batteries|Compatible batteries]]) and 5V 500mA [[Power_Supply_Circuit|DC input through USB port]]
+
+* Measured battery life time, idle, screen off: 12h59
+
+* Overall dimension (lid closed): 99 * 75 * 17.5mm. (display: 7.5mm, keyboard: 10mm)
+
+* Weight: 126g (includes battery)
+
+## Status
+
+* Flashing bootloader, kernel, and rootfs via USB works.
+* Serial console via GND/RXD/TXD pads under the battery works.
+* LCD works
+** After a few minutes of inactivity on the console, it will go blank. Pressing any key brings it back.
+* Keyboard works
+* Audio/ALSA works.
+* ...
+
+## Pinouts
+
+PCB 08.50 (ben)
+
+'''Micro-SD pins on testpads:'''
+
+ Pin  TP     note
+ ------------------
+ #1   TP14   data2
+ #2   TP15   cd/data3 / _CS
+ #3   TP17   cmd / mosi
+ #4   sdVCC  switched by Q4 (fet?) controlled via line from cpu (on TP11)
+ #5   TP16   clock
+ #6   GND
+ #7   TP12   data0 / miso
+ #8   TP13   data1
+
+'''Serial pins:'''
+
+See [[Ben_source_code#serial_console]].
+
+== System information ==
+
+ $ '''cat /proc/cpuinfo'''
+ system type             : JZ4740
+ processor               : 0
+ cpu model               : Ingenic JZRISC V4.15
+ BogoMIPS                : 335.05
+ wait instruction        : yes                                                   
+ microsecond timers      : no                                                    
+ tlb_entries             : 32                                                    
+ extra interrupt vector  : yes                                                   
+ hardware watchpoint     : yes, count: 1, address/irw mask: [0x0fff]             
+ ASEs implemented        :                                                       
+ shadow register sets    : 1                                                     
+ core                    : 0                                                     
+ VCED exceptions         : not available                                         
+ VCEI exceptions         : not available                                         
+
+ $ '''cat /proc/mtd'''
+ dev:    size   erasesize  name
+ mtd0: 00400000 00080000 "NAND BOOT partition"
+ mtd1: 00400000 00080000 "NAND KERNEL partition"
+ mtd2: 20000000 00080000 "NAND ROOTFS partition"
+ mtd3: 5f800000 00080000 "NAND DATA partition"
+
+ $ '''uname -a'''
+ Linux BenNanoNote 2.6.32.27 #1 PREEMPT Sat Mar 5 03:54:50 MSK 2011 mips GNU/Linux
+
+ $ '''cat /proc/iomem'''
+ 00000000-01ffffff : System RAM
+   00010000-0031162b : Kernel code
+   0031162c-0040877f : Kernel data
+ 10003000-10003037 : jz4740-rtc
+   10003000-10003037 : jz4740-rtc
+ 10020000-10020037 : jz4740-i2s
+   10020000-10020037 : jz4740-i2s
+ 10020080-10020087 : jz4740-codec
+   10020080-10020087 : jz4740-codec
+ 10021000-10030fff : jz4740-mmc.0
+   10021000-10030fff : jz4740-mmc
+ 10070000-10070030 : jz4740-adc
+   10070000-10070030 : jz4740-adc
+ 13010000-1301ffff : jz4740-nand.0
+   13010000-1301ffff : jz4740-nand
+ 13030000-1303ffff : jz-ohci.0
+ 13040000-1304ffff : jz-udc
+   13040000-1304ffff : jz-udc
+ 13050000-1305ffff : jz4740-fb
+   13050000-1305ffff : jz4740-fb
+
+ $ '''cat /proc/interrupts'''
+           CPU0       
+   2:      33611            MIPS  JZ4740 cascade interrupt
+  17:         20            INTC  serial
+  20:         56            INTC  jz4740-adc
+  22:         47            INTC  MMC/SD
+  23:          0            INTC  jz4740-rtc
+  28:          0            INTC  DMA
+  31:      32374            INTC  jz4740-timerirq
+  32:        527            INTC  jz-udc
+ 147:          0     GPIO Bank C  jz4740-battery
+ 152:          0     GPIO Bank D  MMC/SD detect changed
+ 170:          0     GPIO Bank D  matrix-keypad
+ 171:         94     GPIO Bank D  matrix-keypad
+ 172:         77     GPIO Bank D  matrix-keypad
+ 173:         17     GPIO Bank D  matrix-keypad
+ 174:        151     GPIO Bank D  matrix-keypad
+ 175:         13     GPIO Bank D  matrix-keypad
+ 176:        235     GPIO Bank D  matrix-keypad
+ 178:          0     GPIO Bank D  matrix-keypad
+ 180:          0     GPIO Bank D  gpio-charger.0
+ 181:          0     GPIO Bank D  Power
+ ERR:          0
+
+== GPIO pins ==
+
+The Jz4720 has only a limited number of pins as outputs to the board.  Furthermore, several functions take up gpio pins which are therefore not usable for other functions.  Those devices are the sdram and nand controller, lcd controller and mmc+sd controller.  Below is a table showing how they are used.  Please complete this table.  The missing entries are not connected to a pad in the Jz4720.
+
+'''Port A:'''
+* 01      sdram data 0
+* 03      sdram data 1
+* 05      sdram data 2
+* 07      sdram data 3
+* 08      sdram data 4
+* 09      sdram data 5
+* 10      sdram data 6
+* 11      sdram data 7
+* 12      sdram data 8
+* 13      sdram data 9
+* 15      sdram data 10
+* 17      sdram data 11
+* 22      sdram data 12
+* 26      sdram data 13
+* 28      sdram data 14
+* 30      sdram data 15
+
+'''Port B:'''
+* 00      sdram address 0
+* 01      sdram address 1
+* 02      sdram address 2
+* 03      sdram address 3
+* 04      sdram address 4
+* 05      sdram address 5
+* 06      sdram address 6
+* 07      sdram address 7
+* 08      sdram address 8
+* 09      sdram address 9
+* 10      sdram address 10
+* 11      sdram address 11
+* 12      sdram address 12
+* 13      sdram address 13
+* 14      sdram address 14
+* 15      nand command latch
+* 16      nand address latch
+* 17      not connected (was marked "SHDN_HOST???", but schematic disagrees)
+* 18      TP23 (free)
+* 19      sdram dcs
+* 20      sdram ras
+* 21      sdram cas
+* 22      sdram write enable
+* 23      sdram cke
+* 24      sdram cko
+* 25      sdram cs1
+* 26      sdram cs2
+* 27      not connected (was marked "USB ID", but schematic disagrees)
+* 28      not connected
+* 29      Audio output enable (anti-pop control)
+* 30      TP25 (free)
+* 31      sdram write enable 0
+
+'''Port C:'''
+* 00      lcd data 0
+* 01      lcd data 1
+* 02      lcd data 2
+* 03      lcd data 3
+* 04      lcd data 4
+* 05      lcd data 5
+* 06      lcd data 6
+* 07      lcd data 7
+* 08      TP 35 (free)
+* 09      TP 36 (free)
+* 10      keyboard out 1, TP59
+* 11      keyboard out 2, TP60
+* 12      keyboard out 3, TP61
+* 13      keyboard out 4, TP62
+* 14      keyboard out 5, TP63
+* 15      keyboard out 6, TP64
+* 16      keyboard out 7, TP65
+* 17      keyboard out 8, TP66
+* 18      lcd pixel clock
+* 19      lcd hsync
+* 20      lcd vsync
+* 21      lcd SPI chipselect
+* 22      lcd SPI data
+* 23      lcd SPI clock
+* 24      sdram write enable 1
+* 27      Charge detect (analog input to read battery voltage).
+* 28      nand read enable
+* 29      nand write enable
+* 30      nand flash ready/busy
+* 31      not connected to a pad; PCSEL31 selects jtag (PCSEL31==0) or uart0 (PCSEL31==1) on pad 147(TxD)+148(RxD) (TP5+TP4).
+
+'''Port D:'''
+* 00      SD Card detect
+* 02      SD Card power enable
+* 04      Speaker AMP enable (no audio unless this output is pulled low).
+* 06      Low power indicator (if 0, battery power is low).
+* 08      SD Card command
+* 09      SD Card clock
+* 10      SD Card data 1
+* 11      SD Card data 2
+* 12      SD Card data 3
+* 13      SD Card data 4
+* 15      TP 38 (free)
+* 18      Keyboard in 1, TP67
+* 19      Keyboard in 2, TP68
+* 20      Keyboard in 3, TP69
+* 21      Keyboard in 4, TP70
+* 22      Keyboard in 5, TP71
+* 23      Keyboard in 6, TP72
+* 24      Keyboard in 7, TP73
+* 25      uart0 transmit, TP75
+* 26      Keyboard in 8 (uart0 receive), TP74
+* 27      Buzzer, controlled with pwm4.  Piezo-electric buzzer; not related to soundcard output.
+* 28      USB detect (0 if usb power is present).
+* 29      power button (0 if pressed).
+
+=== Sorted by function ===
+* buzzer: D27
+* audio: B29, D4
+* power button: D29
+* keyboard: C10, C11, C12, C13, C14, C15, C16, C17, D18, D19, D20, D21, D22, D23, D24, D26(also uart receive)
+* uart: C31, D25, D26(also keyboard), uart is also available on jtag pads TP4+TP5 (without gpio overload).
+* sd/mmc: D0, D2, D8, D9, D10, D11, D12, D13
+* usb: D28
+* battery: C27, D6
+* sdram: A1, A3, A5, A7, A8, A9, A10, A11, A12, A13, A15, A17, A22, A26, A28, A30, B0, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, B11, B12, B13, B14, B19, B10, B21, B22, B23, B24, B25, B26, B31, C24
+* nand: B15, B16, C28, C29, C30
+* lcd: C0, C1, C2, C3, C4, C5, C6, C7, C18, C19, C20, C21, C22, C23
+* only test points: B18, B30, C8, C9, D15
+* unconnected pads: B17, B27, B28
+
+[[Category:Ben NanoNote]]
+
+This content is dual licensed under CC-BY-SA and GFDL and was obtained from [http://en.qi-hardware.com/wiki/Hardware-Ben](http://en.qi-hardware.com/wiki/Hardware-Ben)

+ 55 - 0
docs/How To Submit A Change To This Wiki.md

@@ -0,0 +1,55 @@
+How To Submit A Change To This Wiki
+===================================
+
+Clone this repo and:
+--------------------
+
+    git clone https://gogs.librecmc.org/libreCMC/libreCMC-wiki.git
+
+then
+
+    git push
+
+or
+
+    git request-pull -p
+
+### git push ( In Gogs )
+
+Clone the upstream repo in Gogs, then clone to your computer:
+
+    git clone https://yourUserName@yourURL
+
+Add upstream repo to be able to rebase to upstream point commit:
+
+    git remote add upstream https://gogs.librecmc.org/libreCMC/libreCMC-wiki.git
+    (git checkout -b optionalBranchName)
+    git push (--all)
+
+Create Push Request in Gogs:
+
+* Press the little green PR button in your own repo
+* Or go to <https://gogs.librecmc.org/libreCMC/libreCMC-wiki/pulls>
+
+### git request-pull -p ( Anywhere )
+
+Clone the upstream repo to your computer.
+
+    git add changedFile.md
+    git commit ( -m Short info what changed )
+    git log ( copy commit id )
+    git request-pull -p (start) URL (end)
+    git request-pull -p (commit in upstream repo) URL master
+
+Example for piping output to haste:
+
+    git request-pull -p b3b8926484feb37c33e5150facf315ef12b4612e https://gogs.librecmc.org/jonasbits2/libreCMC-wiki.git master | haste
+
+* Send to hastebin.com or any site you like
+* Paste link in IRC channel
+
+#### Links
+
+* <https://www.git-scm.com/docs/git-request-pull>
+* <https://hastebin.com/about.md>
+

+ 73 - 0
docs/How_To_Build_libreCMC.md

@@ -0,0 +1,73 @@
+# libreCMC build HOWTO
+
+This generic documentation is to help aid those who want to build libreCMC firmware images from source code. While this 
+documentation is not an exhaustive source of information, it should help those who would like to build their own firmware images
+or would like to develop firmware based upon libreCMC.
+
+While libreCMC does allow for building for other targets, not all of them have been tested to work with libreCMC and are not officially supported if they are not mentioned on the libreCMC wiki.
+
+libreCMC is licensed under the GPLv2 and contains code from other free software projects. Some code may be licensed under other free software licenses and will be noted. All software is to be distributed under the terms of the GPLv2 or their respective free software licenses.
+
+## What do I need to get started?
+
+* GNU/Linux distro (Trisquel, *buntu, Fedora or others)
+* GNU GCC / GCC-C++
+* build-essential (Debian-based distro) or base-devel (Parabola)
+* flex
+* gawk
+* wget
+* unzip
+* ncurses-dev (ncurses5-devel, etc..)
+* libghc-zlib-dev
+* libssl-dev 
+* patch
+* perl5
+* subversion
+* git-core 
+* 8 - 10 GB of disk space
+* 4 GB of RAM (8 GB or more is recommended)
+
+## Building libreCMC
+
+1) Get the latest libreCMC source code:
+
+`git clone https://gogs.librecmc.org/libreCMC/libreCMC.git`
+
+or download a [release](/releases)
+
+If you want to build packages found in libreCMC's package feed, update and install the make files 
+by running the following from `$SRC_ROOT`:
+
+`./scripts/feeds update && ./scripts/feeds install -a`
+
+This will pull the makefiles for the package feed and make them available for selection 
+when configuring your build of libreCMC.
+
+2) Configure libreCMC for your device. 
+
+ `make menuconfig` 
+
+ When configuring libreCMC for your device, it is imperative that the right target and profile are selected. Currently, we only _officially_ support the AR71XX target and the TP-Link TL-MR3020 and Netgear WNDR3800. If you want other packages, please keep in mind that these devices don't have very much in terms of flash ROM and your selection of packages may not work properly. Generally, a good default configuration includes:
+
+
+ * luci : Collections -> luci  + luci -> protocols -> luci-proto-relayd
+ * Networking : wpa-cli + wpa-supplicant + iw
+ * Utilities : Editors -> Nano
+
+3) When done configuring, run:
+
+ `make`
+
+ If the build fails, type:
+
+ `make V=s`
+
+ if there are missing dependencies in your build environment, please install them and then run `make`.
+
+4) If the build exits without any errors, you should have a new image in:
+
+ `$SRC_ROOT/bin/$BUILD_TARGET/librecmc-$BUILD_TARGET-generic-$TARGET_PROFILE-$VERSION-$FS_TYPE-factory.bin`
+
+ Where `$BUILD_TARGET = target (ex. ar71xx)`, `$TARGET_PROFILE = device`, `$VERSION = device version (some don't any)`
+
+5) Flash the newly built image (if you are confident). libreCMC project is not responsible for bricked devices.

+ 430 - 0
docs/LICENSE.md

@@ -0,0 +1,430 @@
+```
+Attribution-ShareAlike 4.0 International
+
+=======================================================================
+
+Creative Commons Corporation ("Creative Commons") is not a law firm and
+does not provide legal services or legal advice. Distribution of
+Creative Commons public licenses does not create a lawyer-client or
+other relationship. Creative Commons makes its licenses and related
+information available on an "as-is" basis. Creative Commons gives no
+warranties regarding its licenses, any material licensed under their
+terms and conditions, or any related information. Creative Commons
+disclaims all liability for damages resulting from their use to the
+fullest extent possible.
+
+Using Creative Commons Public Licenses
+
+Creative Commons public licenses provide a standard set of terms and
+conditions that creators and other rights holders may use to share
+original works of authorship and other material subject to copyright
+and certain other rights specified in the public license below. The
+following considerations are for informational purposes only, are not
+exhaustive, and do not form part of our licenses.
+
+     Considerations for licensors: Our public licenses are
+     intended for use by those authorized to give the public
+     permission to use material in ways otherwise restricted by
+     copyright and certain other rights. Our licenses are
+     irrevocable. Licensors should read and understand the terms
+     and conditions of the license they choose before applying it.
+     Licensors should also secure all rights necessary before
+     applying our licenses so that the public can reuse the
+     material as expected. Licensors should clearly mark any
+     material not subject to the license. This includes other CC-
+     licensed material, or material used under an exception or
+     limitation to copyright. More considerations for licensors:
+	wiki.creativecommons.org/Considerations_for_licensors
+
+     Considerations for the public: By using one of our public
+     licenses, a licensor grants the public permission to use the
+     licensed material under specified terms and conditions. If
+     the licensor's permission is not necessary for any reason--for
+     example, because of any applicable exception or limitation to
+     copyright--then that use is not regulated by the license. Our
+     licenses grant only permissions under copyright and certain
+     other rights that a licensor has authority to grant. Use of
+     the licensed material may still be restricted for other
+     reasons, including because others have copyright or other
+     rights in the material. A licensor may make special requests,
+     such as asking that all changes be marked or described.
+     Although not required by our licenses, you are encouraged to
+     respect those requests where reasonable. More_considerations
+     for the public: 
+	wiki.creativecommons.org/Considerations_for_licensees
+
+=======================================================================
+
+Creative Commons Attribution-ShareAlike 4.0 International Public
+License
+
+By exercising the Licensed Rights (defined below), You accept and agree
+to be bound by the terms and conditions of this Creative Commons
+Attribution-ShareAlike 4.0 International Public License ("Public
+License"). To the extent this Public License may be interpreted as a
+contract, You are granted the Licensed Rights in consideration of Your
+acceptance of these terms and conditions, and the Licensor grants You
+such rights in consideration of benefits the Licensor receives from
+making the Licensed Material available under these terms and
+conditions.
+
+
+Section 1 -- Definitions.
+
+  a. Adapted Material means material subject to Copyright and Similar
+     Rights that is derived from or based upon the Licensed Material
+     and in which the Licensed Material is translated, altered,
+     arranged, transformed, or otherwise modified in a manner requiring
+     permission under the Copyright and Similar Rights held by the
+     Licensor. For purposes of this Public License, where the Licensed
+     Material is a musical work, performance, or sound recording,
+     Adapted Material is always produced where the Licensed Material is
+     synched in timed relation with a moving image.
+
+  b. Adapter's License means the license You apply to Your Copyright
+     and Similar Rights in Your contributions to Adapted Material in
+     accordance with the terms and conditions of this Public License.
+
+  c. BY-SA Compatible License means a license listed at
+     creativecommons.org/compatiblelicenses, approved by Creative
+     Commons as essentially the equivalent of this Public License.
+
+  d. Copyright and Similar Rights means copyright and/or similar rights
+     closely related to copyright including, without limitation,
+     performance, broadcast, sound recording, and Sui Generis Database
+     Rights, without regard to how the rights are labeled or
+     categorized. For purposes of this Public License, the rights
+     specified in Section 2(b)(1)-(2) are not Copyright and Similar
+     Rights.
+
+  e. Effective Technological Measures means those measures that, in the
+     absence of proper authority, may not be circumvented under laws
+     fulfilling obligations under Article 11 of the WIPO Copyright
+     Treaty adopted on December 20, 1996, and/or similar international
+     agreements.
+
+  f. Exceptions and Limitations means fair use, fair dealing, and/or
+     any other exception or limitation to Copyright and Similar Rights
+     that applies to Your use of the Licensed Material.
+
+  g. License Elements means the license attributes listed in the name
+     of a Creative Commons Public License. The License Elements of this
+     Public License are Attribution and ShareAlike.
+
+  h. Licensed Material means the artistic or literary work, database,
+     or other material to which the Licensor applied this Public
+     License.
+
+  i. Licensed Rights means the rights granted to You subject to the
+     terms and conditions of this Public License, which are limited to
+     all Copyright and Similar Rights that apply to Your use of the
+     Licensed Material and that the Licensor has authority to license.
+
+  j. Licensor means the individual(s) or entity(ies) granting rights
+     under this Public License.
+
+  k. Share means to provide material to the public by any means or
+     process that requires permission under the Licensed Rights, such
+     as reproduction, public display, public performance, distribution,
+     dissemination, communication, or importation, and to make material
+     available to the public including in ways that members of the
+     public may access the material from a place and at a time
+     individually chosen by them.
+
+  l. Sui Generis Database Rights means rights other than copyright
+     resulting from Directive 96/9/EC of the European Parliament and of
+     the Council of 11 March 1996 on the legal protection of databases,
+     as amended and/or succeeded, as well as other essentially
+     equivalent rights anywhere in the world.
+
+  m. You means the individual or entity exercising the Licensed Rights
+     under this Public License. Your has a corresponding meaning.
+
+
+Section 2 -- Scope.
+
+  a. License grant.
+
+       1. Subject to the terms and conditions of this Public License,
+          the Licensor hereby grants You a worldwide, royalty-free,
+          non-sublicensable, non-exclusive, irrevocable license to
+          exercise the Licensed Rights in the Licensed Material to:
+
+            a. reproduce and Share the Licensed Material, in whole or
+               in part; and
+
+            b. produce, reproduce, and Share Adapted Material.
+
+       2. Exceptions and Limitations. For the avoidance of doubt, where
+          Exceptions and Limitations apply to Your use, this Public
+          License does not apply, and You do not need to comply with
+          its terms and conditions.
+
+       3. Term. The term of this Public License is specified in Section
+          6(a).
+
+       4. Media and formats; technical modifications allowed. The
+          Licensor authorizes You to exercise the Licensed Rights in
+          all media and formats whether now known or hereafter created,
+          and to make technical modifications necessary to do so. The
+          Licensor waives and/or agrees not to assert any right or
+          authority to forbid You from making technical modifications
+          necessary to exercise the Licensed Rights, including
+          technical modifications necessary to circumvent Effective
+          Technological Measures. For purposes of this Public License,
+          simply making modifications authorized by this Section 2(a)
+          (4) never produces Adapted Material.
+
+       5. Downstream recipients.
+
+            a. Offer from the Licensor -- Licensed Material. Every
+               recipient of the Licensed Material automatically
+               receives an offer from the Licensor to exercise the
+               Licensed Rights under the terms and conditions of this
+               Public License.
+
+            b. Additional offer from the Licensor -- Adapted Material.
+               Every recipient of Adapted Material from You
+               automatically receives an offer from the Licensor to
+               exercise the Licensed Rights in the Adapted Material
+               under the conditions of the Adapter's License You apply.
+
+            c. No downstream restrictions. You may not offer or impose
+               any additional or different terms or conditions on, or
+               apply any Effective Technological Measures to, the
+               Licensed Material if doing so restricts exercise of the
+               Licensed Rights by any recipient of the Licensed
+               Material.
+
+       6. No endorsement. Nothing in this Public License constitutes or
+          may be construed as permission to assert or imply that You
+          are, or that Your use of the Licensed Material is, connected
+          with, or sponsored, endorsed, or granted official status by,
+          the Licensor or others designated to receive attribution as
+          provided in Section 3(a)(1)(A)(i).
+
+  b. Other rights.
+
+       1. Moral rights, such as the right of integrity, are not
+          licensed under this Public License, nor are publicity,
+          privacy, and/or other similar personality rights; however, to
+          the extent possible, the Licensor waives and/or agrees not to
+          assert any such rights held by the Licensor to the limited
+          extent necessary to allow You to exercise the Licensed
+          Rights, but not otherwise.
+
+       2. Patent and trademark rights are not licensed under this
+          Public License.
+
+       3. To the extent possible, the Licensor waives any right to
+          collect royalties from You for the exercise of the Licensed
+          Rights, whether directly or through a collecting society
+          under any voluntary or waivable statutory or compulsory
+          licensing scheme. In all other cases the Licensor expressly
+          reserves any right to collect such royalties.
+
+
+Section 3 -- License Conditions.
+
+Your exercise of the Licensed Rights is expressly made subject to the
+following conditions.
+
+  a. Attribution.
+
+       1. If You Share the Licensed Material (including in modified
+          form), You must:
+
+            a. retain the following if it is supplied by the Licensor
+               with the Licensed Material:
+
+                 i. identification of the creator(s) of the Licensed
+                    Material and any others designated to receive
+                    attribution, in any reasonable manner requested by
+                    the Licensor (including by pseudonym if
+                    designated);
+
+                ii. a copyright notice;
+
+               iii. a notice that refers to this Public License;
+
+                iv. a notice that refers to the disclaimer of
+                    warranties;
+
+                 v. a URI or hyperlink to the Licensed Material to the
+                    extent reasonably practicable;
+
+            b. indicate if You modified the Licensed Material and
+               retain an indication of any previous modifications; and
+
+            c. indicate the Licensed Material is licensed under this
+               Public License, and include the text of, or the URI or
+               hyperlink to, this Public License.
+
+       2. You may satisfy the conditions in Section 3(a)(1) in any
+          reasonable manner based on the medium, means, and context in
+          which You Share the Licensed Material. For example, it may be
+          reasonable to satisfy the conditions by providing a URI or
+          hyperlink to a resource that includes the required
+          information.
+
+       3. If requested by the Licensor, You must remove any of the
+          information required by Section 3(a)(1)(A) to the extent
+          reasonably practicable.
+
+  b. ShareAlike.
+
+     In addition to the conditions in Section 3(a), if You Share
+     Adapted Material You produce, the following conditions also apply.
+
+       1. The Adapter's License You apply must be a Creative Commons
+          license with the same License Elements, this version or
+          later, or a BY-SA Compatible License.
+
+       2. You must include the text of, or the URI or hyperlink to, the
+          Adapter's License You apply. You may satisfy this condition
+          in any reasonable manner based on the medium, means, and
+          context in which You Share Adapted Material.
+
+       3. You may not offer or impose any additional or different terms
+          or conditions on, or apply any Effective Technological
+          Measures to, Adapted Material that restrict exercise of the
+          rights granted under the Adapter's License You apply.
+
+
+Section 4 -- Sui Generis Database Rights.
+
+Where the Licensed Rights include Sui Generis Database Rights that
+apply to Your use of the Licensed Material:
+
+  a. for the avoidance of doubt, Section 2(a)(1) grants You the right
+     to extract, reuse, reproduce, and Share all or a substantial
+     portion of the contents of the database;
+
+  b. if You include all or a substantial portion of the database
+     contents in a database in which You have Sui Generis Database
+     Rights, then the database in which You have Sui Generis Database
+     Rights (but not its individual contents) is Adapted Material,
+
+     including for purposes of Section 3(b); and
+  c. You must comply with the conditions in Section 3(a) if You Share
+     all or a substantial portion of the contents of the database.
+
+For the avoidance of doubt, this Section 4 supplements and does not
+replace Your obligations under this Public License where the Licensed
+Rights include other Copyright and Similar Rights.
+
+
+Section 5 -- Disclaimer of Warranties and Limitation of Liability.
+
+  a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE
+     EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS
+     AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF
+     ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,
+     IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,
+     WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
+     PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,
+     ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT
+     KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT
+     ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.
+
+  b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE
+     TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,
+     NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,
+     INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,
+     COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR
+     USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN
+     ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR
+     DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR
+     IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.
+
+  c. The disclaimer of warranties and limitation of liability provided
+     above shall be interpreted in a manner that, to the extent
+     possible, most closely approximates an absolute disclaimer and
+     waiver of all liability.
+
+
+Section 6 -- Term and Termination.
+
+  a. This Public License applies for the term of the Copyright and
+     Similar Rights licensed here. However, if You fail to comply with
+     this Public License, then Your rights under this Public License
+     terminate automatically.
+
+  b. Where Your right to use the Licensed Material has terminated under
+     Section 6(a), it reinstates:
+
+       1. automatically as of the date the violation is cured, provided
+          it is cured within 30 days of Your discovery of the
+          violation; or
+
+       2. upon express reinstatement by the Licensor.
+
+     For the avoidance of doubt, this Section 6(b) does not affect any
+     right the Licensor may have to seek remedies for Your violations
+     of this Public License.
+
+  c. For the avoidance of doubt, the Licensor may also offer the
+     Licensed Material under separate terms or conditions or stop
+     distributing the Licensed Material at any time; however, doing so
+     will not terminate this Public License.
+
+  d. Sections 1, 5, 6, 7, and 8 survive termination of this Public
+     License.
+
+
+Section 7 -- Other Terms and Conditions.
+
+  a. The Licensor shall not be bound by any additional or different
+     terms or conditions communicated by You unless expressly agreed.
+
+  b. Any arrangements, understandings, or agreements regarding the
+     Licensed Material not stated herein are separate from and
+     independent of the terms and conditions of this Public License.
+
+
+Section 8 -- Interpretation.
+
+  a. For the avoidance of doubt, this Public License does not, and
+     shall not be interpreted to, reduce, limit, restrict, or impose
+     conditions on any use of the Licensed Material that could lawfully
+     be made without permission under this Public License.
+
+  b. To the extent possible, if any provision of this Public License is
+     deemed unenforceable, it shall be automatically reformed to the
+     minimum extent necessary to make it enforceable. If the provision
+     cannot be reformed, it shall be severed from this Public License
+     without affecting the enforceability of the remaining terms and
+     conditions.
+
+  c. No term or condition of this Public License will be waived and no
+     failure to comply consented to unless expressly agreed to by the
+     Licensor.
+
+  d. Nothing in this Public License constitutes or may be interpreted
+     as a limitation upon, or waiver of, any privileges and immunities
+     that apply to the Licensor or You, including from the legal
+     processes of any jurisdiction or authority.
+
+
+=======================================================================
+
+Creative Commons is not a party to its public
+licenses. Notwithstanding, Creative Commons may elect to apply one of
+its public licenses to material it publishes and in those instances
+will be considered the “Licensor.” The text of the Creative Commons
+public licenses is dedicated to the public domain under the CC0 Public
+Domain Dedication. Except for the limited purpose of indicating that
+material is shared under a Creative Commons public license or as
+otherwise permitted by the Creative Commons policies published at
+creativecommons.org/policies, Creative Commons does not authorize the
+use of the trademark "Creative Commons" or any other trademark or logo
+of Creative Commons without its prior written consent including,
+without limitation, in connection with any unauthorized modifications
+to any of its public licenses or any other arrangements,
+understandings, or agreements concerning use of licensed material. For
+the avoidance of doubt, this paragraph does not form part of the
+public licenses.
+
+Creative Commons may be contacted at creativecommons.org.
+
+```

+ 22 - 0
docs/List_of_Tested_Hardware.md

@@ -0,0 +1,22 @@
+# List of Tested Devices
+
+| Device Name  | Contributor |  Bootloader Flashed? |
+|-------------------------------------|:-------------:|------:|
+| Netgear WNDR3700 v1        |  orly_owl |  ??? |
+| TP-Link TL-WA901ND v3       |  jonasbits  |  ??? |
+| TP-Link TL-WR710N v2.0    |  jonasbits  |  ??? |
+| TP-Link TL-WR741ND v1.8  |  yang  |  ???|
+| TP-Link TL-WR841ND v5.2  |  orly_owl |  ??? |
+| TP-Link TL-WR841ND v8.2  | RISCi_ATOM, yang| Yes, u-boot_mod|
+| TP-Link TL-WR842ND v2.0  |  zeus |  No |
+| TP-Link TL-WR1043ND v1.8| orly_owl | ??? |
+| TP-Link TL-WR1043ND v2.1| RISCi_ATOM | ??? |
+| D-Link DGL-5500 vA1 rm' wifi card| RISCi_ATOM | ??? |
+| Western Digital MyNet N750 | orly_owl | ??? |
+
+Please note that not all of the devices on the above list are officially supported by the libreCMC
+project. In order for a device to be officially supported, it needs to meet the following rules:
+
+* libreCMC must be flashable from stock firmware (without the usage of non-free software).
+* The bootloader must be free software and flashable with a serial cable + Ethernet cable or from within libreCMC.
+* Components including( wifi, switch, video, etc..) must not require blobs to work.

+ 61 - 0
docs/OpenVPN_Layer_2_Server.md

@@ -0,0 +1,61 @@
+# OpenVPN Layer 2 Server
+
+## Installing OpenVPN packages
+
+TODO
+
+## Interface Setup
+
+TODO
+
+## Certificate and Key Setup Instructions
+
+TODO
+
+## Server configuration
+
+For server bridge option: First two parameters are the ip/netmask of
+the gateway on the bridged subnet. Next two paraters indicate the
+pool-start-IP and pool-end-IP, which is the part of your IP address
+pool that you have reserved just for VPN clients. You have to make
+sure the DHCP server on the company network is not handing those out
+to on-site systems.
+
+/etc/config/openvpn
+```
+config openvpn 'myvpn'
+	option enabled '1'
+	option dev 'tap0'
+	option port '1194'
+	option proto 'udp'
+	option status '/var/log/openvpn_status.log'
+	option log '/tmp/openvpn.log'
+	option verb '3'
+	option mute '5'
+	option keepalive '10 120'
+	option persist_key '1'
+	option persist_tun '1'
+	option user 'nobody'
+	option group 'nogroup'
+	option ca '/etc/easy-rsa/keys/ca.crt'
+	option cert '/etc/easy-rsa/keys/myvpn.crt'
+	option key '/etc/easy-rsa/keys/myvpn.key'
+	option dh '/etc/easy-rsa/keys/dh2048.pem'
+	option tls_server '1'
+	option tls_auth '/etc/easy-rsa/keys/ta.key 0'
+	option server_bridge '10.0.0.1 255.255.255.0 10.0.0.201 10.0.0.220'
+	option topology 'subnet'
+	option client_to_client '1'
+	list push 'persist-key'
+	list push 'persist-tun'
+	list push 'redirect-gateway def1'
+	# allow your clients to access to your network
+	list push 'route 10.0.0.0 255.255.255.0'
+	# push DNS to your clients
+	list push 'dhcp-option DNS 10.0.0.1'
+        # option comp_lzo 'no'
+```
+
+## Client setup information
+
+TODO

+ 15 - 0
docs/README.md

@@ -0,0 +1,15 @@
+# libreCMC : The _libre_ Embedded GNU/Linux Distro.
+
+libreCMC is a set of fully [free](http://www.gnu.org/philosophy/free-sw.en.html) embedded Operating Systems for general purpose computers. It aims to give its users freedom and control over the software that runs on their hardware. Most of the hardware that libreCMC supports includes a wide range of routers and some small single board computers.
+
+## Useful links:
+
+* [Get libreCMC source code](https://gogs.librecmc.org/libreCMC/libreCMC) : Checkout the latest libreCMC sources.
+
+* [Supported Hardware](Supported_Hardware.md): Devices officially supported by libreCMC.
+
+* [Router reset instructions](Router_Reset_Instructions.md) : Generic libreCMC router reset instructions.
+
+* [Report a bug or issue](https://gogs.librecmc.org/libreCMC/libreCMC/issues) : Is something broken? Did you find a non-free component or do you want to make libreCMC better? Submit an issue.
+
+* [Build Documentation](How_To_Build_libreCMC.md) : Learn how to build libreCMC for your device. 

+ 53 - 0
docs/Router_Reset_Instructions.md

@@ -0,0 +1,53 @@
+# libreCMC Router Reset
+
+## Hard reset
+
+### Manual way (if you can’t access the web interface)
+
+1. Power off the router.
+
+2. Power on the router.
+
+3. As soon as the SYS light (the gear) flashes, hold down the reset button until the 
+SYS LED flashes faster.
+
+4. Stop Network-Manager or other network configuration services.
+
+5. Plug in an ethernet cable from your machine to one of the LAN ports.
+
+6. Set your computer’s IP address to 192.168.10.2
+
+7.  `telnet  192.168.10.1` (192.168.1.1 on pre v1.3.1 devices).
+    With v1.3.4+ devices, telnet is disabled. use ssh:
+    `ssh root@192.168.10.1`
+
+8. At the shell prompt, type:
+`firstboot`
+
+9. After you have confirmed that you want to reset everything your need to reboot the router:
+`reboot`  <- It can manually be turned off too.
+
+### Resetting via web interface
+
+1. Login into the router via : 192.168.10.1 (or 192.168.1.1, depending on your configuration).
+
+2. Navigate to: System -> Backup / Flash Firmware 
+
+3. Click : "Preform Reset"
+
+Note: After resetting the router, it will be in a default state (wireless will be disabled, no password
+is set, ip-forwarding is disabled and telnet is enabled and the default IP should be 192.168.10.1) 
+It is recommended that you re-load the default configuration:
+
+# Restoring old configurations
+
+1. Make sure you have your network-manager turned on
+
+2. Log into the router via : 192.168.10.1 
+
+3. Navigate to : System -> Backup / Flash Firmware
+
+4. By "Restore Backup" , click the browse button and select the libreCMC configuration backup (*.tar.gz).
+
+
+

+ 37 - 0
docs/Supported_Hardware.md

@@ -0,0 +1,37 @@
+# libreCMC supported Hardware
+
+### Buffalo
+* [WZR-HP-G300NH](/WZR_HP_G300NH.md)
+* WHR-HP-G300NH
+
+### Netgear 
+
+* [WNDR3800](/WNDR3800.md)
+
+### TP-link 
+
+* [TL-MR3020 v1](/TL_MR3020.md) 
+* [TL-WR741ND](/TL_WR741ND.md)
+* [TL-WR841ND](/TP_WR841ND.md)
+* [TL-WR842ND](/TL_WR842ND.md)
+* [TL-WR1043ND](/TL_WR1043ND)
+
+### ThinkPenguin
+* [TPE-NWIFIROUTER2](/TPE_NWIFIROUTER2.md)
+* [TPE-R1100](/TPE_R1100.md)
+
+### Qi-Hardware
+
+* [Ben Nanonote](/Ben_Nanonote.md)
+
+## Tested Hardware
+
+[List of tested hardware](/List_of_Tested_Hardware.md)
+
+# libreCMC unofficially supported Hardware
+
+### D-Link
+
+* DGL-5500 a1 : Ships with non-free wifi card, but can be replaced with a free one. Has a mini-pci-e card slot.
+
+#####Please note that other targets may work; we are **NOT** responsible for **ANY** _bricked_ devices.

+ 42 - 0
docs/TL_MR3020.md

@@ -0,0 +1,42 @@
+# TP-Link : TL-MR3020
+
+The TL-MR3020 is a versatile device with the following specs:
+
+* SoC : Atheros AR7240 
+* RAM: 32 MB 
+* Flash: 4MB 
+* NIC: 100BASE-X
+
+Please see the libreCMC [build documentation](/wiki/How-To-Build-libreCMC) for build instructions.
+
+## Flashing from factory (virgin)
+
+### Using Web GUI (Recommended)
+
+1) Set TL-MR3020 Mode Switch to either 3G/4G or WISP
+
+2) Connect to the TL-MR3020 router via Ethernet cable
+
+3) Open IP address 192.168.0.254
+
+4) log in to the router's web GUI (default login/password: admin / admin)
+
+5) overwrite the factory firmware by installing the openwrt-ar71xx-generic-tl-mr3020-v1-squashfs-factory.bin firmware image like a regular firmware update.
+
+Wait for the progress bar to finish twice (the device will reset itself in the process), and proceed with basic configuration as with any fresh libreCMC install.
+
+### Flashing from libreCMC Web GUI
+
+1) Connect device to ethernet port on your computer and set the ip address of your machine to 192.168.1.10
+
+2) Open 192.168.1.1 in a browser.
+
+3) Go to: System -> Backup/Flash Firmware
+
+4) Click the "browse" button under the _Flash New Firmware image_ section.
+
+5) Upload a firmware image with : librecmc-_target_-generic-_profile_-squashfs-factory.bin
+
+6) wait for the web interface to appear again (unless you chose to flash an image without it).
+
+# Needs more editing ;)

+ 28 - 0
docs/TL_WR1043ND.md

@@ -0,0 +1,28 @@
+# TL-WR1043ND
+
+## Hardware Specs:
+
+v1.x
+
+* SoC : Atheros AR9103
+* Flash ROM : 8 MiB
+* RAM : 32 MB
+* USB : 1
+* Special: 10/1000 switch
+
+v2.x
+
+* SoC : Qualcomm Atheros QCA9558
+* Flash ROM : 8 MiB
+* RAM : 64 MB
+* USB : 1
+* Special: 10/1000 switch
+
+## Supported Versions:
+
+* v1.x
+* v2.x
+
+Reset instructions
+
+???

+ 15 - 0
docs/TL_WR741ND.md

@@ -0,0 +1,15 @@
+# TP-Link TL-WR741ND
+
+## Specs
+
+* SoC : Atheros AR7240 @ 350 MHz
+* RAM: 32 MB
+* Flash : 4 MB
+
+## Versions Supported 
+
+* v1 - v2, v4.20 - 4.27 
+
+## Versions **NOT** supported
+
+* v2.1 - v3.1 + v4.0

+ 25 - 0
docs/TL_WR841ND.md

@@ -0,0 +1,25 @@
+# TP-WR841ND
+
+## Specs
+
+* SoC : Atheros AR9341
+* RAM: 32 MB
+* Flash: 4 MB
+
+## Versions Supported
+
+* v5.x
+* v8.x
+* v9.x
+* v10.x <-- may need to be tftp flashed
+* v11.x <--
+* v12.x <--
+
+
+DO NOT BUY v13!!! V13 contains a mediatek
+chipset, which requires a non-free firmware
+blob.
+
+## Reset instructions
+
+???

+ 41 - 0
docs/TL_WR842ND.md

@@ -0,0 +1,41 @@
+# TL-WR842ND
+
+## Specs
+
+* SoC : AR7241 (v1) AR9341 (v2)
+* RAM: 32 MB
+* Flash: 8 MB
+
+## Versions Supported
+
+* v1
+* v2
+
+## Flashing TL-WR842ND using tftp recovery mode
+
+* Press and hold WPS/Reset button, and power on router
+* Wait until Lock LED lights up before releasing WPS/Reset button
+* Router has IP address: 192.168.0.86
+* Router is standing by for a tftp server to appear with `wr842nv2_tp_recovery.bin` file using IP address: 192.168.0.66
+
+### Example commands using [Parabola GNU/Linux](https://www.parabola.nu/)
+
+Configure PC IP address to `192.168.0.66`
+
+    ip addr add 192.168.0.66/24 dev enp3s0
+    
+Copy downloaded image into tftp server directory also renaming it to `wr842nv2_tp_recovery.bin`
+
+    cp librecmc-ar71xx-generic-tl-wr842n-v2-squashfs-factory.bin /srv/tftp/wr842nv2_tp_recovery.bin
+
+Start tftpd
+
+`systemctl start tftpd.socket`
+
+`systemctl start tftpd.service`
+
+* After a short time all LEDs will flash once then router will reboot normally
+
+## Reset instructions
+
+???

+ 20 - 0
docs/TPE_NWIFIROUTER2.md

@@ -0,0 +1,20 @@
+# ThinkPenguin  [TPE-NWIFIROUTER2](https://www.thinkpenguin.com/gnu-linux/free-software-wireless-n-broadband-router-gnu-linux-tpe-nwifirouter2)
+
+## Specs
+
+* SoC : Atheros AR9341
+* RAM: 32 MB
+* Flash: 4 MB
+
+## Versions Supported
+
+* v2
+
+## Notes:
+
+* This router is a re-branded and re-flashed Rosewill RNX-N300RT. The Rosewill RNX-N300RT uses the same board found in the 
+TL-WR841N[D] v8.x. The stock RNX-N300RT ships with DRM and CAN NOT be flashed without non-free software (unless you have 
+a chip clip and SPI flasher). Some versions (v1) requires the flash chip to be removed before an SPI programmer can be used. 
+ThinkPenguin's offering ships with libreCMC, does not ship with DRM and can be fully re-programmed.
+
+* The names of the firmware images for this device are `librecmc-ar71xx-generic-tl-wr841-v8-squashfs-*`

+ 25 - 0
docs/TPE_R1100.md

@@ -0,0 +1,25 @@
+# Think Penguin [TPE-R1100 mini WiFi Router](https://www.thinkpenguin.com/TPE-R1100)
+
+## Specs
+
+* SoC: Atheros AR9331
+* RAM: 64M
+* Flash: 16M
+* NIC: 2 10/100 Ethernet Ports
+* USB: 1
+* WiFi: Atheros 802.11b/g/n 2.4Ghz
+* GPIO: 3 General Purpose and one switch.
+* Power: 5v USB
+
+The TPE-R1100 is a general purpose mini WiFi router
+that can be used for a wide range of applications. 
+Some common uses include:
+
+* Route all traffic over a VPN when on the go.
+* WiFi to ethernet bridge.
+* A small web server.
+* IRC bouncer.
+* Meshnet node (CJDNS, Batman...).
+
+
+

+ 11 - 0
docs/WNDR3800.md

@@ -0,0 +1,11 @@
+# Netgear WNDR3800
+
+## Specs
+
+* SoC : Atheros AR7161 rev 2
+* RAM: 128 MB
+* Flash: 16 MB
+
+## Versions Supported
+
+* v1.x

+ 13 - 0
docs/WZR_HP_G300NH.md

@@ -0,0 +1,13 @@
+# Buffalo WZR-HP-G300NH
+This device is scheduled to be supported in the upcoming version 1.3.1 of libreCMC.
+
+## Specs
+
+* SoC : Atheros AR9132
+* RAM: 64 MB
+* Flash: 32 MB
+
+## Versions Supported
+
+More info soon.
+

+ 71 - 0
docs/Welcome.md

@@ -0,0 +1,71 @@
+# libreCMC : The libre Embedded GNU/Linux Distro
+
+The libreCMC project is a set of fully [free](https://www.gnu.org/philosophy/free-sw.en.html) [embedded](/wiki/embedded) Operating Systems
+that give users the freedom to control their computing. Our primary project is an embedded GNU/Linux-libre 
+distro that is based upon the upstream OpenWRT/LEDE project. The main difference between OpenWRT/LEDE and libreCMC
+are the fact that the project removes all [non-free](https://www.gnu.org/philosophy/categories.en.html#non-freeSoftware) packages, drivers and firmware blobs where the sources are not available under a free software license.
+
+## Why would I use libreCMC?
+
+Full control over your computing! In many cases, a variety of embedded devices require components where the sources
+are not available to the community under a Free Software license. These non-free parts mean that the community can't
+fix bugs, security flaws or even use a newer kernel because drivers don't work with newer versions of the kernel. By using these non-free parts,the user is at the mercy of the OEM or manufacture to maintain support for newer drivers that work with newer versions of the Linux™ kernel.
+
+# Quick Start Build Guide
+
+1) Checkout libreCMC
+
+`git clone https://gogs.librecmc.org/libreCMC/libreCMC.git`
+
+2) Enter the libreCMC directory (from now on referred by `$SRC_ROOT`)
+
+`cd $SRC_ROOT`
+
+3) Configure the build for the [supported device](/wiki/Supported-Hardware) and
+the packages that you may want to have. Some targets may have a very limited amount
+of flash (primary storage) and may not have the room for certain configurations of 
+packages.
+
+Also, in order to build libreCMC, make sure that you have all needed [dependencies](/wiki/How-To-Build-libreCMC#what-do-i-need-to-get-started).
+After having installed all the necessary dependencies run:
+
+`make menuconfig`
+
+This will bring up the ncurses menuconfig interface for configuring libreCMC.
+
+A good default configuration for many people would be to include:
+
+* Luci -> luci, luci-ssl
+* Base System -> ca-bundle, sqm-scripts[-extra]
+
+4) Actually start the build:
+
+`make` : To speed things up, you can add a few more threads to the build by using `make -j4`
+
+5) Wait....
+
+Depending on the machine you have access to and the configuration you selected, it will take sometime to build libreCMC. 
+
+a) What if something goes wrong with the build? Run:
+
+`make V=s` : This will allow for the build to be debugged. Sometimes a source package mirror is down or a dependency is missing. This
+will allow us to figure out what is going wrong.
+
+
+b) The build finished, but there is no image for my device! If you select more packages than can fit in flash, then some packages will
+need to be removed from the configuration. After removing some packages, start the build again. Be careful when removing packages from
+the configuration. Some packages are very important for basic functionality or are needed for other packages in the base system.
+
+If you have a device that has <8M of flash, then try removing `Base System -> opkg*, ca-bundle`.
+
+
+6) If everything went OK, there should be a new image in `$SRC_ROOT/bin/targets/$TARGET/generic/`
+
+
+# Where do I go from here?
+
+Well, it depends on many factors. libreCMC can be used for many different use cases. If you need help with libreCMC, help can be found on IRC using:
+
+server :`FreeNode`
+
+channel : `#libreCMC`

+ 15 - 0
docs/embedded.md

@@ -0,0 +1,15 @@
+# Embedded Systems
+Embedded can mean different things to many people. The Wikipedia [definition](https://en.wikipedia.org/wiki/Embedded_system) is:
+
+> An embedded system is a computer system with a dedicated function within a larger mechanical or electrical system, often with real-time computing constraints.
+> ...
+> Examples of properties of typically embedded computers when compared with general-purpose counterparts are low power consumption, small size, rugged operating ranges, and low per-unit cost.
+
+The libreCMC project's definition is:
+
+>
+A device or system with very few resources and is designed to be run for long stretches of time without user intervention. 
+
+One of the main goals of the libreCMC project is to keep things really small in terms of operating footprint (storage and RAM used). Many of the devices that the project supports have as little as 4M of flash and 16M of RAM. In this scope, many SBCs (Single Board Computers) are well outside this range with some having more resources than an average desktop 10+ years ago. 
+
+# Page needs more editing!

+ 24 - 0
docs/old/Save_WiFi.md

@@ -0,0 +1,24 @@
+# Will you help us save WiFi ?
+
+For as long as the libreCMC  and LibreWRT projects have existed, their core focus has been to
+bring Free Software to embedded devices, some of which have WiFi chipsets. While the project(s) 
+core goals have not changed very much over the last few years, the landscape of WiFi enabled devices
+has exploded. Many of the radios in these devices went from being single-purpose radios that can only
+operate within certain ranges to modifiable SDRs that can be changed. While having the freedom to change
+one's own hardware is important, it is also important to operate radio equipment within regulatory laws. 
+
+Since a few individuals have operated devices outside of regulations, the FCC and other regulatory bodies are proposing tighter
+restrictions on hardware that has WiFi or SDRs. These new restrictions would include a full lockout of third-party software
+and prevent users from updating or running new software on hardware they own. With these new digital locks, hardware vendors
+will exercise control over the user by preventing new innovative functionality or even preventing users from applying critical security patches.
+ 
+These new regulations won't work the way they are intended to and they should not be required. Users with the technical knowledge
+will still be able to get around the restrictions and load their own software. Most free software projects
+already put safeguards in place so that users can't accidentally violate regulatory rules that apply to their WiFi or SDR devices, unless
+they choose to remove them on purpose. Instead of punishing everyone in the Free Software community for the actions of a few, individuals 
+who operate devices outside of regulations should be fined instead of taking away everyone's freedom.
+
+The libreCMC project and other members of the Free Software community would like to ask everyone to send a comment
+to the FCC about these new proposals and why they won't help fix the misuse of WiFi or SDRs. More information
+about this issue and how to submit comments can be found at [SaveWiFi.org](http://savewifi.org).
+

+ 12 - 0
docs/testing.md

@@ -0,0 +1,12 @@
+# This is a sample file!
+
+Just testing a symlink'ed wiki!
+
+```
+ Testing
+;alkdfj;a
+alksdjf;lka `
+```
+
+` another block of text `
+

+ 26 - 0
docs/unbrick_with_uboot_mod.md

@@ -0,0 +1,26 @@
+Unbrick libreCMC routers from u-boot_mod
+======================================================
+
+1. Make sure the router is powered off.
+
+2. On the host machine, disable network management (NetworkManager, wicd, etc..)
+
+3. Set the host machine IP address to 192.168.1.2
+
+4. Hold down the reset button.
+
+5. Power on the router with the reset button held.
+
+6. The red LED will light up, then flash every second.
+After the 3rd flash, release the reset button (it may
+take some coordination. From power on to the release of
+the button is exactly 3 sec.
+
+7. Open a web browser and go to 192.168.1/index.html
+
+8. Click the "browse" button and select the firmware image for your router
+
+`librecmc-ar71xx-generic-*-squashfs-*.bin`
+
+
+# WIP

+ 5 - 0
include/host-build.mk

@@ -77,6 +77,10 @@ HOST_MAKE_FLAGS =
 
 HOST_CONFIGURE_CMD = $(BASH) ./configure
 
+ifeq ($(HOST_OS),Darwin)
+  HOST_CONFIG_SITE:=$(INCLUDE_DIR)/site/darwin
+endif
+
 define Host/Configure/Default
 	$(if $(HOST_CONFIGURE_PARALLEL),+)(cd $(HOST_BUILD_DIR)/$(3); \
 		if [ -x configure ]; then \
@@ -127,6 +131,7 @@ define Host/Exports/Default
   $(1) : export PKG_CONFIG_PATH=$$(STAGING_DIR_HOST)/lib/pkgconfig:$$(HOST_BUILD_PREFIX)/lib/pkgconfig
   $(1) : export PKG_CONFIG_LIBDIR=$$(HOST_BUILD_PREFIX)/lib/pkgconfig
   $(1) : export CCACHE_DIR:=$(STAGING_DIR_HOST)/ccache
+  $(if $(HOST_CONFIG_SITE),$(1) : export CONFIG_SITE:=$(HOST_CONFIG_SITE))
   $(if $(IS_PACKAGE_BUILD),$(1) : export PATH=$$(TARGET_PATH_PKG))
 endef
 Host/Exports=$(Host/Exports/Default)

+ 2 - 5
include/kernel-version.mk

@@ -2,12 +2,9 @@
 
 LINUX_RELEASE?=1
 
-LINUX_VERSION-3.18 = .43
-LINUX_VERSION-4.4 = .87
-
-LINUX_KERNEL_HASH-3.18.43 = 1236e8123a6ce537d5029232560966feed054ae31776fe8481dd7d18cdd5492c
-LINUX_KERNEL_HASH-4.4.87 = f2e26505e3aecf622d4f4e1ede44b3b97a38739ad8b78ede14eb354f22d1387a
+LINUX_VERSION-4.4 = .108
 
+LINUX_KERNEL_HASH-4.4.108 = aaf270b84e7b55e7cad0777a6d17515b9afa681d320178364d66926acebd8cb3
 ifdef KERNEL_PATCHVER
   LINUX_VERSION:=$(KERNEL_PATCHVER)$(strip $(LINUX_VERSION-$(KERNEL_PATCHVER)))
 endif

+ 13 - 10
include/kernel.mk

@@ -59,7 +59,7 @@ else
   LINUX_SOURCE:=linux-libre-$(LINUX_VERSION)-gnu.tar.xz
   TESTING:=$(if $(findstring -rc,$(LINUX_VERSION)),/testing,)
   ifeq ($(call qstrip,$(CONFIG_EXTERNAL_KERNEL_TREE))$(call qstrip,$(CONFIG_KERNEL_GIT_CLONE_URI)),)
-      LINUX_SITE:=@KERNEL_LIBRE/$(LINUX_VERSION)-gnu$(TESTING)
+	LINUX_SITE:=@KERNEL_LIBRE/$(LINUX_VERSION)-gnu$(TESTING)
   endif
 
   ifneq ($(TARGET_BUILD),1)
@@ -95,15 +95,16 @@ define ModuleAutoLoad
 	$(SH_FUNC) \
 	export modules=; \
 	probe_module() { \
-		mods="$$$$$$$$1"; \
-		boot="$$$$$$$$2"; \
+		local mods="$$$$$$$$1"; \
+		local boot="$$$$$$$$2"; \
+		local mod; \
 		shift 2; \
-		for mod in $(sort $$$$$$$$mods); do \
+		for mod in $$$$$$$$mods; do \
 			mkdir -p $(2)/etc/modules.d; \
 			echo "$$$$$$$$mod" >> $(2)/etc/modules.d/$(1); \
 		done; \
 		if [ -e $(2)/etc/modules.d/$(1) ]; then \
-			if [ "$$$$$$$$boot" = "1" ]; then \
+			if [ "$$$$$$$$boot" = "1" -a ! -e $(2)/etc/modules-boot.d/$(1) ]; then \
 				mkdir -p $(2)/etc/modules-boot.d; \
 				ln -s ../modules.d/$(1) $(2)/etc/modules-boot.d/; \
 			fi; \
@@ -111,16 +112,17 @@ define ModuleAutoLoad
 		fi; \
 	}; \
 	add_module() { \
-		priority="$$$$$$$$1"; \
-		mods="$$$$$$$$2"; \
-		boot="$$$$$$$$3"; \
+		local priority="$$$$$$$$1"; \
+		local mods="$$$$$$$$2"; \
+		local boot="$$$$$$$$3"; \
+		local mod; \
 		shift 3; \
-		for mod in $(sort $$$$$$$$mods); do \
+		for mod in $$$$$$$$mods; do \
 			mkdir -p $(2)/etc/modules.d; \
 			echo "$$$$$$$$mod" >> $(2)/etc/modules.d/$$$$$$$$priority-$(1); \
 		done; \
 		if [ -e $(2)/etc/modules.d/$$$$$$$$priority-$(1) ]; then \
-			if [ "$$$$$$$$boot" = "1" ]; then \
+			if [ "$$$$$$$$boot" = "1" -a ! -e $(2)/etc/modules-boot.d/$$$$$$$$priority-$(1) ]; then \
 				mkdir -p $(2)/etc/modules-boot.d; \
 				ln -s ../modules.d/$$$$$$$$priority-$(1) $(2)/etc/modules-boot.d/; \
 			fi; \
@@ -129,6 +131,7 @@ define ModuleAutoLoad
 	}; \
 	$(3) \
 	if [ -n "$$$$$$$$modules" ]; then \
+		modules="$$$$$$$$(echo "$$$$$$$$modules" | tr ' ' '\n' | sort | uniq | paste -s -d' ' -)"; \
 		mkdir -p $(2)/etc/modules.d; \
 		mkdir -p $(2)/CONTROL; \
 		echo "#!/bin/sh" > $(2)/CONTROL/postinst-pkg; \

+ 2 - 0
include/site/darwin

@@ -0,0 +1,2 @@
+ac_cv_func_futimens=no
+ac_cv_func_utimensat=no

+ 2 - 2
include/target.mk

@@ -13,11 +13,11 @@ __target_inc=1
 DEVICE_TYPE?=router
 
 # Default packages - the really basic set
-DEFAULT_PACKAGES:=base-files libc libgcc busybox dropbear mtd uci opkg netifd fstools uclient-fetch logd
+DEFAULT_PACKAGES:=base-files ca-bundle libmbedtls libustream-mbedtls libc libgcc busybox dropbear mtd uci opkg netifd fstools uclient-fetch logd
 # For nas targets
 DEFAULT_PACKAGES.nas:=block-mount fdisk lsblk mdadm
 # For router targets
-DEFAULT_PACKAGES.router:=dnsmasq iptables ip6tables ppp ppp-mod-pppoe firewall odhcpd odhcp6c
+DEFAULT_PACKAGES.router:=dnsmasq iptables ip6tables ppp ppp-mod-pppoe ppp-mod-pppoa firewall odhcpd odhcp6c
 DEFAULT_PACKAGES.bootloader:=
 
 ifneq ($(DUMP),)

+ 1 - 1
include/version.mk

@@ -31,7 +31,7 @@ qstrip_escape=$(subst ','\'',$(call qstrip,$(1)))
 sanitize = $(call tolower,$(subst _,-,$(subst $(space),-,$(1))))
 
 VERSION_NUMBER:=$(call qstrip_escape,$(CONFIG_VERSION_NUMBER))
-VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),v1.4.1)
+VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),v1.4.2)
 
 VERSION_CODE:=$(call qstrip_escape,$(CONFIG_VERSION_CODE))
 VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),$(REVISION))

+ 1 - 1
package/base-files/files/lib/functions.sh

@@ -240,7 +240,7 @@ default_postinst() {
 		[ -d /tmp/.uci ] || mkdir -p /tmp/.uci
 		for i in $(sed -ne 's!^/etc/uci-defaults/!!p' "/usr/lib/opkg/info/${pkgname}.list"); do (
 			cd /etc/uci-defaults
-			[ -f "$i" ] && . "$i" && rm -f "$i"
+			[ -f "$i" ] && . ./"$i" && rm -f "$i"
 		) done
 		uci commit
 	fi

+ 0 - 62
package/boot/apex/Makefile

@@ -1,62 +0,0 @@
-#
-# Copyright (C) 2006-2011 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-include $(TOPDIR)/rules.mk
-include $(INCLUDE_DIR)/kernel.mk
-
-PKG_NAME:=apex
-PKG_VERSION:=1.6.9
-PKG_RELEASE:=1
-
-PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
-PKG_SOURCE_URL:=http://downloads.openwrt.org/sources/
-PKG_HASH:=1d2bc04c2c6bb3d2d6c1916b6dc559cda2b1ecb045d7801fd49af6af4234abeb
-PKG_TARGETS:=bin
-
-include $(INCLUDE_DIR)/package.mk
-
-export GCC_HONOUR_COPTS=s
-
-define Package/apex
-  SECTION:=boot
-  CATEGORY:=Boot Loaders
-  DEPENDS:=@TARGET_ixp4xx
-  DEFAULT:=y
-  TITLE:=Boot loader for NSLU2, FSG3, NAS100D and others
-  URL:=http://wiki.buici.com/wiki/Apex_Bootloader
-endef
-
-define build_apex
-	$(MAKE) -C $(PKG_BUILD_DIR) \
-		ARCH=arm \
-		$(1)_config
-	$(MAKE) -C $(PKG_BUILD_DIR) \
-		$(TARGET_CONFIGURE_OPTS) \
-		KBUILD_HAVE_NLS=no \
-		ARCH=arm \
-		clean all
-	$(INSTALL_BIN) $(PKG_BUILD_DIR)/apex.bin $(PKG_BUILD_DIR)/out/apex-$(2).bin
-endef
-
-define Build/Compile
-	$(INSTALL_DIR) $(PKG_BUILD_DIR)/out
-	$(call build_apex,slugos-nslu2-armeb,nslu2-armeb)
-	$(call build_apex,slugos-nslu2-16mb-armeb,nslu2-16mb-armeb)
-	$(call build_apex,slugos-fsg3-armeb,fsg3-armeb)
-	$(call build_apex,slugos-nas100d-armeb,nas100d-armeb)
-endef
-
-define Package/apex/install
-	$(INSTALL_DIR) $(STAGING_DIR)/apex
-	$(CP) $(PKG_BUILD_DIR)/out/*.bin $(1)/
-endef
-
-define Build/InstallDev
-	$(CP) $(PKG_BUILD_DIR)/out/*.bin $(KERNEL_BUILD_DIR)
-endef
-
-$(eval $(call BuildPackage,apex))

+ 0 - 20
package/boot/apex/patches/001-compile_fix.patch

@@ -1,20 +0,0 @@
---- a/Makefile
-+++ b/Makefile
-@@ -444,7 +444,7 @@ ifeq ($(config-targets),1)
- include $(srctree)/src/arch-$(SRCARCH)/Makefile
- export KBUILD_DEFCONFIG
- 
--config %config: scripts_basic outputmakefile FORCE
-+%config: scripts_basic outputmakefile FORCE
- 	$(Q)mkdir -p include/linux include/config
- 	$(Q)$(MAKE) $(build)=scripts/kconfig $@
- 
-@@ -1585,7 +1585,7 @@ endif
- 	$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
- 
- # Modules
--/ %/: prepare scripts FORCE
-+%/: prepare scripts FORCE
- 	$(cmd_crmodverdir)
- 	$(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \
- 	$(build)=$(build-dir)

+ 0 - 23
package/boot/apex/patches/100-openwrt_nslu2_armeb_config.patch

@@ -1,23 +0,0 @@
---- a/src/mach-ixp42x/slugos-nslu2-armeb_config
-+++ b/src/mach-ixp42x/slugos-nslu2-armeb_config
-@@ -19,7 +19,7 @@ CONFIG_EXPERIMENTAL=y
- #
- # General Setup
- #
--CONFIG_TARGET_DESCRIPTION="SlugOS NSLU2 (bigendian)"
-+CONFIG_TARGET_DESCRIPTION="OpenWrt NSLU2 (8MiB Flash)"
- CONFIG_CROSS_COMPILE=""
- CONFIG_AEABI=y
- # CONFIG_DRIVER_LONG_LONG_SIZE is not set
-@@ -163,9 +163,9 @@ CONFIG_ENV_REGION_KERNEL_ALT="fis://kern
- # Overrides
- #
- CONFIG_ENV_DEFAULT_CMDLINE_OVERRIDE=y
--CONFIG_ENV_DEFAULT_CMDLINE="root=/dev/mtdblock4 rootfstype=jffs2 console=ttyS0,115200 init=/linuxrc"
-+CONFIG_ENV_DEFAULT_CMDLINE="root=/dev/mtdblock4 rootfstype=squashfs,jffs2 console=ttyS0,115200 init=/etc/preinit noinitrd"
- CONFIG_ENV_DEFAULT_CMDLINE_ALT_P=y
--CONFIG_ENV_DEFAULT_CMDLINE_ALT="root=/dev/mtdblock4 rootfstype=jffs2 console=ttyS0,115200 init=/linuxrc"
-+CONFIG_ENV_DEFAULT_CMDLINE_ALT="root=/dev/mtdblock4 rootfstype=squashfs,jffs2 console=ttyS0,115200 init=/etc/preinit noinitrd"
- # CONFIG_ENV_DEFAULT_STARTUP_OVERRIDE is not set
- # CONFIG_ENV_DEFAULT_STARTUP_ALT_P is not set
- CONFIG_USES_NOR_BOOTFLASH=y

+ 0 - 23
package/boot/apex/patches/120-openwrt_nslu2_16mb_armeb_config.patch

@@ -1,23 +0,0 @@
---- a/src/mach-ixp42x/slugos-nslu2-16mb-armeb_config
-+++ b/src/mach-ixp42x/slugos-nslu2-16mb-armeb_config
-@@ -19,7 +19,7 @@ CONFIG_EXPERIMENTAL=y
- #
- # General Setup
- #
--CONFIG_TARGET_DESCRIPTION="SlugOS NSLU2/BE (16MiB Flash)"
-+CONFIG_TARGET_DESCRIPTION="OpenWrt NSLU2 (16MiB Flash)"
- CONFIG_CROSS_COMPILE=""
- CONFIG_AEABI=y
- # CONFIG_DRIVER_LONG_LONG_SIZE is not set
-@@ -163,9 +163,9 @@ CONFIG_ENV_REGION_KERNEL_ALT="fis://kern
- # Overrides
- #
- CONFIG_ENV_DEFAULT_CMDLINE_OVERRIDE=y
--CONFIG_ENV_DEFAULT_CMDLINE="root=/dev/mtdblock4 rootfstype=jffs2 console=ttyS0,115200 init=/linuxrc"
-+CONFIG_ENV_DEFAULT_CMDLINE="root=/dev/mtdblock4 rootfstype=squashfs,jffs2 console=ttyS0,115200 init=/etc/preinit noinitrd"
- CONFIG_ENV_DEFAULT_CMDLINE_ALT_P=y
--CONFIG_ENV_DEFAULT_CMDLINE_ALT="root=/dev/mtdblock4 rootfstype=jffs2 console=ttyS0,115200 init=/linuxrc"
-+CONFIG_ENV_DEFAULT_CMDLINE_ALT="root=/dev/mtdblock4 rootfstype=squashfs,jffs2 console=ttyS0,115200 init=/etc/preinit noinitrd"
- # CONFIG_ENV_DEFAULT_STARTUP_OVERRIDE is not set
- # CONFIG_ENV_DEFAULT_STARTUP_ALT_P is not set
- CONFIG_USES_NOR_BOOTFLASH=y

+ 0 - 23
package/boot/apex/patches/140-openwrt_fsg3_armeb_config.patch

@@ -1,23 +0,0 @@
---- a/src/mach-ixp42x/slugos-fsg3-armeb_config
-+++ b/src/mach-ixp42x/slugos-fsg3-armeb_config
-@@ -17,7 +17,7 @@ CONFIG_EXPERIMENTAL=y
- #
- # General Setup
- #
--CONFIG_TARGET_DESCRIPTION="SlugOS FSG3/BE"
-+CONFIG_TARGET_DESCRIPTION="OpenWrt FSG3"
- CONFIG_CROSS_COMPILE=""
- CONFIG_AEABI=y
- CONFIG_CC_OPTIMIZE_FOR_SIZE=y
-@@ -148,9 +148,9 @@ CONFIG_ENV_REGION_KERNEL_ALT="fis://kern
- #    Overrides
- #
- CONFIG_ENV_DEFAULT_CMDLINE_OVERRIDE=y
--CONFIG_ENV_DEFAULT_CMDLINE="root=/dev/sda1 rootdelay=10 console=ttyS0,115200"
-+CONFIG_ENV_DEFAULT_CMDLINE="root=/dev/sda1 rootdelay=10 console=ttyS0,115200 init=/etc/preinit noinitrd"
- CONFIG_ENV_DEFAULT_CMDLINE_ALT_P=y
--CONFIG_ENV_DEFAULT_CMDLINE_ALT="root=/dev/sda2 rootdelay=10 console=ttyS0,115200"
-+CONFIG_ENV_DEFAULT_CMDLINE_ALT="root=/dev/mtdblock2 rootfstype=squashfs console=ttyS0,115200 init=/etc/preinit noinitrd"
- # CONFIG_ENV_DEFAULT_STARTUP_OVERRIDE is not set
- # CONFIG_ENV_DEFAULT_STARTUP_ALT_P is not set
- CONFIG_USES_NOR_BOOTFLASH=y

+ 0 - 22
package/boot/apex/patches/150-limit_ram_to_64mb.patch

@@ -1,22 +0,0 @@
---- a/src/mach-ixp42x/slugos-nslu2-armeb_config
-+++ b/src/mach-ixp42x/slugos-nslu2-armeb_config
-@@ -137,7 +137,7 @@ CONFIG_AUTOBOOT_DELAY=10
- CONFIG_ENV_STARTUP_KERNEL_COPY=y
- # CONFIG_ENV_REGION_KERNEL_SWAP is not set
- CONFIG_ENV_STARTUP_PREFIX_P=y
--CONFIG_ENV_STARTUP_PREFIX="sdram-init; memscan -u 0+256m"
-+CONFIG_ENV_STARTUP_PREFIX="sdram-init; memscan -u 0+64m"
- 
- #
- #    Regions
---- a/src/mach-ixp42x/slugos-nslu2-16mb-armeb_config
-+++ b/src/mach-ixp42x/slugos-nslu2-16mb-armeb_config
-@@ -137,7 +137,7 @@ CONFIG_AUTOBOOT_DELAY=10
- CONFIG_ENV_STARTUP_KERNEL_COPY=y
- # CONFIG_ENV_REGION_KERNEL_SWAP is not set
- CONFIG_ENV_STARTUP_PREFIX_P=y
--CONFIG_ENV_STARTUP_PREFIX="sdram-init; memscan -u 0+256m"
-+CONFIG_ENV_STARTUP_PREFIX="sdram-init; memscan -u 0+64m"
- 
- #
- #    Regions

+ 0 - 20
package/boot/apex/patches/160-openwrt_nas100d_armeb_config.patch

@@ -1,20 +0,0 @@
---- a/src/mach-ixp42x/slugos-nas100d-armeb_config
-+++ b/src/mach-ixp42x/slugos-nas100d-armeb_config
-@@ -19,7 +19,7 @@ CONFIG_EXPERIMENTAL=y
- #
- # General Setup
- #
--CONFIG_TARGET_DESCRIPTION="SlugOS NAS100D/BE"
-+CONFIG_TARGET_DESCRIPTION="OpenWrt NAS100D"
- CONFIG_CROSS_COMPILE=""
- CONFIG_AEABI=y
- # CONFIG_DRIVER_LONG_LONG_SIZE is not set
-@@ -158,7 +158,7 @@ CONFIG_ENV_REGION_KERNEL="fis://kernel"
- # Overrides
- #
- CONFIG_ENV_DEFAULT_CMDLINE_OVERRIDE=y
--CONFIG_ENV_DEFAULT_CMDLINE="root=/dev/mtdblock2 rootfstype=jffs2 console=ttyS0,115200 init=/linuxrc"
-+CONFIG_ENV_DEFAULT_CMDLINE="root=/dev/mtdblock2 rootfstype=squashfs,jffs2 console=ttyS0,115200 init=/etc/preinit noinitrd"
- # CONFIG_ENV_DEFAULT_STARTUP_OVERRIDE is not set
- CONFIG_USES_NOR_BOOTFLASH=y
- CONFIG_RELOCATE_SIMPLE=y

+ 0 - 46
package/boot/fconfig/Makefile

@@ -1,46 +0,0 @@
-#
-# Copyright (C) 2006-2008 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-include $(TOPDIR)/rules.mk
-
-PKG_NAME:=fconfig
-PKG_VERSION:=20080329
-PKG_RELEASE:=1
-
-PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
-PKG_SOURCE_URL:=http://andrzejekiert.ovh.org/software/fconfig/
-PKG_HASH:=4ff0e8f07e35e46b705c0dbe9d9544ede01ea092a69e3f7db03e55a3f2bb8eb7
-
-PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
-
-include $(INCLUDE_DIR)/package.mk
-
-define Package/fconfig
-  SECTION:=utils
-  CATEGORY:=Utilities
-  SUBMENU:=Boot Loaders
-  TITLE:=RedBoot configuration editor
-  URL:=http://andrzejekiert.ovh.org/software.html.en
-endef
-
-define Package/fconfig/description
-	displays and (if writable) also edits the RedBoot configuration.
-endef
-
-define Build/Configure
-endef
-
-define Build/Compile
-	$(call Build/Compile/Default)
-endef
-
-define Package/fconfig/install
-	$(INSTALL_DIR) $(1)/usr/sbin
-	$(INSTALL_BIN) $(PKG_BUILD_DIR)/fconfig $(1)/usr/sbin/
-endef
-
-$(eval $(call BuildPackage,fconfig))

+ 0 - 46
package/boot/kobs-ng/Makefile

@@ -1,46 +0,0 @@
-#
-# Copyright (C) 2013-2014 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-include $(TOPDIR)/rules.mk
-
-PKG_NAME:=kobs-ng
-PKG_VERSION:=5.4
-PKG_RELEASE:=1
-
-PKG_SOURCE:=imx-kobs-$(PKG_VERSION).tar.gz
-PKG_SOURCE_URL:=http://www.freescale.com/lgfiles/NMG/MAD/YOCTO/
-PKG_HASH:=85171b46068ac47c42fedb8104167bf9afd33dd9527ed127e1ca2eb29d7a86bf
-PKG_BUILD_DIR:=$(BUILD_DIR)/imx-kobs-$(PKG_VERSION)
-
-PKG_LICENSE:=GPLv2
-PKG_LICENSE_FILES:=COPYING
-
-include $(INCLUDE_DIR)/package.mk
-
-define Package/kobs-ng
-  SECTION:=utils
-  CATEGORY:=Utilities
-  TITLE:=Application for writing bootstreams to NAND flash
-  DEPENDS:=@TARGET_imx6
-endef
-
-define Package/kobs-ng/description
- The kobs-ng application writes a bootstream to NAND flash with the proper
- FCB/DBBT headers and replicated streams.
-endef
-
-define Build/Prepare
-	$(call Build/Prepare/Default)
-	echo "const char* git_sha = \"$(PKG_VERSION)\";" > $(PKG_BUILD_DIR)/autoversion.h
-endef
-
-define Package/kobs-ng/install
-	$(INSTALL_DIR) $(1)/usr/sbin
-	$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/kobs-ng $(1)/usr/sbin/
-endef
-
-$(eval $(call BuildPackage,kobs-ng))

+ 0 - 23
package/boot/kobs-ng/patches/001-compile.patch

@@ -1,23 +0,0 @@
---- a/src/mtd.c
-+++ b/src/mtd.c
-@@ -28,6 +28,7 @@
- #include <unistd.h>
- #include <stdlib.h>
- #include <string.h>
-+#include <stddef.h>
- #include <fcntl.h>
- #include <ctype.h>
- #include <errno.h>
---- a/src/mtd.h
-+++ b/src/mtd.h
-@@ -25,8 +25,10 @@
- #ifndef MTD_H
- #define MTD_H
- 
-+#define _GNU_SOURCE
- #include <mtd/mtd-user.h>
- #include <endian.h>
-+#include <fcntl.h>
- 
- #include "BootControlBlocks.h"
- #include "rom_nand_hamming_code_ecc.h"

+ 0 - 45
package/boot/kobs-ng/patches/002-add-init-size-param.patch

@@ -1,45 +0,0 @@
-Add --chip_0_size param to override the size of the mtd partition which is
-required if the SPL does not occupy the entire partition. For Gateworks
-Ventana boards the 'uboot' partition contains both the SPL and uboot.
---- a/src/main.c
-+++ b/src/main.c
-@@ -94,6 +94,7 @@ void usage(void)
- 	"  [KOBS] boot structures config options\n"
- 	"    --chip_0_device_path=<path> .......... Device of boot (default /dev/mtd0)\n"
- 	"    --chip_1_device_path=<path> .......... The second chip in case of multichip NAND\n"
-+	"    --chip_0_size=<size> ................. Override size of chip_0 device\n"
- 	"    --search_exponent=<value> ............ NCB field (default 2)\n"
- 	"    --data_setup_time=<value> ............ NCB field (default 80)\n"
- 	"    --data_hold_time=<value> ............. NCB field (default 60)\n"
---- a/src/mtd.c
-+++ b/src/mtd.c
-@@ -876,6 +876,11 @@ struct mtd_data *mtd_open(const struct m
- 			goto out;
- 		}
- 
-+		/* override MTD size */
-+		if (md->cfg.chip_0_size) {
-+			miu->size = md->cfg.chip_0_size;
-+		}
-+
- 		/* verify it's a nand */
- 		if (miu->type != MTD_NANDFLASH
- 			&& miu->type != MTD_MLCNANDFLASH) {
-@@ -3385,7 +3390,7 @@ static const struct {
- } mtd_int_args[] = {
- 	ARG_IGNORE(chip_count),
- 	ARG_IGNORE(chip_0_offset),
--	ARG_IGNORE(chip_0_size),
-+	ARG(chip_0_size),
- 	ARG_IGNORE(chip_1_offset),
- 	ARG_IGNORE(chip_1_size),
- 	ARG(search_exponent),
-@@ -3578,7 +3583,7 @@ void mtd_cfg_dump(struct mtd_config *cfg
- //	Pd(chip_count);
- 	Ps(chip_0_device_path);
- //	Pd(chip_0_offset);
--//	Pd(chip_0_size);
-+	Pd(chip_0_size);
- 	Ps(chip_1_device_path);
- //	Pd(chip_1_offset);
- //	Pd(chip_1_size);

+ 0 - 45
package/boot/kobs-ng/patches/003-raw-mode.patch

@@ -1,45 +0,0 @@
-The downstream Freescale vendor kernel has a patch that allows determining
-if raw NAND flash mode is provided via a debugfs file. This is not present
-in upstream kernels, but the raw access support was added in the 3.19
-kernel, so we will check the kernel version if we can't find the file.
---- a/src/mtd.c
-+++ b/src/mtd.c
-@@ -34,6 +34,7 @@
- #include <errno.h>
- #include <sys/types.h>
- #include <sys/ioctl.h>
-+#include <sys/utsname.h>
- 
- #include "mtd.h"
- #include "rand.h"
-@@ -808,15 +809,27 @@ struct mtd_data *mtd_open(const struct m
- 	md->cfg = *cfg;
- 
- 	/* check if use new raw access mode */
-+	/* by looking for debugfs from fsl patch */
-+	md->raw_mode_flag = 0;
- 	fp = fopen("/sys/kernel/debug/gpmi-nand/raw_mode", "r");
- 	if (!fp) {
--		md->raw_mode_flag = 0;
--		vp(md, "mtd: use legacy raw access mode\n");
-+		/* fallback to kernel version: raw access added in 3.19 */
-+		struct utsname uts;
-+		if (!uname(&uts)) {
-+			int major = 0, minor = 0;
-+			sscanf(uts.release, "%d.%d", &major, &minor);
-+			vp(md, "mtd: Linux %d.%d\n", major, minor);
-+			if ((major << 8 | minor) > (3 << 8 | 18))
-+				md->raw_mode_flag = 1;
-+		}
- 	} else {
- 		fclose(fp);
- 		md->raw_mode_flag = 1;
--		vp(md, "mtd: use new bch layout raw access mode\n");
- 	}
-+	if (md->raw_mode_flag)
-+		vp(md, "mtd: use new bch layout raw access mode\n");
-+	else
-+		vp(md, "mtd: use legacy raw access mode\n");
- 
- 	if (plat_config_data->m_u32UseMultiBootArea) {
- 

+ 0 - 27
package/boot/kobs-ng/patches/004-fix-cal_nfc_geometry.patch

@@ -1,27 +0,0 @@
-The Freescale downstream vendor kernel has a patch that exports the bch
-flash geometry via a debugfs file. This is not available in mainline linux
-kernels so the fallback method calculates the geometry based on known info
-from the mtd partition. A bug exists in this funcion where it fails to
-assume that block0 ECC is the same as the other blocks by default.
---- a/src/mtd.c
-+++ b/src/mtd.c
-@@ -610,7 +610,7 @@ static int cal_nfc_geometry(struct mtd_d
- 	/* The two are fixed, please change them when the driver changes. */
- 	geo->metadata_size_in_bytes = 10;
- 	geo->gf_len = 13;
--	geo->ecc_chunkn_size_in_bytes = 512;
-+	geo->ecc_chunkn_size_in_bytes = geo->ecc_chunk0_size_in_bytes = 512;
- 
- 	if (mtd->oobsize > geo->ecc_chunkn_size_in_bytes) {
- 		geo->gf_len = 14;
-@@ -700,8 +700,9 @@ int parse_nfc_geometry(struct mtd_data *
- 	unsigned int       value;
- 
- 	if (!plat_config_data->m_u32UseNfcGeo) {
-+		/* fsl kernel patch provides bch_geometry via debugfs */
- 		if (!(node = fopen(dbg_geometry_node_path, "r"))) {
--			fprintf(stderr, "Cannot open BCH geometry node: \"%s\"",
-+			fprintf(stderr, "Cannot open BCH geometry node: \"%s\"\n",
- 				dbg_geometry_node_path);
- 			return cal_nfc_geometry(md);
- 		}

+ 0 - 47
package/boot/rbcfg/Makefile

@@ -1,47 +0,0 @@
-#
-# Copyright (C) 2010 Gabor Juhos <juhosg@openwrt.org>
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-include $(TOPDIR)/rules.mk
-
-PKG_NAME:=rbcfg
-PKG_RELEASE:=1
-
-PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
-
-PKG_FLAGS:=nonshared
-
-include $(INCLUDE_DIR)/package.mk
-
-define Package/rbcfg
-  SECTION:=utils
-  CATEGORY:=Utilities
-  SUBMENU:=Boot Loaders
-  TITLE:=RouterBOOT configuration tool
-  DEPENDS:=@TARGET_ar71xx
-endef
-
-define Package/rbcfg/description
- This package contains an utility to manipulate RouterBOOT configuration on the
- MikroTIK RB-4XX devices.
-endef
-
-define Build/Configure
-endef
-
-define Build/Compile
-	$(MAKE) -C $(PKG_BUILD_DIR) \
-		CC="$(TARGET_CC)" \
-		CFLAGS="$(TARGET_CFLAGS) -Wall" \
-		LDFLAGS="$(TARGET_LDFLAGS)"
-endef
-
-define Package/rbcfg/install
-	$(INSTALL_DIR) $(1)/usr/sbin
-	$(INSTALL_BIN) $(PKG_BUILD_DIR)/rbcfg $(1)/usr/sbin/
-endef
-
-$(eval $(call BuildPackage,rbcfg))

+ 0 - 14
package/boot/rbcfg/src/Makefile

@@ -1,14 +0,0 @@
-CC = gcc
-CFLAGS = -Wall
-OBJS = main.o cyg_crc32.o
-
-all: rbcfg
-
-%.o: %.c
-	$(CC) $(CFLAGS) -c -o $@ $<
-
-rbcfg: $(OBJS)
-	$(CC) -o $@ $(OBJS)
-
-clean:
-	rm -f rbcfg *.o

+ 0 - 109
package/boot/rbcfg/src/cyg_crc.h

@@ -1,109 +0,0 @@
-//==========================================================================
-//
-//      crc.h
-//
-//      Interface for the CRC algorithms.
-//
-//==========================================================================
-//####ECOSGPLCOPYRIGHTBEGIN####
-// -------------------------------------------
-// This file is part of eCos, the Embedded Configurable Operating System.
-// Copyright (C) 2002 Andrew Lunn
-//
-// eCos is free software; you can redistribute it and/or modify it under
-// the terms of the GNU General Public License as published by the Free
-// Software Foundation; either version 2 or (at your option) any later version.
-//
-// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or
-// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-// for more details.
-//
-// You should have received a copy of the GNU General Public License along
-// with eCos; if not, write to the Free Software Foundation, Inc.,
-// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
-//
-// As a special exception, if other files instantiate templates or use macros
-// or inline functions from this file, or you compile this file and link it
-// with other works to produce a work based on this file, this file does not
-// by itself cause the resulting work to be covered by the GNU General Public
-// License. However the source code for this file must still be made available
-// in accordance with section (3) of the GNU General Public License.
-//
-// This exception does not invalidate any other reasons why a work based on
-// this file might be covered by the GNU General Public License.
-//
-// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
-// at http://sources.redhat.com/ecos/ecos-license/
-// -------------------------------------------
-//####ECOSGPLCOPYRIGHTEND####
-//==========================================================================
-//#####DESCRIPTIONBEGIN####
-//
-// Author(s):    Andrew Lunn
-// Contributors: Andrew Lunn
-// Date:         2002-08-06
-// Purpose:
-// Description:
-//
-// This code is part of eCos (tm).
-//
-//####DESCRIPTIONEND####
-//
-//==========================================================================
-
-#ifndef _SERVICES_CRC_CRC_H_
-#define _SERVICES_CRC_CRC_H_
-
-#if 0
-#include <cyg/infra/cyg_type.h>
-#else
-#include <stdint.h>
-typedef uint32_t cyg_uint32;
-typedef uint16_t cyg_uint16;
-#endif
-
-#ifndef __externC
-# ifdef __cplusplus
-#  define __externC extern "C"
-# else
-#  define __externC extern
-# endif
-#endif
-
-// Compute a CRC, using the POSIX 1003 definition
-
-__externC cyg_uint32
-cyg_posix_crc32(unsigned char *s, int len);
-
-// Gary S. Brown's 32 bit CRC
-
-__externC cyg_uint32
-cyg_crc32(unsigned char *s, int len);
-
-// Gary S. Brown's 32 bit CRC, but accumulate the result from a
-// previous CRC calculation
-
-__externC cyg_uint32
-cyg_crc32_accumulate(cyg_uint32 crc, unsigned char *s, int len);
-
-// Ethernet FCS Algorithm
-
-__externC cyg_uint32
-cyg_ether_crc32(unsigned char *s, int len);
-
-// Ethernet FCS algorithm, but accumulate the result from a previous
-// CRC calculation.
-
-__externC cyg_uint32
-cyg_ether_crc32_accumulate(cyg_uint32 crc, unsigned char *s, int len);
-
-// 16 bit CRC with polynomial x^16+x^12+x^5+1
-
-__externC cyg_uint16
-cyg_crc16(unsigned char *s, int len);
-
-#endif // _SERVICES_CRC_CRC_H_
-
-
-

+ 0 - 172
package/boot/rbcfg/src/cyg_crc32.c

@@ -1,172 +0,0 @@
-//==========================================================================
-//
-//      crc32.c
-//
-//      Gary S. Brown's 32 bit CRC
-//
-//==========================================================================
-//####ECOSGPLCOPYRIGHTBEGIN####
-// -------------------------------------------
-// This file is part of eCos, the Embedded Configurable Operating System.
-// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
-// Copyright (C) 2002 Gary Thomas
-//
-// eCos is free software; you can redistribute it and/or modify it under
-// the terms of the GNU General Public License as published by the Free
-// Software Foundation; either version 2 or (at your option) any later version.
-//
-// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or
-// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-// for more details.
-//
-// You should have received a copy of the GNU General Public License along
-// with eCos; if not, write to the Free Software Foundation, Inc.,
-// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
-//
-// As a special exception, if other files instantiate templates or use macros
-// or inline functions from this file, or you compile this file and link it
-// with other works to produce a work based on this file, this file does not
-// by itself cause the resulting work to be covered by the GNU General Public
-// License. However the source code for this file must still be made available
-// in accordance with section (3) of the GNU General Public License.
-//
-// This exception does not invalidate any other reasons why a work based on
-// this file might be covered by the GNU General Public License.
-//
-// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
-// at http://sources.redhat.com/ecos/ecos-license/
-// -------------------------------------------
-//####ECOSGPLCOPYRIGHTEND####
-//==========================================================================
-//#####DESCRIPTIONBEGIN####
-//
-// Author(s):    gthomas
-// Contributors: gthomas,asl
-// Date:         2001-01-31
-// Purpose:      
-// Description:  
-//              
-// This code is part of eCos (tm).
-//
-//####DESCRIPTIONEND####
-//
-//==========================================================================
-
-#if 0
-#include <cyg/crc/crc.h>
-#else
-#include "cyg_crc.h"
-#endif
-
-  /* ====================================================================== */
-  /*  COPYRIGHT (C) 1986 Gary S. Brown.  You may use this program, or       */
-  /*  code or tables extracted from it, as desired without restriction.     */
-  /*                                                                        */
-  /*  First, the polynomial itself and its table of feedback terms.  The    */
-  /*  polynomial is                                                         */
-  /*  X^32+X^26+X^23+X^22+X^16+X^12+X^11+X^10+X^8+X^7+X^5+X^4+X^2+X^1+X^0   */
-  /*                                                                        */
-  /* ====================================================================== */
-
-static const cyg_uint32 crc32_tab[] = {
-      0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL, 0x076dc419L,
-      0x706af48fL, 0xe963a535L, 0x9e6495a3L, 0x0edb8832L, 0x79dcb8a4L,
-      0xe0d5e91eL, 0x97d2d988L, 0x09b64c2bL, 0x7eb17cbdL, 0xe7b82d07L,
-      0x90bf1d91L, 0x1db71064L, 0x6ab020f2L, 0xf3b97148L, 0x84be41deL,
-      0x1adad47dL, 0x6ddde4ebL, 0xf4d4b551L, 0x83d385c7L, 0x136c9856L,
-      0x646ba8c0L, 0xfd62f97aL, 0x8a65c9ecL, 0x14015c4fL, 0x63066cd9L,
-      0xfa0f3d63L, 0x8d080df5L, 0x3b6e20c8L, 0x4c69105eL, 0xd56041e4L,
-      0xa2677172L, 0x3c03e4d1L, 0x4b04d447L, 0xd20d85fdL, 0xa50ab56bL,
-      0x35b5a8faL, 0x42b2986cL, 0xdbbbc9d6L, 0xacbcf940L, 0x32d86ce3L,
-      0x45df5c75L, 0xdcd60dcfL, 0xabd13d59L, 0x26d930acL, 0x51de003aL,
-      0xc8d75180L, 0xbfd06116L, 0x21b4f4b5L, 0x56b3c423L, 0xcfba9599L,
-      0xb8bda50fL, 0x2802b89eL, 0x5f058808L, 0xc60cd9b2L, 0xb10be924L,
-      0x2f6f7c87L, 0x58684c11L, 0xc1611dabL, 0xb6662d3dL, 0x76dc4190L,
-      0x01db7106L, 0x98d220bcL, 0xefd5102aL, 0x71b18589L, 0x06b6b51fL,
-      0x9fbfe4a5L, 0xe8b8d433L, 0x7807c9a2L, 0x0f00f934L, 0x9609a88eL,
-      0xe10e9818L, 0x7f6a0dbbL, 0x086d3d2dL, 0x91646c97L, 0xe6635c01L,
-      0x6b6b51f4L, 0x1c6c6162L, 0x856530d8L, 0xf262004eL, 0x6c0695edL,
-      0x1b01a57bL, 0x8208f4c1L, 0xf50fc457L, 0x65b0d9c6L, 0x12b7e950L,
-      0x8bbeb8eaL, 0xfcb9887cL, 0x62dd1ddfL, 0x15da2d49L, 0x8cd37cf3L,
-      0xfbd44c65L, 0x4db26158L, 0x3ab551ceL, 0xa3bc0074L, 0xd4bb30e2L,
-      0x4adfa541L, 0x3dd895d7L, 0xa4d1c46dL, 0xd3d6f4fbL, 0x4369e96aL,
-      0x346ed9fcL, 0xad678846L, 0xda60b8d0L, 0x44042d73L, 0x33031de5L,
-      0xaa0a4c5fL, 0xdd0d7cc9L, 0x5005713cL, 0x270241aaL, 0xbe0b1010L,
-      0xc90c2086L, 0x5768b525L, 0x206f85b3L, 0xb966d409L, 0xce61e49fL,
-      0x5edef90eL, 0x29d9c998L, 0xb0d09822L, 0xc7d7a8b4L, 0x59b33d17L,
-      0x2eb40d81L, 0xb7bd5c3bL, 0xc0ba6cadL, 0xedb88320L, 0x9abfb3b6L,
-      0x03b6e20cL, 0x74b1d29aL, 0xead54739L, 0x9dd277afL, 0x04db2615L,
-      0x73dc1683L, 0xe3630b12L, 0x94643b84L, 0x0d6d6a3eL, 0x7a6a5aa8L,
-      0xe40ecf0bL, 0x9309ff9dL, 0x0a00ae27L, 0x7d079eb1L, 0xf00f9344L,
-      0x8708a3d2L, 0x1e01f268L, 0x6906c2feL, 0xf762575dL, 0x806567cbL,
-      0x196c3671L, 0x6e6b06e7L, 0xfed41b76L, 0x89d32be0L, 0x10da7a5aL,
-      0x67dd4accL, 0xf9b9df6fL, 0x8ebeeff9L, 0x17b7be43L, 0x60b08ed5L,
-      0xd6d6a3e8L, 0xa1d1937eL, 0x38d8c2c4L, 0x4fdff252L, 0xd1bb67f1L,
-      0xa6bc5767L, 0x3fb506ddL, 0x48b2364bL, 0xd80d2bdaL, 0xaf0a1b4cL,
-      0x36034af6L, 0x41047a60L, 0xdf60efc3L, 0xa867df55L, 0x316e8eefL,
-      0x4669be79L, 0xcb61b38cL, 0xbc66831aL, 0x256fd2a0L, 0x5268e236L,
-      0xcc0c7795L, 0xbb0b4703L, 0x220216b9L, 0x5505262fL, 0xc5ba3bbeL,
-      0xb2bd0b28L, 0x2bb45a92L, 0x5cb36a04L, 0xc2d7ffa7L, 0xb5d0cf31L,
-      0x2cd99e8bL, 0x5bdeae1dL, 0x9b64c2b0L, 0xec63f226L, 0x756aa39cL,
-      0x026d930aL, 0x9c0906a9L, 0xeb0e363fL, 0x72076785L, 0x05005713L,
-      0x95bf4a82L, 0xe2b87a14L, 0x7bb12baeL, 0x0cb61b38L, 0x92d28e9bL,
-      0xe5d5be0dL, 0x7cdcefb7L, 0x0bdbdf21L, 0x86d3d2d4L, 0xf1d4e242L,
-      0x68ddb3f8L, 0x1fda836eL, 0x81be16cdL, 0xf6b9265bL, 0x6fb077e1L,
-      0x18b74777L, 0x88085ae6L, 0xff0f6a70L, 0x66063bcaL, 0x11010b5cL,
-      0x8f659effL, 0xf862ae69L, 0x616bffd3L, 0x166ccf45L, 0xa00ae278L,
-      0xd70dd2eeL, 0x4e048354L, 0x3903b3c2L, 0xa7672661L, 0xd06016f7L,
-      0x4969474dL, 0x3e6e77dbL, 0xaed16a4aL, 0xd9d65adcL, 0x40df0b66L,
-      0x37d83bf0L, 0xa9bcae53L, 0xdebb9ec5L, 0x47b2cf7fL, 0x30b5ffe9L,
-      0xbdbdf21cL, 0xcabac28aL, 0x53b39330L, 0x24b4a3a6L, 0xbad03605L,
-      0xcdd70693L, 0x54de5729L, 0x23d967bfL, 0xb3667a2eL, 0xc4614ab8L,
-      0x5d681b02L, 0x2a6f2b94L, 0xb40bbe37L, 0xc30c8ea1L, 0x5a05df1bL,
-      0x2d02ef8dL
-   };
-
-/* This is the standard Gary S. Brown's 32 bit CRC algorithm, but
-   accumulate the CRC into the result of a previous CRC. */
-cyg_uint32 
-cyg_crc32_accumulate(cyg_uint32 crc32val, unsigned char *s, int len)
-{
-  int i;
-
-  for (i = 0;  i < len;  i++) {
-    crc32val = crc32_tab[(crc32val ^ s[i]) & 0xff] ^ (crc32val >> 8);
-  }
-  return crc32val;
-}
-
-/* This is the standard Gary S. Brown's 32 bit CRC algorithm */
-cyg_uint32
-cyg_crc32(unsigned char *s, int len)
-{
-  return (cyg_crc32_accumulate(0,s,len));
-}
-
-/* Return a 32-bit CRC of the contents of the buffer accumulating the
-   result from a previous CRC calculation. This uses the Ethernet FCS
-   algorithm.*/
-cyg_uint32
-cyg_ether_crc32_accumulate(cyg_uint32 crc32val, unsigned char *s, int len)
-{
-  int i;
-
-  if (s == 0) return 0L;
-  
-  crc32val = crc32val ^ 0xffffffff;
-  for (i = 0;  i < len;  i++) {
-      crc32val = crc32_tab[(crc32val ^ s[i]) & 0xff] ^ (crc32val >> 8);
-  }
-  return crc32val ^ 0xffffffff;
-}
-
-/* Return a 32-bit CRC of the contents of the buffer, using the
-   Ethernet FCS algorithm. */
-cyg_uint32
-cyg_ether_crc32(unsigned char *s, int len)
-{
-  return cyg_ether_crc32_accumulate(0,s,len);
-}
-
-

+ 0 - 791
package/boot/rbcfg/src/main.c

@@ -1,791 +0,0 @@
-/*
- *  RouterBOOT configuration utility
- *
- *  Copyright (C) 2010 Gabor Juhos <juhosg@openwrt.org>
- *
- *  This program is free software; you can redistribute it and/or modify it
- *  under the terms of the GNU General Public License version 2 as published
- *  by the Free Software Foundation.
- *
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <string.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <sys/stat.h>
-#include <linux/limits.h>
-
-#include "rbcfg.h"
-#include "cyg_crc.h"
-
-#define RBCFG_TMP_FILE	"/tmp/.rbcfg"
-#define RBCFG_MTD_NAME	"soft_config"
-
-#define RB_ERR_NOTFOUND		1
-#define RB_ERR_INVALID		2
-#define RB_ERR_NOMEM		3
-#define RB_ERR_IO		4
-
-#define ARRAY_SIZE(_a)	(sizeof((_a)) / sizeof((_a)[0]))
-
-struct rbcfg_ctx {
-	char		*mtd_device;
-	char		*tmp_file;
-	char		*buf;
-	unsigned	buflen;
-};
-
-struct rbcfg_value {
-	const char		*name;
-	const char		*desc;
-	union {
-		uint32_t	u32;
-		const char	*raw;
-	} val;
-};
-
-#define RBCFG_ENV_TYPE_U32	0
-
-struct rbcfg_env {
-	const char			*name;
-	int				type;
-	uint16_t			id;
-	const struct rbcfg_value	*values;
-	int				num_values;
-};
-
-#define CMD_FLAG_USES_CFG	0x01
-
-struct rbcfg_command {
-	const char	*command;
-	const char	*usage;
-	int		flags;
-	int		(*exec)(int argc, const char *argv[]);
-};
-
-static void usage(void);
-
-/* Globals */
-
-static struct rbcfg_ctx *rbcfg_ctx;
-static char *rbcfg_name;
-
-#define CFG_U32(_name, _desc, _val) { 	\
-	.name		= (_name),	\
-	.desc		= (_desc),	\
-	.val.u32	= (_val),	\
-}
-
-static const struct rbcfg_value rbcfg_boot_delay[] = {
-	CFG_U32("1", "1 second", RB_BOOT_DELAY_1SEC),
-	CFG_U32("2", "2 seconds", RB_BOOT_DELAY_2SEC),
-	CFG_U32("3", "3 seconds", RB_BOOT_DELAY_3SEC),
-	CFG_U32("4", "4 seconds", RB_BOOT_DELAY_4SEC),
-	CFG_U32("5", "5 seconds", RB_BOOT_DELAY_5SEC),
-	CFG_U32("6", "6 seconds", RB_BOOT_DELAY_6SEC),
-	CFG_U32("7", "7 seconds", RB_BOOT_DELAY_7SEC),
-	CFG_U32("8", "8 seconds", RB_BOOT_DELAY_8SEC),
-	CFG_U32("9", "9 seconds", RB_BOOT_DELAY_9SEC),
-};
-
-static const struct rbcfg_value rbcfg_boot_device[] = {
-	CFG_U32("eth", "boot over Ethernet",
-		RB_BOOT_DEVICE_ETHER),
-	CFG_U32("nandeth", "boot from NAND, if fail then Ethernet",
-		RB_BOOT_DEVICE_NANDETH),
-	CFG_U32("ethnand", "boot Ethernet once, then NAND",
-		RB_BOOT_DEVICE_ETHONCE),
-	CFG_U32("nand", "boot from NAND only",
-		RB_BOOT_DEVICE_NANDONLY),
-};
-
-static const struct rbcfg_value rbcfg_boot_key[] = {
-	CFG_U32("any", "any key", RB_BOOT_KEY_ANY),
-	CFG_U32("del", "<Delete> key only", RB_BOOT_KEY_DEL),
-};
-
-static const struct rbcfg_value rbcfg_boot_protocol[] = {
-	CFG_U32("bootp", "BOOTP protocol", RB_BOOT_PROTOCOL_BOOTP),
-	CFG_U32("dhcp", "DHCP protocol", RB_BOOT_PROTOCOL_DHCP),
-};
-
-static const struct rbcfg_value rbcfg_uart_speed[] = {
-	CFG_U32("115200", "", RB_UART_SPEED_115200),
-	CFG_U32("57600", "", RB_UART_SPEED_57600),
-	CFG_U32("38400", "", RB_UART_SPEED_38400),
-	CFG_U32("19200", "", RB_UART_SPEED_19200),
-	CFG_U32("9600", "", RB_UART_SPEED_9600),
-	CFG_U32("4800", "", RB_UART_SPEED_4800),
-	CFG_U32("2400", "", RB_UART_SPEED_2400),
-	CFG_U32("1200", "", RB_UART_SPEED_1200),
-	CFG_U32("off", "disable console output", RB_UART_SPEED_OFF),
-};
-
-static const struct rbcfg_value rbcfg_cpu_mode[] = {
-	CFG_U32("powersave", "power save", RB_CPU_MODE_POWERSAVE),
-	CFG_U32("regular", "regular (better for -0c environment)",
-		RB_CPU_MODE_REGULAR),
-};
-
-static const struct rbcfg_value rbcfg_booter[] = {
-	CFG_U32("regular", "load regular booter", RB_BOOTER_REGULAR),
-	CFG_U32("backup", "force backup-booter loading", RB_BOOTER_BACKUP),
-};
-
-static const struct rbcfg_env rbcfg_envs[] = {
-	{
-		.name		= "boot_delay",
-		.id		= RB_ID_BOOT_DELAY,
-		.type		= RBCFG_ENV_TYPE_U32,
-		.values		= rbcfg_boot_delay,
-		.num_values	= ARRAY_SIZE(rbcfg_boot_delay),
-	}, {
-		.name		= "boot_device",
-		.id		= RB_ID_BOOT_DEVICE,
-		.type		= RBCFG_ENV_TYPE_U32,
-		.values		= rbcfg_boot_device,
-		.num_values	= ARRAY_SIZE(rbcfg_boot_device),
-	}, {
-		.name		= "boot_key",
-		.id		= RB_ID_BOOT_KEY,
-		.type		= RBCFG_ENV_TYPE_U32,
-		.values		= rbcfg_boot_key,
-		.num_values	= ARRAY_SIZE(rbcfg_boot_key),
-	}, {
-		.name		= "boot_protocol",
-		.id		= RB_ID_BOOT_PROTOCOL,
-		.type		= RBCFG_ENV_TYPE_U32,
-		.values		= rbcfg_boot_protocol,
-		.num_values	= ARRAY_SIZE(rbcfg_boot_protocol),
-	}, {
-		.name		= "booter",
-		.id		= RB_ID_BOOTER,
-		.type		= RBCFG_ENV_TYPE_U32,
-		.values		= rbcfg_booter,
-		.num_values	= ARRAY_SIZE(rbcfg_booter),
-	}, {
-		.name		= "cpu_mode",
-		.id		= RB_ID_CPU_MODE,
-		.type		= RBCFG_ENV_TYPE_U32,
-		.values		= rbcfg_cpu_mode,
-		.num_values	= ARRAY_SIZE(rbcfg_cpu_mode),
-	}, {
-		.name		= "uart_speed",
-		.id		= RB_ID_UART_SPEED,
-		.type		= RBCFG_ENV_TYPE_U32,
-		.values		= rbcfg_uart_speed,
-		.num_values	= ARRAY_SIZE(rbcfg_uart_speed),
-	}
-};
-
-static inline uint16_t
-get_u16(const void *buf)
-{
-	const uint8_t *p = buf;
-
-	return ((uint16_t) p[1] + ((uint16_t) p[0] << 8));
-}
-
-static inline uint32_t
-get_u32(const void *buf)
-{
-	const uint8_t *p = buf;
-
-	return ((uint32_t) p[3] + ((uint32_t) p[2] << 8) +
-	       ((uint32_t) p[1] << 16) + ((uint32_t) p[0] << 24));
-}
-
-static inline void
-put_u32(void *buf, uint32_t val)
-{
-	uint8_t *p = buf;
-
-	p[3] = val & 0xff;
-	p[2] = (val >> 8) & 0xff;
-	p[1] = (val >> 16) & 0xff;
-	p[0] = (val >> 24) & 0xff;
-}
-
-static int
-rbcfg_find_tag(struct rbcfg_ctx *ctx, uint16_t tag_id, uint16_t *tag_len,
-	       void **tag_data)
-{
-	uint16_t id;
-	uint16_t len;
-	char *buf = ctx->buf;
-	unsigned int buflen = ctx->buflen;
-	int ret = RB_ERR_NOTFOUND;
-
-	/* skip magic and CRC value */
-	buf += 8;
-	buflen -= 8;
-
-	while (buflen > 2) {
-		len = get_u16(buf);
-		buf += 2;
-		buflen -= 2;
-
-		if (buflen < 2)
-			break;
-
-		id = get_u16(buf);
-		buf += 2;
-		buflen -= 2;
-
-		if (id == RB_ID_TERMINATOR)
-			break;
-
-		if (buflen < len)
-			break;
-
-		if (id == tag_id) {
-			*tag_len = len;
-			*tag_data = buf;
-			ret = 0;
-			break;
-		}
-
-		buf += len;
-		buflen -= len;
-	}
-
-	if (ret)
-		fprintf(stderr, "no tag found with id=%u\n", tag_id);
-
-	return ret;
-}
-
-static int
-rbcfg_get_u32(struct rbcfg_ctx *ctx, uint16_t id, uint32_t *val)
-{
-	void *tag_data;
-	uint16_t tag_len;
-	int err;
-
-	err = rbcfg_find_tag(ctx, id, &tag_len, &tag_data);
-	if (err)
-		return err;
-
-	*val = get_u32(tag_data);
-	return 0;
-}
-
-static int
-rbcfg_set_u32(struct rbcfg_ctx *ctx, uint16_t id, uint32_t val)
-{
-	void *tag_data;
-	uint16_t tag_len;
-	int err;
-
-	err = rbcfg_find_tag(ctx, id, &tag_len, &tag_data);
-	if (err)
-		return err;
-
-	put_u32(tag_data, val);
-	return 0;
-}
-
-char *rbcfg_find_mtd(const char *name, int *erase_size)
-{
-	FILE *f;
-	int mtd_num;
-	char dev[PATH_MAX];
-	char *ret = NULL;
-	struct stat s;
-	int err;
-
-	f = fopen("/proc/mtd", "r");
-	if (!f)
-		return NULL;
-
-	while (1) {
-		char *p;
-		p = fgets(dev, sizeof(dev), f);
-		if (!p)
-			break;
-
-		if (!strstr(dev, name))
-			continue;
-
-		err = sscanf(dev, "mtd%d: %08x", &mtd_num, erase_size);
-		if (err != 2)
-			break;
-
-		sprintf(dev, "/dev/mtdblock%d", mtd_num);
-		err = stat(dev, &s);
-		if (err < 0)
-			break;
-
-		if ((s.st_mode & S_IFBLK) == 0)
-			break;
-
-		ret = malloc(strlen(dev) + 1);
-		if (ret == NULL)
-			break;
-
-		strncpy(ret, dev, strlen(dev) + 1);
-		break;
-	}
-
-	fclose(f);
-	return ret;
-}
-
-static int
-rbcfg_check_tmp(struct rbcfg_ctx *ctx)
-{
-	struct stat s;
-	int err;
-
-	err = stat(ctx->tmp_file, &s);
-	if (err < 0)
-		return 0;
-
-	if ((s.st_mode & S_IFREG) == 0)
-		return 0;
-
-	if (s.st_size != ctx->buflen)
-		return 0;
-
-	return 1;
-}
-
-static int
-rbcfg_load(struct rbcfg_ctx *ctx)
-{
-	uint32_t magic;
-	uint32_t crc_orig, crc;
-	char *name;
-	int tmp;
-	int fd;
-	int err;
-
-	tmp = rbcfg_check_tmp(ctx);
-	name = (tmp) ? ctx->tmp_file : ctx->mtd_device;
-
-	fd = open(name, O_RDONLY);
-	if (fd < 0) {
-		fprintf(stderr, "unable to open %s\n", name);
-		err = RB_ERR_IO;
-		goto err;
-	}
-
-	err = read(fd, ctx->buf, ctx->buflen);
-	if (err != ctx->buflen) {
-		fprintf(stderr, "unable to read from %s\n", name);
-		err = RB_ERR_IO;
-		goto err_close;
-	}
-
-	magic = get_u32(ctx->buf);
-	if (magic != RB_MAGIC_SOFT) {
-		fprintf(stderr, "invalid configuration\n");
-		err = RB_ERR_INVALID;
-		goto err_close;
-	}
-
-	crc_orig = get_u32(ctx->buf + 4);
-	put_u32(ctx->buf + 4, 0);
-	crc = cyg_ether_crc32((unsigned char *) ctx->buf, ctx->buflen);
-	if (crc != crc_orig) {
-		fprintf(stderr, "configuration has CRC error\n");
-		err = RB_ERR_INVALID;
-		goto err_close;
-	}
-
-	err = 0;
-
- err_close:
-	close(fd);
- err:
-	return err;
-}
-
-static int
-rbcfg_open()
-{
-	char *mtd_device;
-	struct rbcfg_ctx *ctx;
-	int buflen;
-	int err;
-
-	mtd_device = rbcfg_find_mtd(RBCFG_MTD_NAME, &buflen);
-	if (!mtd_device) {
-		fprintf(stderr, "unable to find configuration\n");
-		return RB_ERR_NOTFOUND;
-	}
-
-	ctx = malloc(sizeof(struct rbcfg_ctx) + buflen);
-	if (ctx == NULL) {
-		err = RB_ERR_NOMEM;
-		goto err_free_mtd;
-	}
-
-	ctx->mtd_device = mtd_device;
-	ctx->tmp_file = RBCFG_TMP_FILE;
-	ctx->buflen = buflen;
-	ctx->buf = (char *) &ctx[1];
-
-	err = rbcfg_load(ctx);
-	if (err)
-		goto err_free_ctx;
-
-	rbcfg_ctx = ctx;
-	return 0;
-
- err_free_ctx:
-	free(ctx);
- err_free_mtd:
-	free(mtd_device);
-	return err;
-}
-
-static int
-rbcfg_update(int tmp)
-{
-	struct rbcfg_ctx *ctx = rbcfg_ctx;
-	char *name;
-	uint32_t crc;
-	int fd;
-	int err;
-
-	put_u32(ctx->buf, RB_MAGIC_SOFT);
-	put_u32(ctx->buf + 4, 0);
-	crc = cyg_ether_crc32((unsigned char *) ctx->buf, ctx->buflen);
-	put_u32(ctx->buf + 4, crc);
-
-	name = (tmp) ? ctx->tmp_file : ctx->mtd_device;
-	fd = open(name, O_WRONLY | O_CREAT);
-	if (fd < 0) {
-		fprintf(stderr, "unable to open %s for writing\n", name);
-		err = RB_ERR_IO;
-		goto out;
-	}
-
-	err = write(fd, ctx->buf, ctx->buflen);
-	if (err != ctx->buflen) {
-		err = RB_ERR_IO;
-		goto out_close;
-	}
-
-	fsync(fd);
-	err = 0;
-
- out_close:
-	close(fd);
- out:
-	return err;
-}
-
-static void
-rbcfg_close(void)
-{
-	struct rbcfg_ctx *ctx;
-
-	ctx = rbcfg_ctx;
-	free(ctx->mtd_device);
-	free(ctx);
-}
-
-static const struct rbcfg_value *
-rbcfg_env_find(const struct rbcfg_env *env, const char *name)
-{
-	unsigned i;
-
-	for (i = 0; i < env->num_values; i++) {
-		const struct rbcfg_value *v = &env->values[i];
-
-		if (strcmp(v->name, name) == 0)
-			return v;
-	}
-
-	return NULL;
-}
-
-static const struct rbcfg_value *
-rbcfg_env_find_u32(const struct rbcfg_env *env, uint32_t val)
-{
-	unsigned i;
-
-	for (i = 0; i < env->num_values; i++) {
-		const struct rbcfg_value *v = &env->values[i];
-
-		if (v->val.u32 == val)
-			return v;
-	}
-
-	return NULL;
-}
-
-static const char *
-rbcfg_env_get_u32(const struct rbcfg_env *env)
-{
-	const struct rbcfg_value *v;
-	uint32_t val;
-	int err;
-
-	err = rbcfg_get_u32(rbcfg_ctx, env->id, &val);
-	if (err)
-		return NULL;
-
-	v = rbcfg_env_find_u32(env, val);
-	if (v == NULL) {
-		fprintf(stderr, "unknown value %08x found for %s\n",
-			val, env->name);
-		return NULL;
-	}
-
-	return v->name;
-}
-
-static int
-rbcfg_env_set_u32(const struct rbcfg_env *env, const char *data)
-{
-	const struct rbcfg_value *v;
-	int err;
-
-	v = rbcfg_env_find(env, data);
-	if (v == NULL) {
-		fprintf(stderr, "invalid value '%s'\n", data);
-		return RB_ERR_INVALID;
-	}
-
-	err = rbcfg_set_u32(rbcfg_ctx, env->id, v->val.u32);
-	return err;
-}
-
-static const char *
-rbcfg_env_get(const struct rbcfg_env *env)
-{
-	const char *ret = NULL;
-
-	switch (env->type) {
-	case RBCFG_ENV_TYPE_U32:
-		ret = rbcfg_env_get_u32(env);
-		break;
-	}
-
-	return ret;
-}
-
-static int
-rbcfg_env_set(const struct rbcfg_env *env, const char *data)
-{
-	int ret = 0;
-
-	switch (env->type) {
-	case RBCFG_ENV_TYPE_U32:
-		ret = rbcfg_env_set_u32(env, data);
-		break;
-	}
-
-	return ret;
-}
-
-static int
-rbcfg_cmd_apply(int argc, const char *argv[])
-{
-	return rbcfg_update(0);
-}
-
-static int
-rbcfg_cmd_help(int argc, const char *argv[])
-{
-	usage();
-	return 0;
-}
-
-static int
-rbcfg_cmd_get(int argc, const char *argv[])
-{
-	int err = RB_ERR_NOTFOUND;
-	int i;
-
-	if (argc != 1) {
-		usage();
-		return RB_ERR_INVALID;
-	}
-
-	for (i = 0; i < ARRAY_SIZE(rbcfg_envs); i++) {
-		const struct rbcfg_env *env = &rbcfg_envs[i];
-		const char *value;
-
-		if (strcmp(env->name, argv[0]))
-			continue;
-
-		value = rbcfg_env_get(env);
-		if (value) {
-			fprintf(stdout, "%s\n", value);
-			err = 0;
-		}
-		break;
-	}
-
-	return err;
-}
-
-static int
-rbcfg_cmd_set(int argc, const char *argv[])
-{
-	int err = RB_ERR_INVALID;
-	int i;
-
-	if (argc != 2) {
-		/* not enough parameters */
-		usage();
-		return RB_ERR_INVALID;
-	}
-
-	for (i = 0; i < ARRAY_SIZE(rbcfg_envs); i++) {
-		const struct rbcfg_env *env = &rbcfg_envs[i];
-
-		if (strcmp(env->name, argv[0]))
-			continue;
-
-		err = rbcfg_env_set(env, argv[1]);
-		if (err == 0)
-			err = rbcfg_update(1);
-		break;
-	}
-
-	return err;
-}
-
-static int
-rbcfg_cmd_show(int argc, const char *argv[])
-{
-	int i;
-
-	if (argc != 0) {
-		usage();
-		return RB_ERR_INVALID;
-	}
-
-	for (i = 0; i < ARRAY_SIZE(rbcfg_envs); i++) {
-		const struct rbcfg_env *env = &rbcfg_envs[i];
-		const char *value;
-
-		value = rbcfg_env_get(env);
-		if (value)
-			fprintf(stdout, "%s=%s\n", env->name, value);
-	}
-
-	return 0;
-}
-
-static const struct rbcfg_command rbcfg_commands[] = {
-	{
-		.command	= "apply",
-		.usage		= "apply\n"
-				  "\t- write configuration to the mtd device",
-		.flags		= CMD_FLAG_USES_CFG,
-		.exec		= rbcfg_cmd_apply,
-	}, {
-		.command	= "help",
-		.usage		= "help\n"
-				  "\t- show this screen",
-		.exec		= rbcfg_cmd_help,
-	}, {
-		.command	= "get",
-		.usage		= "get <name>\n"
-				  "\t- get value of the configuration option <name>",
-		.flags		= CMD_FLAG_USES_CFG,
-		.exec		= rbcfg_cmd_get,
-	}, {
-		.command	= "set",
-		.usage		= "set <name> <value>\n"
-				  "\t- set value of the configuration option <name> to <value>",
-		.flags		= CMD_FLAG_USES_CFG,
-		.exec		= rbcfg_cmd_set,
-	}, {
-		.command	= "show",
-		.usage		= "show\n"
-				  "\t- show value of all configuration options",
-		.flags		= CMD_FLAG_USES_CFG,
-		.exec		= rbcfg_cmd_show,
-	}
-};
-
-static void
-usage(void)
-{
-	char buf[255];
-	int len;
-	int i;
-
-	fprintf(stderr, "Usage: %s <command>\n", rbcfg_name);
-
-	fprintf(stderr, "\nCommands:\n");
-	for (i = 0; i < ARRAY_SIZE(rbcfg_commands); i++) {
-		const struct rbcfg_command *cmd;
-		cmd = &rbcfg_commands[i];
-
-		len = snprintf(buf, sizeof(buf), "%s", cmd->usage);
-		buf[len] = '\0';
-		fprintf(stderr, "%s\n", buf);
-	}
-
-	fprintf(stderr, "\nConfiguration options:\n");
-	for (i = 0; i < ARRAY_SIZE(rbcfg_envs); i++) {
-		const struct rbcfg_env *env;
-		int j;
-
-		env = &rbcfg_envs[i];
-		fprintf(stderr, "\n%s:\n", env->name);
-		for (j = 0; j < env->num_values; j++) {
-			const struct rbcfg_value *v = &env->values[j];
-			fprintf(stderr, "\t%-12s %s\n", v->name, v->desc);
-		}
-	}
-	fprintf(stderr, "\n");
-}
-
-int main(int argc, const char *argv[])
-{
-	const struct rbcfg_command *cmd = NULL;
-	int ret;
-	int i;
-
-	rbcfg_name = (char *) argv[0];
-
-	if (argc < 2) {
-		usage();
-		return EXIT_FAILURE;
-	}
-
-	for (i = 0; i < ARRAY_SIZE(rbcfg_commands); i++) {
-		if (strcmp(rbcfg_commands[i].command, argv[1]) == 0) {
-			cmd = &rbcfg_commands[i];
-			break;
-		}
-	}
-
-	if (cmd == NULL) {
-		fprintf(stderr, "unknown command '%s'\n", argv[1]);
-		usage();
-		return EXIT_FAILURE;
-	}
-
-	argc -= 2;
-	argv += 2;
-
-	if (cmd->flags & CMD_FLAG_USES_CFG) {
-		ret = rbcfg_open();
-		if (ret)
-			return EXIT_FAILURE;
-	}
-
-	ret = cmd->exec(argc, argv);
-
-	if (cmd->flags & CMD_FLAG_USES_CFG)
-		rbcfg_close();
-
-	if (ret)
-		return EXIT_FAILURE;
-
-	return EXIT_SUCCESS;
-}

+ 0 - 75
package/boot/rbcfg/src/rbcfg.h

@@ -1,75 +0,0 @@
-/*
- *  Mikrotik's RouterBOOT configuration defines
- *
- *  Copyright (C) 2010 Gabor Juhos <juhosg@openwrt.org>
- *
- *  This program is free software; you can redistribute it and/or modify it
- *  under the terms of the GNU General Public License version 2 as published
- *  by the Free Software Foundation.
- *
- */
-
-#ifndef _RBCFG_H
-#define _RBCFG_H
-
-/*
- * Magic numbers
- */
-#define RB_MAGIC_SOFT	0x74666f53 /* 'Soft' */
-
-/*
- * ID values for Software settings
- */
-#define RB_ID_TERMINATOR	0
-#define RB_ID_UART_SPEED	1
-#define RB_ID_BOOT_DELAY	2
-#define RB_ID_BOOT_DEVICE	3
-#define RB_ID_BOOT_KEY		4
-#define RB_ID_CPU_MODE		5
-#define RB_ID_FW_VERSION	6
-#define RB_ID_SOFT_07		7
-#define RB_ID_SOFT_08		8
-#define RB_ID_BOOT_PROTOCOL	9
-#define RB_ID_SOFT_10		10
-#define RB_ID_SOFT_11		11
-#define RB_ID_BOOTER		13
-
-#define RB_UART_SPEED_115200	0
-#define RB_UART_SPEED_57600	1
-#define RB_UART_SPEED_38400	2
-#define RB_UART_SPEED_19200	3
-#define RB_UART_SPEED_9600	4
-#define RB_UART_SPEED_4800	5
-#define RB_UART_SPEED_2400	6
-#define RB_UART_SPEED_1200	7
-#define RB_UART_SPEED_OFF	8
-
-#define RB_BOOT_DELAY_1SEC	1
-#define RB_BOOT_DELAY_2SEC	2
-#define RB_BOOT_DELAY_3SEC	3
-#define RB_BOOT_DELAY_4SEC	4
-#define RB_BOOT_DELAY_5SEC	5
-#define RB_BOOT_DELAY_6SEC	6
-#define RB_BOOT_DELAY_7SEC	7
-#define RB_BOOT_DELAY_8SEC	8
-#define RB_BOOT_DELAY_9SEC	9
-
-#define RB_BOOT_DEVICE_ETHER	0
-#define RB_BOOT_DEVICE_NANDETH	1
-#define RB_BOOT_DEVICE_CFCARD	2
-#define RB_BOOT_DEVICE_ETHONCE	3
-#define RB_BOOT_DEVICE_NANDONLY	5
-
-#define RB_BOOT_KEY_ANY		0
-#define RB_BOOT_KEY_DEL		1
-
-#define RB_CPU_MODE_POWERSAVE	0
-#define RB_CPU_MODE_REGULAR	1
-
-#define RB_BOOT_PROTOCOL_BOOTP	0
-#define RB_BOOT_PROTOCOL_DHCP	1
-
-#define RB_BOOTER_REGULAR	0
-#define RB_BOOTER_BACKUP	1
-
-#endif /* _RBCFG_H */

+ 5 - 4
package/boot/uboot-ar71xx/Makefile

@@ -9,15 +9,16 @@ include $(TOPDIR)/rules.mk
 include $(INCLUDE_DIR)/kernel.mk
 
 PKG_NAME:=u-boot
-PKG_VERSION:=2010.03
+PKG_VERSION:=2010.03-libre
 PKG_RELEASE:=1
 
 PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
-PKG_HASH:=902d1b2c15787df55186fae4033685fb0c5a5a12755a08383e97c4a3e255925b
+PKG_HASH:=7bd134647ea27cc1fa08da66790e743d877a82751cf102584d241a2542f8232c
 PKG_SOURCE_URL:= \
-	http://mirror2.openwrt.org/sources \
-	ftp://ftp.denx.de/pub/u-boot
+	https://librecmc.org/librecmc/downloads/sources/v1.4 \
+
+
 PKG_TARGETS:=bin
 
 PKG_LICENSE:=GPL-2.0 GPL-2.0+

+ 4 - 4
package/boot/uboot-envtools/Makefile

@@ -9,15 +9,15 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=uboot-envtools
 PKG_DISTNAME:=u-boot
-PKG_VERSION:=2015.10
+PKG_VERSION:=2015.10-librecmc
 PKG_RELEASE:=1
 
 PKG_BUILD_DIR:=$(BUILD_DIR)/u-boot-$(PKG_VERSION)
 PKG_SOURCE:=$(PKG_DISTNAME)-$(PKG_VERSION).tar.bz2
 PKG_SOURCE_URL:=\
-	http://mirror2.openwrt.org/sources \
-	ftp://ftp.denx.de/pub/u-boot
-PKG_HASH:=bdc68d5f9455ad933b059c735d983f2c8b6b552dafb062e5ff1444f623021955
+	https://librecmc.org/librecmc/downloads/sources/v1.4/
+
+PKG_HASH:=35aa6ad931c9474578ae01c7b565753d9d28059bc4d5444eea923840342f1e86
 
 PKG_BUILD_DEPENDS:=+fstools
 

+ 0 - 88
package/boot/uboot-envtools/files/ipq

@@ -1,88 +0,0 @@
-#
-# Copyright (C) 2010 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-include $(TOPDIR)/rules.mk
-include $(INCLUDE_DIR)/kernel.mk
-
-PKG_NAME:=u-boot
-PKG_VERSION:=2012.10-rc2
-PKG_RELEASE:=1
-
-PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
-PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
-PKG_SOURCE_URL:= \
-	http://mirror2.openwrt.org/sources \
-	ftp://ftp.denx.de/pub/u-boot
-PKG_HASH:=6d094cafa7ecea8b671fbdcd21130b6a4f5744fc47dd263e101ed5d3629dffd4
-PKG_TARGETS:=bin
-
-PKG_LICENSE:=GPL-2.0 GPL-2.0+
-PKG_LICENSE_FILES:=Licenses/README
-
-include $(INCLUDE_DIR)/package.mk
-
-define uboot/Default
-  TITLE:=
-  CONFIG:=
-  IMAGE:=
-endef
-
-define uboot/qi_lb60
-  TITLE:=U-boot for the qi_lb60 board
-endef
-
-UBOOTS:=qi_lb60
-
-define Package/uboot/template
-define Package/uboot-xburst-$(1)
-  SECTION:=boot
-  CATEGORY:=Boot Loaders
-  DEPENDS:=@TARGET_xburst
-  TITLE:=$(2)
-  URL:=http://www.denx.de/wiki/UBoot/WebHome
-  VARIANT:=$(1)
-endef
-endef
-
-define BuildUbootPackage
-	$(eval $(uboot/Default))
-	$(eval $(uboot/$(1)))
-	$(call Package/uboot/template,$(1),$(TITLE))
-endef
-
-
-ifdef BUILD_VARIANT
-$(eval $(call uboot/$(BUILD_VARIANT)))
-UBOOT_CONFIG:=$(if $(CONFIG),$(CONFIG),$(BUILD_VARIANT))
-UBOOT_IMAGE:=$(if $(IMAGE),$(IMAGE),openwrt-$(BOARD)-$(BUILD_VARIANT)-u-boot.bin)
-endif
-
-define Build/Configure
-	$(MAKE) -C $(PKG_BUILD_DIR) \
-		$(UBOOT_CONFIG)_config
-endef
-
-define Build/Compile
-	$(MAKE) -C $(PKG_BUILD_DIR) \
-		CROSS_COMPILE=$(TARGET_CROSS)
-endef
-
-define Package/uboot/install/template
-define Package/uboot-xburst-$(1)/install
-	$(CP) $(PKG_BUILD_DIR)/u-boot-xburst.bin $(BIN_DIR)/$(2)
-	rmdir $$(1)
-endef
-endef
-
-$(foreach u,$(UBOOTS), \
-	$(eval $(call Package/uboot/install/template,$(u),openwrt-$(BOARD)-$(u)-u-boot.bin)) \
-)
-
-$(foreach u,$(UBOOTS), \
-	$(eval $(call BuildUbootPackage,$(u))) \
-	$(eval $(call BuildPackage,uboot-xburst-$(u))) \
-)

+ 0 - 894
package/boot/uboot-xburst/patches/0001-qi_lb60-add-nand-spl-support.patch

@@ -1,894 +0,0 @@
-From 0329cf7965956a5a7044827e0ce88ae8d5150e54 Mon Sep 17 00:00:00 2001
-From: Xiangfu <xiangfu@openmobilefree.net>
-Date: Fri, 12 Oct 2012 09:46:58 +0800
-Subject: [PATCH 1/6] qi_lb60: add nand spl support
-
-  The JZ4740 CPU can load 8KB from two different addresses:
-   1. the normal area up to 8KB starting from NAND flash address 0x00000000
-   2. the backup area up to 8KB starting from NAND flash address 0x00002000
-
-Signed-off-by: Xiangfu <xiangfu@openmobilefree.net>
----
- Makefile                          |   12 +++
- arch/mips/cpu/xburst/Makefile     |    7 +-
- arch/mips/cpu/xburst/cpu.c        |    4 +
- arch/mips/cpu/xburst/jz4740.c     |   82 +++++++----------
- arch/mips/cpu/xburst/spl/Makefile |   47 ++++++++++
- arch/mips/cpu/xburst/spl/start.S  |   63 +++++++++++++
- board/qi/qi_lb60/Makefile         |    4 +
- board/qi/qi_lb60/qi_lb60-spl.c    |   30 +++++++
- board/qi/qi_lb60/qi_lb60.c        |    8 +-
- board/qi/qi_lb60/u-boot-spl.lds   |   61 +++++++++++++
- drivers/mtd/nand/jz4740_nand.c    |   39 ++++++++-
- include/configs/qi_lb60.h         |  175 ++++++++++++++++++-------------------
- 12 files changed, 386 insertions(+), 146 deletions(-)
- create mode 100644 arch/mips/cpu/xburst/spl/Makefile
- create mode 100644 arch/mips/cpu/xburst/spl/start.S
- create mode 100644 board/qi/qi_lb60/qi_lb60-spl.c
- create mode 100644 board/qi/qi_lb60/u-boot-spl.lds
-
-diff --git a/Makefile b/Makefile
-index 34d9075..a22778e 100644
---- a/Makefile
-+++ b/Makefile
-@@ -393,6 +393,10 @@ ALL-y += $(obj)u-boot-nodtb-tegra.bin
- endif
- endif
- 
-+ifeq ($(CPU),xburst)
-+ALL-y += $(obj)u-boot-xburst.bin
-+endif
-+
- all:		$(ALL-y) $(SUBDIR_EXAMPLES)
- 
- $(obj)u-boot.dtb:	$(obj)u-boot
-@@ -506,6 +510,14 @@ $(obj)u-boot-nodtb-tegra.bin:	$(obj)spl/u-boot-spl.bin $(obj)u-boot.bin
- endif
- endif
- 
-+ifeq ($(CPU),xburst)
-+$(obj)u-boot-xburst.bin:	$(obj)spl/u-boot-spl.bin $(obj)u-boot.bin
-+	        dd if=$(obj)spl/u-boot-spl.bin of=$(obj)spl/u-boot-pad.bin conv=sync bs=8192 count=1
-+		dd if=$(obj)spl/u-boot-spl.bin of=$(obj)spl/u-boot-pad.bin conv=sync,notrunc oflag=append bs=8192 count=1
-+	        tr '\0' '\377' < /dev/zero | dd of=$(obj)spl/u-boot-pad.bin conv=sync,notrunc oflag=append bs=16384 count=1
-+	        cat $(obj)spl/u-boot-pad.bin u-boot.bin > $@
-+endif
-+
- ifeq ($(CONFIG_SANDBOX),y)
- GEN_UBOOT = \
- 		cd $(LNDIR) && $(CC) $(SYMS) -T $(obj)u-boot.lds \
-diff --git a/arch/mips/cpu/xburst/Makefile b/arch/mips/cpu/xburst/Makefile
-index b1f2ae4..ec35e55 100644
---- a/arch/mips/cpu/xburst/Makefile
-+++ b/arch/mips/cpu/xburst/Makefile
-@@ -24,9 +24,12 @@ include $(TOPDIR)/config.mk
- 
- LIB	= $(obj)lib$(CPU).o
- 
-+COBJS-y	= cpu.o jz_serial.o
-+
-+ifneq ($(CONFIG_SPL_BUILD),y)
- START	= start.o
--SOBJS-y	=
--COBJS-y	= cpu.o timer.o jz_serial.o
-+COBJS-y += timer.o
-+endif
- 
- COBJS-$(CONFIG_JZ4740) += jz4740.o
- 
-diff --git a/arch/mips/cpu/xburst/cpu.c b/arch/mips/cpu/xburst/cpu.c
-index ddcbfaa..1432838 100644
---- a/arch/mips/cpu/xburst/cpu.c
-+++ b/arch/mips/cpu/xburst/cpu.c
-@@ -42,6 +42,8 @@
- 		:			\
- 		: "i" (op), "R" (*(unsigned char *)(addr)))
- 
-+#ifndef CONFIG_SPL_BUILD
-+
- void __attribute__((weak)) _machine_restart(void)
- {
- 	struct jz4740_wdt *wdt = (struct jz4740_wdt *)JZ4740_WDT_BASE;
-@@ -109,6 +111,8 @@ void invalidate_dcache_range(ulong start_addr, ulong stop)
- 		cache_op(Hit_Invalidate_D, addr);
- }
- 
-+#endif
-+
- void flush_icache_all(void)
- {
- 	u32 addr, t = 0;
-diff --git a/arch/mips/cpu/xburst/jz4740.c b/arch/mips/cpu/xburst/jz4740.c
-index c0b9817..8816aa3 100644
---- a/arch/mips/cpu/xburst/jz4740.c
-+++ b/arch/mips/cpu/xburst/jz4740.c
-@@ -32,31 +32,19 @@ int disable_interrupts(void)
- 	return 0;
- }
- 
--/*
-- * PLL output clock = EXTAL * NF / (NR * NO)
-- * NF = FD + 2, NR = RD + 2
-- * NO = 1 (if OD = 0), NO = 2 (if OD = 1 or 2), NO = 4 (if OD = 3)
-- */
- void pll_init(void)
- {
- 	struct jz4740_cpm *cpm = (struct jz4740_cpm *)JZ4740_CPM_BASE;
- 
--	register unsigned int cfcr, plcr1;
--	int n2FR[33] = {
--		0, 0, 1, 2, 3, 0, 4, 0, 5, 0, 0, 0, 6, 0, 0, 0,
--		7, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0,
--		9
--	};
--	int div[5] = {1, 3, 3, 3, 3}; /* divisors of I:S:P:L:M */
--	int nf, pllout2;
-+	register unsigned int cfcr, plcr;
-+	unsigned int nf, pllout2;
- 
- 	cfcr =	CPM_CPCCR_CLKOEN |
--		CPM_CPCCR_PCS |
--		(n2FR[div[0]] << CPM_CPCCR_CDIV_BIT) |
--		(n2FR[div[1]] << CPM_CPCCR_HDIV_BIT) |
--		(n2FR[div[2]] << CPM_CPCCR_PDIV_BIT) |
--		(n2FR[div[3]] << CPM_CPCCR_MDIV_BIT) |
--		(n2FR[div[4]] << CPM_CPCCR_LDIV_BIT);
-+		(0 << CPM_CPCCR_CDIV_BIT) |
-+		(2 << CPM_CPCCR_HDIV_BIT) |
-+		(2 << CPM_CPCCR_PDIV_BIT) |
-+		(2 << CPM_CPCCR_MDIV_BIT) |
-+		(2 << CPM_CPCCR_LDIV_BIT);
- 
- 	pllout2 = (cfcr & CPM_CPCCR_PCS) ?
- 		CONFIG_SYS_CPU_SPEED : (CONFIG_SYS_CPU_SPEED / 2);
-@@ -65,15 +53,18 @@ void pll_init(void)
- 	writel(pllout2 / 48000000 - 1, &cpm->uhccdr);
- 
- 	nf = CONFIG_SYS_CPU_SPEED * 2 / CONFIG_SYS_EXTAL;
--	plcr1 = ((nf - 2) << CPM_CPPCR_PLLM_BIT) | /* FD */
-+	plcr = ((nf - 2) << CPM_CPPCR_PLLM_BIT) | /* FD */
- 		(0 << CPM_CPPCR_PLLN_BIT) |	/* RD=0, NR=2 */
- 		(0 << CPM_CPPCR_PLLOD_BIT) |	/* OD=0, NO=1 */
--		(0x20 << CPM_CPPCR_PLLST_BIT) |	/* PLL stable time */
-+		(0x32 << CPM_CPPCR_PLLST_BIT) |	/* PLL stable time */
- 		CPM_CPPCR_PLLEN;		/* enable PLL */
- 
- 	/* init PLL */
- 	writel(cfcr, &cpm->cpccr);
--	writel(plcr1, &cpm->cppcr);
-+	writel(plcr, &cpm->cppcr);
-+
-+	while (!(readl(&cpm->cppcr) & CPM_CPPCR_PLLS))
-+		;
- }
- 
- void sdram_init(void)
-@@ -92,26 +83,12 @@ void sdram_init(void)
- 		2 << EMC_DMCR_TCL_BIT	/* CAS latency is 3 */
- 	};
- 
--	int div[] = {1, 2, 3, 4, 6, 8, 12, 16, 24, 32};
--
- 	cpu_clk = CONFIG_SYS_CPU_SPEED;
--	mem_clk = cpu_clk * div[__cpm_get_cdiv()] / div[__cpm_get_mdiv()];
-+	mem_clk = 84000000;
- 
- 	writel(0, &emc->bcr);	/* Disable bus release */
- 	writew(0, &emc->rtcsr);	/* Disable clock for counting */
- 
--	/* Fault DMCR value for mode register setting*/
--#define SDRAM_ROW0	11
--#define SDRAM_COL0	8
--#define SDRAM_BANK40	0
--
--	dmcr0 = ((SDRAM_ROW0 - 11) << EMC_DMCR_RA_BIT) |
--		((SDRAM_COL0 - 8) << EMC_DMCR_CA_BIT) |
--		(SDRAM_BANK40 << EMC_DMCR_BA_BIT) |
--		(SDRAM_BW16 << EMC_DMCR_BW_BIT) |
--		EMC_DMCR_EPIN |
--		cas_latency_dmcr[((SDRAM_CASL == 3) ? 1 : 0)];
--
- 	/* Basic DMCR value */
- 	dmcr = ((SDRAM_ROW - 11) << EMC_DMCR_RA_BIT) |
- 		((SDRAM_COL - 8) << EMC_DMCR_CA_BIT) |
-@@ -128,31 +105,31 @@ void sdram_init(void)
- 	if (tmp > 11)
- 		tmp = 11;
- 	dmcr |= (tmp - 4) << EMC_DMCR_TRAS_BIT;
--	tmp = SDRAM_RCD / ns;
- 
-+	tmp = SDRAM_RCD / ns;
- 	if (tmp > 3)
- 		tmp = 3;
- 	dmcr |= tmp << EMC_DMCR_RCD_BIT;
--	tmp = SDRAM_TPC / ns;
- 
-+	tmp = SDRAM_TPC / ns;
- 	if (tmp > 7)
- 		tmp = 7;
- 	dmcr |= tmp << EMC_DMCR_TPC_BIT;
--	tmp = SDRAM_TRWL / ns;
- 
-+	tmp = SDRAM_TRWL / ns;
- 	if (tmp > 3)
- 		tmp = 3;
- 	dmcr |= tmp << EMC_DMCR_TRWL_BIT;
--	tmp = (SDRAM_TRAS + SDRAM_TPC) / ns;
- 
-+	tmp = (SDRAM_TRAS + SDRAM_TPC) / ns;
- 	if (tmp > 14)
- 		tmp = 14;
- 	dmcr |= ((tmp + 1) >> 1) << EMC_DMCR_TRC_BIT;
- 
- 	/* SDRAM mode value */
--	sdmode = EMC_SDMR_BT_SEQ |
--		 EMC_SDMR_OM_NORMAL |
--		 EMC_SDMR_BL_4 |
-+	sdmode = EMC_SDMR_BT_SEQ	|
-+		 EMC_SDMR_OM_NORMAL	|
-+		 EMC_SDMR_BL_4		|
- 		 cas_latency_sdmr[((SDRAM_CASL == 3) ? 1 : 0)];
- 
- 	/* Stage 1. Precharge all banks by writing SDMR with DMCR.MRSET=0 */
-@@ -172,8 +149,8 @@ void sdram_init(void)
- 	if (tmp > 0xff)
- 		tmp = 0xff;
- 	writew(tmp, &emc->rtcor);
-+
- 	writew(0, &emc->rtcnt);
--	/* Divisor is 64, CKO/64 */
- 	writew(EMC_RTCSR_CKS_64, &emc->rtcsr);
- 
- 	/* Wait for number of auto-refresh cycles */
-@@ -182,13 +159,17 @@ void sdram_init(void)
- 		;
- 
- 	/* Stage 3. Mode Register Set */
-+	dmcr0 = (11 << EMC_DMCR_RA_BIT)	|
-+		(8 << EMC_DMCR_CA_BIT)	|
-+		(0 << EMC_DMCR_BA_BIT)	|
-+		EMC_DMCR_EPIN		|
-+		(SDRAM_BW16 << EMC_DMCR_BW_BIT) |
-+		cas_latency_dmcr[((SDRAM_CASL == 3) ? 1 : 0)];
- 	writel(dmcr0 | EMC_DMCR_RFSH | EMC_DMCR_MRSET, &emc->dmcr);
- 	writeb(0, JZ4740_EMC_SDMR0 | sdmode);
- 
- 	/* Set back to basic DMCR value */
- 	writel(dmcr | EMC_DMCR_RFSH | EMC_DMCR_MRSET, &emc->dmcr);
--
--	/* everything is ok now */
- }
- 
- DECLARE_GLOBAL_DATA_PTR;
-@@ -232,9 +213,10 @@ void rtc_init(void)
- phys_size_t initdram(int board_type)
- {
- 	struct jz4740_emc *emc = (struct jz4740_emc *)JZ4740_EMC_BASE;
--	u32 dmcr;
--	u32 rows, cols, dw, banks;
--	ulong size;
-+
-+	unsigned int dmcr;
-+	unsigned int rows, cols, dw, banks;
-+	unsigned long size;
- 
- 	dmcr = readl(&emc->dmcr);
- 	rows = 11 + ((dmcr & EMC_DMCR_RA_MASK) >> EMC_DMCR_RA_BIT);
-diff --git a/arch/mips/cpu/xburst/spl/Makefile b/arch/mips/cpu/xburst/spl/Makefile
-new file mode 100644
-index 0000000..f45e8c8
---- /dev/null
-+++ b/arch/mips/cpu/xburst/spl/Makefile
-@@ -0,0 +1,47 @@
-+#
-+# Copyright (C) 2011 Xiangfu Liu <xiangfu@openmobilefree.net>
-+#
-+# See file CREDITS for list of people who contributed to this
-+# project.
-+#
-+# This program is free software; you can redistribute it and/or
-+# modify it under the terms of the GNU General Public License as
-+# published by the Free Software Foundation; either version 2 of
-+# the License, or (at your option) any later version.
-+#
-+# This program is distributed in the hope that it will be useful,
-+# but WITHOUT ANY WARRANTY; without even the implied warranty of
-+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+# GNU General Public License for more details.
-+#
-+# You should have received a copy of the GNU General Public License
-+# along with this program; if not, write to the Free Software
-+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-+# MA 02111-1307 USA
-+#
-+
-+include $(TOPDIR)/config.mk
-+
-+LIB	= $(obj)lib$(CPU).o
-+
-+START	= start.o
-+SOBJS-y	=
-+COBJS-y	=
-+
-+SRCS	:= $(START:.o=.S) $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c)
-+OBJS	:= $(addprefix $(obj),$(SOBJS-y) $(COBJS-y))
-+START	:= $(addprefix $(obj),$(START))
-+
-+all:	$(obj).depend $(START) $(LIB)
-+
-+$(LIB):	$(OBJS)
-+	$(call cmd_link_o_target, $(OBJS))
-+
-+#########################################################################
-+
-+# defines $(obj).depend target
-+include $(SRCTREE)/rules.mk
-+
-+sinclude $(obj).depend
-+
-+#########################################################################
-diff --git a/arch/mips/cpu/xburst/spl/start.S b/arch/mips/cpu/xburst/spl/start.S
-new file mode 100644
-index 0000000..e31c4c8
---- /dev/null
-+++ b/arch/mips/cpu/xburst/spl/start.S
-@@ -0,0 +1,63 @@
-+/*
-+ * Copyright (c) 2010 Xiangfu Liu <xiangfu@openmobilefree.net>
-+ *
-+ * See file CREDITS for list of people who contributed to this
-+ * project.
-+ *
-+ * This program is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU General Public License as
-+ * published by the Free Software Foundation; either version 3 of
-+ * the License, or (at your option) any later version.
-+ *
-+ * This program is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+ * GNU General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU General Public License
-+ * along with this program; if not, write to the Free Software
-+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-+ * MA 02111-1307 USA
-+ */
-+
-+#include <config.h>
-+#include <version.h>
-+#include <asm/regdef.h>
-+#include <asm/mipsregs.h>
-+#include <asm/addrspace.h>
-+#include <asm/cacheops.h>
-+
-+#include <asm/jz4740.h>
-+
-+	.set noreorder
-+
-+	.globl _start
-+	.text
-+_start:
-+	.word JZ4740_NANDBOOT_CFG /* fetched during NAND Boot */
-+reset:
-+	/*
-+	 * STATUS register
-+	 * CU0=UM=EXL=IE=0, BEV=ERL=1, IP2~7=1
-+	 */
-+	li	t0, 0x0040FC04
-+	mtc0	t0, CP0_STATUS
-+	/*
-+	 * CAUSE register
-+	 * IV=1, use the specical interrupt vector (0x200)
-+	 */
-+	li	t1, 0x00800000
-+	mtc0	t1, CP0_CAUSE
-+
-+	bal     1f
-+	 nop
-+	.word   _GLOBAL_OFFSET_TABLE_
-+1:
-+	move    gp, ra
-+	lw      t1, 0(ra)
-+	move	gp, t1
-+
-+	la	sp, 0x80004000
-+	la	t9, nand_spl_boot
-+	j	t9
-+	nop
-diff --git a/board/qi/qi_lb60/Makefile b/board/qi/qi_lb60/Makefile
-index 5dae11b..e399246 100644
---- a/board/qi/qi_lb60/Makefile
-+++ b/board/qi/qi_lb60/Makefile
-@@ -22,7 +22,11 @@ include $(TOPDIR)/config.mk
- 
- LIB	= $(obj)lib$(BOARD).o
- 
-+ifeq ($(CONFIG_SPL_BUILD),y)
-+COBJS	:= $(BOARD)-spl.o
-+else
- COBJS	:= $(BOARD).o
-+endif
- 
- SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c)
- OBJS	:= $(addprefix $(obj),$(SOBJS) $(COBJS))
-diff --git a/board/qi/qi_lb60/qi_lb60-spl.c b/board/qi/qi_lb60/qi_lb60-spl.c
-new file mode 100644
-index 0000000..3fe3fa3
---- /dev/null
-+++ b/board/qi/qi_lb60/qi_lb60-spl.c
-@@ -0,0 +1,30 @@
-+/*
-+ * Authors: Xiangfu Liu <xiangfu@openmobilefree.cc>
-+ *
-+ * This program is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU General Public License
-+ * as published by the Free Software Foundation; either version
-+ * 3 of the License, or (at your option) any later version.
-+ */
-+
-+#include <common.h>
-+#include <nand.h>
-+#include <asm/io.h>
-+#include <asm/jz4740.h>
-+
-+void nand_spl_boot(void)
-+{
-+	__gpio_as_sdram_16bit_4720();
-+	__gpio_as_uart0();
-+	__gpio_jtag_to_uart0();
-+
-+	serial_init();
-+
-+	pll_init();
-+	sdram_init();
-+
-+	nand_init();
-+
-+	puts("\nQi LB60 SPL: Starting U-Boot ...\n");
-+	nand_boot();
-+}
-diff --git a/board/qi/qi_lb60/qi_lb60.c b/board/qi/qi_lb60/qi_lb60.c
-index d975209..3bd4e2f 100644
---- a/board/qi/qi_lb60/qi_lb60.c
-+++ b/board/qi/qi_lb60/qi_lb60.c
-@@ -1,5 +1,5 @@
- /*
-- * Authors: Xiangfu Liu <xiangfu@sharism.cc>
-+ * Authors: Xiangfu Liu <xiangfu@openmobilefree.net>
-  *
-  * This program is free software; you can redistribute it and/or
-  * modify it under the terms of the GNU General Public License
-@@ -97,8 +97,10 @@ int board_early_init_f(void)
- /* U-Boot common routines */
- int checkboard(void)
- {
--	printf("Board: Qi LB60 (Ingenic XBurst Jz4740 SoC, Speed %ld MHz)\n",
--	       gd->cpu_clk / 1000000);
-+	printf("Board: Qi LB60 (Ingenic XBurst Jz4740 SoC)\n");
-+	printf(" CPU: %ld\n", gd->cpu_clk);
-+	printf(" MEM: %ld\n", gd->mem_clk);
-+	printf(" DEV: %ld\n", gd->dev_clk);
- 
- 	return 0;
- }
-diff --git a/board/qi/qi_lb60/u-boot-spl.lds b/board/qi/qi_lb60/u-boot-spl.lds
-new file mode 100644
-index 0000000..930537f
---- /dev/null
-+++ b/board/qi/qi_lb60/u-boot-spl.lds
-@@ -0,0 +1,61 @@
-+/*
-+ * (C) Copyright 2012 Xiangfu Liu <xiangfu@openmobilefree.net>
-+ *
-+ * This program is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU General Public License as
-+ * published by the Free Software Foundation; either version 2 of
-+ * the License, or (at your option) any later version.
-+ *
-+ * This program is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+ * GNU General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU General Public License
-+ * along with this program; if not, write to the Free Software
-+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-+ * MA 02111-1307 USA
-+ */
-+
-+OUTPUT_FORMAT("elf32-tradlittlemips", "elf32-tradlittlemips", "elf32-tradlittlemips")
-+
-+OUTPUT_ARCH(mips)
-+ENTRY(_start)
-+SECTIONS
-+{
-+	. = 0x80000000;
-+	. = ALIGN(4);
-+	.text :
-+	{
-+	  *(.text)
-+	}
-+
-+	. = ALIGN(4);
-+	.rodata  : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) }
-+
-+	. = ALIGN(4);
-+	.data  : { *(.data) }
-+
-+	. = ALIGN(4);
-+	.sdata  : { *(.sdata) }
-+
-+	_gp = ALIGN(16);
-+
-+	__got_start = .;
-+	.got  : { *(.got) }
-+	__got_end = .;
-+
-+	. = .;
-+	__u_boot_cmd_start = .;
-+	.u_boot_cmd : { *(.u_boot_cmd) }
-+	__u_boot_cmd_end = .;
-+
-+	uboot_end_data = .;
-+	num_got_entries = (__got_end - __got_start) >> 2;
-+
-+	. = ALIGN(4);
-+	.sbss  : { *(.sbss) }
-+	.bss  : { *(.bss) }
-+	uboot_end = .;
-+}
-+ASSERT(uboot_end <= 0x80002000, "NAND bootstrap too big");
-diff --git a/drivers/mtd/nand/jz4740_nand.c b/drivers/mtd/nand/jz4740_nand.c
-index 3ec34f3..24a4921 100644
---- a/drivers/mtd/nand/jz4740_nand.c
-+++ b/drivers/mtd/nand/jz4740_nand.c
-@@ -15,6 +15,9 @@
- #include <asm/io.h>
- #include <asm/jz4740.h>
- 
-+#ifdef CONFIG_SPL_BUILD
-+#define printf(s) puts(s)
-+#endif
- #define JZ_NAND_DATA_ADDR ((void __iomem *)0xB8000000)
- #define JZ_NAND_CMD_ADDR (JZ_NAND_DATA_ADDR + 0x8000)
- #define JZ_NAND_ADDR_ADDR (JZ_NAND_DATA_ADDR + 0x10000)
-@@ -176,7 +179,7 @@ static int jz_nand_rs_correct_data(struct mtd_info *mtd, u_char *dat,
- 		for (k = 0; k < 9; k++)
- 			writeb(read_ecc[k], &emc->nfpar[k]);
- 	}
--	/* Set PRDY */
-+
- 	writel(readl(&emc->nfecr) | EMC_NFECR_PRDY, &emc->nfecr);
- 
- 	/* Wait for completion */
-@@ -184,7 +187,7 @@ static int jz_nand_rs_correct_data(struct mtd_info *mtd, u_char *dat,
- 		status = readl(&emc->nfints);
- 	} while (!(status & EMC_NFINTS_DECF));
- 
--	/* disable ecc */
-+	/* Disable ECC */
- 	writel(readl(&emc->nfecr) & ~EMC_NFECR_ECCE, &emc->nfecr);
- 
- 	/* Check decoding */
-@@ -192,7 +195,7 @@ static int jz_nand_rs_correct_data(struct mtd_info *mtd, u_char *dat,
- 		return 0;
- 
- 	if (status & EMC_NFINTS_UNCOR) {
--		printf("uncorrectable ecc\n");
-+		printf("JZ4740 uncorrectable ECC\n");
- 		return -1;
- 	}
- 
-@@ -230,6 +233,32 @@ static int jz_nand_rs_correct_data(struct mtd_info *mtd, u_char *dat,
- 	return errcnt;
- }
- 
-+#ifdef CONFIG_SPL_BUILD
-+static void jz_nand_read_buf(struct mtd_info *mtd, uint8_t *buf, int len)
-+{
-+	int i;
-+	struct nand_chip *this = mtd->priv;
-+
-+#if (JZ4740_NANDBOOT_CFG == JZ4740_NANDBOOT_B16R3) || \
-+	(JZ4740_NANDBOOT_CFG == JZ4740_NANDBOOT_B16R2)
-+	for (i = 0; i < len; i += 2)
-+		buf[i] = readw(this->IO_ADDR_R);
-+#elif (JZ4740_NANDBOOT_CFG == JZ4740_NANDBOOT_B8R3) || \
-+	(JZ4740_NANDBOOT_CFG == JZ4740_NANDBOOT_B8R2)
-+	for (i = 0; i < len; i++)
-+		buf[i] = readb(this->IO_ADDR_R);
-+#else
-+	#error JZ4740_NANDBOOT_CFG not defined or wrong
-+#endif
-+}
-+
-+static uint8_t jz_nand_read_byte(struct mtd_info *mtd)
-+{
-+	struct nand_chip *this = mtd->priv;
-+	return readb(this->IO_ADDR_R);
-+}
-+#endif
-+
- /*
-  * Main initialization routine
-  */
-@@ -254,6 +283,10 @@ int board_nand_init(struct nand_chip *nand)
- 	nand->ecc.size		= CONFIG_SYS_NAND_ECCSIZE;
- 	nand->ecc.bytes		= CONFIG_SYS_NAND_ECCBYTES;
- 	nand->ecc.layout	= &qi_lb60_ecclayout_2gb;
-+#ifdef CONFIG_SPL_BUILD
-+	nand->read_byte		= jz_nand_read_byte;
-+	nand->read_buf		= jz_nand_read_buf;
-+#endif
- 	nand->chip_delay	= 50;
- 	nand->options		= NAND_USE_FLASH_BBT;
- 
-diff --git a/include/configs/qi_lb60.h b/include/configs/qi_lb60.h
-index 4bb5bbc..7bff444 100644
---- a/include/configs/qi_lb60.h
-+++ b/include/configs/qi_lb60.h
-@@ -1,5 +1,5 @@
- /*
-- * Authors: Xiangfu Liu <xiangfu.z@gmail.com>
-+ * Authors: Xiangfu Liu <xiangfu@openmobilefree.net>
-  *
-  * This program is free software; you can redistribute it and/or
-  * modify it under the terms of the GNU General Public License
-@@ -14,7 +14,6 @@
- #define CONFIG_SYS_LITTLE_ENDIAN
- #define CONFIG_JZSOC		/* Jz SoC */
- #define CONFIG_JZ4740		/* Jz4740 SoC */
--#define CONFIG_NAND_JZ4740
- 
- #define CONFIG_SYS_CPU_SPEED	336000000	/* CPU clock: 336 MHz */
- #define CONFIG_SYS_EXTAL	12000000	/* EXTAL freq: 12 MHz */
-@@ -24,24 +23,43 @@
- #define CONFIG_SYS_UART_BASE	JZ4740_UART0_BASE /* Base of the UART channel */
- #define CONFIG_BAUDRATE		57600
- 
-+#define CONFIG_BOOTP_MASK	(CONFIG_BOOTP_DEFAUL)
-+#define CONFIG_BOOTDELAY	0
-+#define CONFIG_BOOTARGS "mem=32M console=tty0 console=ttyS0,57600n8 ubi.mtd=2 rootfstype=ubifs root=ubi0:rootfs rw rootwait"
-+#define CONFIG_BOOTCOMMAND	"nand read 0x80600000 0x400000 0x280000;bootm"
-+
-+/*
-+ * Miscellaneous configurable options
-+ */
-+#define CONFIG_SYS_SDRAM_BASE		0x80000000	/* Cached addr */
-+#define CONFIG_SYS_INIT_SP_OFFSET	0x400000
-+#define CONFIG_SYS_LOAD_ADDR		0x80600000
-+#define CONFIG_SYS_MEMTEST_START	0x80100000
-+#define CONFIG_SYS_MEMTEST_END		0x80A00000
-+#define CONFIG_SYS_TEXT_BASE		0x80100000
-+#define CONFIG_SYS_MONITOR_BASE		CONFIG_SYS_TEXT_BASE
-+
-+#define CONFIG_SYS_MALLOC_LEN		(4 * 1024 * 1024)
-+#define CONFIG_SYS_BOOTPARAMS_LEN	(128 * 1024)
-+
-+#define CONFIG_SYS_CBSIZE	256 /* Console I/O Buffer Size */
-+#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16)
-+
-+#define CONFIG_SYS_LONGHELP
-+#define CONFIG_SYS_MAXARGS	16
-+#define CONFIG_SYS_PROMPT	"NanoNote# "
-+
- #define CONFIG_SKIP_LOWLEVEL_INIT
- #define CONFIG_BOARD_EARLY_INIT_F
- #define CONFIG_SYS_NO_FLASH
- #define CONFIG_SYS_FLASH_BASE	0 /* init flash_base as 0 */
--#define CONFIG_ENV_OVERWRITE
--
--#define CONFIG_BOOTP_MASK	(CONFIG_BOOTP_DEFAUL)
--#define CONFIG_BOOTDELAY	0
--#define CONFIG_BOOTARGS		"mem=32M console=tty0 console=ttyS0,57600n8 ubi.mtd=2 rootfstype=ubifs root=ubi0:rootfs rw rootwait"
--#define CONFIG_BOOTCOMMAND	"nand read 0x80600000 0x400000 0x200000;bootm"
- 
- /*
-- * Command line configuration.
-+ * Command line configuration
-  */
- #define CONFIG_CMD_BOOTD	/* bootd			*/
- #define CONFIG_CMD_CONSOLE	/* coninfo			*/
- #define CONFIG_CMD_ECHO		/* echo arguments		*/
--
- #define CONFIG_CMD_LOADB	/* loadb			*/
- #define CONFIG_CMD_LOADS	/* loads			*/
- #define CONFIG_CMD_MEMORY	/* md mm nm mw cp cmp crc base loop mtest */
-@@ -58,45 +76,16 @@
- #define CONFIG_LOADS_ECHO	1	/* echo on for serial download */
- 
- /*
-- * Miscellaneous configurable options
-- */
--#define CONFIG_SYS_MAXARGS 16
--#define CONFIG_SYS_LONGHELP
--#define CONFIG_SYS_PROMPT "NanoNote# "
--#define CONFIG_SYS_CBSIZE 256 /* Console I/O Buffer Size */
--#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16)
--
--#define CONFIG_SYS_MALLOC_LEN		(4 * 1024 * 1024)
--#define CONFIG_SYS_BOOTPARAMS_LEN	(128 * 1024)
--
--#define CONFIG_SYS_SDRAM_BASE		0x80000000	/* Cached addr */
--#define CONFIG_SYS_INIT_SP_OFFSET	0x400000
--#define CONFIG_SYS_LOAD_ADDR		0x80600000
--#define CONFIG_SYS_MEMTEST_START	0x80100000
--#define CONFIG_SYS_MEMTEST_END		0x80800000
--
--/*
-- * Environment
-+ * NAND driver configuration
-  */
--#define CONFIG_ENV_IS_IN_NAND		/* use NAND for environment vars */
--
--#define CONFIG_SYS_NAND_5_ADDR_CYCLE
--/*
-- * if board nand flash is 1GB, set to 1
-- * if board nand flash is 2GB, set to 2
-- * for change the PAGE_SIZE and BLOCK_SIZE
-- * will delete when there is no 1GB flash
-- */
--#define NANONOTE_NAND_SIZE	2
--
--#define CONFIG_SYS_NAND_PAGE_SIZE	(2048 * NANONOTE_NAND_SIZE)
--#define CONFIG_SYS_NAND_BLOCK_SIZE	(256 * NANONOTE_NAND_SIZE << 10)
--/* nand bad block was marked at this page in a block, start from 0 */
-+#define CONFIG_NAND_JZ4740
-+#define CONFIG_SYS_NAND_PAGE_SIZE	4096
-+#define CONFIG_SYS_NAND_BLOCK_SIZE	(512 << 10)
-+/* NAND bad block was marked at this page in a block, start from 0 */
- #define CONFIG_SYS_NAND_BADBLOCK_PAGE	127
- #define CONFIG_SYS_NAND_PAGE_COUNT	128
- #define CONFIG_SYS_NAND_BAD_BLOCK_POS	0
--/* ECC offset position in oob area, default value is 6 if it isn't defined */
--#define CONFIG_SYS_NAND_ECC_POS		(6 * NANONOTE_NAND_SIZE)
-+#define CONFIG_SYS_NAND_ECC_POS		12
- #define CONFIG_SYS_NAND_ECCSIZE		512
- #define CONFIG_SYS_NAND_ECCBYTES	9
- #define CONFIG_SYS_NAND_ECCPOS		\
-@@ -115,10 +104,9 @@
- #define CONFIG_SYS_ONENAND_BASE		CONFIG_SYS_NAND_BASE
- #define CONFIG_SYS_MAX_NAND_DEVICE	1
- #define CONFIG_SYS_NAND_SELECT_DEVICE	1 /* nand driver supports mutipl.*/
--#define CONFIG_NAND_SPL_TEXT_BASE	0x80000000
- 
- /*
-- * IPL (Initial Program Loader, integrated inside CPU)
-+ * IPL (Initial Program Loader, integrated inside Ingenic Xburst JZ4740 CPU)
-  * Will load first 8k from NAND (SPL) into cache and execute it from there.
-  *
-  * SPL (Secondary Program Loader)
-@@ -130,77 +118,88 @@
-  * NUB (NAND U-Boot)
-  * This NAND U-Boot (NUB) is a special U-Boot version which can be started
-  * from RAM. Therefore it mustn't (re-)configure the SDRAM controller.
-- *
-  */
-+
-+/*
-+ * NAND SPL configuration
-+ */
-+#define CONFIG_SPL
-+#define CONFIG_SPL_LIBGENERIC_SUPPORT
-+#define CONFIG_SPL_LIBCOMMON_SUPPORT
-+#define CONFIG_SPL_NAND_LOAD
-+#define CONFIG_SPL_NAND_SIMPLE
-+#define CONFIG_SPL_NAND_SUPPORT
-+#define CONFIG_SPL_TEXT_BASE	0x80000000
-+#define CONFIG_SPL_START_S_PATH	"arch/mips/cpu/xburst/spl"
-+
-+#define CONFIG_SYS_NAND_5_ADDR_CYCLE
-+#define CONFIG_SYS_NAND_HW_ECC_OOBFIRST
-+#define JZ4740_NANDBOOT_CFG		JZ4740_NANDBOOT_B8R3
-+
- #define CONFIG_SYS_NAND_U_BOOT_DST	0x80100000 /* Load NUB to this addr */
- #define CONFIG_SYS_NAND_U_BOOT_START	CONFIG_SYS_NAND_U_BOOT_DST
--/* Start NUB from this addr*/
-+					/* Start NUB from this addr */
-+#define CONFIG_SYS_NAND_U_BOOT_OFFS (32  << 10) /* Offset of NUB */
-+#define CONFIG_SYS_NAND_U_BOOT_SIZE (256 << 10) /* Size of NUB */
- 
- /*
-- * Define the partitioning of the NAND chip (only RAM U-Boot is needed here)
-+ * Environment configuration
-  */
--#define CONFIG_SYS_NAND_U_BOOT_OFFS (256 << 10) /* Offset to RAM U-Boot image */
--#define CONFIG_SYS_NAND_U_BOOT_SIZE (512 << 10) /* Size of RAM U-Boot image */
--
-+#define CONFIG_ENV_OVERWRITE
-+#define CONFIG_ENV_IS_IN_NAND
- #define CONFIG_ENV_SIZE		(4 << 10)
- #define CONFIG_ENV_OFFSET	\
- 	(CONFIG_SYS_NAND_BLOCK_SIZE + CONFIG_SYS_NAND_U_BOOT_SIZE)
- #define CONFIG_ENV_OFFSET_REDUND \
- 	(CONFIG_ENV_OFFSET  + CONFIG_SYS_NAND_BLOCK_SIZE)
- 
--#define CONFIG_SYS_TEXT_BASE	0x80100000
--#define CONFIG_SYS_MONITOR_BASE	CONFIG_SYS_TEXT_BASE
--
- /*
-- * SDRAM Info.
-+ * CPU cache configuration
-  */
--#define CONFIG_NR_DRAM_BANKS	1
-+#define CONFIG_SYS_DCACHE_SIZE		16384
-+#define CONFIG_SYS_ICACHE_SIZE		16384
-+#define CONFIG_SYS_CACHELINE_SIZE	32
- 
- /*
-- * Cache Configuration
-+ * SDRAM configuration
-  */
--#define CONFIG_SYS_DCACHE_SIZE	16384
--#define CONFIG_SYS_ICACHE_SIZE	16384
--#define CONFIG_SYS_CACHELINE_SIZE	32
-+#define CONFIG_NR_DRAM_BANKS	1
-+
-+#define SDRAM_BW16		1	/* Data bus width: 0-32bit, 1-16bit */
-+#define SDRAM_BANK4		1	/* Banks each chip: 0-2bank, 1-4bank */
-+#define SDRAM_ROW		13	/* Row address: 11 to 13 */
-+#define SDRAM_COL		9	/* Column address: 8 to 12 */
-+#define SDRAM_CASL		2	/* CAS latency: 2 or 3 */
-+#define SDRAM_TRAS		45	/* RAS# Active Time */
-+#define SDRAM_RCD		20	/* RAS# to CAS# Delay */
-+#define SDRAM_TPC		20	/* RAS# Precharge Time */
-+#define SDRAM_TRWL		7	/* Write Latency Time */
-+#define SDRAM_TREF		15625	/* Refresh period: 8192 cycles/64ms */
- 
- /*
-- * GPIO definition
-+ * GPIO configuration
-  */
--#define GPIO_LCD_CS	(2 * 32 + 21)
--#define GPIO_AMP_EN	(3 * 32 + 4)
-+#define GPIO_LCD_CS		(2 * 32 + 21)
-+#define GPIO_AMP_EN		(3 * 32 + 4)
- 
--#define GPIO_SDPW_EN	(3 * 32 + 2)
--#define GPIO_SD_DETECT	(3 * 32 + 0)
-+#define GPIO_SDPW_EN		(3 * 32 + 2)
-+#define GPIO_SD_DETECT		(3 * 32 + 0)
- 
--#define GPIO_BUZZ_PWM	(3 * 32 + 27)
--#define GPIO_USB_DETECT	(3 * 32 + 28)
-+#define GPIO_BUZZ_PWM		(3 * 32 + 27)
-+#define GPIO_USB_DETECT		(3 * 32 + 28)
- 
--#define GPIO_AUDIO_POP	(1 * 32 + 29)
--#define GPIO_COB_TEST	(1 * 32 + 30)
-+#define GPIO_AUDIO_POP		(1 * 32 + 29)
-+#define GPIO_COB_TEST		(1 * 32 + 30)
- 
- #define GPIO_KEYOUT_BASE	(2 * 32 + 10)
--#define GPIO_KEYIN_BASE	(3 * 32 + 18)
--#define GPIO_KEYIN_8	(3 * 32 + 26)
-+#define GPIO_KEYIN_BASE		(3 * 32 + 18)
-+#define GPIO_KEYIN_8		(3 * 32 + 26)
- 
--#define GPIO_SD_CD_N	GPIO_SD_DETECT		/* SD Card insert detect */
-+#define GPIO_SD_CD_N		GPIO_SD_DETECT	/* SD Card insert detect */
- #define GPIO_SD_VCC_EN_N	GPIO_SDPW_EN	/* SD Card Power Enable */
- 
- #define SPEN	GPIO_LCD_CS	/* LCDCS :Serial command enable      */
- #define SPDA	(2 * 32 + 22)	/* LCDSCL:Serial command clock input */
- #define SPCK	(2 * 32 + 23)	/* LCDSDA:Serial command data input  */
- 
--/* SDRAM paramters */
--#define SDRAM_BW16		1	/* Data bus width: 0-32bit, 1-16bit */
--#define SDRAM_BANK4		1	/* Banks each chip: 0-2bank, 1-4bank */
--#define SDRAM_ROW		13	/* Row address: 11 to 13 */
--#define SDRAM_COL		9	/* Column address: 8 to 12 */
--#define SDRAM_CASL		2	/* CAS latency: 2 or 3 */
--
--/* SDRAM Timings, unit: ns */
--#define SDRAM_TRAS		45	/* RAS# Active Time */
--#define SDRAM_RCD		20	/* RAS# to CAS# Delay */
--#define SDRAM_TPC		20	/* RAS# Precharge Time */
--#define SDRAM_TRWL		7	/* Write Latency Time */
--#define SDRAM_TREF		15625	/* Refresh period: 8192 cycles/64ms */
--
- #endif
--- 
-1.7.9.5
-

+ 0 - 916
package/boot/uboot-xburst/patches/0002-qi_lb60-add-software-usbboot-support.patch

@@ -1,916 +0,0 @@
-From fa51192b912d296b8eec10f7d44c6c17eb1dd368 Mon Sep 17 00:00:00 2001
-From: Xiangfu <xiangfu@openmobilefree.net>
-Date: Fri, 12 Oct 2012 09:47:39 +0800
-Subject: [PATCH 2/6] qi_lb60: add software usbboot support
-
-  JZ4740 CPU have a internal ROM have such kind of code, that make
-  JZ4740 can boot from USB
-
-  usbboot.S can downloads user program from the USB port to internal
-  SRAM and branches to the internal SRAM to execute the program
-
-Signed-off-by: Xiangfu <xiangfu@openmobilefree.net>
----
- board/qi/qi_lb60/Makefile      |    1 +
- board/qi/qi_lb60/qi_lb60-spl.c |   20 +
- board/qi/qi_lb60/usbboot.S     |  838 ++++++++++++++++++++++++++++++++++++++++
- 3 files changed, 859 insertions(+)
- create mode 100644 board/qi/qi_lb60/usbboot.S
-
-diff --git a/board/qi/qi_lb60/Makefile b/board/qi/qi_lb60/Makefile
-index e399246..6dd8c6f 100644
---- a/board/qi/qi_lb60/Makefile
-+++ b/board/qi/qi_lb60/Makefile
-@@ -23,6 +23,7 @@ include $(TOPDIR)/config.mk
- LIB	= $(obj)lib$(BOARD).o
- 
- ifeq ($(CONFIG_SPL_BUILD),y)
-+SOBJS	:= usbboot.o
- COBJS	:= $(BOARD)-spl.o
- else
- COBJS	:= $(BOARD).o
-diff --git a/board/qi/qi_lb60/qi_lb60-spl.c b/board/qi/qi_lb60/qi_lb60-spl.c
-index 3fe3fa3..aea459c 100644
---- a/board/qi/qi_lb60/qi_lb60-spl.c
-+++ b/board/qi/qi_lb60/qi_lb60-spl.c
-@@ -12,6 +12,24 @@
- #include <asm/io.h>
- #include <asm/jz4740.h>
- 
-+#define KEY_U_OUT       (32 * 2 + 16)
-+#define KEY_U_IN        (32 * 3 + 19)
-+
-+extern void usb_boot(void);
-+
-+static void check_usb_boot(void)
-+{
-+	__gpio_as_input(KEY_U_IN);
-+	__gpio_enable_pull(KEY_U_IN);
-+	__gpio_as_output(KEY_U_OUT);
-+	__gpio_clear_pin(KEY_U_OUT);
-+
-+	if (!__gpio_get_pin(KEY_U_IN)) {
-+		puts("[U] pressed, goto USBBOOT mode\n");
-+		usb_boot();
-+	}
-+}
-+
- void nand_spl_boot(void)
- {
- 	__gpio_as_sdram_16bit_4720();
-@@ -23,6 +41,8 @@ void nand_spl_boot(void)
- 	pll_init();
- 	sdram_init();
- 
-+	check_usb_boot();
-+
- 	nand_init();
- 
- 	puts("\nQi LB60 SPL: Starting U-Boot ...\n");
-diff --git a/board/qi/qi_lb60/usbboot.S b/board/qi/qi_lb60/usbboot.S
-new file mode 100644
-index 0000000..c872266
---- /dev/null
-+++ b/board/qi/qi_lb60/usbboot.S
-@@ -0,0 +1,838 @@
-+/*
-+ *  for jz4740 usb boot
-+ *
-+ *  Copyright (c) 2009 Author: <jlwei@ingenic.cn>
-+ *
-+ * See file CREDITS for list of people who contributed to this
-+ * project.
-+ *
-+ * This program is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU General Public License as
-+ * published by the Free Software Foundation; either version 2 of
-+ * the License, or (at your option) any later version.
-+ *
-+ * This program is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+ * GNU General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU General Public License
-+ * along with this program; if not, write to the Free Software
-+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-+ * MA 02111-1307 USA
-+ */
-+    .set noreorder
-+    .globl usb_boot
-+    .text
-+
-+/*
-+ * Both NAND and USB boot load data to D-Cache first, then transfer
-+ * data from D-Cache to I-Cache, and jump to execute the code in I-Cache.
-+ * So init caches first and then dispatch to a proper boot routine.
-+ */
-+
-+.macro load_addr reg addr
-+	li \reg, 0x80000000
-+	addiu \reg, \reg, \addr
-+	la $2, usbboot_begin
-+	subu \reg, \reg, $2
-+.endm
-+
-+usb_boot:
-+	/* Initialize PLL: set ICLK to 84MHz and HCLK to 42MHz. */
-+	la	$9, 0xB0000000		/* CPCCR: Clock Control Register */
-+	la	$8, 0x42041110		/* I:S:M:P=1:2:2:2 */
-+	sw	$8, 0($9)
-+
-+	la	$9, 0xB0000010		/* CPPCR: PLL Control Register */
-+	la	$8, 0x06000120		/* M=12 N=0 D=0 CLK=12*(M+2)/(N+2) */
-+	sw	$8, 0($9)
-+
-+	mtc0	$0, $26		/* CP0_ERRCTL, restore WST reset state */
-+	nop
-+
-+	mtc0	$0, $16			/* CP0_CONFIG */
-+	nop
-+
-+	/* Relocate code to beginning of the ram */
-+
-+	la $2, usbboot_begin
-+	la $3, usbboot_end
-+	li $4, 0x80000000
-+
-+1:
-+	lw $5, 0($2)
-+	sw $5, 0($4)
-+	addiu $2, $2, 4
-+	bne $2, $3, 1b
-+	addiu $4, $4, 4
-+
-+	li $2, 0x80000000
-+	ori $3, $2, 0
-+	addiu $3, $3, usbboot_end
-+	la $4, usbboot_begin
-+	subu $3, $3, $4
-+
-+
-+2:
-+	cache	0x0, 0($2)		/* Index_Invalidate_I */
-+	cache	0x1, 0($2)		/* Index_Writeback_Inv_D */
-+	addiu	$2, $2, 32
-+	subu $4, $3, $2
-+	bgtz	$4, 2b
-+	nop
-+
-+	load_addr $3, usb_boot_return
-+
-+	jr $3
-+
-+usbboot_begin:
-+
-+init_caches:
-+	li	$2, 3			/* cacheable for kseg0 access */
-+	mtc0	$2, $16			/* CP0_CONFIG */
-+	nop
-+
-+	li	$2, 0x20000000		/* enable idx-store-data cache insn */
-+	mtc0	$2, $26			/* CP0_ERRCTL */
-+
-+	ori	$2, $28, 0		/* start address */
-+	ori	$3, $2, 0x3fe0		/* end address, total 16KB */
-+	mtc0	$0, $28, 0		/* CP0_TAGLO */
-+	mtc0	$0, $28, 1		/* CP0_DATALO */
-+cache_clear_a_line:
-+	cache	0x8, 0($2)		/* Index_Store_Tag_I */
-+	cache	0x9, 0($2)		/* Index_Store_Tag_D */
-+	bne	$2, $3, cache_clear_a_line
-+	addiu	$2, $2, 32		/* increment CACHE_LINE_SIZE */
-+
-+	ori	$2, $28, 0		/* start address */
-+	ori	$3, $2, 0x3fe0		/* end address, total 16KB */
-+	la	$4, 0x1ffff000		/* physical address and 4KB page mask */
-+cache_alloc_a_line:
-+	and	$5, $2, $4
-+	ori	$5, $5, 1		/* V bit of the physical tag */
-+	mtc0	$5, $28, 0		/* CP0_TAGLO */
-+	cache	0x8, 0($2)		/* Index_Store_Tag_I */
-+	cache	0x9, 0($2)		/* Index_Store_Tag_D */
-+	bne	$2, $3, cache_alloc_a_line
-+	addiu	$2, $2, 32		/* increment CACHE_LINE_SIZE */
-+
-+	nop
-+	nop
-+	nop
-+	/*
-+	 * Transfer data from dcache to icache, then jump to icache.
-+	 * Input parameters:
-+	 * $19: data length in bytes
-+	 * $20: jump target address
-+	 */
-+xfer_d2i:
-+
-+	ori	$8, $20, 0
-+	addu	$9, $8, $19		/* total 16KB */
-+
-+1:
-+	cache	0x0, 0($8)		/* Index_Invalidate_I */
-+	cache	0x1, 0($8)		/* Index_Writeback_Inv_D */
-+	bne	$8, $9, 1b
-+	addiu	$8, $8, 32
-+
-+	/* flush write-buffer */
-+	sync
-+
-+	/* Invalidate BTB */
-+	mfc0	$8, $16, 7		/* CP0_CONFIG */
-+	nop
-+	ori	$8, 2
-+	mtc0	$8, $16, 7
-+	nop
-+
-+	/* Overwrite config to disable ram initalisation */
-+	li $2, 0xff
-+	sb $2, 20($20)
-+
-+	jalr	$20
-+	nop
-+
-+icache_return:
-+	/* User code can return to here after executing itself in
-+	  icache, by jumping to $31. */
-+	b	usb_boot_return
-+	nop
-+
-+
-+usb_boot_return:
-+	/* Enable the USB PHY */
-+	la	$9, 0xB0000024		/* CPM_SCR */
-+	lw	$8, 0($9)
-+	ori	$8, 0x40		/* USBPHY_ENABLE */
-+	sw	$8, 0($9)
-+
-+	/* Initialize USB registers */
-+	la	$27, 0xb3040000	/* USB registers base address */
-+
-+	sb	$0, 0x0b($27)	/* INTRUSBE: disable common USB interrupts */
-+	sh	$0, 0x06($27)	/* INTRINE: disable EPIN interrutps */
-+	sh	$0, 0x08($27)	/* INTROUTE: disable EPOUT interrutps */
-+
-+	li	$9, 0x61
-+	sb	$9, 0x01($27)	/* POWER: HSENAB | SUSPENDM | SOFTCONN */
-+
-+	/* Initialize USB states */
-+	li	$22, 0			/* set EP0 to IDLE state */
-+	li	$23, 1			/* no data stage */
-+
-+	/* Main loop of polling the usb commands */
-+usb_command_loop:
-+	lbu	$9, 0x0a($27)		/* read INTRUSB */
-+	andi	$9, 0x04		/* check USB_INTR_RESET */
-+	beqz	$9, check_intr_ep0in
-+	nop
-+
-+ 	/* 1. Handle USB reset interrupt */
-+handle_reset_intr:
-+	lbu	$9, 0x01($27)		/* read POWER */
-+	andi	$9, 0x10		/* test HS_MODE */
-+	bnez	$9, _usb_set_maxpktsize
-+	li	$9, 512			/* max packet size of HS mode */
-+	li	$9, 64			/* max packet size of FS mode */
-+
-+_usb_set_maxpktsize:
-+	li	$8, 1
-+	sb	$8, 0x0e($27)		/* set INDEX 1 */
-+
-+	sh	$9, 0x10($27)		/* INMAXP */
-+	sb	$0, 0x13($27)		/* INCSRH */
-+	sh	$9, 0x14($27)		/* OUTMAXP */
-+	sb	$0, 0x17($27)		/* OUTCSRH */
-+
-+_usb_flush_fifo:
-+	li	$8, 0x48		/* INCSR_CDT && INCSR_FF */
-+	sb	$8, 0x12($27)		/* INCSR */
-+	li	$8, 0x90		/* OUTCSR_CDT && OUTCSR_FF */
-+	sb	$8, 0x16($27)		/* OUTCSR */
-+
-+	li	$22, 0			/* set EP0 to IDLE state */
-+	li	$23, 1			/* no data stage */
-+
-+	/* 2. Check and handle EP0 interrupt */
-+check_intr_ep0in:
-+	lhu	$10, 0x02($27)		/* read INTRIN */
-+	andi	$9, $10, 0x1		/* check EP0 interrupt */
-+	beqz	$9, check_intr_ep1in
-+	nop
-+
-+handle_ep0_intr:
-+	sb	$0, 0x0e($27)		/* set INDEX 0 */
-+	lbu	$11, 0x12($27)		/* read CSR0 */
-+
-+	andi	$9, $11, 0x04		/* check SENTSTALL */
-+	beqz	$9, _ep0_setupend
-+	nop
-+
-+_ep0_sentstall:
-+	andi	$9, $11, 0xdb
-+	sb	$9, 0x12($27)		/* clear SENDSTALL and SENTSTALL */
-+	li	$22, 0			/* set EP0 to IDLE state */
-+
-+_ep0_setupend:
-+	andi	$9, $11, 0x10		/* check SETUPEND */
-+	beqz	$9, ep0_idle_state
-+	nop
-+
-+	ori	$9, $11, 0x80
-+	sb	$9, 0x12($27)		/* set SVDSETUPEND */
-+	li	$22, 0			/* set EP0 to IDLE state */
-+
-+ep0_idle_state:
-+	bnez	$22, ep0_tx_state
-+	nop
-+
-+	/* 2.1 Handle EP0 IDLE state interrupt */
-+	andi	$9, $11, 0x01		/* check OUTPKTRDY */
-+	beqz	$9, check_intr_ep1in
-+	nop
-+
-+	/* Read 8-bytes setup packet from the FIFO */
-+	lw	$25, 0x20($27)		/* first word of setup packet */
-+	lw	$26, 0x20($27)		/* second word of setup packet */
-+
-+	andi	$9, $25, 0x60		/* bRequestType & USB_TYPE_MASK */
-+	beqz	$9, _ep0_std_req
-+	nop
-+
-+	/* 2.1.1 Vendor-specific setup request */
-+_ep0_vend_req:
-+	li	$22, 0			/* set EP0 to IDLE state */
-+	li	$23, 1			/* NoData = 1 */
-+
-+	andi	$9, $25, 0xff00		/* check bRequest */
-+	srl	$9, $9, 8
-+	beqz	$9, __ep0_get_cpu_info
-+	sub	$8, $9, 0x1
-+	beqz	$8, __ep0_set_data_address
-+	sub	$8, $9, 0x2
-+	beqz	$8, __ep0_set_data_length
-+	sub	$8, $9, 0x3
-+	beqz	$8, __ep0_flush_caches
-+	sub	$8, $9, 0x4
-+	beqz	$8, __ep0_prog_start1
-+	sub	$8, $9, 0x5
-+	beqz	$8, __ep0_prog_start2
-+	nop
-+	b	_ep0_idle_state_fini	/* invalid request */
-+	nop
-+
-+__ep0_get_cpu_info:
-+	load_addr $20, cpu_info_data	/* data pointer to transfer */
-+	li	$21, 8			/* bytes left to transfer */
-+	li	$22, 1			/* set EP0 to TX state */
-+	li	$23, 0			/* NoData = 0 */
-+
-+	b	_ep0_idle_state_fini
-+	nop
-+
-+__ep0_set_data_address:
-+	li	$9, 0xffff0000
-+	and	$9, $25, $9
-+	andi	$8, $26, 0xffff
-+	or	$20, $9, $8		/* data address of next transfer */
-+
-+	b	_ep0_idle_state_fini
-+	nop
-+
-+__ep0_set_data_length:
-+	li	$9, 0xffff0000
-+	and	$9, $25, $9
-+	andi	$8, $26, 0xffff
-+	or	$21, $9, $8		/* data length of next transfer */
-+
-+	li	$9, 0x48		/* SVDOUTPKTRDY and DATAEND */
-+	sb	$9, 0x12($27)		/* CSR0 */
-+
-+	/* We must write packet to FIFO before EP1-IN interrupt here. */
-+	b	handle_epin1_intr
-+	nop
-+
-+__ep0_flush_caches:
-+	/* Flush dcache and invalidate icache. */
-+	li	$8, 0x80000000
-+	addi	$9, $8, 0x3fe0		/* total 16KB */
-+
-+1:
-+	cache	0x0, 0($8)		/* Index_Invalidate_I */
-+	cache	0x1, 0($8)		/* Index_Writeback_Inv_D */
-+	bne	$8, $9, 1b
-+	addiu	$8, $8, 32
-+
-+	/* flush write-buffer */
-+	sync
-+
-+	/* Invalidate BTB */
-+	mfc0	$8, $16, 7		/* CP0_CONFIG */
-+	nop
-+	ori	$8, 2
-+	mtc0	$8, $16, 7
-+	nop
-+
-+	b	_ep0_idle_state_fini
-+	nop
-+
-+__ep0_prog_start1:
-+	li	$9, 0x48		/* SVDOUTPKTRDY and DATAEND */
-+	sb	$9, 0x12($27)		/* CSR0 */
-+
-+	li	$9, 0xffff0000
-+	and	$9, $25, $9
-+	andi	$8, $26, 0xffff
-+	or	$20, $9, $8		/* target address */
-+
-+	b	xfer_d2i
-+	li	$19, 0x2000		/* 16KB data length */
-+
-+__ep0_prog_start2:
-+	li	$9, 0x48		/* SVDOUTPKTRDY and DATAEND */
-+	sb	$9, 0x12($27)		/* CSR0 */
-+
-+	li	$9, 0xffff0000
-+	and	$9, $25, $9
-+	andi	$8, $26, 0xffff
-+	or	$20, $9, $8		/* target address */
-+
-+	jalr	$20		/* jump, and place the return address in $31 */
-+	nop
-+
-+__ep0_prog_start2_return:
-+/* User code can return to here after executing itself, by jumping to $31 */
-+	b	usb_boot_return
-+	nop
-+
-+	/* 2.1.2 Standard setup request */
-+_ep0_std_req:
-+	andi	$12, $25, 0xff00	/* check bRequest */
-+	srl	$12, $12, 8
-+	sub	$9, $12, 0x05		/* check USB_REQ_SET_ADDRESS */
-+	bnez	$9, __ep0_req_set_config
-+	nop
-+
-+	/* Handle USB_REQ_SET_ADDRESS */
-+__ep0_req_set_addr:
-+	srl	$9, $25, 16		/* get wValue */
-+	sb	$9, 0x0($27)		/* set FADDR */
-+	li	$23, 1			/* NoData = 1 */
-+	b	_ep0_idle_state_fini
-+	nop
-+
-+__ep0_req_set_config:
-+	sub	$9, $12, 0x09		/* check USB_REQ_SET_CONFIGURATION */
-+	bnez	$9, __ep0_req_get_desc
-+	nop
-+
-+	/* Handle USB_REQ_SET_CONFIGURATION */
-+	li	$23, 1			/* NoData = 1 */
-+	b	_ep0_idle_state_fini
-+	nop
-+
-+__ep0_req_get_desc:
-+	sub	$9, $12, 0x06		/* check USB_REQ_GET_DESCRIPTOR */
-+	bnez	$9, _ep0_idle_state_fini
-+	li	$23, 1			/* NoData = 1 */
-+
-+	/* Handle USB_REQ_GET_DESCRIPTOR */
-+	li	$23, 0			/* NoData = 0 */
-+
-+	srl	$9, $25, 24		/* wValue >> 8 */
-+	sub	$8, $9, 0x01		/* check USB_DT_DEVICE */
-+	beqz	$8, ___ep0_get_dev_desc
-+	srl	$21, $26, 16		/* get wLength */
-+	sub	$8, $9, 0x02		/* check USB_DT_CONFIG */
-+	beqz	$8, ___ep0_get_conf_desc
-+	sub	$8, $9, 0x03		/* check USB_DT_STRING */
-+	beqz	$8, ___ep0_get_string_desc
-+	sub	$8, $9, 0x06		/* check USB_DT_DEVICE_QUALIFIER */
-+	beqz	$8, ___ep0_get_dev_qualifier
-+	nop
-+	b	_ep0_idle_state_fini
-+	nop
-+
-+___ep0_get_dev_desc:
-+	load_addr	$20, device_desc	/* data pointer */
-+	li	$22, 1			/* set EP0 to TX state */
-+	sub	$8, $21, 18
-+	blez	$8, _ep0_idle_state_fini /* wLength <= 18 */
-+	nop
-+	li	$21, 18			/* max length of device_desc */
-+	b	_ep0_idle_state_fini
-+	nop
-+
-+___ep0_get_dev_qualifier:
-+	load_addr	$20, dev_qualifier	/* data pointer */
-+	li	$22, 1			/* set EP0 to TX state */
-+	sub	$8, $21, 10
-+	blez	$8, _ep0_idle_state_fini /* wLength <= 10 */
-+	nop
-+	li	$21, 10			/* max length of dev_qualifier */
-+	b	_ep0_idle_state_fini
-+	nop
-+
-+___ep0_get_conf_desc:
-+	load_addr	$20, config_desc_fs	/* data pointer of FS mode */
-+	lbu	$8, 0x01($27)		/* read POWER */
-+	andi	$8, 0x10		/* test HS_MODE */
-+	beqz	$8, ___ep0_get_conf_desc2
-+	nop
-+	load_addr $20, config_desc_hs	/* data pointer of HS mode */
-+
-+___ep0_get_conf_desc2:
-+	li	$22, 1			/* set EP0 to TX state */
-+	sub	$8, $21, 32
-+	blez	$8, _ep0_idle_state_fini /* wLength <= 32 */
-+	nop
-+	li	$21, 32			/* max length of config_desc */
-+	b	_ep0_idle_state_fini
-+	nop
-+
-+___ep0_get_string_desc:
-+	li	$22, 1			/* set EP0 to TX state */
-+
-+	srl	$9, $25, 16		/* wValue & 0xff */
-+	andi	$9, 0xff
-+
-+	sub	$8, $9, 1
-+	beqz	$8, ___ep0_get_string_manufacture
-+	sub	$8, $9, 2
-+	beqz	$8, ___ep0_get_string_product
-+	nop
-+
-+___ep0_get_string_lang_ids:
-+	load_addr	$20, string_lang_ids	/* data pointer */
-+	b	_ep0_idle_state_fini
-+	li	$21, 4			/* data length */
-+
-+___ep0_get_string_manufacture:
-+	load_addr	$20, string_manufacture	/* data pointer */
-+	b	_ep0_idle_state_fini
-+	li	$21, 16			/* data length */
-+
-+___ep0_get_string_product:
-+	load_addr	$20, string_product	/* data pointer */
-+	b	_ep0_idle_state_fini
-+	li	$21, 46			/* data length */
-+
-+_ep0_idle_state_fini:
-+	li	$9, 0x40		/* SVDOUTPKTRDY */
-+	beqz	$23, _ep0_idle_state_fini2
-+	nop
-+	ori	$9, $9, 0x08		/* DATAEND */
-+_ep0_idle_state_fini2:
-+	sb	$9, 0x12($27)		/* CSR0 */
-+	beqz	$22, check_intr_ep1in
-+	nop
-+
-+	/* 2.2 Handle EP0 TX state interrupt */
-+ep0_tx_state:
-+	sub	$9, $22, 1
-+	bnez	$9, check_intr_ep1in
-+	nop
-+
-+	sub	$9, $21, 64		/* max packetsize */
-+	blez	$9, _ep0_tx_state2	/* data count <= 64 */
-+	ori	$19, $21, 0
-+	li	$19, 64
-+
-+_ep0_tx_state2:
-+	beqz	$19, _ep0_tx_state3	/* send ZLP */
-+	ori	$18, $19, 0		/* record bytes to be transferred */
-+	sub	$21, $21, $19		/* decrement data count */
-+
-+_ep0_fifo_write_loop:
-+	lbu	$9, 0($20)		/* read data */
-+	sb	$9, 0x20($27)		/* load FIFO */
-+	sub	$19, $19, 1		/* decrement counter */
-+	bnez	$19, _ep0_fifo_write_loop
-+	addi	$20, $20, 1		/* increment data pointer */
-+
-+	sub	$9, $18, 64		/* max packetsize */
-+	beqz	$9, _ep0_tx_state4
-+	nop
-+
-+_ep0_tx_state3:
-+	/* transferred bytes < max packetsize */
-+	li	$9, 0x0a		/* set INPKTRDY and DATAEND */
-+	sb	$9, 0x12($27)		/* CSR0 */
-+	li	$22, 0			/* set EP0 to IDLE state */
-+	b	check_intr_ep1in
-+	nop
-+
-+_ep0_tx_state4:
-+	/* transferred bytes == max packetsize */
-+	li	$9, 0x02		/* set INPKTRDY */
-+	sb	$9, 0x12($27)		/* CSR0 */
-+	b	check_intr_ep1in
-+	nop
-+
-+	/* 3. Check and handle EP1 BULK-IN interrupt */
-+check_intr_ep1in:
-+	andi	$9, $10, 0x2		/* check EP1 IN interrupt */
-+	beqz	$9, check_intr_ep1out
-+	nop
-+
-+handle_epin1_intr:
-+	li	$9, 1
-+	sb	$9, 0x0e($27)		/* set INDEX 1 */
-+	lbu	$9, 0x12($27)		/* read INCSR */
-+
-+	andi	$8, $9, 0x2		/* check INCSR_FFNOTEMPT */
-+	bnez	$8, _epin1_tx_state4
-+	nop
-+
-+_epin1_write_fifo:
-+	lhu	$9, 0x10($27)		/* get INMAXP */
-+	sub	$8, $21, $9
-+	blez	$8, _epin1_tx_state1	/* bytes left <= INMAXP */
-+	ori	$19, $21, 0
-+	ori	$19, $9, 0
-+
-+_epin1_tx_state1:
-+	beqz	$19, _epin1_tx_state4	/* No data */
-+	nop
-+
-+	sub	$21, $21, $19		/* decrement data count */
-+
-+	srl	$5, $19, 2		/* # of word */
-+	andi	$6, $19, 0x3		/* # of byte */
-+	beqz	$5, _epin1_tx_state2
-+	nop
-+
-+_epin1_fifo_write_word:
-+	lw	$9, 0($20)		/* read data from source address */
-+	sw	$9, 0x24($27)		/* write FIFO */
-+	sub	$5, $5, 1		/* decrement counter */
-+	bnez	$5, _epin1_fifo_write_word
-+	addiu	$20, $20, 4		/* increment dest address */
-+
-+_epin1_tx_state2:
-+	beqz	$6, _epin1_tx_state3
-+	nop
-+
-+_epin1_fifo_write_byte:
-+	lbu	$9, 0($20)		/* read data from source address */
-+	sb	$9, 0x24($27)		/* write FIFO */
-+	sub	$6, $6, 1		/* decrement counter */
-+	bnez	$6, _epin1_fifo_write_byte
-+	addiu	$20, $20, 1		/* increment dest address */
-+
-+_epin1_tx_state3:
-+	li	$9, 0x1
-+	sb	$9, 0x12($27)		/* INCSR, set INPKTRDY */
-+
-+_epin1_tx_state4:
-+	/* 4. Check and handle EP1 BULK-OUT interrupt */
-+check_intr_ep1out:
-+	lhu	$9, 0x04($27)		/* read INTROUT */
-+	andi	$9, 0x2
-+	beqz	$9, check_status_next
-+	nop
-+
-+handle_epout1_intr:
-+	li	$9, 1
-+	sb	$9, 0x0e($27)		/* set INDEX 1 */
-+
-+	lbu	$9, 0x16($27)		/* read OUTCSR */
-+	andi	$9, 0x1			/* check OUTPKTRDY */
-+	beqz	$9, check_status_next
-+	nop
-+
-+_epout1_read_fifo:
-+	lhu	$19, 0x18($27)		/* read OUTCOUNT */
-+	srl	$5, $19, 2		/* # of word */
-+	andi	$6, $19, 0x3		/* # of byte */
-+	beqz	$5, _epout1_rx_state1
-+	nop
-+
-+_epout1_fifo_read_word:
-+	lw	$9, 0x24($27)		/* read FIFO */
-+	sw	$9, 0($20)		/* store to dest address */
-+	sub	$5, $5, 1		/* decrement counter */
-+	bnez	$5, _epout1_fifo_read_word
-+	addiu	$20, $20, 4		/* increment dest address */
-+
-+_epout1_rx_state1:
-+	beqz	$6, _epout1_rx_state2
-+	nop
-+
-+_epout1_fifo_read_byte:
-+	lbu	$9, 0x24($27)		/* read FIFO */
-+	sb	$9, 0($20)		/* store to dest address */
-+	sub	$6, $6, 1		/* decrement counter */
-+	bnez	$6, _epout1_fifo_read_byte
-+	addiu	$20, $20, 1		/* increment dest address */
-+
-+_epout1_rx_state2:
-+	sb	$0, 0x16($27)		/* clear OUTPKTRDY */
-+
-+check_status_next:
-+	b	usb_command_loop
-+	nop
-+
-+/* Device/Configuration/Interface/Endpoint/String Descriptors */
-+
-+	.align	2
-+device_desc:
-+	.byte	0x12		/* bLength */
-+	.byte	0x01		/* bDescriptorType */
-+	.byte	0x00		/* bcdUSB */
-+	.byte	0x02		/* bcdUSB */
-+	.byte	0x00		/* bDeviceClass */
-+	.byte	0x00		/* bDeviceSubClass */
-+	.byte	0x00		/* bDeviceProtocol */
-+	.byte	0x40		/* bMaxPacketSize0 */
-+	.byte	0x1a		/* idVendor */
-+	.byte	0x60		/* idVendor */
-+	.byte	0x40		/* idProduct */
-+	.byte	0x47		/* idProduct */
-+	.byte	0x00		/* bcdDevice */
-+	.byte	0x01		/* bcdDevice */
-+	.byte	0x01		/* iManufacturer */
-+	.byte	0x02		/* iProduct */
-+	.byte	0x00		/* iSerialNumber */
-+	.byte	0x01		/* bNumConfigurations */
-+
-+	.align	2
-+dev_qualifier:
-+	.byte	0x0a		/* bLength */
-+	.byte	0x06		/* bDescriptorType */
-+	.byte	0x00		/* bcdUSB */
-+	.byte	0x02		/* bcdUSB */
-+	.byte	0x00		/* bDeviceClass */
-+	.byte	0x00		/* bDeviceSubClass */
-+	.byte	0x00		/* bDeviceProtocol */
-+	.byte	0x40		/* bMaxPacketSize0 */
-+	.byte	0x01		/* bNumConfigurations */
-+	.byte	0x00		/* bRESERVED */
-+
-+	.align	2
-+config_desc_hs:
-+	.byte	0x09		/* bLength */
-+	.byte	0x02		/* bDescriptorType */
-+	.byte	0x20		/* wTotalLength */
-+	.byte	0x00		/* wTotalLength */
-+	.byte	0x01		/* bNumInterfaces */
-+	.byte	0x01		/* bConfigurationValue */
-+	.byte	0x00		/* iConfiguration */
-+	.byte	0xc0		/* bmAttributes */
-+	.byte	0x01		/* MaxPower */
-+intf_desc_hs:
-+	.byte	0x09		/* bLength */
-+	.byte	0x04		/* bDescriptorType */
-+	.byte	0x00		/* bInterfaceNumber */
-+	.byte	0x00		/* bAlternateSetting */
-+	.byte	0x02		/* bNumEndpoints */
-+	.byte	0xff		/* bInterfaceClass */
-+	.byte	0x00		/* bInterfaceSubClass */
-+	.byte	0x50		/* bInterfaceProtocol */
-+	.byte	0x00		/* iInterface */
-+ep1_desc_hs:
-+	.byte	0x07		/* bLength */
-+	.byte	0x05		/* bDescriptorType */
-+	.byte	0x01		/* bEndpointAddress */
-+	.byte	0x02		/* bmAttributes */
-+	.byte	0x00		/* wMaxPacketSize */
-+	.byte	0x02		/* wMaxPacketSize */
-+	.byte	0x00		/* bInterval */
-+ep2_desc_hs:
-+	.byte	0x07		/* bLength */
-+	.byte	0x05		/* bDescriptorType */
-+	.byte	0x81		/* bEndpointAddress */
-+	.byte	0x02		/* bmAttributes */
-+	.byte	0x00		/* wMaxPacketSize */
-+	.byte	0x02		/* wMaxPacketSize */
-+	.byte	0x00		/* bInterval */
-+
-+	.align	2
-+config_desc_fs:
-+	.byte	0x09		/* bLength */
-+	.byte	0x02		/* bDescriptorType */
-+	.byte	0x20		/* wTotalLength */
-+	.byte	0x00		/* wTotalLength */
-+	.byte	0x01		/* bNumInterfaces */
-+	.byte	0x01		/* bConfigurationValue */
-+	.byte	0x00		/* iConfiguration */
-+	.byte	0xc0		/* bmAttributes */
-+	.byte	0x01		/* MaxPower */
-+intf_desc_fs:
-+	.byte	0x09		/* bLength */
-+	.byte	0x04		/* bDescriptorType */
-+	.byte	0x00		/* bInterfaceNumber */
-+	.byte	0x00		/* bAlternateSetting */
-+	.byte	0x02		/* bNumEndpoints */
-+	.byte	0xff		/* bInterfaceClass */
-+	.byte	0x00		/* bInterfaceSubClass */
-+	.byte	0x50		/* bInterfaceProtocol */
-+	.byte	0x00		/* iInterface */
-+ep1_desc_fs:
-+	.byte	0x07		/* bLength */
-+	.byte	0x05		/* bDescriptorType */
-+	.byte	0x01		/* bEndpointAddress */
-+	.byte	0x02		/* bmAttributes */
-+	.byte	0x40		/* wMaxPacketSize */
-+	.byte	0x00		/* wMaxPacketSize */
-+	.byte	0x00		/* bInterval */
-+ep2_desc_fs:
-+	.byte	0x07		/* bLength */
-+	.byte	0x05		/* bDescriptorType */
-+	.byte	0x81		/* bEndpointAddress */
-+	.byte	0x02		/* bmAttributes */
-+	.byte	0x40		/* wMaxPacketSize */
-+	.byte	0x00		/* wMaxPacketSize */
-+	.byte	0x00		/* bInterval */
-+
-+	.align	2
-+string_lang_ids:
-+	.byte	0x04
-+	.byte	0x03
-+	.byte	0x09
-+	.byte	0x04
-+
-+	.align	2
-+string_manufacture:
-+	.byte	0x10
-+	.byte	0x03
-+	.byte	0x49
-+	.byte	0x00
-+	.byte	0x6e
-+	.byte	0x00
-+	.byte	0x67
-+	.byte	0x00
-+	.byte	0x65
-+	.byte	0x00
-+	.byte	0x6e
-+	.byte	0x00
-+	.byte	0x69
-+	.byte	0x00
-+	.byte	0x63
-+	.byte	0x00
-+
-+	.align	2
-+string_product:
-+	.byte	0x2e
-+	.byte	0x03
-+	.byte	0x4a
-+	.byte	0x00
-+	.byte	0x5a
-+	.byte	0x00
-+	.byte	0x34
-+	.byte	0x00
-+	.byte	0x37
-+	.byte	0x00
-+	.byte	0x34
-+	.byte	0x00
-+	.byte	0x30
-+	.byte	0x00
-+	.byte	0x20
-+	.byte	0x00
-+	.byte	0x55
-+	.byte	0x00
-+	.byte	0x53
-+	.byte	0x00
-+	.byte	0x42
-+	.byte	0x00
-+	.byte	0x20
-+	.byte	0x00
-+	.byte	0x42
-+	.byte	0x00
-+	.byte	0x6f
-+	.byte	0x00
-+	.byte	0x6f
-+	.byte	0x00
-+	.byte	0x74
-+	.byte	0x00
-+	.byte	0x20
-+	.byte	0x00
-+	.byte	0x44
-+	.byte	0x00
-+	.byte	0x65
-+	.byte	0x00
-+	.byte	0x76
-+	.byte	0x00
-+	.byte	0x69
-+	.byte	0x00
-+	.byte	0x63
-+	.byte	0x00
-+	.byte	0x65
-+	.byte	0x00
-+
-+	.align	2
-+cpu_info_data:
-+	.byte	0x4a
-+	.byte	0x5a
-+	.byte	0x34
-+	.byte	0x37
-+	.byte	0x34
-+	.byte	0x30
-+	.byte	0x56
-+	.byte	0x31
-+usbboot_end:
-+
-+    .set reorder
--- 
-1.7.9.5
-

+ 0 - 1664
package/boot/uboot-xburst/patches/0003-add-mmc-support.patch

@@ -1,1664 +0,0 @@
-From bd36739e77669e8df45c38f6acfe2cea511534d9 Mon Sep 17 00:00:00 2001
-From: Xiangfu <xiangfu@openmobilefree.net>
-Date: Wed, 10 Oct 2012 18:19:41 +0800
-Subject: [PATCH 3/6] add mmc support
-
----
- arch/mips/include/asm/jz4740.h |  166 ++++++
- board/qi/qi_lb60/qi_lb60.c     |    9 +-
- drivers/mmc/Makefile           |    1 +
- drivers/mmc/jz_mmc.c           | 1179 ++++++++++++++++++++++++++++++++++++++++
- drivers/mmc/jz_mmc.h           |  176 ++++++
- include/configs/qi_lb60.h      |    9 +
- include/mmc.h                  |   40 ++
- 7 files changed, 1578 insertions(+), 2 deletions(-)
- create mode 100644 drivers/mmc/jz_mmc.c
- create mode 100644 drivers/mmc/jz_mmc.h
-
-diff --git a/arch/mips/include/asm/jz4740.h b/arch/mips/include/asm/jz4740.h
-index 7a7cfff..68287fb 100644
---- a/arch/mips/include/asm/jz4740.h
-+++ b/arch/mips/include/asm/jz4740.h
-@@ -1146,5 +1146,171 @@ extern void sdram_init(void);
- extern void calc_clocks(void);
- extern void rtc_init(void);
- 
-+/*************************************************************************
-+ * MSC
-+ *************************************************************************/
-+#define REG8(addr)	*((volatile u8 *)(addr))
-+#define REG16(addr)	*((volatile u16 *)(addr))
-+#define REG32(addr)	*((volatile u32 *)(addr))
-+
-+#define	CPM_BASE	0xB0000000
-+#define CPM_CPCCR	(CPM_BASE+0x00)
-+#define CPM_MSCCDR	(CPM_BASE+0x68)
-+#define REG_CPM_MSCCDR	REG32(CPM_MSCCDR)
-+#define REG_CPM_CPCCR	REG32(CPM_CPCCR)
-+
-+#define	MSC_BASE	0xB0021000
-+
-+#define	MSC_STRPCL		(MSC_BASE + 0x000)
-+#define	MSC_STAT		(MSC_BASE + 0x004)
-+#define	MSC_CLKRT		(MSC_BASE + 0x008)
-+#define	MSC_CMDAT		(MSC_BASE + 0x00C)
-+#define	MSC_RESTO		(MSC_BASE + 0x010)
-+#define	MSC_RDTO		(MSC_BASE + 0x014)
-+#define	MSC_BLKLEN		(MSC_BASE + 0x018)
-+#define	MSC_NOB			(MSC_BASE + 0x01C)
-+#define	MSC_SNOB		(MSC_BASE + 0x020)
-+#define	MSC_IMASK		(MSC_BASE + 0x024)
-+#define	MSC_IREG		(MSC_BASE + 0x028)
-+#define	MSC_CMD			(MSC_BASE + 0x02C)
-+#define	MSC_ARG			(MSC_BASE + 0x030)
-+#define	MSC_RES			(MSC_BASE + 0x034)
-+#define	MSC_RXFIFO		(MSC_BASE + 0x038)
-+#define	MSC_TXFIFO		(MSC_BASE + 0x03C)
-+
-+#define	REG_MSC_STRPCL		REG16(MSC_STRPCL)
-+#define	REG_MSC_STAT		REG32(MSC_STAT)
-+#define	REG_MSC_CLKRT		REG16(MSC_CLKRT)
-+#define	REG_MSC_CMDAT		REG32(MSC_CMDAT)
-+#define	REG_MSC_RESTO		REG16(MSC_RESTO)
-+#define	REG_MSC_RDTO		REG16(MSC_RDTO)
-+#define	REG_MSC_BLKLEN		REG16(MSC_BLKLEN)
-+#define	REG_MSC_NOB		REG16(MSC_NOB)
-+#define	REG_MSC_SNOB		REG16(MSC_SNOB)
-+#define	REG_MSC_IMASK		REG16(MSC_IMASK)
-+#define	REG_MSC_IREG		REG16(MSC_IREG)
-+#define	REG_MSC_CMD		REG8(MSC_CMD)
-+#define	REG_MSC_ARG		REG32(MSC_ARG)
-+#define	REG_MSC_RES		REG16(MSC_RES)
-+#define	REG_MSC_RXFIFO		REG32(MSC_RXFIFO)
-+#define	REG_MSC_TXFIFO		REG32(MSC_TXFIFO)
-+
-+/* MSC Clock and Control Register (MSC_STRPCL) */
-+
-+#define MSC_STRPCL_EXIT_MULTIPLE	(1 << 7)
-+#define MSC_STRPCL_EXIT_TRANSFER	(1 << 6)
-+#define MSC_STRPCL_START_READWAIT	(1 << 5)
-+#define MSC_STRPCL_STOP_READWAIT	(1 << 4)
-+#define MSC_STRPCL_RESET		(1 << 3)
-+#define MSC_STRPCL_START_OP		(1 << 2)
-+#define MSC_STRPCL_CLOCK_CONTROL_BIT	0
-+#define MSC_STRPCL_CLOCK_CONTROL_MASK	(0x3 << MSC_STRPCL_CLOCK_CONTROL_BIT)
-+  #define MSC_STRPCL_CLOCK_CONTROL_STOP	  (0x1 << MSC_STRPCL_CLOCK_CONTROL_BIT) /* Stop MMC/SD clock */
-+  #define MSC_STRPCL_CLOCK_CONTROL_START  (0x2 << MSC_STRPCL_CLOCK_CONTROL_BIT) /* Start MMC/SD clock */
-+
-+/* MSC Status Register (MSC_STAT) */
-+
-+#define MSC_STAT_IS_RESETTING		(1 << 15)
-+#define MSC_STAT_SDIO_INT_ACTIVE	(1 << 14)
-+#define MSC_STAT_PRG_DONE		(1 << 13)
-+#define MSC_STAT_DATA_TRAN_DONE		(1 << 12)
-+#define MSC_STAT_END_CMD_RES		(1 << 11)
-+#define MSC_STAT_DATA_FIFO_AFULL	(1 << 10)
-+#define MSC_STAT_IS_READWAIT		(1 << 9)
-+#define MSC_STAT_CLK_EN			(1 << 8)
-+#define MSC_STAT_DATA_FIFO_FULL		(1 << 7)
-+#define MSC_STAT_DATA_FIFO_EMPTY	(1 << 6)
-+#define MSC_STAT_CRC_RES_ERR		(1 << 5)
-+#define MSC_STAT_CRC_READ_ERROR		(1 << 4)
-+#define MSC_STAT_CRC_WRITE_ERROR_BIT	2
-+#define MSC_STAT_CRC_WRITE_ERROR_MASK	(0x3 << MSC_STAT_CRC_WRITE_ERROR_BIT)
-+  #define MSC_STAT_CRC_WRITE_ERROR_NO		(0 << MSC_STAT_CRC_WRITE_ERROR_BIT) /* No error on transmission of data */
-+  #define MSC_STAT_CRC_WRITE_ERROR		(1 << MSC_STAT_CRC_WRITE_ERROR_BIT) /* Card observed erroneous transmission of data */
-+  #define MSC_STAT_CRC_WRITE_ERROR_NOSTS	(2 << MSC_STAT_CRC_WRITE_ERROR_BIT) /* No CRC status is sent back */
-+#define MSC_STAT_TIME_OUT_RES		(1 << 1)
-+#define MSC_STAT_TIME_OUT_READ		(1 << 0)
-+
-+/* MSC Bus Clock Control Register (MSC_CLKRT) */
-+
-+#define	MSC_CLKRT_CLK_RATE_BIT		0
-+#define	MSC_CLKRT_CLK_RATE_MASK		(0x7 << MSC_CLKRT_CLK_RATE_BIT)
-+  #define MSC_CLKRT_CLK_RATE_DIV_1	  (0x0 << MSC_CLKRT_CLK_RATE_BIT) /* CLK_SRC */
-+  #define MSC_CLKRT_CLK_RATE_DIV_2	  (0x1 << MSC_CLKRT_CLK_RATE_BIT) /* 1/2 of CLK_SRC */
-+  #define MSC_CLKRT_CLK_RATE_DIV_4	  (0x2 << MSC_CLKRT_CLK_RATE_BIT) /* 1/4 of CLK_SRC */
-+  #define MSC_CLKRT_CLK_RATE_DIV_8	  (0x3 << MSC_CLKRT_CLK_RATE_BIT) /* 1/8 of CLK_SRC */
-+  #define MSC_CLKRT_CLK_RATE_DIV_16	  (0x4 << MSC_CLKRT_CLK_RATE_BIT) /* 1/16 of CLK_SRC */
-+  #define MSC_CLKRT_CLK_RATE_DIV_32	  (0x5 << MSC_CLKRT_CLK_RATE_BIT) /* 1/32 of CLK_SRC */
-+  #define MSC_CLKRT_CLK_RATE_DIV_64	  (0x6 << MSC_CLKRT_CLK_RATE_BIT) /* 1/64 of CLK_SRC */
-+  #define MSC_CLKRT_CLK_RATE_DIV_128	  (0x7 << MSC_CLKRT_CLK_RATE_BIT) /* 1/128 of CLK_SRC */
-+
-+/* MSC Command Sequence Control Register (MSC_CMDAT) */
-+
-+#define	MSC_CMDAT_IO_ABORT	(1 << 11)
-+#define	MSC_CMDAT_BUS_WIDTH_BIT	9
-+#define	MSC_CMDAT_BUS_WIDTH_MASK (0x3 << MSC_CMDAT_BUS_WIDTH_BIT)
-+#define MSC_CMDAT_BUS_WIDTH_1BIT (0x0 << MSC_CMDAT_BUS_WIDTH_BIT)
-+#define MSC_CMDAT_BUS_WIDTH_4BIT (0x2 << MSC_CMDAT_BUS_WIDTH_BIT)
-+#define	MSC_CMDAT_DMA_EN	(1 << 8)
-+#define	MSC_CMDAT_INIT		(1 << 7)
-+#define	MSC_CMDAT_BUSY		(1 << 6)
-+#define	MSC_CMDAT_STREAM_BLOCK	(1 << 5)
-+#define	MSC_CMDAT_WRITE		(1 << 4)
-+#define	MSC_CMDAT_READ		(0 << 4)
-+#define	MSC_CMDAT_DATA_EN	(1 << 3)
-+#define	MSC_CMDAT_RESPONSE_BIT	0
-+#define	MSC_CMDAT_RESPONSE_MASK	(0x7 << MSC_CMDAT_RESPONSE_BIT)
-+#define MSC_CMDAT_RESPONSE_NONE	(0x0 << MSC_CMDAT_RESPONSE_BIT)
-+#define MSC_CMDAT_RESPONSE_R1	(0x1 << MSC_CMDAT_RESPONSE_BIT)
-+#define MSC_CMDAT_RESPONSE_R2	(0x2 << MSC_CMDAT_RESPONSE_BIT)
-+#define MSC_CMDAT_RESPONSE_R3	(0x3 << MSC_CMDAT_RESPONSE_BIT)
-+#define MSC_CMDAT_RESPONSE_R4	(0x4 << MSC_CMDAT_RESPONSE_BIT)
-+#define MSC_CMDAT_RESPONSE_R5	(0x5 << MSC_CMDAT_RESPONSE_BIT)
-+#define MSC_CMDAT_RESPONSE_R6	(0x6 << MSC_CMDAT_RESPONSE_BIT)
-+
-+/* MSC Interrupts Mask Register (MSC_IMASK) */
-+#define	MSC_IMASK_SDIO			(1 << 7)
-+#define	MSC_IMASK_TXFIFO_WR_REQ		(1 << 6)
-+#define	MSC_IMASK_RXFIFO_RD_REQ		(1 << 5)
-+#define	MSC_IMASK_END_CMD_RES		(1 << 2)
-+#define	MSC_IMASK_PRG_DONE		(1 << 1)
-+#define	MSC_IMASK_DATA_TRAN_DONE	(1 << 0)
-+
-+
-+/* MSC Interrupts Status Register (MSC_IREG) */
-+#define	MSC_IREG_SDIO			(1 << 7)
-+#define	MSC_IREG_TXFIFO_WR_REQ		(1 << 6)
-+#define	MSC_IREG_RXFIFO_RD_REQ		(1 << 5)
-+#define	MSC_IREG_END_CMD_RES		(1 << 2)
-+#define	MSC_IREG_PRG_DONE		(1 << 1)
-+#define	MSC_IREG_DATA_TRAN_DONE		(1 << 0)
-+
-+static __inline__ unsigned int __cpm_get_pllout2(void)
-+{
-+	if (REG_CPM_CPCCR & CPM_CPCCR_PCS)
-+		return __cpm_get_pllout();
-+	else
-+		return __cpm_get_pllout()/2;
-+}
-+
-+static inline void __cpm_select_msc_clk(int sd)
-+{
-+	unsigned int pllout2 = __cpm_get_pllout2();
-+	unsigned int div = 0;
-+
-+	if (sd) {
-+		div = pllout2 / 24000000;
-+	}
-+	else {
-+		div = pllout2 / 16000000;
-+	}
-+
-+	REG_CPM_MSCCDR = div - 1;
-+}
-+#define __msc_reset() 						\
-+do { 								\
-+	REG_MSC_STRPCL = MSC_STRPCL_RESET;			\
-+ 	while (REG_MSC_STAT & MSC_STAT_IS_RESETTING);		\
-+} while (0)
-+
- #endif	/* !__ASSEMBLY__ */
- #endif	/* __JZ4740_H__ */
-diff --git a/board/qi/qi_lb60/qi_lb60.c b/board/qi/qi_lb60/qi_lb60.c
-index 3bd4e2f..a2ba648 100644
---- a/board/qi/qi_lb60/qi_lb60.c
-+++ b/board/qi/qi_lb60/qi_lb60.c
-@@ -40,8 +40,13 @@ static void gpio_init(void)
- 		__gpio_clear_pin(GPIO_KEYOUT_BASE + i);
- 	}
- 
--	__gpio_as_input(GPIO_KEYIN_8);
--	__gpio_enable_pull(GPIO_KEYIN_8);
-+	if (__gpio_get_pin(GPIO_KEYIN_BASE + 2) == 0){
-+		printf("[S] pressed, enable UART0\n");
-+		__gpio_as_uart0();
-+	} else {
-+		__gpio_as_input(GPIO_KEYIN_8);
-+		__gpio_enable_pull(GPIO_KEYIN_8);
-+	}
- 
- 	/* enable the TP4, TP5 as UART0 */
- 	__gpio_jtag_to_uart0();
-diff --git a/drivers/mmc/Makefile b/drivers/mmc/Makefile
-index 565ba6a..3c717b1 100644
---- a/drivers/mmc/Makefile
-+++ b/drivers/mmc/Makefile
-@@ -47,6 +47,7 @@ COBJS-$(CONFIG_SDHCI) += sdhci.o
- COBJS-$(CONFIG_S5P_SDHCI) += s5p_sdhci.o
- COBJS-$(CONFIG_SH_MMCIF) += sh_mmcif.o
- COBJS-$(CONFIG_TEGRA_MMC) += tegra_mmc.o
-+COBJS-$(CONFIG_JZ4740_MMC) += jz_mmc.o
- 
- COBJS	:= $(COBJS-y)
- SRCS	:= $(COBJS:.o=.c)
-diff --git a/drivers/mmc/jz_mmc.c b/drivers/mmc/jz_mmc.c
-new file mode 100644
-index 0000000..642cecc
---- /dev/null
-+++ b/drivers/mmc/jz_mmc.c
-@@ -0,0 +1,1179 @@
-+/*
-+ * (C) Copyright 2003
-+ * Kyle Harris, Nexus Technologies, Inc. kharris@nexus-tech.net
-+ *
-+ * See file CREDITS for list of people who contributed to this
-+ * project.
-+ *
-+ * This program is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU General Public License as
-+ * published by the Free Software Foundation; either version 2 of
-+ * the License, or (at your option) any later version.
-+ *
-+ * This program is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+ * GNU General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU General Public License
-+ * along with this program; if not, write to the Free Software
-+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-+ * MA 02111-1307 USA
-+ */
-+
-+#include <config.h>
-+#include <common.h>
-+#include <part.h>
-+#include <mmc.h>
-+
-+#include <asm/io.h>
-+#include <asm/jz4740.h>
-+#include "jz_mmc.h"
-+
-+static int sd2_0 = 0;
-+static int mmc_ready = 0;
-+static int use_4bit;		/* Use 4-bit data bus */
-+/*
-+ *  MMC Events
-+ */
-+#define MMC_EVENT_NONE	        0x00	/* No events */
-+#define MMC_EVENT_RX_DATA_DONE	0x01	/* Rx data done */
-+#define MMC_EVENT_TX_DATA_DONE	0x02	/* Tx data done */
-+#define MMC_EVENT_PROG_DONE	0x04	/* Programming is done */
-+
-+
-+#define MMC_IRQ_MASK()				\
-+do {						\
-+      	REG_MSC_IMASK = 0xffff;			\
-+      	REG_MSC_IREG = 0xffff;			\
-+} while (0)
-+
-+/*
-+ * GPIO definition
-+ */
-+#if defined(CONFIG_SAKC)
-+
-+#define __msc_init_io()				\
-+do {						\
-+	__gpio_as_input(GPIO_SD_CD_N);		\
-+} while (0)
-+
-+#else
-+#define __msc_init_io()				\
-+do {						\
-+	__gpio_as_output(GPIO_SD_VCC_EN_N);	\
-+	__gpio_as_input(GPIO_SD_CD_N);		\
-+} while (0)
-+
-+#define __msc_enable_power()			\
-+do {						\
-+	__gpio_clear_pin(GPIO_SD_VCC_EN_N);	\
-+} while (0)
-+
-+#define __msc_disable_power()			\
-+do {						\
-+	__gpio_set_pin(GPIO_SD_VCC_EN_N);	\
-+} while (0)
-+	
-+#endif /* CONFIG_SAKE */
-+
-+#define __msc_card_detected()			\
-+({						\
-+	int detected = 1;			\
-+	__gpio_as_input(GPIO_SD_CD_N);		\
-+	__gpio_disable_pull(GPIO_SD_CD_N);	\
-+	if (!__gpio_get_pin(GPIO_SD_CD_N))	\
-+		detected = 0;			\
-+	detected;				\
-+})
-+
-+/*
-+ * Local functions
-+ */
-+
-+extern int
-+fat_register_device(block_dev_desc_t *dev_desc, int part_no);
-+
-+static block_dev_desc_t mmc_dev;
-+
-+block_dev_desc_t * mmc_get_dev(int dev)
-+{
-+	return ((block_dev_desc_t *)&mmc_dev);
-+}
-+
-+/* Stop the MMC clock and wait while it happens */
-+static inline int jz_mmc_stop_clock(void)
-+{
-+	int timeout = 1000;
-+
-+	REG_MSC_STRPCL = MSC_STRPCL_CLOCK_CONTROL_STOP;
-+
-+	while (timeout && (REG_MSC_STAT & MSC_STAT_CLK_EN)) {
-+		timeout--;
-+		if (timeout == 0)
-+			return MMC_ERROR_TIMEOUT;
-+		udelay(1);
-+	}
-+        return MMC_NO_ERROR;
-+}
-+
-+/* Start the MMC clock and operation */
-+static inline int jz_mmc_start_clock(void)
-+{
-+	REG_MSC_STRPCL = MSC_STRPCL_CLOCK_CONTROL_START | MSC_STRPCL_START_OP;
-+	return MMC_NO_ERROR;
-+}
-+
-+static inline u32 jz_mmc_calc_clkrt(int is_sd, u32 rate)
-+{
-+	u32 clkrt = 0;
-+	u32 clk_src = is_sd ? 24000000 : 16000000;
-+
-+  	while (rate < clk_src) {
-+      		clkrt ++;
-+      		clk_src >>= 1;
-+    	}
-+
-+	return clkrt;
-+}
-+
-+/* Set the MMC clock frequency */
-+void jz_mmc_set_clock(int sd, u32 rate)
-+{
-+	jz_mmc_stop_clock();
-+
-+	/* Select clock source of MSC */
-+	__cpm_select_msc_clk(sd);
-+
-+	/* Set clock dividor of MSC */
-+	REG_MSC_CLKRT = jz_mmc_calc_clkrt(sd, rate);
-+}
-+
-+static int jz_mmc_check_status(struct mmc_request *request)
-+{
-+	u32 status = REG_MSC_STAT;
-+
-+	/* Checking for response or data timeout */
-+	if (status & (MSC_STAT_TIME_OUT_RES | MSC_STAT_TIME_OUT_READ)) {
-+		printf("MMC/SD timeout, MMC_STAT 0x%x CMD %d\n", status, request->cmd);
-+		return MMC_ERROR_TIMEOUT;
-+	}
-+
-+	/* Checking for CRC error */
-+	if (status & (MSC_STAT_CRC_READ_ERROR | MSC_STAT_CRC_WRITE_ERROR | MSC_STAT_CRC_RES_ERR)) {
-+		printf("MMC/CD CRC error, MMC_STAT 0x%x\n", status);
-+		return MMC_ERROR_CRC;
-+	}
-+
-+	return MMC_NO_ERROR;
-+}
-+
-+/* Obtain response to the command and store it to response buffer */
-+static void jz_mmc_get_response(struct mmc_request *request)
-+{
-+	int i;
-+	u8 *buf;
-+	u32 data;
-+
-+	debug("fetch response for request %d, cmd %d\n", 
-+	      request->rtype, request->cmd);
-+
-+	buf = request->response;
-+	request->result = MMC_NO_ERROR;
-+
-+	switch (request->rtype) {
-+	case RESPONSE_R1: case RESPONSE_R1B: case RESPONSE_R6:
-+	case RESPONSE_R3: case RESPONSE_R4: case RESPONSE_R5:
-+	{
-+		data = REG_MSC_RES;
-+		buf[0] = (data >> 8) & 0xff;
-+		buf[1] = data & 0xff;
-+		data = REG_MSC_RES;
-+		buf[2] = (data >> 8) & 0xff;
-+		buf[3] = data & 0xff;
-+		data = REG_MSC_RES;
-+		buf[4] = data & 0xff;
-+
-+		debug("request %d, response [%02x %02x %02x %02x %02x]\n",
-+		      request->rtype, buf[0], buf[1], buf[2], buf[3], buf[4]);
-+		break;
-+	}
-+	case RESPONSE_R2_CID: case RESPONSE_R2_CSD:
-+	{
-+		for (i = 0; i < 16; i += 2) {
-+			data = REG_MSC_RES;
-+			buf[i] = (data >> 8) & 0xff;
-+			buf[i+1] = data & 0xff;
-+		}
-+		debug("request %d, response [", request->rtype);
-+#if CONFIG_MMC_DEBUG_VERBOSE > 2
-+		if (g_mmc_debug >= 3) {
-+			int n;
-+			for (n = 0; n < 17; n++)
-+				printk("%02x ", buf[n]);
-+			printk("]\n");
-+		}
-+#endif
-+		break;
-+	}
-+	case RESPONSE_NONE:
-+		debug("No response\n");
-+		break;
-+
-+	default:
-+		debug("unhandled response type for request %d\n", request->rtype);
-+		break;
-+	}
-+}
-+
-+static int jz_mmc_receive_data(struct mmc_request *req)
-+{
-+	u32  stat, timeout, data, cnt;
-+	u8 *buf = req->buffer;
-+	u32 wblocklen = (u32)(req->block_len + 3) >> 2; /* length in word */
-+
-+	timeout = 0x3ffffff;
-+
-+	while (timeout) {
-+		timeout--;
-+		stat = REG_MSC_STAT;
-+
-+		if (stat & MSC_STAT_TIME_OUT_READ)
-+			return MMC_ERROR_TIMEOUT;
-+		else if (stat & MSC_STAT_CRC_READ_ERROR)
-+			return MMC_ERROR_CRC;
-+		else if (!(stat & MSC_STAT_DATA_FIFO_EMPTY)
-+			 || (stat & MSC_STAT_DATA_FIFO_AFULL)) {
-+			/* Ready to read data */
-+			break;
-+		}
-+		udelay(1);
-+	}
-+	if (!timeout)
-+		return MMC_ERROR_TIMEOUT;
-+
-+	/* Read data from RXFIFO. It could be FULL or PARTIAL FULL */
-+	cnt = wblocklen;
-+	while (cnt) {
-+		data = REG_MSC_RXFIFO;
-+		{
-+			*buf++ = (u8)(data >> 0);
-+			*buf++ = (u8)(data >> 8);
-+			*buf++ = (u8)(data >> 16);
-+			*buf++ = (u8)(data >> 24);
-+		}
-+		cnt --;
-+		while (cnt && (REG_MSC_STAT & MSC_STAT_DATA_FIFO_EMPTY))
-+			;
-+	}
-+	return MMC_NO_ERROR;
-+}
-+
-+static int jz_mmc_transmit_data(struct mmc_request *req)
-+{
-+#if 0
-+	u32 nob = req->nob;
-+	u32 wblocklen = (u32)(req->block_len + 3) >> 2; /* length in word */
-+	u8 *buf = req->buffer;
-+	u32 *wbuf = (u32 *)buf;
-+	u32 waligned = (((u32)buf & 0x3) == 0); /* word aligned ? */
-+	u32 stat, timeout, data, cnt;
-+
-+	for (nob; nob >= 1; nob--) {
-+		timeout = 0x3FFFFFF;
-+
-+		while (timeout) {
-+			timeout--;
-+			stat = REG_MSC_STAT;
-+
-+			if (stat & (MSC_STAT_CRC_WRITE_ERROR | MSC_STAT_CRC_WRITE_ERROR_NOSTS))
-+				return MMC_ERROR_CRC;
-+			else if (!(stat & MSC_STAT_DATA_FIFO_FULL)) {
-+				/* Ready to write data */
-+				break;
-+			}
-+
-+			udelay(1);
-+		}
-+
-+		if (!timeout)
-+			return MMC_ERROR_TIMEOUT;
-+
-+		/* Write data to TXFIFO */
-+		cnt = wblocklen;
-+		while (cnt) {
-+			while (REG_MSC_STAT & MSC_STAT_DATA_FIFO_FULL)
-+				;
-+
-+			if (waligned) {
-+				REG_MSC_TXFIFO = *wbuf++;
-+			}
-+			else {
-+				data = *buf++ | (*buf++ << 8) | (*buf++ << 16) | (*buf++ << 24);
-+				REG_MSC_TXFIFO = data;
-+			}
-+
-+			cnt--;
-+		}
-+	}
-+#endif
-+	return MMC_NO_ERROR;
-+}
-+
-+
-+/*
-+ * Name:	  int jz_mmc_exec_cmd()
-+ * Function:      send command to the card, and get a response
-+ * Input:	  struct mmc_request *req	: MMC/SD request
-+ * Output:	  0:  right		>0:  error code
-+ */
-+int jz_mmc_exec_cmd(struct mmc_request *request)
-+{
-+	u32 cmdat = 0, events = 0;
-+	int retval, timeout = 0x3fffff;
-+
-+	/* Indicate we have no result yet */
-+	request->result = MMC_NO_RESPONSE;
-+	if (request->cmd == MMC_CIM_RESET) {
-+		/* On reset, 1-bit bus width */
-+		use_4bit = 0;
-+
-+		/* Reset MMC/SD controller */
-+		__msc_reset();
-+
-+		/* On reset, drop MMC clock down */
-+		jz_mmc_set_clock(0, MMC_CLOCK_SLOW);
-+
-+		/* On reset, stop MMC clock */
-+		jz_mmc_stop_clock();
-+	}
-+	if (request->cmd == MMC_CMD_SEND_OP_COND) {
-+		debug("Have an MMC card\n");
-+		/* always use 1bit for MMC */
-+		use_4bit = 0;
-+	}
-+	if (request->cmd == SET_BUS_WIDTH) {
-+		if (request->arg == 0x2) {
-+			printf("Use 4-bit bus width\n");
-+			use_4bit = 1;
-+		} else {
-+			printf("Use 1-bit bus width\n");
-+			use_4bit = 0;
-+		}
-+	}
-+
-+	/* stop clock */
-+	jz_mmc_stop_clock();
-+
-+	/* mask all interrupts */
-+	REG_MSC_IMASK = 0xffff;
-+
-+	/* clear status */
-+	REG_MSC_IREG = 0xffff;
-+
-+	/* use 4-bit bus width when possible */
-+	if (use_4bit)
-+		cmdat |= MSC_CMDAT_BUS_WIDTH_4BIT;
-+
-+        /* Set command type and events */
-+	switch (request->cmd) {
-+	/* MMC core extra command */
-+	case MMC_CIM_RESET:
-+		cmdat |= MSC_CMDAT_INIT; /* Initialization sequence sent prior to command */
-+		break;
-+
-+	/* bc - broadcast - no response */
-+	case MMC_CMD_GO_IDLE_STATE:
-+	case MMC_CMD_SET_DSR:
-+		break;
-+
-+	/* bcr - broadcast with response */
-+	case MMC_CMD_SEND_OP_COND:
-+	case MMC_CMD_ALL_SEND_CID:
-+	case MMC_GO_IRQ_STATE:
-+		break;
-+
-+	/* adtc - addressed with data transfer */
-+	case MMC_READ_DAT_UNTIL_STOP:
-+	case MMC_CMD_READ_SINGLE_BLOCK:
-+	case MMC_CMD_READ_MULTIPLE_BLOCK:
-+	case SD_CMD_APP_SEND_SCR:
-+		cmdat |= MSC_CMDAT_DATA_EN | MSC_CMDAT_READ;
-+		events = MMC_EVENT_RX_DATA_DONE;
-+		break;
-+
-+	case MMC_WRITE_DAT_UNTIL_STOP:
-+	case MMC_CMD_WRITE_SINGLE_BLOCK:
-+	case MMC_CMD_WRITE_MULTIPLE_BLOCK:
-+	case MMC_PROGRAM_CID:
-+	case MMC_PROGRAM_CSD:
-+	case MMC_SEND_WRITE_PROT:
-+	case MMC_GEN_CMD:
-+	case MMC_LOCK_UNLOCK:
-+		cmdat |= MSC_CMDAT_DATA_EN | MSC_CMDAT_WRITE;
-+		events = MMC_EVENT_TX_DATA_DONE | MMC_EVENT_PROG_DONE;
-+
-+		break;
-+
-+	case MMC_CMD_STOP_TRANSMISSION:
-+		events = MMC_EVENT_PROG_DONE;
-+		break;
-+
-+	/* ac - no data transfer */
-+	default:
-+		break;
-+	}
-+
-+	/* Set response type */
-+	switch (request->rtype) {
-+	case RESPONSE_NONE:
-+		break;
-+
-+	case RESPONSE_R1B:
-+		cmdat |= MSC_CMDAT_BUSY;
-+		/*FALLTHRU*/
-+	case RESPONSE_R1:
-+		cmdat |= MSC_CMDAT_RESPONSE_R1;
-+		break;
-+	case RESPONSE_R2_CID:
-+	case RESPONSE_R2_CSD:
-+		cmdat |= MSC_CMDAT_RESPONSE_R2;
-+		break;
-+	case RESPONSE_R3:
-+		cmdat |= MSC_CMDAT_RESPONSE_R3;
-+		break;
-+	case RESPONSE_R4:
-+		cmdat |= MSC_CMDAT_RESPONSE_R4;
-+		break;
-+	case RESPONSE_R5:
-+		cmdat |= MSC_CMDAT_RESPONSE_R5;
-+		break;
-+	case RESPONSE_R6:
-+		cmdat |= MSC_CMDAT_RESPONSE_R6;
-+		break;
-+	default:
-+		break;
-+	}
-+
-+	/* Set command index */
-+	if (request->cmd == MMC_CIM_RESET) {
-+		REG_MSC_CMD = MMC_CMD_GO_IDLE_STATE;
-+	} else {
-+		REG_MSC_CMD = request->cmd;
-+	}
-+
-+        /* Set argument */
-+	REG_MSC_ARG = request->arg;
-+
-+	/* Set block length and nob */
-+	if (request->cmd == SD_CMD_APP_SEND_SCR) { /* get SCR from DataFIFO */
-+		REG_MSC_BLKLEN = 8;
-+		REG_MSC_NOB = 1;
-+	} else {
-+		REG_MSC_BLKLEN = request->block_len;
-+		REG_MSC_NOB = request->nob;
-+	}
-+
-+	/* Set command */
-+	REG_MSC_CMDAT = cmdat;
-+
-+	debug("Send cmd %d cmdat: %x arg: %x resp %d\n", request->cmd,
-+	      cmdat, request->arg, request->rtype);
-+
-+        /* Start MMC/SD clock and send command to card */
-+	jz_mmc_start_clock();
-+
-+	/* Wait for command completion */
-+	while (timeout-- && !(REG_MSC_STAT & MSC_STAT_END_CMD_RES))
-+		;
-+
-+	if (timeout == 0)
-+		return MMC_ERROR_TIMEOUT;
-+
-+	REG_MSC_IREG = MSC_IREG_END_CMD_RES; /* clear flag */
-+
-+	/* Check for status */
-+	retval = jz_mmc_check_status(request);
-+	if (retval) {
-+		return retval;
-+	}
-+
-+	/* Complete command with no response */
-+	if (request->rtype == RESPONSE_NONE) {
-+		return MMC_NO_ERROR;
-+	}
-+
-+	/* Get response */
-+	jz_mmc_get_response(request);
-+
-+	/* Start data operation */
-+	if (events & (MMC_EVENT_RX_DATA_DONE | MMC_EVENT_TX_DATA_DONE)) {
-+		if (events & MMC_EVENT_RX_DATA_DONE) {
-+			if (request->cmd == SD_CMD_APP_SEND_SCR) {
-+				/* SD card returns SCR register as data.
-+				   MMC core expect it in the response buffer,
-+				   after normal response. */
-+				request->buffer = (u8 *)((u32)request->response + 5);
-+			}
-+			jz_mmc_receive_data(request);
-+		}
-+
-+		if (events & MMC_EVENT_TX_DATA_DONE) {
-+			jz_mmc_transmit_data(request);
-+		}
-+
-+		/* Wait for Data Done */
-+		while (!(REG_MSC_IREG & MSC_IREG_DATA_TRAN_DONE))
-+			;
-+		REG_MSC_IREG = MSC_IREG_DATA_TRAN_DONE; /* clear status */
-+	}
-+
-+	/* Wait for Prog Done event */
-+	if (events & MMC_EVENT_PROG_DONE) {
-+		while (!(REG_MSC_IREG & MSC_IREG_PRG_DONE))
-+			;
-+		REG_MSC_IREG = MSC_IREG_PRG_DONE; /* clear status */
-+	}
-+
-+	/* Command completed */
-+
-+	return MMC_NO_ERROR;			 /* return successfully */
-+}
-+
-+int mmc_block_read(u8 *dst, ulong src, ulong len)
-+{
-+
-+	struct mmc_request request;
-+	struct mmc_response_r1 r1;
-+	int retval = 0;
-+
-+	if (len == 0)
-+		goto exit;
-+
-+	mmc_simple_cmd(&request, MMC_CMD_SEND_STATUS, mmcinfo.rca, RESPONSE_R1);
-+	retval = mmc_unpack_r1(&request, &r1, 0);
-+	if (retval && (retval != MMC_ERROR_STATE_MISMATCH))
-+		goto exit;
-+
-+	mmc_simple_cmd(&request, MMC_CMD_SET_BLOCKLEN, len, RESPONSE_R1);
-+	if (retval = mmc_unpack_r1(&request, &r1, 0))
-+		goto exit;
-+
-+	if (!sd2_0)
-+		src *= mmcinfo.block_len;
-+
-+	mmc_send_cmd(&request, MMC_CMD_READ_SINGLE_BLOCK, src, 1, len, RESPONSE_R1, dst);
-+	if (retval = mmc_unpack_r1(&request, &r1, 0))
-+		goto exit;
-+
-+exit:
-+	return retval;
-+}
-+
-+ulong mmc_bread(int dev_num, ulong blkstart, ulong blkcnt, ulong *dst)
-+{
-+	if (!mmc_ready) {
-+		printf("Please initial the MMC first\n");
-+		return -1;
-+	}
-+
-+	int i = 0;
-+	ulong dst_tmp = dst;
-+ 
-+	for (i = 0; i < blkcnt; i++) {
-+		if ((mmc_block_read((uchar *)(dst_tmp), blkstart, mmcinfo.block_len)) < 0)
-+			return -1;
-+
-+		dst_tmp += mmcinfo.block_len;
-+		blkstart++;
-+	}
-+ 
-+	return i;
-+}
-+
-+int mmc_select_card(void)
-+{
-+	struct mmc_request request;
-+	struct mmc_response_r1 r1;
-+	int retval;
-+
-+	mmc_simple_cmd(&request, MMC_CMD_SELECT_CARD, mmcinfo.rca, RESPONSE_R1B);
-+	retval = mmc_unpack_r1(&request, &r1, 0);
-+	if (retval) {
-+		return retval;
-+	}
-+
-+	if (mmcinfo.sd) {
-+		mmc_simple_cmd(&request, MMC_CMD_APP_CMD,  mmcinfo.rca, RESPONSE_R1);
-+		retval = mmc_unpack_r1(&request,&r1,0);
-+		if (retval) {
-+			return retval;
-+		}
-+#if defined(MMC_BUS_WIDTH_1BIT)		
-+		mmc_simple_cmd(&request, SET_BUS_WIDTH, 1, RESPONSE_R1);
-+#else
-+		mmc_simple_cmd(&request, SET_BUS_WIDTH, 2, RESPONSE_R1);
-+#endif
-+                retval = mmc_unpack_r1(&request,&r1,0);
-+                if (retval) {
-+			return retval;
-+		}
-+	}
-+	return 0;
-+}
-+
-+/*
-+ * Configure card
-+ */
-+static void mmc_configure_card(void)
-+{
-+	u32 rate;
-+
-+	/* Get card info */
-+	if (sd2_0)
-+		mmcinfo.block_num = (mmcinfo.csd.c_size + 1) << 10;
-+	else
-+		mmcinfo.block_num = (mmcinfo.csd.c_size + 1) * (1 << (mmcinfo.csd.c_size_mult + 2));
-+
-+	mmcinfo.block_len = 1 << mmcinfo.csd.read_bl_len;
-+
-+	mmc_dev.if_type = IF_TYPE_SD;
-+	mmc_dev.part_type = PART_TYPE_DOS;
-+	mmc_dev.dev = 0;
-+	mmc_dev.lun = 0;
-+	mmc_dev.type = 0;
-+	mmc_dev.blksz = mmcinfo.block_len;
-+	mmc_dev.lba = mmcinfo.block_num;
-+	mmc_dev.removable = 0;
-+
-+	printf("%s Detected: %lu blocks of %lu bytes\n",
-+	       sd2_0 == 1 ? "SDHC" : "SD",
-+	       mmc_dev.lba,
-+	       mmc_dev.blksz);
-+
-+	/* Fix the clock rate */
-+	rate = mmc_tran_speed(mmcinfo.csd.tran_speed);
-+	if (rate < MMC_CLOCK_SLOW)
-+		rate = MMC_CLOCK_SLOW;
-+	if ((mmcinfo.sd == 0) && (rate > MMC_CLOCK_FAST))
-+		rate = MMC_CLOCK_FAST;
-+        if ((mmcinfo.sd) && (rate > SD_CLOCK_FAST))
-+		rate = SD_CLOCK_FAST;
-+
-+	debug("%s: block_len=%d block_num=%d rate=%d\n", 
-+	      __func__, mmcinfo.block_len, mmcinfo.block_num, rate);
-+
-+	jz_mmc_set_clock(mmcinfo.sd, rate);
-+}
-+
-+/*
-+ * State machine routines to initialize card(s)
-+ */
-+
-+/*
-+  CIM_SINGLE_CARD_ACQ  (frequency at 400 kHz)
-+  --- Must enter from GO_IDLE_STATE ---
-+  1. SD_SEND_OP_COND (SD Card) [CMD55] + [CMD41]
-+  2. SEND_OP_COND (Full Range) [CMD1]   {optional}
-+  3. SEND_OP_COND (Set Range ) [CMD1]
-+     If busy, delay and repeat step 2
-+  4. ALL_SEND_CID              [CMD2]
-+     If timeout, set an error (no cards found)
-+  5. SET_RELATIVE_ADDR         [CMD3]
-+  6. SEND_CSD                  [CMD9]
-+  7. SET_DSR                   [CMD4]    Only call this if (csd.dsr_imp).
-+  8. Set clock frequency (check available in csd.tran_speed)
-+ */
-+
-+#define MMC_INIT_DOING   0
-+#define MMC_INIT_PASSED  1
-+#define MMC_INIT_FAILED  2
-+
-+static int mmc_init_card_state(struct mmc_request *request)
-+{
-+	struct mmc_response_r1 r1;
-+	struct mmc_response_r3 r3;
-+	int retval;
-+	int ocr = 0x40300000;
-+	int limit_41 = 0;
-+
-+	switch (request->cmd) {
-+	case MMC_CMD_GO_IDLE_STATE: /* No response to parse */
-+		if (mmcinfo.sd)
-+			mmc_simple_cmd(request, 8, 0x1aa, RESPONSE_R1);
-+		else
-+			mmc_simple_cmd(request, MMC_CMD_SEND_OP_COND, MMC_OCR_ARG, RESPONSE_R3);
-+		break;
-+
-+	case 8:
-+        	retval = mmc_unpack_r1(request,&r1,mmcinfo.state);
-+		mmc_simple_cmd(request, MMC_CMD_APP_CMD,  0, RESPONSE_R1);
-+		break;
-+
-+        case MMC_CMD_APP_CMD:
-+        	retval = mmc_unpack_r1(request,&r1,mmcinfo.state);
-+		if (retval & (limit_41 < 100)) {
-+			debug("%s: unable to MMC_APP_CMD error=%d (%s)\n", 
-+			      __func__, retval, mmc_result_to_string(retval));
-+			limit_41++;
-+			mmc_simple_cmd(request, SD_CMD_APP_SEND_OP_COND, ocr, RESPONSE_R3);
-+		} else if (limit_41 < 100) {
-+			limit_41++;
-+			mmc_simple_cmd(request, SD_CMD_APP_SEND_OP_COND, ocr, RESPONSE_R3);
-+		} else{
-+			/* reset the card to idle*/
-+			mmc_simple_cmd(request, MMC_CMD_GO_IDLE_STATE, 0, RESPONSE_NONE);
-+			mmcinfo.sd = 0;
-+		}
-+		break;
-+
-+        case SD_CMD_APP_SEND_OP_COND:
-+                retval = mmc_unpack_r3(request, &r3);
-+                if (retval) {
-+			debug("%s: try MMC card\n", __func__);
-+			mmc_simple_cmd(request, SD_CMD_APP_SEND_OP_COND, MMC_OCR_ARG, RESPONSE_R3);
-+			break;
-+		}
-+
-+                debug("%s: read ocr value = 0x%08x\n", __func__, r3.ocr);
-+
-+		if(!(r3.ocr & MMC_CARD_BUSY || ocr == 0)){
-+			udelay(50000);
-+			mmc_simple_cmd(request, MMC_CMD_APP_CMD, 0, RESPONSE_R1);
-+		} else {
-+			mmcinfo.sd = 1; /* SD Card ready */
-+			mmcinfo.state = CARD_STATE_READY;
-+			mmc_simple_cmd(request, MMC_CMD_ALL_SEND_CID, 0, RESPONSE_R2_CID);
-+		}
-+		break;
-+
-+	case MMC_CMD_SEND_OP_COND:
-+		retval = mmc_unpack_r3(request, &r3);
-+		if (retval) {
-+			debug("%s: failed SEND_OP_COND error=%d (%s)\n", 
-+			      __func__, retval, mmc_result_to_string(retval));
-+			return MMC_INIT_FAILED;
-+		}
-+
-+		debug("%s: read ocr value = 0x%08x\n", __func__, r3.ocr);
-+		if (!(r3.ocr & MMC_CARD_BUSY)) {
-+	                mmc_simple_cmd(request, MMC_CMD_SEND_OP_COND, MMC_OCR_ARG, RESPONSE_R3);
-+		} else {
-+		        mmcinfo.sd = 0; /* MMC Card ready */
-+			mmcinfo.state = CARD_STATE_READY;
-+			mmc_simple_cmd(request, MMC_CMD_ALL_SEND_CID, 0, RESPONSE_R2_CID);
-+		}
-+		break;
-+
-+	case MMC_CMD_ALL_SEND_CID: 
-+		retval = mmc_unpack_cid( request, &mmcinfo.cid );
-+		/*FIXME:ignore CRC error for CMD2/CMD9/CMD10 */
-+		if ( retval && (retval != MMC_ERROR_CRC)) {
-+			debug("mmc_init_card_state: unable to ALL_SEND_CID error=%d (%s)\n", 
-+			      retval, mmc_result_to_string(retval));
-+			return MMC_INIT_FAILED;
-+		}
-+		mmcinfo.state = CARD_STATE_IDENT;
-+		if(mmcinfo.sd)
-+			mmc_simple_cmd(request, MMC_CMD_SET_RELATIVE_ADDR, 0, RESPONSE_R6);
-+                else
-+			mmc_simple_cmd(request, MMC_CMD_SET_RELATIVE_ADDR, ID_TO_RCA(mmcinfo.id) << 16, RESPONSE_R1);
-+		break;
-+
-+        case MMC_CMD_SET_RELATIVE_ADDR:
-+	        if (mmcinfo.sd)	{
-+			retval = mmc_unpack_r6(request, &r1, mmcinfo.state, &mmcinfo.rca);
-+			mmcinfo.rca = mmcinfo.rca << 16; 
-+			debug("%s: Get RCA from SD: 0x%04x Status: %x\n",
-+			      __func__, mmcinfo.rca, r1.status);
-+                } else {
-+			retval = mmc_unpack_r1(request,&r1,mmcinfo.state);
-+			mmcinfo.rca = ID_TO_RCA(mmcinfo.id) << 16;
-+	        }
-+		if (retval) {
-+			debug("%s: unable to SET_RELATIVE_ADDR error=%d (%s)\n", 
-+			      __func__, retval, mmc_result_to_string(retval));
-+			return MMC_INIT_FAILED;
-+		}
-+
-+		mmcinfo.state = CARD_STATE_STBY;
-+                mmc_simple_cmd(request, MMC_CMD_SEND_CSD, mmcinfo.rca, RESPONSE_R2_CSD);
-+
-+		break;
-+
-+	case MMC_CMD_SEND_CSD:
-+		retval = mmc_unpack_csd(request, &mmcinfo.csd);
-+		mmc_ready = 1;
-+		/*FIXME:ignore CRC error for CMD2/CMD9/CMD10 */
-+	        if (retval && (retval != MMC_ERROR_CRC)) {
-+			debug("%s: unable to SEND_CSD error=%d (%s)\n", 
-+			      __func__, retval, mmc_result_to_string(retval));
-+			return MMC_INIT_FAILED;
-+		}
-+		if (mmcinfo.csd.dsr_imp) {
-+			debug("%s: driver doesn't support setting DSR\n", __func__);
-+		}
-+		mmc_configure_card();
-+		return MMC_INIT_PASSED;
-+
-+	default:
-+		debug("%s: error!  Illegal last cmd %d\n", __func__, request->cmd);
-+		return MMC_INIT_FAILED;
-+	}
-+
-+	return MMC_INIT_DOING;
-+}
-+
-+int mmc_init_card(void)
-+{
-+	struct mmc_request request;
-+	int retval;
-+
-+	mmc_simple_cmd(&request, MMC_CIM_RESET, 0, RESPONSE_NONE); /* reset card */
-+	mmc_simple_cmd(&request, MMC_CMD_GO_IDLE_STATE, 0, RESPONSE_NONE);
-+	mmcinfo.sd = 1;  /* assuming a SD card */
-+
-+	while ((retval = mmc_init_card_state(&request)) == MMC_INIT_DOING)
-+		;
-+
-+	if (retval == MMC_INIT_PASSED)
-+		return MMC_NO_ERROR;
-+	else
-+		return MMC_NO_RESPONSE;
-+}
-+
-+int mmc_legacy_init(int verbose)
-+{
-+	if (!__msc_card_detected())
-+		return 1;
-+
-+	/* Step-1: init GPIO */
-+	__gpio_as_msc();
-+	__msc_init_io();
-+
-+	/* Step-2: turn on power of card */
-+#if !defined(CONFIG_SAKC)
-+	__msc_enable_power();
-+#endif
-+
-+	/* Step-3: Reset MSC Controller. */
-+	__msc_reset();
-+
-+	/* Step-3: mask all IRQs. */
-+	MMC_IRQ_MASK();
-+
-+	/* Step-4: stop MMC/SD clock */
-+	jz_mmc_stop_clock();
-+	mmc_init_card();
-+	mmc_select_card();
-+
-+	mmc_dev.block_read = mmc_bread;
-+	fat_register_device(&mmc_dev,1); /* partitions start counting with 1 */
-+
-+	return 0;
-+}
-+
-+/*
-+ * Debugging functions
-+ */
-+static char * mmc_result_strings[] = {
-+	"NO_RESPONSE",
-+	"NO_ERROR",
-+	"ERROR_OUT_OF_RANGE",
-+	"ERROR_ADDRESS",
-+	"ERROR_BLOCK_LEN",
-+	"ERROR_ERASE_SEQ",
-+	"ERROR_ERASE_PARAM",
-+	"ERROR_WP_VIOLATION",
-+	"ERROR_CARD_IS_LOCKED",
-+	"ERROR_LOCK_UNLOCK_FAILED",
-+	"ERROR_COM_CRC",
-+	"ERROR_ILLEGAL_COMMAND",
-+	"ERROR_CARD_ECC_FAILED",
-+	"ERROR_CC",
-+	"ERROR_GENERAL",
-+	"ERROR_UNDERRUN",
-+	"ERROR_OVERRUN",
-+	"ERROR_CID_CSD_OVERWRITE",
-+	"ERROR_STATE_MISMATCH",
-+	"ERROR_HEADER_MISMATCH",
-+	"ERROR_TIMEOUT",
-+	"ERROR_CRC",
-+	"ERROR_DRIVER_FAILURE",
-+};
-+
-+char * mmc_result_to_string(int i)
-+{
-+	return mmc_result_strings[i+1];
-+}
-+
-+static char * card_state_strings[] = {
-+	"empty",
-+	"idle",
-+	"ready",
-+	"ident",
-+	"stby",
-+	"tran",
-+	"data",
-+	"rcv",
-+	"prg",
-+	"dis",
-+};
-+
-+static inline char * card_state_to_string(int i)
-+{
-+	return card_state_strings[i+1];
-+}
-+
-+/*
-+ * Utility functions
-+ */
-+
-+#define PARSE_U32(_buf,_index) \
-+	(((u32)_buf[_index]) << 24) | (((u32)_buf[_index+1]) << 16) | \
-+        (((u32)_buf[_index+2]) << 8) | ((u32)_buf[_index+3]);
-+
-+#define PARSE_U16(_buf,_index) \
-+	(((u16)_buf[_index]) << 8) | ((u16)_buf[_index+1]);
-+
-+int mmc_unpack_csd(struct mmc_request *request, struct mmc_csd *csd)
-+{
-+	u8 *buf = request->response;
-+	int num = 0;
-+
-+	if (request->result)
-+		return request->result;
-+
-+	if (buf[0] != 0x3f)
-+		return MMC_ERROR_HEADER_MISMATCH;
-+
-+	csd->csd_structure = (buf[1] & 0xc0) >> 6;
-+	if (csd->csd_structure)
-+		sd2_0 = 1;
-+	else
-+		sd2_0 = 0;
-+
-+	switch (csd->csd_structure) {
-+	case 0 :/* Version 1.01-1.10
-+		 * Version 2.00/Standard Capacity */
-+		csd->taac               = buf[2];
-+		csd->nsac               = buf[3];
-+		csd->tran_speed         = buf[4];
-+		csd->ccc                = (((u16)buf[5]) << 4) | ((buf[6] & 0xf0) >> 4);
-+		csd->read_bl_len        = buf[6] & 0x0f;
-+		/* for support 2GB card*/
-+		if (csd->read_bl_len >= 10)
-+		{
-+			num = csd->read_bl_len - 9;
-+			csd->read_bl_len = 9;
-+		}
-+
-+		csd->read_bl_partial    = (buf[7] & 0x80) ? 1 : 0;
-+		csd->write_blk_misalign = (buf[7] & 0x40) ? 1 : 0;
-+		csd->read_blk_misalign  = (buf[7] & 0x20) ? 1 : 0;
-+		csd->dsr_imp            = (buf[7] & 0x10) ? 1 : 0;
-+		csd->c_size             = ((((u16)buf[7]) & 0x03) << 10) | (((u16)buf[8]) << 2) | (((u16)buf[9]) & 0xc0) >> 6;
-+
-+		if (num)
-+			csd->c_size = csd->c_size << num;
-+
-+
-+		csd->vdd_r_curr_min     = (buf[9] & 0x38) >> 3;
-+		csd->vdd_r_curr_max     = buf[9] & 0x07;
-+		csd->vdd_w_curr_min     = (buf[10] & 0xe0) >> 5;
-+		csd->vdd_w_curr_max     = (buf[10] & 0x1c) >> 2;
-+		csd->c_size_mult        = ((buf[10] & 0x03) << 1) | ((buf[11] & 0x80) >> 7);
-+		csd->sector_size    = (buf[11] & 0x7c) >> 2;
-+		csd->erase_grp_size = ((buf[11] & 0x03) << 3) | ((buf[12] & 0xe0) >> 5);
-+		csd->wp_grp_size        = buf[12] & 0x1f;
-+		csd->wp_grp_enable      = (buf[13] & 0x80) ? 1 : 0;
-+		csd->default_ecc        = (buf[13] & 0x60) >> 5;
-+		csd->r2w_factor         = (buf[13] & 0x1c) >> 2;
-+		csd->write_bl_len       = ((buf[13] & 0x03) << 2) | ((buf[14] & 0xc0) >> 6);
-+		if (csd->write_bl_len >= 10)
-+			csd->write_bl_len = 9;
-+
-+		csd->write_bl_partial   = (buf[14] & 0x20) ? 1 : 0;
-+		csd->file_format_grp    = (buf[15] & 0x80) ? 1 : 0;
-+		csd->copy               = (buf[15] & 0x40) ? 1 : 0;
-+		csd->perm_write_protect = (buf[15] & 0x20) ? 1 : 0;
-+		csd->tmp_write_protect  = (buf[15] & 0x10) ? 1 : 0;
-+		csd->file_format        = (buf[15] & 0x0c) >> 2;
-+		csd->ecc                = buf[15] & 0x03;
-+		break;
-+	case 1 :	/* Version 2.00/High Capacity */
-+		csd->taac               = 0;
-+		csd->nsac               = 0;
-+		csd->tran_speed         = buf[4];
-+		csd->ccc                = (((u16)buf[5]) << 4) | ((buf[6] & 0xf0) >> 4);
-+
-+		csd->read_bl_len        = 9;
-+		csd->read_bl_partial    = 0;
-+		csd->write_blk_misalign = 0;
-+		csd->read_blk_misalign  = 0;
-+		csd->dsr_imp            = (buf[7] & 0x10) ? 1 : 0;
-+		csd->c_size             = ((((u16)buf[8]) & 0x3f) << 16) | (((u16)buf[9]) << 8) | ((u16)buf[10]) ;
-+		csd->sector_size	= 0x7f;
-+		csd->erase_grp_size	= 0;
-+		csd->wp_grp_size        = 0;
-+		csd->wp_grp_enable      = 0;
-+		csd->default_ecc        = (buf[13] & 0x60) >> 5;
-+		csd->r2w_factor         = 4;/* Unused */
-+		csd->write_bl_len       = 9;
-+
-+		csd->write_bl_partial   = 0;
-+		csd->file_format_grp    = 0;
-+		csd->copy               = (buf[15] & 0x40) ? 1 : 0;
-+		csd->perm_write_protect = (buf[15] & 0x20) ? 1 : 0;
-+		csd->tmp_write_protect  = (buf[15] & 0x10) ? 1 : 0;
-+		csd->file_format        = 0;
-+		csd->ecc                = buf[15] & 0x03;
-+	}
-+
-+	return 0;
-+}
-+
-+int mmc_unpack_r1(struct mmc_request *request, struct mmc_response_r1 *r1, enum card_state state)
-+{
-+	u8 *buf = request->response;
-+
-+	if (request->result)
-+		return request->result;
-+
-+	r1->cmd    = buf[0];
-+	r1->status = PARSE_U32(buf,1);
-+
-+	debug("mmc_unpack_r1: cmd=%d status=%08x\n", r1->cmd, r1->status);
-+
-+	if (R1_STATUS(r1->status)) {
-+		if (r1->status & R1_OUT_OF_RANGE)       return MMC_ERROR_OUT_OF_RANGE;
-+		if (r1->status & R1_ADDRESS_ERROR)      return MMC_ERROR_ADDRESS;
-+		if (r1->status & R1_BLOCK_LEN_ERROR)    return MMC_ERROR_BLOCK_LEN;
-+		if (r1->status & R1_ERASE_SEQ_ERROR)    return MMC_ERROR_ERASE_SEQ;
-+		if (r1->status & R1_ERASE_PARAM)        return MMC_ERROR_ERASE_PARAM;
-+		if (r1->status & R1_WP_VIOLATION)       return MMC_ERROR_WP_VIOLATION;
-+		/*if (r1->status & R1_CARD_IS_LOCKED)     return MMC_ERROR_CARD_IS_LOCKED; */
-+		if (r1->status & R1_LOCK_UNLOCK_FAILED) return MMC_ERROR_LOCK_UNLOCK_FAILED;
-+		if (r1->status & R1_COM_CRC_ERROR)      return MMC_ERROR_COM_CRC;
-+		if (r1->status & R1_ILLEGAL_COMMAND)    return MMC_ERROR_ILLEGAL_COMMAND;
-+		if (r1->status & R1_CARD_ECC_FAILED)    return MMC_ERROR_CARD_ECC_FAILED;
-+		if (r1->status & R1_CC_ERROR)           return MMC_ERROR_CC;
-+		if (r1->status & R1_ERROR)              return MMC_ERROR_GENERAL;
-+		if (r1->status & R1_UNDERRUN)           return MMC_ERROR_UNDERRUN;
-+		if (r1->status & R1_OVERRUN)            return MMC_ERROR_OVERRUN;
-+		if (r1->status & R1_CID_CSD_OVERWRITE)  return MMC_ERROR_CID_CSD_OVERWRITE;
-+	}
-+
-+	if (buf[0] != request->cmd) 
-+		return MMC_ERROR_HEADER_MISMATCH;
-+
-+	/* This should be last - it's the least dangerous error */
-+
-+	return 0;
-+}
-+
-+int mmc_unpack_scr(struct mmc_request *request, struct mmc_response_r1 *r1, enum card_state state, u32 *scr)
-+{
-+        u8 *buf = request->response;
-+	if (request->result)
-+		return request->result;
-+
-+        *scr = PARSE_U32(buf, 5); /* Save SCR returned by the SD Card */
-+        return mmc_unpack_r1(request, r1, state);
-+
-+}
-+
-+int mmc_unpack_r6(struct mmc_request *request, struct mmc_response_r1 *r1, enum card_state state, int *rca)
-+{
-+	u8 *buf = request->response;
-+
-+	if (request->result)
-+		return request->result;
-+
-+        *rca = PARSE_U16(buf,1);  /* Save RCA returned by the SD Card */
-+
-+        *(buf+1) = 0;
-+        *(buf+2) = 0;
-+
-+        return mmc_unpack_r1(request, r1, state);
-+}
-+
-+int mmc_unpack_cid(struct mmc_request *request, struct mmc_cid *cid)
-+{
-+	int i;
-+	u8 *buf = request->response;
-+
-+	if (request->result) 
-+		return request->result;
-+
-+	cid->mid = buf[1];
-+	cid->oid = PARSE_U16(buf,2);
-+	for (i = 0 ; i < 5 ; i++)
-+		cid->pnm[i] = buf[4+i];
-+	cid->pnm[6] = 0;
-+	cid->prv = buf[10];
-+	cid->psn = PARSE_U32(buf,10);
-+	cid->mdt = buf[15];
-+
-+	printf("Man %02x OEM 0x%04x \"%s\" %d.%d 0x%08x "
-+	       "Date %02u/%04u\n",
-+	       cid->mid,
-+	       cid->oid,
-+	       cid->pnm, 
-+	       cid->prv >> 4,
-+	       cid->prv & 0xf, 
-+	       cid->psn,
-+	       cid->mdt & 0xf,
-+	       (cid->mdt >> 4) + 2000);
-+
-+	if (buf[0] != 0x3f)
-+		return MMC_ERROR_HEADER_MISMATCH;
-+      	return 0;
-+}
-+
-+int mmc_unpack_r3(struct mmc_request *request, struct mmc_response_r3 *r3)
-+{
-+	u8 *buf = request->response;
-+
-+	if (request->result)
-+		return request->result;
-+
-+	r3->ocr = PARSE_U32(buf,1);
-+	debug("mmc_unpack_r3: ocr=%08x\n", r3->ocr);
-+
-+	if (buf[0] != 0x3f)  return MMC_ERROR_HEADER_MISMATCH;
-+	return 0;
-+}
-+
-+#define KBPS 1
-+#define MBPS 1000
-+
-+static u32 ts_exp[] = { 100*KBPS, 1*MBPS, 10*MBPS, 100*MBPS, 0, 0, 0, 0 };
-+static u32 ts_mul[] = { 0,    1000, 1200, 1300, 1500, 2000, 2500, 3000, 
-+			3500, 4000, 4500, 5000, 5500, 6000, 7000, 8000 };
-+
-+u32 mmc_tran_speed(u8 ts)
-+{
-+	u32 rate = ts_exp[(ts & 0x7)] * ts_mul[(ts & 0x78) >> 3];
-+
-+	if (rate <= 0) {
-+		debug("%s: error - unrecognized speed 0x%02x\n", __func__, ts);
-+		return 1;
-+	}
-+
-+	return rate;
-+}
-+
-+void mmc_send_cmd(struct mmc_request *request, int cmd, u32 arg, 
-+		  u16 nob, u16 block_len, enum mmc_rsp_t rtype, u8 *buffer)
-+{
-+	request->cmd       = cmd;
-+	request->arg       = arg;
-+	request->rtype     = rtype;
-+	request->nob       = nob;
-+	request->block_len = block_len;
-+	request->buffer    = buffer;
-+	request->cnt       = nob * block_len;
-+
-+	jz_mmc_exec_cmd(request);
-+}
-diff --git a/drivers/mmc/jz_mmc.h b/drivers/mmc/jz_mmc.h
-new file mode 100644
-index 0000000..936c514
---- /dev/null
-+++ b/drivers/mmc/jz_mmc.h
-@@ -0,0 +1,176 @@
-+/*
-+ *  linux/drivers/mmc/jz_mmc.h
-+ *
-+ *  Author: Vladimir Shebordaev, Igor Oblakov
-+ *  Copyright:  MontaVista Software Inc.
-+ *
-+ *  $Id: jz_mmc.h,v 1.3 2007-06-15 08:04:20 jlwei Exp $
-+ *
-+ *  This program is free software; you can redistribute it and/or modify
-+ *  it under the terms of the GNU General Public License version 2 as
-+ *  published by the Free Software Foundation.
-+ */
-+#ifndef __MMC_JZMMC_H__
-+#define __MMC_JZMMC_H__
-+
-+#define ID_TO_RCA(x) ((x)+1)
-+#define MMC_OCR_ARG		0x00ff8000	/* Argument of OCR */
-+
-+/* Standard MMC/SD clock speeds */
-+#define MMC_CLOCK_SLOW    400000      /* 400 kHz for initial setup */
-+#define MMC_CLOCK_FAST  20000000      /* 20 MHz for maximum for normal operation */
-+#define SD_CLOCK_FAST   24000000      /* 24 MHz for SD Cards */
-+
-+/* Use negative numbers to disambiguate */
-+#define MMC_CIM_RESET            -1
-+#define SET_BUS_WIDTH            6    /* ac   [1:0] bus width    R1  */    
-+
-+#define R1_OUT_OF_RANGE		(1 << 31)	/* er, c */
-+#define R1_ADDRESS_ERROR	(1 << 30)	/* erx, c */
-+#define R1_BLOCK_LEN_ERROR	(1 << 29)	/* er, c */
-+#define R1_ERASE_SEQ_ERROR      (1 << 28)	/* er, c */
-+#define R1_ERASE_PARAM		(1 << 27)	/* ex, c */
-+#define R1_WP_VIOLATION		(1 << 26)	/* erx, c */
-+#define R1_CARD_IS_LOCKED	(1 << 25)	/* sx, a */
-+#define R1_LOCK_UNLOCK_FAILED	(1 << 24)	/* erx, c */
-+#define R1_COM_CRC_ERROR	(1 << 23)	/* er, b */
-+#define R1_ILLEGAL_COMMAND	(1 << 22)	/* er, b */
-+#define R1_CARD_ECC_FAILED	(1 << 21)	/* ex, c */
-+#define R1_CC_ERROR		(1 << 20)	/* erx, c */
-+#define R1_ERROR		(1 << 19)	/* erx, c */
-+#define R1_UNDERRUN		(1 << 18)	/* ex, c */
-+#define R1_OVERRUN		(1 << 17)	/* ex, c */
-+#define R1_CID_CSD_OVERWRITE	(1 << 16)	/* erx, c, CID/CSD overwrite */
-+#define R1_WP_ERASE_SKIP	(1 << 15)	/* sx, c */
-+#define R1_CARD_ECC_DISABLED	(1 << 14)	/* sx, a */
-+#define R1_ERASE_RESET		(1 << 13)	/* sr, c */
-+#define R1_STATUS(x)            (x & 0xFFFFE000)
-+
-+#define MMC_CARD_BUSY	0x80000000	/* Card Power up status bit */
-+
-+#define MMC_PROGRAM_CID          26   /* adtc                    R1  */
-+#define MMC_PROGRAM_CSD          27   /* adtc                    R1  */
-+
-+#define MMC_GO_IRQ_STATE         40   /* bcr                     R5  */
-+#define MMC_GEN_CMD              56   /* adtc [0] RD/WR          R1b */
-+#define MMC_LOCK_UNLOCK          42   /* adtc                    R1b */
-+#define MMC_WRITE_DAT_UNTIL_STOP 20   /* adtc [31:0] data addr   R1  */
-+#define MMC_READ_DAT_UNTIL_STOP  11   /* adtc [31:0] dadr        R1  */
-+#define MMC_SEND_WRITE_PROT      30   /* adtc [31:0] wpdata addr R1  */
-+
-+
-+enum mmc_result_t {
-+	MMC_NO_RESPONSE        = -1,
-+	MMC_NO_ERROR           = 0,
-+	MMC_ERROR_OUT_OF_RANGE,
-+	MMC_ERROR_ADDRESS,
-+	MMC_ERROR_BLOCK_LEN,
-+	MMC_ERROR_ERASE_SEQ,
-+	MMC_ERROR_ERASE_PARAM,
-+	MMC_ERROR_WP_VIOLATION,
-+	MMC_ERROR_CARD_IS_LOCKED,
-+	MMC_ERROR_LOCK_UNLOCK_FAILED,
-+	MMC_ERROR_COM_CRC,
-+	MMC_ERROR_ILLEGAL_COMMAND,
-+	MMC_ERROR_CARD_ECC_FAILED,
-+	MMC_ERROR_CC,
-+	MMC_ERROR_GENERAL,
-+	MMC_ERROR_UNDERRUN,
-+	MMC_ERROR_OVERRUN,
-+	MMC_ERROR_CID_CSD_OVERWRITE,
-+	MMC_ERROR_STATE_MISMATCH,
-+	MMC_ERROR_HEADER_MISMATCH,
-+	MMC_ERROR_TIMEOUT,
-+	MMC_ERROR_CRC,
-+	MMC_ERROR_DRIVER_FAILURE,
-+};
-+
-+enum card_state {
-+	CARD_STATE_EMPTY = -1,
-+	CARD_STATE_IDLE	 = 0,
-+	CARD_STATE_READY = 1,
-+	CARD_STATE_IDENT = 2,
-+	CARD_STATE_STBY	 = 3,
-+	CARD_STATE_TRAN	 = 4,
-+	CARD_STATE_DATA	 = 5,
-+	CARD_STATE_RCV	 = 6,
-+	CARD_STATE_PRG	 = 7,
-+	CARD_STATE_DIS	 = 8,
-+};
-+
-+enum mmc_rsp_t {
-+	RESPONSE_NONE   = 0,
-+	RESPONSE_R1     = 1,
-+	RESPONSE_R1B    = 2,
-+	RESPONSE_R2_CID = 3,
-+	RESPONSE_R2_CSD  = 4,
-+	RESPONSE_R3      = 5,
-+	RESPONSE_R4      = 6,
-+	RESPONSE_R5      = 7,
-+        RESPONSE_R6      = 8,
-+};
-+
-+struct mmc_response_r1 {
-+	u8  cmd;
-+	u32 status;
-+};
-+
-+struct mmc_response_r3 {  
-+	u32 ocr;
-+}; 
-+
-+/* the information structure of MMC/SD Card */
-+struct  mmc_info {
-+	int             id;     /* Card index */
-+        int             sd;     /* MMC or SD card */
-+        int             rca;    /* RCA */
-+        u32             scr;    /* SCR 63:32*/
-+	int             flags;  /* Ejected, inserted */
-+	enum card_state state;  /* empty, ident, ready, whatever */
-+
-+	/* Card specific information */
-+	struct mmc_cid  cid;
-+	struct mmc_csd  csd;
-+	u32             block_num;
-+	u32             block_len;
-+	u32             erase_unit;
-+};
-+
-+struct mmc_info mmcinfo;
-+
-+struct mmc_request {
-+	int               index;      /* Slot index - used for CS lines */
-+	int               cmd;        /* Command to send */
-+	u32               arg;        /* Argument to send */
-+	enum mmc_rsp_t    rtype;      /* Response type expected */
-+
-+	/* Data transfer (these may be modified at the low level) */
-+	u16               nob;        /* Number of blocks to transfer*/
-+	u16               block_len;  /* Block length */
-+	u8               *buffer;     /* Data buffer */
-+	u32               cnt;        /* Data length, for PIO */
-+
-+	/* Results */
-+	u8                response[18]; /* Buffer to store response - CRC is optional */
-+	enum mmc_result_t result;
-+};
-+
-+char * mmc_result_to_string(int);
-+int    mmc_unpack_csd(struct mmc_request *request, struct mmc_csd *csd);
-+int    mmc_unpack_r1(struct mmc_request *request, struct mmc_response_r1 *r1, enum card_state state);
-+int    mmc_unpack_r6(struct mmc_request *request, struct mmc_response_r1 *r1, enum card_state state, int *rca);
-+int    mmc_unpack_scr(struct mmc_request *request, struct mmc_response_r1 *r1, enum card_state state, u32 *scr);
-+int    mmc_unpack_cid(struct mmc_request *request, struct mmc_cid *cid);
-+int    mmc_unpack_r3(struct mmc_request *request, struct mmc_response_r3 *r3);
-+
-+void   mmc_send_cmd(struct mmc_request *request, int cmd, u32 arg, 
-+		     u16 nob, u16 block_len, enum mmc_rsp_t rtype, u8 *buffer);
-+u32    mmc_tran_speed(u8 ts);
-+void   jz_mmc_set_clock(int sd, u32 rate);
-+
-+static inline void mmc_simple_cmd(struct mmc_request *request, int cmd, u32 arg, enum mmc_rsp_t rtype)
-+{
-+	mmc_send_cmd( request, cmd, arg, 0, 0, rtype, 0);
-+}
-+
-+#endif /* __MMC_JZMMC_H__ */
-diff --git a/include/configs/qi_lb60.h b/include/configs/qi_lb60.h
-index 7bff444..7b33be0 100644
---- a/include/configs/qi_lb60.h
-+++ b/include/configs/qi_lb60.h
-@@ -31,6 +31,15 @@
- /*
-  * Miscellaneous configurable options
-  */
-+#define CONFIG_JZ4740_MMC
-+#define CONFIG_MMC      	1
-+#define CONFIG_FAT      	1
-+#define CONFIG_DOS_PARTITION	1
-+#define CONFIG_CMD_MMC
-+#define CONFIG_CMD_FAT
-+#define CONFIG_CMD_EXT2
-+
-+
- #define CONFIG_SYS_SDRAM_BASE		0x80000000	/* Cached addr */
- #define CONFIG_SYS_INIT_SP_OFFSET	0x400000
- #define CONFIG_SYS_LOAD_ADDR		0x80600000
-diff --git a/include/mmc.h b/include/mmc.h
-index a13e2bd..3c4761c 100644
---- a/include/mmc.h
-+++ b/include/mmc.h
-@@ -283,4 +283,44 @@ struct mmc *mmc_spi_init(uint bus, uint cs, uint speed, uint mode);
- int mmc_legacy_init(int verbose);
- #endif
- 
-+struct mmc_csd
-+{
-+	u8	csd_structure:2,
-+		spec_vers:4,
-+		rsvd1:2;
-+	u8	taac;
-+	u8	nsac;
-+	u8	tran_speed;
-+	u16	ccc:12,
-+		read_bl_len:4;
-+	u32	c_size:22;
-+	u64	read_bl_partial:1,
-+		write_blk_misalign:1,
-+		read_blk_misalign:1,
-+		dsr_imp:1,
-+		rsvd2:2,
-+		vdd_r_curr_min:3,
-+		vdd_r_curr_max:3,
-+		vdd_w_curr_min:3,
-+		vdd_w_curr_max:3,
-+		c_size_mult:3,
-+		sector_size:5,
-+		erase_grp_size:5,
-+		wp_grp_size:5,
-+		wp_grp_enable:1,
-+		default_ecc:2,
-+		r2w_factor:3,
-+		write_bl_len:4,
-+		write_bl_partial:1,
-+		rsvd3:5;
-+	u8	file_format_grp:1,
-+		copy:1,
-+		perm_write_protect:1,
-+		tmp_write_protect:1,
-+		file_format:2,
-+		ecc:2;
-+	u8	crc:7;
-+	u8	one:1;
-+};
-+
- #endif /* _MMC_H_ */
--- 
-1.7.9.5
-

+ 0 - 200
package/boot/uboot-xburst/patches/0004-add-more-boot-options-F1-F2-F3-F4-M-S.patch

@@ -1,200 +0,0 @@
-From c52b6168979d03fc31205444c3278c537787472a Mon Sep 17 00:00:00 2001
-From: Xiangfu <xiangfu@openmobilefree.net>
-Date: Wed, 10 Oct 2012 18:39:55 +0800
-Subject: [PATCH 4/6] add more boot options(F1/F2/F3/F4/M/S)
-
----
- arch/mips/include/asm/global_data.h |    3 +++
- arch/mips/lib/bootm.c               |   17 ++++++++++++++++-
- board/qi/qi_lb60/qi_lb60.c          |   26 +++++++++++++++++++++++---
- common/main.c                       |   21 +++++++++++++++++++--
- include/configs/qi_lb60.h           |   32 ++++++++++++++++++++++++++++++++
- 5 files changed, 93 insertions(+), 6 deletions(-)
-
-diff --git a/arch/mips/include/asm/global_data.h b/arch/mips/include/asm/global_data.h
-index 6e2cdc7..cd03d7e 100644
---- a/arch/mips/include/asm/global_data.h
-+++ b/arch/mips/include/asm/global_data.h
-@@ -59,6 +59,9 @@ typedef	struct	global_data {
- 	unsigned long	env_valid;	/* Checksum of Environment valid? */
- 	void		**jt;		/* jump table */
- 	char		env_buf[32];	/* buffer for getenv() before reloc. */
-+#if defined(CONFIG_NANONOTE)
-+        unsigned long   boot_option;
-+#endif
- } gd_t;
- 
- #include <asm-generic/global_data_flags.h>
-diff --git a/arch/mips/lib/bootm.c b/arch/mips/lib/bootm.c
-index 608c1a7..e00416b 100644
---- a/arch/mips/lib/bootm.c
-+++ b/arch/mips/lib/bootm.c
-@@ -47,10 +47,25 @@ int do_bootm_linux(int flag, int argc, char * const argv[],
- 			bootm_headers_t *images)
- {
- 	void (*theKernel) (int, char **, char **, int *);
--	char *commandline = getenv("bootargs");
-+	char *commandline;
- 	char env_buf[12];
- 	char *cp;
- 
-+#if defined(CONFIG_NANONOTE)
-+        if (gd->boot_option & BOOT_FROM_MEMCARD)
-+                commandline = getenv ("bootargsfromsd");
-+        else if (gd->boot_option & BOOT_WITH_F1)
-+                commandline = getenv ("bootargsf1");
-+        else if (gd->boot_option & BOOT_WITH_F2)
-+                commandline = getenv ("bootargsf2");
-+        else if (gd->boot_option & BOOT_WITH_F3)
-+                commandline = getenv ("bootargsf3");
-+        else if (gd->boot_option & BOOT_WITH_F4)
-+                commandline = getenv ("bootargsf4");
-+        else
-+#endif
-+                commandline = getenv ("bootargs");
-+
- 	if ((flag != 0) && (flag != BOOTM_STATE_OS_GO))
- 		return 1;
- 
-diff --git a/board/qi/qi_lb60/qi_lb60.c b/board/qi/qi_lb60/qi_lb60.c
-index a2ba648..d622219 100644
---- a/board/qi/qi_lb60/qi_lb60.c
-+++ b/board/qi/qi_lb60/qi_lb60.c
-@@ -15,7 +15,7 @@ DECLARE_GLOBAL_DATA_PTR;
- 
- static void gpio_init(void)
- {
--	unsigned int i;
-+	unsigned int i, j;
- 
- 	/* Initialize NAND Flash Pins */
- 	__gpio_as_nand();
-@@ -42,14 +42,34 @@ static void gpio_init(void)
- 
- 	if (__gpio_get_pin(GPIO_KEYIN_BASE + 2) == 0){
- 		printf("[S] pressed, enable UART0\n");
-+		gd->boot_option |= BOOT_WITH_ENABLE_UART;
- 		__gpio_as_uart0();
- 	} else {
- 		__gpio_as_input(GPIO_KEYIN_8);
- 		__gpio_enable_pull(GPIO_KEYIN_8);
- 	}
- 
--	/* enable the TP4, TP5 as UART0 */
--	__gpio_jtag_to_uart0();
-+	if (__gpio_get_pin(GPIO_KEYIN_BASE + 3) == 0) {
-+		printf("[M] pressed, boot from memory card\n");
-+		gd->boot_option |= BOOT_FROM_MEMCARD;
-+		__gpio_jtag_to_uart0();
-+	}
-+
-+	for (j = 0; j < 4; j++) {
-+		for (i = 0; i < 4; i++)
-+			__gpio_set_pin(GPIO_KEYOUT_BASE + i);
-+
-+		__gpio_clear_pin(GPIO_KEYOUT_BASE + j);
-+
-+		if (__gpio_get_pin(GPIO_KEYIN_BASE) == 0) {
-+			printf("[F%d] pressed", (j + 1));
-+			gd->boot_option |= (1 << (j + 2));
-+			/* BOOT_WITH_F1	(1 << 2) */
-+			/* BOOT_WITH_F2	(1 << 3) */
-+			/* BOOT_WITH_F3	(1 << 4) */
-+			/* BOOT_WITH_F4	(1 << 5) */
-+		}
-+	}
- 
- 	__gpio_as_output(GPIO_AUDIO_POP);
- 	__gpio_set_pin(GPIO_AUDIO_POP);
-diff --git a/common/main.c b/common/main.c
-index 9507cec..dbfb7ca 100644
---- a/common/main.c
-+++ b/common/main.c
-@@ -355,7 +355,11 @@ void main_loop (void)
- #if defined(CONFIG_BOOTDELAY) && (CONFIG_BOOTDELAY >= 0)
- 	s = getenv ("bootdelay");
- 	bootdelay = s ? (int)simple_strtol(s, NULL, 10) : CONFIG_BOOTDELAY;
--
-+#if defined(CONFIG_NANONOTE)
-+	DECLARE_GLOBAL_DATA_PTR;
-+	if (gd->boot_option & BOOT_WITH_ENABLE_UART)
-+		bootdelay = 3;
-+# endif
- 	debug ("### main_loop entered: bootdelay=%d\n\n", bootdelay);
- 
- #if defined(CONFIG_MENU_SHOW)
-@@ -379,7 +383,20 @@ void main_loop (void)
- 	}
- 	else
- #endif /* CONFIG_BOOTCOUNT_LIMIT */
--		s = getenv ("bootcmd");
-+#if defined(CONFIG_NANONOTE)
-+		if (gd->boot_option & BOOT_FROM_MEMCARD)
-+			s = getenv ("bootcmdfromsd");
-+		else if (gd->boot_option & BOOT_WITH_F1)
-+			s = getenv ("bootcmdf1");
-+		else if (gd->boot_option & BOOT_WITH_F2)
-+			s = getenv ("bootcmdf2");
-+		else if (gd->boot_option & BOOT_WITH_F3)
-+			s = getenv ("bootcmdf3");
-+		else if (gd->boot_option & BOOT_WITH_F4)
-+			s = getenv ("bootcmdf4");
-+		else
-+#endif
-+			s = getenv ("bootcmd");
- 
- 	debug ("### main_loop: bootcmd=\"%s\"\n", s ? s : "<UNDEFINED>");
- 
-diff --git a/include/configs/qi_lb60.h b/include/configs/qi_lb60.h
-index 7b33be0..52b370c 100644
---- a/include/configs/qi_lb60.h
-+++ b/include/configs/qi_lb60.h
-@@ -31,6 +31,7 @@
- /*
-  * Miscellaneous configurable options
-  */
-+#define CONFIG_NANONOTE
- #define CONFIG_JZ4740_MMC
- #define CONFIG_MMC      	1
- #define CONFIG_FAT      	1
-@@ -39,6 +40,37 @@
- #define CONFIG_CMD_FAT
- #define CONFIG_CMD_EXT2
- 
-+#define CONFIG_CMD_UBIFS
-+#define CONFIG_CMD_UBI
-+#define CONFIG_MTD_PARTITIONS
-+#define CONFIG_MTD_DEVICE
-+#define CONFIG_CMD_MTDPARTS
-+#define CONFIG_CMD_UBI
-+#define CONFIG_CMD_UBIFS
-+#define CONFIG_LZO
-+#define CONFIG_RBTREE
-+
-+#define MTDIDS_DEFAULT		"nand0=jz4740-nand"
-+#define MTDPARTS_DEFAULT	"mtdparts=jz4740-nand:4M@0(uboot)ro,4M@4M(kernel)ro,512M@8M(rootfs)ro,-(data)ro"
-+
-+#define BOOT_FROM_MEMCARD	1
-+#define BOOT_WITH_ENABLE_UART	(1 << 1)	/* Vaule for global_data.h gd->boot_option */
-+#define BOOT_WITH_F1		(1 << 2)
-+#define BOOT_WITH_F2		(1 << 3)
-+#define BOOT_WITH_F3		(1 << 4)
-+#define BOOT_WITH_F4		(1 << 5)
-+
-+#define CONFIG_EXTRA_ENV_SETTINGS \
-+	"bootcmdfromsd=mmc init; ext2load mmc 0 0x80600000 /boot/uImage; bootm;\0" \
-+	"bootargsfromsd=mem=32M console=tty0 console=ttyS0,57600n8 rootfstype=ext2 root=/dev/mmcblk0p1 rw rootwait\0" \
-+	"bootcmdf1=mmc init; ext2load mmc 0:1 0x80600000 /boot/uImage; bootm;\0" \
-+	"bootargsf1=mem=32M console=tty0 console=ttyS0,57600n8 rootfstype=ext2 root=/dev/mmcblk0p1 rw rootwait\0" \
-+	"bootcmdf2=mmc init; ext2load mmc 0:2 0x80600000 /boot/uImage; bootm;\0" \
-+	"bootargsf2=mem=32M console=tty0 console=ttyS0,57600n8 rootfstype=ext2 root=/dev/mmcblk0p2 rw rootwait\0" \
-+	"bootcmdf3=mmc init; ext2load mmc 0:3 0x80600000 /boot/uImage; bootm;\0" \
-+	"bootargsf3=mem=32M console=tty0 console=ttyS0,57600n8 rootfstype=ext2 root=/dev/mmcblk0p3 rw rootwait\0" \
-+	"bootcmdf4=mtdparts default;ubi part rootfs;ubifsmount rootfs;ubifsload 0x80600000 /boot/uImage; bootm;\0" \
-+	"bootargsf4=mem=32M console=tty0 console=ttyS0,57600n8 ubi.mtd=2 rootfstype=ubifs root=ubi0:rootfs rw rootwait"
- 
- #define CONFIG_SYS_SDRAM_BASE		0x80000000	/* Cached addr */
- #define CONFIG_SYS_INIT_SP_OFFSET	0x400000
--- 
-1.7.9.5
-

+ 0 - 847
package/boot/uboot-xburst/patches/0005-add-nanonote-lcd-support.patch

@@ -1,847 +0,0 @@
-From ca8c5216cfd3ad3fda9867ed2d157ae5a209834b Mon Sep 17 00:00:00 2001
-From: Xiangfu <xiangfu@openmobilefree.net>
-Date: Wed, 10 Oct 2012 22:05:27 +0800
-Subject: [PATCH 5/6] add nanonote lcd support
-
----
- arch/mips/include/asm/global_data.h |    1 +
- arch/mips/include/asm/jz4740.h      |   90 ++++++++
- arch/mips/lib/board.c               |    6 +
- common/lcd.c                        |    9 +-
- drivers/video/Makefile              |    1 +
- drivers/video/nanonote_gpm940b0.c   |  400 +++++++++++++++++++++++++++++++++++
- drivers/video/nanonote_gpm940b0.h   |  135 ++++++++++++
- include/configs/qi_lb60.h           |    7 +
- include/lcd.h                       |   52 ++++-
- 9 files changed, 697 insertions(+), 4 deletions(-)
- create mode 100644 drivers/video/nanonote_gpm940b0.c
- create mode 100644 drivers/video/nanonote_gpm940b0.h
-
-diff --git a/arch/mips/include/asm/global_data.h b/arch/mips/include/asm/global_data.h
-index cd03d7e..7cec2de 100644
---- a/arch/mips/include/asm/global_data.h
-+++ b/arch/mips/include/asm/global_data.h
-@@ -44,6 +44,7 @@ typedef	struct	global_data {
- 	unsigned long	per_clk;	/* Peripheral bus clock */
- 	unsigned long	mem_clk;	/* Memory bus clock */
- 	unsigned long	dev_clk;	/* Device clock */
-+        unsigned long   fb_base;        /* base address of framebuffer */
- 	/* "static data" needed by most of timer.c */
- 	unsigned long	tbl;
- 	unsigned long	lastinc;
-diff --git a/arch/mips/include/asm/jz4740.h b/arch/mips/include/asm/jz4740.h
-index 68287fb..13724a2 100644
---- a/arch/mips/include/asm/jz4740.h
-+++ b/arch/mips/include/asm/jz4740.h
-@@ -1312,5 +1312,95 @@ do { 								\
-  	while (REG_MSC_STAT & MSC_STAT_IS_RESETTING);		\
- } while (0)
- 
-+/*************************************************************************
-+ * LCD (LCD Controller)
-+ *************************************************************************/
-+#define REG32(addr)	*((volatile u32 *)(addr))
-+
-+#define	CPM_BASE	0xB0000000
-+#define CPM_CPCCR	(CPM_BASE+0x00)
-+#define REG_CPM_CPCCR	REG32(CPM_CPCCR)
-+
-+#define	LCD_BASE	0xB3050000
-+#define LCD_CFG		(LCD_BASE + 0x00) /* LCD Configure Register */
-+#define LCD_VSYNC	(LCD_BASE + 0x04) /* Vertical Synchronize Register */
-+#define LCD_HSYNC	(LCD_BASE + 0x08) /* Horizontal Synchronize Register */
-+#define LCD_VAT		(LCD_BASE + 0x0c) /* Virtual Area Setting Register */
-+#define LCD_DAH		(LCD_BASE + 0x10) /* Display Area Horizontal Start/End Point */
-+#define LCD_DAV		(LCD_BASE + 0x14) /* Display Area Vertical Start/End Point */
-+#define LCD_PS		(LCD_BASE + 0x18) /* PS Signal Setting */
-+#define LCD_CLS		(LCD_BASE + 0x1c) /* CLS Signal Setting */
-+#define LCD_SPL		(LCD_BASE + 0x20) /* SPL Signal Setting */
-+#define LCD_REV		(LCD_BASE + 0x24) /* REV Signal Setting */
-+#define LCD_CTRL	(LCD_BASE + 0x30) /* LCD Control Register */
-+#define LCD_STATE	(LCD_BASE + 0x34) /* LCD Status Register */
-+#define LCD_IID		(LCD_BASE + 0x38) /* Interrupt ID Register */
-+#define LCD_DA0		(LCD_BASE + 0x40) /* Descriptor Address Register 0 */
-+#define LCD_SA0		(LCD_BASE + 0x44) /* Source Address Register 0 */
-+#define LCD_FID0	(LCD_BASE + 0x48) /* Frame ID Register 0 */
-+#define LCD_CMD0	(LCD_BASE + 0x4c) /* DMA Command Register 0 */
-+#define LCD_DA1		(LCD_BASE + 0x50) /* Descriptor Address Register 1 */
-+#define LCD_SA1		(LCD_BASE + 0x54) /* Source Address Register 1 */
-+#define LCD_FID1	(LCD_BASE + 0x58) /* Frame ID Register 1 */
-+#define LCD_CMD1	(LCD_BASE + 0x5c) /* DMA Command Register 1 */
-+
-+#define REG_LCD_CFG	REG32(LCD_CFG)
-+#define REG_LCD_VSYNC	REG32(LCD_VSYNC)
-+#define REG_LCD_HSYNC	REG32(LCD_HSYNC)
-+#define REG_LCD_VAT	REG32(LCD_VAT)
-+#define REG_LCD_DAH	REG32(LCD_DAH)
-+#define REG_LCD_DAV	REG32(LCD_DAV)
-+#define REG_LCD_PS	REG32(LCD_PS)
-+#define REG_LCD_CLS	REG32(LCD_CLS)
-+#define REG_LCD_SPL	REG32(LCD_SPL)
-+#define REG_LCD_REV	REG32(LCD_REV)
-+#define REG_LCD_CTRL	REG32(LCD_CTRL)
-+#define REG_LCD_STATE	REG32(LCD_STATE)
-+#define REG_LCD_IID	REG32(LCD_IID)
-+#define REG_LCD_DA0	REG32(LCD_DA0)
-+#define REG_LCD_SA0	REG32(LCD_SA0)
-+#define REG_LCD_FID0	REG32(LCD_FID0)
-+#define REG_LCD_CMD0	REG32(LCD_CMD0)
-+#define REG_LCD_DA1	REG32(LCD_DA1)
-+#define REG_LCD_SA1	REG32(LCD_SA1)
-+#define REG_LCD_FID1	REG32(LCD_FID1)
-+#define REG_LCD_CMD1	REG32(LCD_CMD1)
-+
-+#define LCD_CTRL_BPP_BIT	0  /* Bits Per Pixel */
-+#define LCD_CTRL_BPP_MASK	(0x07 << LCD_CTRL_BPP_BIT)
-+  #define LCD_CTRL_BPP_1	(0 << LCD_CTRL_BPP_BIT) /* 1 bpp */
-+  #define LCD_CTRL_BPP_2	(1 << LCD_CTRL_BPP_BIT) /* 2 bpp */
-+  #define LCD_CTRL_BPP_4	(2 << LCD_CTRL_BPP_BIT) /* 4 bpp */
-+  #define LCD_CTRL_BPP_8	(3 << LCD_CTRL_BPP_BIT) /* 8 bpp */
-+  #define LCD_CTRL_BPP_16	(4 << LCD_CTRL_BPP_BIT) /* 15/16 bpp */
-+  #define LCD_CTRL_BPP_18_24	(5 << LCD_CTRL_BPP_BIT) /* 18/24/32 bpp */
-+
-+#define LCD_CTRL_BST_BIT	28  /* Burst Length Selection */
-+#define LCD_CTRL_BST_MASK	(0x03 << LCD_CTRL_BST_BIT)
-+  #define LCD_CTRL_BST_4	(0 << LCD_CTRL_BST_BIT) /* 4-word */
-+  #define LCD_CTRL_BST_8	(1 << LCD_CTRL_BST_BIT) /* 8-word */
-+  #define LCD_CTRL_BST_16	(2 << LCD_CTRL_BST_BIT) /* 16-word */
-+#define LCD_CTRL_RGB565		(0 << 27) /* RGB565 mode */
-+#define LCD_CTRL_RGB555		(1 << 27) /* RGB555 mode */
-+#define LCD_CTRL_OFUP		(1 << 26) /* Output FIFO underrun protection enable */
-+#define LCD_CTRL_FRC_BIT	24  /* STN FRC Algorithm Selection */
-+#define LCD_CTRL_FRC_MASK	(0x03 << LCD_CTRL_FRC_BIT)
-+  #define LCD_CTRL_FRC_16	(0 << LCD_CTRL_FRC_BIT) /* 16 grayscale */
-+  #define LCD_CTRL_FRC_4	(1 << LCD_CTRL_FRC_BIT) /* 4 grayscale */
-+  #define LCD_CTRL_FRC_2	(2 << LCD_CTRL_FRC_BIT) /* 2 grayscale */
-+
-+#define CPM_LPCDR	(CPM_BASE+0x64)
-+#define CPM_CLKGR	(CPM_BASE+0x20)
-+#define REG_CPM_LPCDR	REG32(CPM_LPCDR)
-+#define REG_CPM_CLKGR	REG32(CPM_CLKGR)
-+
-+#define __cpm_start_tcu()	(REG_CPM_CLKGR &= ~CPM_CLKGR_TCU)
-+#define __cpm_stop_lcd()	(REG_CPM_CLKGR |= CPM_CLKGR_LCD)
-+#define __cpm_set_pixdiv(v) \
-+	(REG_CPM_LPCDR = (REG_CPM_LPCDR & ~CPM_LPCDR_PIXDIV_MASK) | ((v) << (CPM_LPCDR_PIXDIV_BIT)))
-+#define __cpm_set_ldiv(v) \
-+	(REG_CPM_CPCCR = (REG_CPM_CPCCR & ~CPM_CPCCR_LDIV_MASK) | ((v) << (CPM_CPCCR_LDIV_BIT)))
-+#define __cpm_start_lcd()	(REG_CPM_CLKGR &= ~CPM_CLKGR_LCD)
-+
- #endif	/* !__ASSEMBLY__ */
- #endif	/* __JZ4740_H__ */
-diff --git a/arch/mips/lib/board.c b/arch/mips/lib/board.c
-index b14b33e..c2e64d9 100644
---- a/arch/mips/lib/board.c
-+++ b/arch/mips/lib/board.c
-@@ -172,6 +172,12 @@ void board_init_f(ulong bootflag)
- 	addr &= ~(4096 - 1);
- 	debug("Top of RAM usable for U-Boot at: %08lx\n", addr);
- 
-+#ifdef CONFIG_LCD
-+        /* reserve memory for LCD display (always full pages) */
-+        addr = lcd_setmem (addr);
-+        gd->fb_base = addr;
-+#endif /* CONFIG_LCD */
-+
- 	/* Reserve memory for U-Boot code, data & bss
- 	 * round down to next 16 kB limit
- 	 */
-diff --git a/common/lcd.c b/common/lcd.c
-index b6be800..af1281a 100644
---- a/common/lcd.c
-+++ b/common/lcd.c
-@@ -263,6 +263,13 @@ static void lcd_drawchars(ushort x, ushort y, uchar *str, int count)
- 						lcd_color_fg : lcd_color_bg;
- 				bits <<= 1;
- 			}
-+#elif LCD_BPP == LCD_COLOR32
-+                       uint *m = (uint *)d;
-+                       for (c=0; c<32; ++c) {
-+                               *m++ = (bits & 0x80) ?
-+				       lcd_color_fg : lcd_color_bg;
-+                               bits <<= 1;
-+                       }
- #endif
- 		}
- #if LCD_BPP == LCD_MONOCHROME
-@@ -509,7 +516,7 @@ static inline ushort *configuration_get_cmap(void)
- 	return (ushort *)&(cp->lcd_cmap[255 * sizeof(ushort)]);
- #elif defined(CONFIG_ATMEL_LCD)
- 	return (ushort *)(panel_info.mmio + ATMEL_LCDC_LUT(0));
--#elif !defined(CONFIG_ATMEL_HLCD) && !defined(CONFIG_EXYNOS_FB)
-+#elif !defined(CONFIG_ATMEL_HLCD) && !defined(CONFIG_EXYNOS_FB) && !defined(CONFIG_VIDEO_GPM940B0)
- 	return panel_info.cmap;
- #else
- #if defined(CONFIG_LCD_LOGO)
-diff --git a/drivers/video/Makefile b/drivers/video/Makefile
-index ebb6da8..03625bc 100644
---- a/drivers/video/Makefile
-+++ b/drivers/video/Makefile
-@@ -50,6 +50,7 @@ COBJS-$(CONFIG_VIDEO_SED13806) += sed13806.o
- COBJS-$(CONFIG_VIDEO_SM501) += sm501.o
- COBJS-$(CONFIG_VIDEO_SMI_LYNXEM) += smiLynxEM.o videomodes.o
- COBJS-$(CONFIG_VIDEO_VCXK) += bus_vcxk.o
-+COBJS-$(CONFIG_VIDEO_GPM940B0) += nanonote_gpm940b0.o
- 
- COBJS	:= $(sort $(COBJS-y))
- SRCS	:= $(COBJS:.o=.c)
-diff --git a/drivers/video/nanonote_gpm940b0.c b/drivers/video/nanonote_gpm940b0.c
-new file mode 100644
-index 0000000..11efb72
---- /dev/null
-+++ b/drivers/video/nanonote_gpm940b0.c
-@@ -0,0 +1,400 @@
-+/*
-+ * JzRISC lcd controller
-+ *
-+ * Xiangfu Liu <xiangfu@sharism.cc>
-+ *
-+ * This program is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU General Public License as
-+ * published by the Free Software Foundation; either version 2 of
-+ * the License, or (at your option) any later version.
-+ *
-+ * This program is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the
-+ * GNU General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU General Public License
-+ * along with this program; if not, write to the Free Software
-+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-+ * MA 02111-1307 USA
-+ */
-+
-+#include <config.h>
-+#include <common.h>
-+#include <lcd.h>
-+
-+#include <asm/io.h>               /* virt_to_phys() */
-+#include <asm/jz4740.h>
-+
-+#include "nanonote_gpm940b0.h"
-+
-+#define align2(n) (n)=((((n)+1)>>1)<<1)
-+#define align4(n) (n)=((((n)+3)>>2)<<2)
-+#define align8(n) (n)=((((n)+7)>>3)<<3)
-+
-+struct jzfb_info {
-+	unsigned int cfg;	/* panel mode and pin usage etc. */
-+	unsigned int w;
-+	unsigned int h;
-+	unsigned int bpp;	/* bit per pixel */
-+	unsigned int fclk;	/* frame clk */
-+	unsigned int hsw;	/* hsync width, in pclk */
-+	unsigned int vsw;	/* vsync width, in line count */
-+	unsigned int elw;	/* end of line, in pclk */
-+	unsigned int blw;	/* begin of line, in pclk */
-+	unsigned int efw;	/* end of frame, in line count */
-+	unsigned int bfw;	/* begin of frame, in line count */
-+};
-+
-+static struct jzfb_info jzfb = {
-+	MODE_8BIT_SERIAL_TFT | PCLK_N | HSYNC_N | VSYNC_N,
-+	320, 240, 32, 70, 1, 1, 273, 140, 1, 20
-+};
-+
-+vidinfo_t panel_info = {
-+	320, 240, LCD_BPP,
-+};
-+
-+void *lcd_base;
-+void *lcd_console_address;
-+int lcd_line_length;
-+int lcd_color_fg;
-+int lcd_color_bg;
-+short console_col;
-+short console_row;
-+
-+static int jz_lcd_init_mem(void *lcdbase, vidinfo_t *vid)
-+{
-+	u_long palette_mem_size;
-+	struct jz_fb_info *fbi = &vid->jz_fb;
-+	int fb_size = vid->vl_row * (vid->vl_col * NBITS (vid->vl_bpix)) / 8;
-+
-+	fbi->screen = (u_long)lcdbase;
-+	fbi->palette_size = 256;
-+	palette_mem_size = fbi->palette_size * sizeof(u16);
-+
-+	debug("jz_lcd.c palette_mem_size = 0x%08lx\n", (u_long) palette_mem_size);
-+	/* locate palette and descs at end of page following fb */
-+	fbi->palette = (u_long)lcdbase + fb_size + PAGE_SIZE - palette_mem_size;
-+
-+	return 0;
-+}
-+
-+static void jz_lcd_desc_init(vidinfo_t *vid)
-+{
-+	struct jz_fb_info * fbi;
-+	fbi = &vid->jz_fb;
-+	fbi->dmadesc_fblow = (struct jz_fb_dma_descriptor *)((unsigned int)fbi->palette - 3*16);
-+	fbi->dmadesc_fbhigh = (struct jz_fb_dma_descriptor *)((unsigned int)fbi->palette - 2*16);
-+	fbi->dmadesc_palette = (struct jz_fb_dma_descriptor *)((unsigned int)fbi->palette - 1*16);
-+
-+	#define BYTES_PER_PANEL	 (vid->vl_col * vid->vl_row * NBITS(vid->vl_bpix) / 8)
-+
-+	/* populate descriptors */
-+	fbi->dmadesc_fblow->fdadr = virt_to_phys(fbi->dmadesc_fblow);
-+	fbi->dmadesc_fblow->fsadr = virt_to_phys((void *)(fbi->screen + BYTES_PER_PANEL));
-+	fbi->dmadesc_fblow->fidr  = 0;
-+	fbi->dmadesc_fblow->ldcmd = BYTES_PER_PANEL / 4 ;
-+
-+	fbi->fdadr1 = virt_to_phys(fbi->dmadesc_fblow); /* only used in dual-panel mode */
-+
-+	fbi->dmadesc_fbhigh->fsadr = virt_to_phys((void *)fbi->screen);
-+	fbi->dmadesc_fbhigh->fidr = 0;
-+	fbi->dmadesc_fbhigh->ldcmd =  BYTES_PER_PANEL / 4; /* length in word */
-+
-+	fbi->dmadesc_palette->fsadr = virt_to_phys((void *)fbi->palette);
-+	fbi->dmadesc_palette->fidr  = 0;
-+	fbi->dmadesc_palette->ldcmd = (fbi->palette_size * 2)/4 | (1<<28);
-+
-+	if(NBITS(vid->vl_bpix) < 12) {
-+		/* assume any mode with <12 bpp is palette driven */
-+		fbi->dmadesc_palette->fdadr = virt_to_phys(fbi->dmadesc_fbhigh);
-+		fbi->dmadesc_fbhigh->fdadr = virt_to_phys(fbi->dmadesc_palette);
-+		/* flips back and forth between pal and fbhigh */
-+		fbi->fdadr0 = virt_to_phys(fbi->dmadesc_palette);
-+	} else {
-+		/* palette shouldn't be loaded in true-color mode */
-+		fbi->dmadesc_fbhigh->fdadr = virt_to_phys((void *)fbi->dmadesc_fbhigh);
-+		fbi->fdadr0 = virt_to_phys(fbi->dmadesc_fbhigh); /* no pal just fbhigh */
-+	}
-+}
-+
-+static int  jz_lcd_hw_init(vidinfo_t *vid)
-+{
-+	struct jz_fb_info *fbi = &vid->jz_fb;
-+	unsigned int val = 0;
-+	unsigned int pclk;
-+	unsigned int stnH;
-+	int pll_div;
-+
-+	/* Setting Control register */
-+	switch (jzfb.bpp) {
-+	case 1:
-+		val |= LCD_CTRL_BPP_1;
-+		break;
-+	case 2:
-+		val |= LCD_CTRL_BPP_2;
-+		break;
-+	case 4:
-+		val |= LCD_CTRL_BPP_4;
-+		break;
-+	case 8:
-+		val |= LCD_CTRL_BPP_8;
-+		break;
-+	case 15:
-+		val |= LCD_CTRL_RGB555;
-+	case 16:
-+		val |= LCD_CTRL_BPP_16;
-+		break;
-+	case 17 ... 32:
-+		val |= LCD_CTRL_BPP_18_24;	/* target is 4bytes/pixel */
-+		break;
-+
-+	default:
-+		printf("jz_lcd.c The BPP %d is not supported\n", jzfb.bpp);
-+		val |= LCD_CTRL_BPP_16;
-+		break;
-+	}
-+
-+	switch (jzfb.cfg & MODE_MASK) {
-+	case MODE_STN_MONO_DUAL:
-+	case MODE_STN_COLOR_DUAL:
-+	case MODE_STN_MONO_SINGLE:
-+	case MODE_STN_COLOR_SINGLE:
-+		switch (jzfb.bpp) {
-+		case 1:
-+			/* val |= LCD_CTRL_PEDN; */
-+		case 2:
-+			val |= LCD_CTRL_FRC_2;
-+			break;
-+		case 4:
-+			val |= LCD_CTRL_FRC_4;
-+			break;
-+		case 8:
-+		default:
-+			val |= LCD_CTRL_FRC_16;
-+			break;
-+		}
-+		break;
-+	}
-+
-+	val |= LCD_CTRL_BST_16;		/* Burst Length is 16WORD=64Byte */
-+	val |= LCD_CTRL_OFUP;		/* OutFIFO underrun protect */
-+
-+	switch (jzfb.cfg & MODE_MASK) {
-+	case MODE_STN_MONO_DUAL:
-+	case MODE_STN_COLOR_DUAL:
-+	case MODE_STN_MONO_SINGLE:
-+	case MODE_STN_COLOR_SINGLE:
-+		switch (jzfb.cfg & STN_DAT_PINMASK) {
-+		case STN_DAT_PIN1:
-+			/* Do not adjust the hori-param value. */
-+			break;
-+		case STN_DAT_PIN2:
-+			align2(jzfb.hsw);
-+			align2(jzfb.elw);
-+			align2(jzfb.blw);
-+			break;
-+		case STN_DAT_PIN4:
-+			align4(jzfb.hsw);
-+			align4(jzfb.elw);
-+			align4(jzfb.blw);
-+			break;
-+		case STN_DAT_PIN8:
-+			align8(jzfb.hsw);
-+			align8(jzfb.elw);
-+			align8(jzfb.blw);
-+			break;
-+		}
-+		break;
-+	}
-+
-+	REG_LCD_CTRL = val;
-+
-+	switch (jzfb.cfg & MODE_MASK) {
-+	case MODE_STN_MONO_DUAL:
-+	case MODE_STN_COLOR_DUAL:
-+	case MODE_STN_MONO_SINGLE:
-+	case MODE_STN_COLOR_SINGLE:
-+		if (((jzfb.cfg & MODE_MASK) == MODE_STN_MONO_DUAL) ||
-+		    ((jzfb.cfg & MODE_MASK) == MODE_STN_COLOR_DUAL))
-+			stnH = jzfb.h >> 1;
-+		else
-+			stnH = jzfb.h;
-+
-+		REG_LCD_VSYNC = (0 << 16) | jzfb.vsw;
-+		REG_LCD_HSYNC = ((jzfb.blw+jzfb.w) << 16) | (jzfb.blw+jzfb.w+jzfb.hsw);
-+
-+		/* Screen setting */
-+		REG_LCD_VAT = ((jzfb.blw + jzfb.w + jzfb.hsw + jzfb.elw) << 16) | (stnH + jzfb.vsw + jzfb.bfw + jzfb.efw);
-+		REG_LCD_DAH = (jzfb.blw << 16) | (jzfb.blw + jzfb.w);
-+		REG_LCD_DAV = (0 << 16) | (stnH);
-+
-+		/* AC BIAs signal */
-+		REG_LCD_PS = (0 << 16) | (stnH+jzfb.vsw+jzfb.efw+jzfb.bfw);
-+
-+		break;
-+
-+	case MODE_TFT_GEN:
-+	case MODE_TFT_SHARP:
-+	case MODE_TFT_CASIO:
-+	case MODE_TFT_SAMSUNG:
-+	case MODE_8BIT_SERIAL_TFT:
-+	case MODE_TFT_18BIT:
-+		REG_LCD_VSYNC = (0 << 16) | jzfb.vsw;
-+		REG_LCD_HSYNC = (0 << 16) | jzfb.hsw;
-+		REG_LCD_DAV =((jzfb.vsw+jzfb.bfw) << 16) | (jzfb.vsw +jzfb.bfw+jzfb.h);
-+		REG_LCD_DAH = ((jzfb.hsw + jzfb.blw) << 16) | (jzfb.hsw + jzfb.blw + jzfb.w );
-+		REG_LCD_VAT = (((jzfb.blw + jzfb.w + jzfb.elw + jzfb.hsw)) << 16) \
-+			| (jzfb.vsw + jzfb.bfw + jzfb.h + jzfb.efw);
-+		break;
-+	}
-+
-+	switch (jzfb.cfg & MODE_MASK) {
-+	case MODE_TFT_SAMSUNG:
-+	{
-+		unsigned int total, tp_s, tp_e, ckv_s, ckv_e;
-+		unsigned int rev_s, rev_e, inv_s, inv_e;
-+
-+		pclk = val * (jzfb.w + jzfb.hsw + jzfb.elw + jzfb.blw) *
-+			(jzfb.h + jzfb.vsw + jzfb.efw + jzfb.bfw); /* Pixclk */
-+
-+		total = jzfb.blw + jzfb.w + jzfb.elw + jzfb.hsw;
-+		tp_s = jzfb.blw + jzfb.w + 1;
-+		tp_e = tp_s + 1;
-+		ckv_s = tp_s - pclk/(1000000000/4100);
-+		ckv_e = tp_s + total;
-+		rev_s = tp_s - 11;	/* -11.5 clk */
-+		rev_e = rev_s + total;
-+		inv_s = tp_s;
-+		inv_e = inv_s + total;
-+		REG_LCD_CLS = (tp_s << 16) | tp_e;
-+		REG_LCD_PS = (ckv_s << 16) | ckv_e;
-+		REG_LCD_SPL = (rev_s << 16) | rev_e;
-+		REG_LCD_REV = (inv_s << 16) | inv_e;
-+		jzfb.cfg |= STFT_REVHI | STFT_SPLHI;
-+		break;
-+	}
-+	case MODE_TFT_SHARP:
-+	{
-+		unsigned int total, cls_s, cls_e, ps_s, ps_e;
-+		unsigned int spl_s, spl_e, rev_s, rev_e;
-+		total = jzfb.blw + jzfb.w + jzfb.elw + jzfb.hsw;
-+		spl_s = 1;
-+		spl_e = spl_s + 1;
-+		cls_s = 0;
-+		cls_e = total - 60;	/* > 4us (pclk = 80ns) */
-+		ps_s = cls_s;
-+		ps_e = cls_e;
-+		rev_s = total - 40;	/* > 3us (pclk = 80ns) */
-+		rev_e = rev_s + total;
-+		jzfb.cfg |= STFT_PSHI; 
-+		REG_LCD_SPL = (spl_s << 16) | spl_e;
-+		REG_LCD_CLS = (cls_s << 16) | cls_e;
-+		REG_LCD_PS = (ps_s << 16) | ps_e;
-+		REG_LCD_REV = (rev_s << 16) | rev_e;
-+		break;
-+	}
-+	case MODE_TFT_CASIO:
-+		break;
-+	}
-+
-+	/* Configure the LCD panel */
-+	REG_LCD_CFG = jzfb.cfg;
-+
-+	/* Timing setting */
-+	__cpm_stop_lcd();
-+
-+	val = jzfb.fclk; /* frame clk */
-+	if ( (jzfb.cfg & MODE_MASK) != MODE_8BIT_SERIAL_TFT) {
-+		pclk = val * (jzfb.w + jzfb.hsw + jzfb.elw + jzfb.blw) *
-+			(jzfb.h + jzfb.vsw + jzfb.efw + jzfb.bfw); /* Pixclk */
-+	} else {
-+		/* serial mode: Hsync period = 3*Width_Pixel */
-+		pclk = val * (jzfb.w*3 + jzfb.hsw + jzfb.elw + jzfb.blw) *
-+			(jzfb.h + jzfb.vsw + jzfb.efw + jzfb.bfw); /* Pixclk */
-+	}
-+
-+	if (((jzfb.cfg & MODE_MASK) == MODE_STN_COLOR_SINGLE) ||
-+	    ((jzfb.cfg & MODE_MASK) == MODE_STN_COLOR_DUAL))
-+		pclk = (pclk * 3);
-+
-+	if (((jzfb.cfg & MODE_MASK) == MODE_STN_COLOR_SINGLE) ||
-+	    ((jzfb.cfg & MODE_MASK) == MODE_STN_COLOR_DUAL) ||
-+	    ((jzfb.cfg & MODE_MASK) == MODE_STN_MONO_SINGLE) ||
-+	    ((jzfb.cfg & MODE_MASK) == MODE_STN_MONO_DUAL))
-+		pclk = pclk >> ((jzfb.cfg & STN_DAT_PINMASK) >> 4);
-+
-+	if (((jzfb.cfg & MODE_MASK) == MODE_STN_COLOR_DUAL) ||
-+	    ((jzfb.cfg & MODE_MASK) == MODE_STN_MONO_DUAL))
-+		pclk >>= 1;
-+
-+	pll_div = (REG_CPM_CPCCR & CPM_CPCCR_PCS); /* clock source,0:pllout/2 1: pllout */
-+	pll_div = pll_div ? 1 : 2;
-+	val = (__cpm_get_pllout() / pll_div) / pclk;
-+	val--;
-+	if (val > 0x1ff) {
-+		printf("CPM_LPCDR too large, set it to 0x1ff\n");
-+		val = 0x1ff;
-+	}
-+	__cpm_set_pixdiv(val);
-+
-+	val = pclk * 3 ;	/* LCDClock > 2.5*Pixclock */
-+	if (val > 150000000) {
-+		printf("Warning: LCDClock=%d\n, LCDClock must less or equal to 150MHz.\n", val);
-+		printf("Change LCDClock to 150MHz\n");
-+		val = 150000000;
-+	}
-+	val = (__cpm_get_pllout() / pll_div) / val;
-+	val--;
-+	if (val > 0x1f) {
-+		printf("CPM_CPCCR.LDIV too large, set it to 0x1f\n");
-+		val = 0x1f;
-+	}
-+	__cpm_set_ldiv( val );
-+	REG_CPM_CPCCR |= CPM_CPCCR_CE ; /* update divide */
-+
-+	__cpm_start_lcd();
-+	udelay(1000);
-+
-+	REG_LCD_DA0 = fbi->fdadr0; /* frame descripter*/
-+
-+	if (((jzfb.cfg & MODE_MASK) == MODE_STN_COLOR_DUAL) ||
-+	    ((jzfb.cfg & MODE_MASK) == MODE_STN_MONO_DUAL))
-+		REG_LCD_DA1 = fbi->fdadr1; /* frame descripter*/
-+
-+	return 0;
-+}
-+
-+void lcd_ctrl_init (void *lcdbase)
-+{
-+	__lcd_display_pin_init();
-+	__lcd_display_on() ;
-+
-+	jz_lcd_init_mem(lcdbase, &panel_info);
-+	jz_lcd_desc_init(&panel_info);
-+	jz_lcd_hw_init(&panel_info);
-+
-+}
-+
-+/*
-+ * Before enabled lcd controller, lcd registers should be configured correctly.
-+ */
-+void lcd_enable (void)
-+{
-+	REG_LCD_CTRL &= ~(1<<4); /* LCDCTRL.DIS */
-+	REG_LCD_CTRL |= 1<<3;    /* LCDCTRL.ENA*/
-+}
-+
-+void lcd_disable (void)
-+{
-+	REG_LCD_CTRL |= (1<<4);
-+}
-+
-+void lcd_setcolreg (ushort regno, ushort red, ushort green, ushort blue)
-+{
-+}
-+
-+void lcd_initcolregs (void)
-+{
-+}
-diff --git a/drivers/video/nanonote_gpm940b0.h b/drivers/video/nanonote_gpm940b0.h
-new file mode 100644
-index 0000000..efe491e
---- /dev/null
-+++ b/drivers/video/nanonote_gpm940b0.h
-@@ -0,0 +1,135 @@
-+/*
-+ * JzRISC lcd controller
-+ *
-+ * Xiangfu Liu <xiangfu@sharism.cc>
-+ *
-+ * This program is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU General Public License as
-+ * published by the Free Software Foundation; either version 2 of
-+ * the License, or (at your option) any later version.
-+ *
-+ * This program is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the
-+ * GNU General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU General Public License
-+ * along with this program; if not, write to the Free Software
-+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-+ * MA 02111-1307 USA
-+ */
-+
-+#ifndef __QI_LB60_GPM940B0_H__
-+#define __QI_LB60_GPM940B0_H__
-+
-+struct lcd_desc{
-+	unsigned int next_desc; /* LCDDAx */
-+	unsigned int databuf;   /* LCDSAx */
-+	unsigned int frame_id;  /* LCDFIDx */ 
-+	unsigned int cmd;       /* LCDCMDx */
-+};
-+
-+#define MODE_MASK		0x0f
-+#define MODE_TFT_GEN		0x00
-+#define MODE_TFT_SHARP		0x01
-+#define MODE_TFT_CASIO		0x02
-+#define MODE_TFT_SAMSUNG	0x03
-+#define MODE_CCIR656_NONINT	0x04
-+#define MODE_CCIR656_INT	0x05
-+#define MODE_STN_COLOR_SINGLE	0x08
-+#define MODE_STN_MONO_SINGLE	0x09
-+#define MODE_STN_COLOR_DUAL	0x0a
-+#define MODE_STN_MONO_DUAL	0x0b
-+#define MODE_8BIT_SERIAL_TFT    0x0c
-+
-+#define MODE_TFT_18BIT          (1<<7)
-+
-+#define STN_DAT_PIN1	(0x00 << 4)
-+#define STN_DAT_PIN2	(0x01 << 4)
-+#define STN_DAT_PIN4	(0x02 << 4)
-+#define STN_DAT_PIN8	(0x03 << 4)
-+#define STN_DAT_PINMASK	STN_DAT_PIN8
-+
-+#define STFT_PSHI	(1 << 15)
-+#define STFT_CLSHI	(1 << 14)
-+#define STFT_SPLHI	(1 << 13)
-+#define STFT_REVHI	(1 << 12)
-+
-+#define SYNC_MASTER	(0 << 16)
-+#define SYNC_SLAVE	(1 << 16)
-+
-+#define DE_P		(0 << 9)
-+#define DE_N		(1 << 9)
-+
-+#define PCLK_P		(0 << 10)
-+#define PCLK_N		(1 << 10)
-+
-+#define HSYNC_P		(0 << 11)
-+#define HSYNC_N		(1 << 11)
-+
-+#define VSYNC_P		(0 << 8)
-+#define VSYNC_N		(1 << 8)
-+
-+#define DATA_NORMAL	(0 << 17)
-+#define DATA_INVERSE	(1 << 17)
-+
-+
-+/* Jz LCDFB supported I/O controls. */
-+#define FBIOSETBACKLIGHT	0x4688
-+#define FBIODISPON		0x4689
-+#define FBIODISPOFF		0x468a
-+#define FBIORESET		0x468b
-+#define FBIOPRINT_REG		0x468c
-+
-+/*
-+ * LCD panel specific definition
-+ */
-+#define MODE	(0xc9)		/* 8bit serial RGB */
-+
-+#define __spi_write_reg1(reg, val)		\
-+do {						\
-+	unsigned char no;			\
-+	unsigned short value;			\
-+	unsigned char a=reg;			\
-+	unsigned char b=val;			\
-+	__gpio_set_pin(SPEN);			\
-+	__gpio_set_pin(SPCK);			\
-+	__gpio_clear_pin(SPDA);			\
-+	__gpio_clear_pin(SPEN);			\
-+	value=((a<<8)|(b&0xFF));		\
-+	for(no=0;no<16;no++)			\
-+	{					\
-+		__gpio_clear_pin(SPCK);		\
-+		if((value&0x8000)==0x8000)	\
-+			__gpio_set_pin(SPDA);	\
-+		else				\
-+			__gpio_clear_pin(SPDA);	\
-+		__gpio_set_pin(SPCK);		\
-+		value=(value<<1);		\
-+	}					\
-+	__gpio_set_pin(SPEN);			\
-+} while (0)
-+
-+#define __lcd_display_pin_init()		\
-+do {						\
-+	__cpm_start_tcu();			\
-+	__gpio_as_output(SPEN); /* use SPDA */	\
-+	__gpio_as_output(SPCK); /* use SPCK */	\
-+	__gpio_as_output(SPDA); /* use SPDA */	\
-+} while (0)
-+
-+#define __lcd_display_on()			\
-+do {						\
-+	__spi_write_reg1(0x05, 0x1e);		\
-+	__spi_write_reg1(0x05, 0x5e);		\
-+	__spi_write_reg1(0x07, 0x8d);		\
-+	__spi_write_reg1(0x13, 0x01);		\
-+	__spi_write_reg1(0x05, 0x5f);		\
-+} while (0)
-+
-+#define __lcd_display_off()			\
-+do {						\
-+	__spi_write_reg1(0x05, 0x5e);		\
-+} while (0)
-+
-+#endif /* __QI_LB60_GPM940B0_H__ */
-diff --git a/include/configs/qi_lb60.h b/include/configs/qi_lb60.h
-index 52b370c..d3e78ad 100644
---- a/include/configs/qi_lb60.h
-+++ b/include/configs/qi_lb60.h
-@@ -32,6 +32,13 @@
-  * Miscellaneous configurable options
-  */
- #define CONFIG_NANONOTE
-+
-+#define CONFIG_LCD
-+#define CONFIG_SYS_WHITE_ON_BLACK
-+#define LCD_BPP			LCD_COLOR32
-+#define CONFIG_VIDEO_GPM940B0
-+
-+
- #define CONFIG_JZ4740_MMC
- #define CONFIG_MMC      	1
- #define CONFIG_FAT      	1
-diff --git a/include/lcd.h b/include/lcd.h
-index 42070d7..6de5482 100644
---- a/include/lcd.h
-+++ b/include/lcd.h
-@@ -263,8 +263,44 @@ typedef struct vidinfo {
- 
- void init_panel_info(vidinfo_t *vid);
- 
--#else
-+#elif defined(CONFIG_JZSOC)
-+/*
-+ * LCD controller stucture for JZSOC: JZ4740
-+ */
-+struct jz_fb_dma_descriptor {
-+       u_long  fdadr;          /* Frame descriptor address register */
-+       u_long  fsadr;          /* Frame source address register */
-+       u_long  fidr;           /* Frame ID register */
-+       u_long  ldcmd;          /* Command register */
-+};
-+
-+/*
-+ * Jz LCD info
-+ */
-+struct jz_fb_info {
-+
-+       u_long  fdadr0; /* physical address of frame/palette descriptor */
-+       u_long  fdadr1; /* physical address of frame descriptor */
-+
-+       /* DMA descriptors */
-+       struct  jz_fb_dma_descriptor *  dmadesc_fblow;
-+       struct  jz_fb_dma_descriptor *  dmadesc_fbhigh;
-+       struct  jz_fb_dma_descriptor *  dmadesc_palette;
-+       u_long  screen;         /* address of frame buffer */
-+       u_long  palette;        /* address of palette memory */
-+       u_int   palette_size;
-+};
-+typedef struct vidinfo {
-+       ushort  vl_col;         /* Number of columns (i.e. 640) */
-+       ushort  vl_row;         /* Number of rows (i.e. 480) */
-+       u_char  vl_bpix;        /* Bits per pixel, 0 = 1, 1 = 2, 2 = 4, 3 = 8 */
-+
-+       struct jz_fb_info jz_fb;
-+} vidinfo_t;
-+
-+extern vidinfo_t panel_info;
- 
-+#else
- typedef struct vidinfo {
- 	ushort	vl_col;		/* Number of columns (i.e. 160) */
- 	ushort	vl_row;		/* Number of rows (i.e. 100) */
-@@ -318,6 +354,7 @@ void lcd_show_board_info(void);
- #define LCD_COLOR4	2
- #define LCD_COLOR8	3
- #define LCD_COLOR16	4
-+#define LCD_COLOR32	5
- 
- /*----------------------------------------------------------------------*/
- #if defined(CONFIG_LCD_INFO_BELOW_LOGO)
-@@ -369,7 +406,7 @@ void lcd_show_board_info(void);
- # define CONSOLE_COLOR_GREY	14
- # define CONSOLE_COLOR_WHITE	15	/* Must remain last / highest	*/
- 
--#else
-+#elif LCD_BPP == LCD_COLOR16
- 
- /*
-  * 16bpp color definitions
-@@ -377,6 +414,15 @@ void lcd_show_board_info(void);
- # define CONSOLE_COLOR_BLACK	0x0000
- # define CONSOLE_COLOR_WHITE	0xffff	/* Must remain last / highest	*/
- 
-+#elif LCD_BPP == LCD_COLOR32
-+/*
-+ * 18,24,32 bpp color definitions
-+ */
-+# define CONSOLE_COLOR_BLACK   0x00000000
-+# define CONSOLE_COLOR_WHITE   0xffffffff /* Must remain last / highest */
-+
-+#else
-+
- #endif /* color definitions */
- 
- /************************************************************************/
-@@ -406,7 +452,7 @@ void lcd_show_board_info(void);
- #if LCD_BPP == LCD_MONOCHROME
- # define COLOR_MASK(c)		((c)	  | (c) << 1 | (c) << 2 | (c) << 3 | \
- 				 (c) << 4 | (c) << 5 | (c) << 6 | (c) << 7)
--#elif (LCD_BPP == LCD_COLOR8) || (LCD_BPP == LCD_COLOR16)
-+#elif (LCD_BPP == LCD_COLOR8) || (LCD_BPP == LCD_COLOR16) || (LCD_BPP == LCD_COLOR32)
- # define COLOR_MASK(c)		(c)
- #else
- # error Unsupported LCD BPP.
--- 
-1.7.9.5
-

+ 0 - 60
package/boot/uboot-xburst/patches/0006-enable-silent-console.patch

@@ -1,60 +0,0 @@
-From 5eb4d4c598f2806bd1b3d1140e917bfead7851ad Mon Sep 17 00:00:00 2001
-From: Xiangfu <xiangfu@openmobilefree.net>
-Date: Wed, 10 Oct 2012 23:51:26 +0800
-Subject: [PATCH 6/6] enable silent console
-
----
- common/console.c          |   16 ++++++++++++++++
- include/configs/qi_lb60.h |    2 ++
- 2 files changed, 18 insertions(+)
-
-diff --git a/common/console.c b/common/console.c
-index 1177f7d..e8a2078 100644
---- a/common/console.c
-+++ b/common/console.c
-@@ -685,6 +685,14 @@ done:
- 
- 	gd->flags |= GD_FLG_DEVINIT;	/* device initialization completed */
- 
-+#ifdef CONFIG_SILENT_CONSOLE
-+	/* Check one more time the contents of the silent environment
-+	 * variable, because if the environment is loaded from NAND it was
-+	 * not available when console_init_f() was called */
-+	if (getenv("silent") != NULL)
-+		gd->flags |= GD_FLG_SILENT;
-+#endif
-+
- 	stdio_print_current_devices();
- 
- #ifdef CONFIG_SYS_CONSOLE_ENV_OVERWRITE
-@@ -760,6 +768,14 @@ int console_init_r(void)
- 
- 	gd->flags |= GD_FLG_DEVINIT;	/* device initialization completed */
- 
-+#ifdef CONFIG_SILENT_CONSOLE
-+	/* Check one more time the contents of the silent environment
-+	 * variable, because if the environment is loaded from NAND it was
-+	 * not available when console_init_f() was called */
-+	if (getenv("silent") != NULL)
-+		gd->flags |= GD_FLG_SILENT;
-+#endif
-+
- 	stdio_print_current_devices();
- 
- 	/* Setting environment variables */
-diff --git a/include/configs/qi_lb60.h b/include/configs/qi_lb60.h
-index d3e78ad..a3534ff 100644
---- a/include/configs/qi_lb60.h
-+++ b/include/configs/qi_lb60.h
-@@ -102,6 +102,8 @@
- #define CONFIG_SYS_NO_FLASH
- #define CONFIG_SYS_FLASH_BASE	0 /* init flash_base as 0 */
- 
-+#define CONFIG_SILENT_CONSOLE		1	/* Enable silent console */
-+
- /*
-  * Command line configuration
-  */
--- 
-1.7.9.5
-

+ 0 - 42
package/boot/yamonenv/Makefile

@@ -1,42 +0,0 @@
-#
-# Copyright (C) 2006 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-include $(TOPDIR)/rules.mk
-
-PKG_NAME:=yamonenv
-PKG_VERSION:=20051022
-PKG_RELEASE:=1
-
-PKG_SOURCE:=$(PKG_NAME)_gruen.4g__$(PKG_VERSION).tar.gz
-PKG_SOURCE_URL:=http://downloads.openwrt.org/sources/
-PKG_HASH:=466eca9cdad2c15e957fb9ce7d0b6927ecd17d85c4cc2dff37e97a3e6b209c67
-
-PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
-
-PKG_FLAGS:=nonshared
-
-include $(INCLUDE_DIR)/package.mk
-
-define Package/yamonenv
-  SECTION:=utils
-  CATEGORY:=Utilities
-  SUBMENU:=Boot Loaders
-  DEPENDS:=@TARGET_au1000
-  TITLE:=YAMON configuration utility
-  URL:=http://meshcube.org/nylon/stable/sources/
-  MAINTAINER:=Florian Fainelli <florian@openwrt.org>
-endef
-
-define Build/Configure
-endef
-
-define Package/yamonenv/install
-	$(INSTALL_DIR) $(1)/usr/sbin
-	$(CP) $(PKG_BUILD_DIR)/src/$(PKG_NAME) $(1)/usr/sbin/
-endef
-
-$(eval $(call BuildPackage,yamonenv))

+ 0 - 11
package/boot/yamonenv/patches/001-yamonenv_mtd_partition.patch

@@ -1,11 +0,0 @@
---- a/src/yamonenv.c
-+++ b/src/yamonenv.c
-@@ -12,7 +12,7 @@
- #include <fcntl.h>
- #include <unistd.h>
- 
--#define DEFAULT_YAMON_ENV_FILE   "/dev/mtd/3"
-+#define DEFAULT_YAMON_ENV_FILE   "/dev/mtd3"
- 
- 
- // control byte definitions:

+ 0 - 125
package/devel/binutils/Makefile

@@ -1,125 +0,0 @@
-#
-# Copyright (C) 2006-2013 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-include $(TOPDIR)/rules.mk
-
-PKG_NAME:=binutils
-PKG_VERSION:=2.27
-PKG_RELEASE:=1
-
-PKG_SOURCE_URL:=@GNU/binutils
-PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
-PKG_VERSION:=$(PKG_VERSION)
-PKG_HASH:=369737ce51587f92466041a97ab7d2358c6d9e1b6490b3940eb09fb0a9a6ac88
-
-PKG_FIXUP:=autoreconf
-PKG_LIBTOOL_PATHS:=. gas bfd opcodes gprof binutils ld libiberty gold intl
-PKG_REMOVE_FILES:=libtool.m4
-PKG_INSTALL:=1
-
-PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
-PKG_LICENSE:=GPL-3.0+
-PKG_BUILD_PARALLEL:=1
-PKG_USE_MIPS16:=0
-
-include $(INCLUDE_DIR)/nls.mk
-include $(INCLUDE_DIR)/package.mk
-
-define Package/libbfd
-  SECTION:=libs
-  CATEGORY:=Libraries
-  TITLE:=libbfd
-  DEPENDS:=+zlib $(ICONV_DEPENDS) $(INTL_DEPENDS)
-endef
-
-define Package/libopcodes
-  SECTION:=libs
-  CATEGORY:=Libraries
-  TITLE:=libbfd
-  DEPENDS:=+libbfd
-endef
-
-define Package/binutils
-  SECTION:=devel
-  CATEGORY:=Development
-  TITLE:=binutils
-  DEPENDS:=+objdump +ar
-endef
-
-define Package/objdump
-  SECTION:=devel
-  CATEGORY:=Development
-  TITLE:=objdump
-  DEPENDS:=+libopcodes
-endef
-
-define Package/ar
-  SECTION:=devel
-  CATEGORY:=Development
-  TITLE:=ar
-  DEPENDS:=+zlib +libbfd
-endef
-
-define Package/binutils/description
-  The Binutils package contains a linker, an assembler, and other tools for handling object files
-endef
-
-TARGET_CFLAGS += $(FPIC) -Wno-unused-value
-
-CONFIGURE_ARGS += \
-	--host=$(REAL_GNU_TARGET_NAME) \
-	--target=$(REAL_GNU_TARGET_NAME) \
-	--enable-shared \
-	--enable-install-libiberty \
-	--enable-install-libbfd
-
-define Build/Install
-	$(call Build/Install/Default)
-	$(MAKE) -C $(PKG_BUILD_DIR)/libiberty \
-		target_header_dir=libiberty \
-		DESTDIR="$(PKG_INSTALL_DIR)" \
-		MULTIOSDIR="" \
-		install
-endef
-
-define Build/InstallDev
-	$(CP) $(PKG_INSTALL_DIR)/* $(1)/
-endef
-
-define Package/libbfd/install
-	$(INSTALL_DIR) $(1)/usr/lib
-	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libbfd*.so $(1)/usr/lib/
-endef
-
-define Package/libopcodes/install
-	$(INSTALL_DIR) $(1)/usr/lib
-	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libopcodes*.so $(1)/usr/lib/
-endef
-
-define Package/objdump/install
-	$(INSTALL_DIR) $(1)/usr/bin
-	$(CP) $(PKG_INSTALL_DIR)/usr/bin/objdump $(1)/usr/bin/
-endef
-
-define Package/ar/install
-	$(INSTALL_DIR) $(1)/usr/bin
-	$(CP) $(PKG_INSTALL_DIR)/usr/bin/ar $(1)/usr/bin/
-endef
-
-define Package/binutils/install
-	$(INSTALL_DIR) $(1)/usr $(1)/bin
-	$(CP) $(PKG_INSTALL_DIR)/usr/bin/ $(1)/usr/
-	mv $(1)/usr/bin/strings $(1)/bin/strings
-	rm -f $(1)/usr/bin/objdump
-	rm -f $(1)/usr/bin/ar
-endef
-
-$(eval $(call BuildPackage,libbfd))
-$(eval $(call BuildPackage,libopcodes))
-$(eval $(call BuildPackage,binutils))
-$(eval $(call BuildPackage,objdump))
-$(eval $(call BuildPackage,ar))

+ 0 - 65
package/devel/binutils/patches/0001-Do-not-pass-host-compiler-sanitization-flags-on-to-l.patch

@@ -1,65 +0,0 @@
-From 183eb37e25d903ccd68cc2d8f8a37e75872c03d2 Mon Sep 17 00:00:00 2001
-From: Nick Clifton <nickc@redhat.com>
-Date: Tue, 6 Sep 2016 17:35:35 +0100
-Subject: [PATCH 1/2] Do not pass host compiler sanitization flags on to linker
- testsuite.
-
-	* Makefile.am (CFLAGS_FOR_TARGET): Define as a copy of CFLAGS but
-	without any sanitization options.
-	(CXXFLAGS_FOR_TARGET): Define as a copy of CXXFLAGS but	without
-	any sanitization options.
-	(check-DEJAGNU): Pass CFLAGS_FOR_TARGET and CXXFLAGS_FOR_TARGET
-	as CFLAGS and CXXFLAGS respectively.
----
- ld/Makefile.am | 8 ++++++--
- ld/Makefile.in | 8 ++++++--
- 2 files changed, 12 insertions(+), 4 deletions(-)
-
---- a/ld/Makefile.am
-+++ b/ld/Makefile.am
-@@ -136,6 +136,10 @@ CXX_FOR_TARGET = ` \
-     fi; \
-   fi`
- 
-+# Strip out sanitization options as we want to test building binaries without any extra paraphernalia
-+CFLAGS_FOR_TARGET = `echo $(CFLAGS) | sed -e 's/-fsanitize=address//g' -e 's/-fsanitize=undefined//g'`
-+CXXFLAGS_FOR_TARGET = `echo $(CXXFLAGS) | sed -e 's/-fsanitize=address//g' -e 's/-fsanitize=undefined//g'`
-+
- transform = s/^ld-new$$/$(installed_linker)/;@program_transform_name@
- bin_PROGRAMS = ld-new
- info_TEXINFOS = ld.texinfo
-@@ -2075,8 +2079,8 @@ check-DEJAGNU: site.exp
- 	runtest=$(RUNTEST); \
- 	if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \
- 	  $$runtest --tool $(DEJATOOL) --srcdir $${srcroot}/testsuite \
--		CC="$(CC_FOR_TARGET)" CFLAGS="$(CFLAGS)" \
--		CXX="$(CXX_FOR_TARGET)" CXXFLAGS="$(CXXFLAGS)" \
-+		CC="$(CC_FOR_TARGET)" CFLAGS="$(CFLAGS_FOR_TARGET)" \
-+		CXX="$(CXX_FOR_TARGET)" CXXFLAGS="$(CXXFLAGS_FOR_TARGET)" \
- 		CC_FOR_HOST="$(CC)" CFLAGS_FOR_HOST="$(CFLAGS)" \
- 		OFILES="$(OFILES)" BFDLIB="$(TESTBFDLIB)" \
- 		LIBIBERTY="$(LIBIBERTY) $(LIBINTL)" LIBS="$(LIBS)" \
---- a/ld/Makefile.in
-+++ b/ld/Makefile.in
-@@ -507,6 +507,10 @@ CXX_FOR_TARGET = ` \
-     fi; \
-   fi`
- 
-+
-+# Strip out sanitization options as they require special host libraries.
-+CFLAGS_FOR_TARGET = `echo $(CFLAGS) | sed -e 's/-fsanitize=address//g' -e 's/-fsanitize=undefined//g'`
-+CXXFLAGS_FOR_TARGET = `echo $(CXXFLAGS) | sed -e 's/-fsanitize=address//g' -e 's/-fsanitize=undefined//g'`
- info_TEXINFOS = ld.texinfo
- ld_TEXINFOS = configdoc.texi
- noinst_TEXINFOS = ldint.texinfo
-@@ -3644,8 +3648,8 @@ check-DEJAGNU: site.exp
- 	runtest=$(RUNTEST); \
- 	if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \
- 	  $$runtest --tool $(DEJATOOL) --srcdir $${srcroot}/testsuite \
--		CC="$(CC_FOR_TARGET)" CFLAGS="$(CFLAGS)" \
--		CXX="$(CXX_FOR_TARGET)" CXXFLAGS="$(CXXFLAGS)" \
-+		CC="$(CC_FOR_TARGET)" CFLAGS="$(CFLAGS_FOR_TARGET)" \
-+		CXX="$(CXX_FOR_TARGET)" CXXFLAGS="$(CXXFLAGS_FOR_TARGET)" \
- 		CC_FOR_HOST="$(CC)" CFLAGS_FOR_HOST="$(CFLAGS)" \
- 		OFILES="$(OFILES)" BFDLIB="$(TESTBFDLIB)" \
- 		LIBIBERTY="$(LIBIBERTY) $(LIBINTL)" LIBS="$(LIBS)" \

+ 0 - 1258
package/devel/binutils/patches/0002-When-building-target-binaries-ensure-that-the-warnin.patch

@@ -1,1258 +0,0 @@
-From b8ff24c72174effd5c5527866313982e28507275 Mon Sep 17 00:00:00 2001
-From: Vlad Zakharov <vzakhar@synopsys.com>
-Date: Mon, 26 Sep 2016 16:36:08 +0100
-Subject: [PATCH 2/2] When building target binaries, ensure that the warning
- flags selected for the command line match the target compiler.
-
-bfd	* warning.m4 (AC_EGREP_CPP_FOR_BUILD): Introduce macro
-	to verify CC_FOR_BUILD compiler.
-	(AM_BINUTILS_WARNINGS): Introduce ac_cpp_for_build variable
-	and add CC_FOR_BUILD compiler checks.
-	* Makefile.in: Regenerate.
-	* configure: Likewise.
-	* doc/Makefile.in: Likewise.
-
-binutils	* Makefile.am: Replace AM_CLFAGS with AM_CFLAGS_FOR_BUILD
-	when building with CC_FOR_BUILD compiler.
-	* Makefile.in: Regenerate.
-	* configure: Likewise.
-	* doc/Makefile.in: Likewise.
-
-gas	* Makefile.in: Regenerate.
-	* configure: Likewise.
-	* doc/Makefile.in: Likewise.
-
-gold	* Makefile.in: Regenerate.
-	* configure: Likewise.
-	* testsuite/Makefile.in: Likewise.
-
-gprof	* Makefile.in: Regenerate.
-	* configure: Likewise.
-
-ld	* Makefile.in: Regenerate.
-	* configure: Likewise.
-
-opcodes	* Makefile.in: Regenerate.
-	* configure: Likewise.
----
- bfd/Makefile.in            |  1 +
- bfd/configure              | 56 +++++++++++++++++++++++++++++++++++++++++-----
- bfd/doc/Makefile.in        |  1 +
- bfd/warning.m4             | 47 ++++++++++++++++++++++++++++++++++----
- binutils/Makefile.am       | 10 +++++----
- binutils/Makefile.in       | 10 +++++----
- binutils/configure         | 56 +++++++++++++++++++++++++++++++++++++++++-----
- binutils/doc/Makefile.in   |  1 +
- gas/Makefile.in            |  1 +
- gas/configure              | 56 +++++++++++++++++++++++++++++++++++++++++-----
- gas/doc/Makefile.in        |  1 +
- gold/Makefile.in           |  5 +++--
- gold/configure             | 52 ++++++++++++++++++++++++++++++++++++++----
- gold/testsuite/Makefile.in |  1 +
- gprof/Makefile.in          |  1 +
- gprof/configure            | 56 +++++++++++++++++++++++++++++++++++++++++-----
- ld/Makefile.in             |  3 ++-
- ld/configure               | 56 +++++++++++++++++++++++++++++++++++++++++-----
- opcodes/Makefile.in        |  1 +
- opcodes/configure          | 56 +++++++++++++++++++++++++++++++++++++++++-----
- 20 files changed, 416 insertions(+), 55 deletions(-)
-
---- a/bfd/Makefile.in
-+++ b/bfd/Makefile.in
-@@ -288,6 +288,7 @@ TDEFINES = @TDEFINES@
- USE_NLS = @USE_NLS@
- VERSION = @VERSION@
- WARN_CFLAGS = @WARN_CFLAGS@
-+WARN_CFLAGS_FOR_BUILD = @WARN_CFLAGS_FOR_BUILD@
- WARN_WRITE_STRINGS = @WARN_WRITE_STRINGS@
- XGETTEXT = @XGETTEXT@
- abs_builddir = @abs_builddir@
---- a/bfd/configure
-+++ b/bfd/configure
-@@ -659,6 +659,7 @@ MAINTAINER_MODE_FALSE
- MAINTAINER_MODE_TRUE
- WARN_WRITE_STRINGS
- NO_WERROR
-+WARN_CFLAGS_FOR_BUILD
- WARN_CFLAGS
- REPORT_BUGS_TEXI
- REPORT_BUGS_TO
-@@ -11427,7 +11428,7 @@ else
-   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
-   lt_status=$lt_dlunknown
-   cat > conftest.$ac_ext <<_LT_EOF
--#line 11430 "configure"
-+#line 11431 "configure"
- #include "confdefs.h"
- 
- #if HAVE_DLFCN_H
-@@ -11533,7 +11534,7 @@ else
-   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
-   lt_status=$lt_dlunknown
-   cat > conftest.$ac_ext <<_LT_EOF
--#line 11536 "configure"
-+#line 11537 "configure"
- #include "confdefs.h"
- 
- #if HAVE_DLFCN_H
-@@ -12240,8 +12241,12 @@ fi
- # Set the 'development' global.
- . $srcdir/../bfd/development.sh
- 
-+# Set acp_cpp_for_build variable
-+ac_cpp_for_build="$CC_FOR_BUILD -E $CPPFLAGS_FOR_BUILD"
-+
- # Default set of GCC warnings to enable.
- GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
-+GCC_WARN_CFLAGS_FOR_BUILD="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
- 
- # Add -Wshadow if the compiler is a sufficiently recent version of GCC.
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-@@ -12286,6 +12291,36 @@ fi
- rm -f conftest*
- 
- 
-+# Verify CC_FOR_BUILD to be compatible with waring flags
-+
-+# Add -Wshadow if the compiler is a sufficiently recent version of GCC.
-+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-+/* end confdefs.h.  */
-+__GNUC__
-+_ACEOF
-+if (eval "$ac_cpp_for_build conftest.$ac_ext") 2>&5 |
-+  $EGREP "^[0-3]$" >/dev/null 2>&1; then :
-+
-+else
-+  GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wshadow"
-+fi
-+rm -f conftest*
-+
-+
-+# Add -Wstack-usage if the compiler is a sufficiently recent version of GCC.
-+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-+/* end confdefs.h.  */
-+__GNUC__
-+_ACEOF
-+if (eval "$ac_cpp_for_build conftest.$ac_ext") 2>&5 |
-+  $EGREP "^[0-4]$" >/dev/null 2>&1; then :
-+
-+else
-+  GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wstack-usage=262144"
-+fi
-+rm -f conftest*
-+
-+
- # Check whether --enable-werror was given.
- if test "${enable_werror+set}" = set; then :
-   enableval=$enable_werror; case "${enableval}" in
-@@ -12301,6 +12336,7 @@ case "${host}" in
-   *-*-mingw32*)
-     if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then
-       GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wno-format"
-+      GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wno-format"
-     fi
-     ;;
-   *) ;;
-@@ -12314,25 +12350,32 @@ fi
- NO_WERROR=
- if test "${ERROR_ON_WARNING}" = yes ; then
-     GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Werror"
-+    GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Werror"
-     NO_WERROR="-Wno-error"
- fi
- 
- if test "${GCC}" = yes ; then
-   WARN_CFLAGS="${GCC_WARN_CFLAGS}"
-+  WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD}"
- fi
- 
- # Check whether --enable-build-warnings was given.
- if test "${enable_build_warnings+set}" = set; then :
-   enableval=$enable_build_warnings; case "${enableval}" in
--  yes)	WARN_CFLAGS="${GCC_WARN_CFLAGS}";;
-+  yes)	WARN_CFLAGS="${GCC_WARN_CFLAGS}"
-+        WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD}";;
-   no)	if test "${GCC}" = yes ; then
- 	  WARN_CFLAGS="-w"
-+      WARN_CFLAGS_FOR_BUILD="-w"
- 	fi;;
-   ,*)   t=`echo "${enableval}" | sed -e "s/,/ /g"`
--        WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}";;
-+        WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}"
-+        WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD} ${t}";;
-   *,)   t=`echo "${enableval}" | sed -e "s/,/ /g"`
--        WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}";;
--  *)    WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`;;
-+        WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}"
-+        WARN_CFLAGS_FOR_BUILD="${t} ${GCC_WARN_CFLAGS_FOR_BUILD}";;
-+  *)    WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`
-+        WARN_CFLAGS_FOR_BUILD=`echo "${enableval}" | sed -e "s/,/ /g"`;;
- esac
- fi
- 
-@@ -12343,6 +12386,7 @@ fi
- 
- 
- 
-+
- 
- 
- 
---- a/bfd/doc/Makefile.in
-+++ b/bfd/doc/Makefile.in
-@@ -248,6 +248,7 @@ TDEFINES = @TDEFINES@
- USE_NLS = @USE_NLS@
- VERSION = @VERSION@
- WARN_CFLAGS = @WARN_CFLAGS@
-+WARN_CFLAGS_FOR_BUILD = @WARN_CFLAGS_FOR_BUILD@
- WARN_WRITE_STRINGS = @WARN_WRITE_STRINGS@
- XGETTEXT = @XGETTEXT@
- abs_builddir = @abs_builddir@
---- a/bfd/warning.m4
-+++ b/bfd/warning.m4
-@@ -17,12 +17,34 @@ dnl along with this program; see the fil
- dnl <http://www.gnu.org/licenses/>.
- dnl
- 
-+# AC_EGREP_CPP_FOR_BUILD(PATTERN, PROGRAM,
-+#              [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
-+# ------------------------------------------------------
-+AC_DEFUN([AC_EGREP_CPP_FOR_BUILD],
-+[AC_LANG_PREPROC_REQUIRE()dnl
-+AC_REQUIRE([AC_PROG_EGREP])dnl
-+AC_LANG_CONFTEST([AC_LANG_SOURCE([[$2]])])
-+AS_IF([dnl eval is necessary to expand ac_cpp.
-+dnl Ultrix and Pyramid sh refuse to redirect output of eval, so use subshell.
-+(eval "$ac_cpp_for_build conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD |
-+dnl Quote $1 to prevent m4 from eating character classes
-+  $EGREP "[$1]" >/dev/null 2>&1],
-+  [$3],
-+  [$4])
-+rm -f conftest*
-+])# AC_EGREP_CPP_FOR_BUILD
-+
-+
- AC_DEFUN([AM_BINUTILS_WARNINGS],[
- # Set the 'development' global.
- . $srcdir/../bfd/development.sh
- 
-+# Set acp_cpp_for_build variable
-+ac_cpp_for_build="$CC_FOR_BUILD -E $CPPFLAGS_FOR_BUILD"
-+
- # Default set of GCC warnings to enable.
- GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
-+GCC_WARN_CFLAGS_FOR_BUILD="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
- 
- # Add -Wshadow if the compiler is a sufficiently recent version of GCC.
- AC_EGREP_CPP([^[0-3]$],[__GNUC__],,GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wshadow")
-@@ -34,6 +56,14 @@ AC_EGREP_CPP([^[0-4]$],[__GNUC__],,GCC_W
- WARN_WRITE_STRINGS=""
- AC_EGREP_CPP([^[0-3]$],[__GNUC__],,WARN_WRITE_STRINGS="-Wwrite-strings")
- 
-+# Verify CC_FOR_BUILD to be compatible with waring flags
-+
-+# Add -Wshadow if the compiler is a sufficiently recent version of GCC.
-+AC_EGREP_CPP_FOR_BUILD([^[0-3]$],[__GNUC__],,GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wshadow")
-+
-+# Add -Wstack-usage if the compiler is a sufficiently recent version of GCC.
-+AC_EGREP_CPP_FOR_BUILD([^[0-4]$],[__GNUC__],,GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wstack-usage=262144")
-+
- AC_ARG_ENABLE(werror,
-   [  --enable-werror         treat compile warnings as errors],
-   [case "${enableval}" in
-@@ -47,6 +77,7 @@ case "${host}" in
-   *-*-mingw32*)
-     if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then
-       GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wno-format"
-+      GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wno-format"
-     fi
-     ;;
-   *) ;;
-@@ -60,25 +91,32 @@ fi
- NO_WERROR=
- if test "${ERROR_ON_WARNING}" = yes ; then
-     GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Werror"
-+    GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Werror"
-     NO_WERROR="-Wno-error"
- fi
- 
- if test "${GCC}" = yes ; then
-   WARN_CFLAGS="${GCC_WARN_CFLAGS}"
-+  WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD}"
- fi
- 
- AC_ARG_ENABLE(build-warnings,
- [  --enable-build-warnings enable build-time compiler warnings],
- [case "${enableval}" in
--  yes)	WARN_CFLAGS="${GCC_WARN_CFLAGS}";;
-+  yes)	WARN_CFLAGS="${GCC_WARN_CFLAGS}" 
-+        WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD}";;
-   no)	if test "${GCC}" = yes ; then
- 	  WARN_CFLAGS="-w"
-+      WARN_CFLAGS_FOR_BUILD="-w" 
- 	fi;;
-   ,*)   t=`echo "${enableval}" | sed -e "s/,/ /g"`
--        WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}";;
-+        WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}"
-+        WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD} ${t}";;
-   *,)   t=`echo "${enableval}" | sed -e "s/,/ /g"`
--        WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}";;
--  *)    WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`;;
-+        WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}"
-+        WARN_CFLAGS_FOR_BUILD="${t} ${GCC_WARN_CFLAGS_FOR_BUILD}";;
-+  *)    WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`
-+        WARN_CFLAGS_FOR_BUILD=`echo "${enableval}" | sed -e "s/,/ /g"`;;
- esac])
- 
- if test x"$silent" != x"yes" && test x"$WARN_CFLAGS" != x""; then
-@@ -86,6 +124,7 @@ if test x"$silent" != x"yes" && test x"$
- fi
- 
- AC_SUBST(WARN_CFLAGS)
-+AC_SUBST(WARN_CFLAGS_FOR_BUILD)
- AC_SUBST(NO_WERROR)
-      AC_SUBST(WARN_WRITE_STRINGS)
- ])
---- a/binutils/Makefile.am
-+++ b/binutils/Makefile.am
-@@ -47,8 +47,10 @@ ZLIB = @zlibdir@ -lz
- ZLIBINC = @zlibinc@
- 
- WARN_CFLAGS = @WARN_CFLAGS@
-+WARN_CFLAGS_FOR_BUILD = @WARN_CFLAGS_FOR_BUILD@
- NO_WERROR = @NO_WERROR@
- AM_CFLAGS = $(WARN_CFLAGS) $(ZLIBINC)
-+AM_CFLAGS_FOR_BUILD = $(WARN_CFLAGS_FOR_BUILD) $(ZLIBINC)
- LIBICONV = @LIBICONV@
- 
- # these two are almost the same program
-@@ -305,17 +307,17 @@ sysinfo$(EXEEXT_FOR_BUILD): sysinfo.@OBJ
- 	$(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) -o $@ sysinfo.@OBJEXT@ syslex_wrap.@OBJEXT@
- 
- syslex_wrap.@OBJEXT@: syslex_wrap.c syslex.c sysinfo.h config.h
--	$(CC_FOR_BUILD) -c -I. -I$(srcdir) $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(NO_WERROR) $(srcdir)/syslex_wrap.c
-+	$(CC_FOR_BUILD) -c -I. -I$(srcdir) $(AM_CFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(NO_WERROR) $(srcdir)/syslex_wrap.c
- 
- sysinfo.@OBJEXT@: sysinfo.c
- 	if [ -r sysinfo.c ]; then \
--	  $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(NO_WERROR) sysinfo.c ; \
-+	  $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(NO_WERROR) sysinfo.c ; \
- 	else \
--	  $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(NO_WERROR) $(srcdir)/sysinfo.c ; \
-+	  $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(NO_WERROR) $(srcdir)/sysinfo.c ; \
- 	fi
- 
- bin2c$(EXEEXT_FOR_BUILD): bin2c.c
--	$(CC_FOR_BUILD) -o $@ $(AM_CPPFLAGS) $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) $(srcdir)/bin2c.c
-+	$(CC_FOR_BUILD) -o $@ $(AM_CPPFLAGS) $(AM_CFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) $(srcdir)/bin2c.c
- 
- embedspu: embedspu.sh Makefile
- 	awk '/^program_transform_name=/ {print "program_transform_name=\"$(program_transform_name)\""; next} {print}' < $< > $@
---- a/binutils/Makefile.in
-+++ b/binutils/Makefile.in
-@@ -401,6 +401,7 @@ STRIP = @STRIP@
- USE_NLS = @USE_NLS@
- VERSION = @VERSION@
- WARN_CFLAGS = @WARN_CFLAGS@
-+WARN_CFLAGS_FOR_BUILD = @WARN_CFLAGS_FOR_BUILD@
- WARN_WRITE_STRINGS = @WARN_WRITE_STRINGS@
- XGETTEXT = @XGETTEXT@
- YACC = `if [ -f ../bison/bison ]; then echo ../bison/bison -y -L$(srcdir)/../bison/; else echo @YACC@; fi`
-@@ -478,6 +479,7 @@ am__skipyacc =
- ZLIB = @zlibdir@ -lz
- ZLIBINC = @zlibinc@
- AM_CFLAGS = $(WARN_CFLAGS) $(ZLIBINC)
-+AM_CFLAGS_FOR_BUILD = $(WARN_CFLAGS_FOR_BUILD) $(ZLIBINC)
- 
- # these two are almost the same program
- AR_PROG = ar
-@@ -1370,17 +1372,17 @@ sysinfo$(EXEEXT_FOR_BUILD): sysinfo.@OBJ
- 	$(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) -o $@ sysinfo.@OBJEXT@ syslex_wrap.@OBJEXT@
- 
- syslex_wrap.@OBJEXT@: syslex_wrap.c syslex.c sysinfo.h config.h
--	$(CC_FOR_BUILD) -c -I. -I$(srcdir) $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(NO_WERROR) $(srcdir)/syslex_wrap.c
-+	$(CC_FOR_BUILD) -c -I. -I$(srcdir) $(AM_CFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(NO_WERROR) $(srcdir)/syslex_wrap.c
- 
- sysinfo.@OBJEXT@: sysinfo.c
- 	if [ -r sysinfo.c ]; then \
--	  $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(NO_WERROR) sysinfo.c ; \
-+	  $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(NO_WERROR) sysinfo.c ; \
- 	else \
--	  $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(NO_WERROR) $(srcdir)/sysinfo.c ; \
-+	  $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(NO_WERROR) $(srcdir)/sysinfo.c ; \
- 	fi
- 
- bin2c$(EXEEXT_FOR_BUILD): bin2c.c
--	$(CC_FOR_BUILD) -o $@ $(AM_CPPFLAGS) $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) $(srcdir)/bin2c.c
-+	$(CC_FOR_BUILD) -o $@ $(AM_CPPFLAGS) $(AM_CFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) $(srcdir)/bin2c.c
- 
- embedspu: embedspu.sh Makefile
- 	awk '/^program_transform_name=/ {print "program_transform_name=\"$(program_transform_name)\""; next} {print}' < $< > $@
---- a/binutils/configure
-+++ b/binutils/configure
-@@ -652,6 +652,7 @@ YFLAGS
- YACC
- WARN_WRITE_STRINGS
- NO_WERROR
-+WARN_CFLAGS_FOR_BUILD
- WARN_CFLAGS
- OTOOL64
- OTOOL
-@@ -11225,7 +11226,7 @@ else
-   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
-   lt_status=$lt_dlunknown
-   cat > conftest.$ac_ext <<_LT_EOF
--#line 11228 "configure"
-+#line 11229 "configure"
- #include "confdefs.h"
- 
- #if HAVE_DLFCN_H
-@@ -11331,7 +11332,7 @@ else
-   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
-   lt_status=$lt_dlunknown
-   cat > conftest.$ac_ext <<_LT_EOF
--#line 11334 "configure"
-+#line 11335 "configure"
- #include "confdefs.h"
- 
- #if HAVE_DLFCN_H
-@@ -11945,8 +11946,12 @@ _ACEOF
- # Set the 'development' global.
- . $srcdir/../bfd/development.sh
- 
-+# Set acp_cpp_for_build variable
-+ac_cpp_for_build="$CC_FOR_BUILD -E $CPPFLAGS_FOR_BUILD"
-+
- # Default set of GCC warnings to enable.
- GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
-+GCC_WARN_CFLAGS_FOR_BUILD="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
- 
- # Add -Wshadow if the compiler is a sufficiently recent version of GCC.
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-@@ -11991,6 +11996,36 @@ fi
- rm -f conftest*
- 
- 
-+# Verify CC_FOR_BUILD to be compatible with waring flags
-+
-+# Add -Wshadow if the compiler is a sufficiently recent version of GCC.
-+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-+/* end confdefs.h.  */
-+__GNUC__
-+_ACEOF
-+if (eval "$ac_cpp_for_build conftest.$ac_ext") 2>&5 |
-+  $EGREP "^[0-3]$" >/dev/null 2>&1; then :
-+
-+else
-+  GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wshadow"
-+fi
-+rm -f conftest*
-+
-+
-+# Add -Wstack-usage if the compiler is a sufficiently recent version of GCC.
-+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-+/* end confdefs.h.  */
-+__GNUC__
-+_ACEOF
-+if (eval "$ac_cpp_for_build conftest.$ac_ext") 2>&5 |
-+  $EGREP "^[0-4]$" >/dev/null 2>&1; then :
-+
-+else
-+  GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wstack-usage=262144"
-+fi
-+rm -f conftest*
-+
-+
- # Check whether --enable-werror was given.
- if test "${enable_werror+set}" = set; then :
-   enableval=$enable_werror; case "${enableval}" in
-@@ -12006,6 +12041,7 @@ case "${host}" in
-   *-*-mingw32*)
-     if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then
-       GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wno-format"
-+      GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wno-format"
-     fi
-     ;;
-   *) ;;
-@@ -12019,25 +12055,32 @@ fi
- NO_WERROR=
- if test "${ERROR_ON_WARNING}" = yes ; then
-     GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Werror"
-+    GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Werror"
-     NO_WERROR="-Wno-error"
- fi
- 
- if test "${GCC}" = yes ; then
-   WARN_CFLAGS="${GCC_WARN_CFLAGS}"
-+  WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD}"
- fi
- 
- # Check whether --enable-build-warnings was given.
- if test "${enable_build_warnings+set}" = set; then :
-   enableval=$enable_build_warnings; case "${enableval}" in
--  yes)	WARN_CFLAGS="${GCC_WARN_CFLAGS}";;
-+  yes)	WARN_CFLAGS="${GCC_WARN_CFLAGS}"
-+        WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD}";;
-   no)	if test "${GCC}" = yes ; then
- 	  WARN_CFLAGS="-w"
-+      WARN_CFLAGS_FOR_BUILD="-w"
- 	fi;;
-   ,*)   t=`echo "${enableval}" | sed -e "s/,/ /g"`
--        WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}";;
-+        WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}"
-+        WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD} ${t}";;
-   *,)   t=`echo "${enableval}" | sed -e "s/,/ /g"`
--        WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}";;
--  *)    WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`;;
-+        WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}"
-+        WARN_CFLAGS_FOR_BUILD="${t} ${GCC_WARN_CFLAGS_FOR_BUILD}";;
-+  *)    WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`
-+        WARN_CFLAGS_FOR_BUILD=`echo "${enableval}" | sed -e "s/,/ /g"`;;
- esac
- fi
- 
-@@ -12048,6 +12091,7 @@ fi
- 
- 
- 
-+
- 
- 
- 
---- a/binutils/doc/Makefile.in
-+++ b/binutils/doc/Makefile.in
-@@ -249,6 +249,7 @@ STRIP = @STRIP@
- USE_NLS = @USE_NLS@
- VERSION = @VERSION@
- WARN_CFLAGS = @WARN_CFLAGS@
-+WARN_CFLAGS_FOR_BUILD = @WARN_CFLAGS_FOR_BUILD@
- WARN_WRITE_STRINGS = @WARN_WRITE_STRINGS@
- XGETTEXT = @XGETTEXT@
- YACC = @YACC@
---- a/gas/Makefile.in
-+++ b/gas/Makefile.in
-@@ -255,6 +255,7 @@ STRIP = @STRIP@
- USE_NLS = @USE_NLS@
- VERSION = @VERSION@
- WARN_CFLAGS = @WARN_CFLAGS@ @WARN_WRITE_STRINGS@
-+WARN_CFLAGS_FOR_BUILD = @WARN_CFLAGS_FOR_BUILD@
- WARN_WRITE_STRINGS = @WARN_WRITE_STRINGS@
- XGETTEXT = @XGETTEXT@
- YACC = `if [ -f ../bison/bison ] ; then echo ../bison/bison -y -L../bison/bison ; else echo @YACC@ ; fi`
---- a/gas/configure
-+++ b/gas/configure
-@@ -642,6 +642,7 @@ cgen_cpu_prefix
- GDBINIT
- WARN_WRITE_STRINGS
- NO_WERROR
-+WARN_CFLAGS_FOR_BUILD
- WARN_CFLAGS
- OTOOL64
- OTOOL
-@@ -10985,7 +10986,7 @@ else
-   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
-   lt_status=$lt_dlunknown
-   cat > conftest.$ac_ext <<_LT_EOF
--#line 10988 "configure"
-+#line 10989 "configure"
- #include "confdefs.h"
- 
- #if HAVE_DLFCN_H
-@@ -11091,7 +11092,7 @@ else
-   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
-   lt_status=$lt_dlunknown
-   cat > conftest.$ac_ext <<_LT_EOF
--#line 11094 "configure"
-+#line 11095 "configure"
- #include "confdefs.h"
- 
- #if HAVE_DLFCN_H
-@@ -11721,8 +11722,12 @@ using_cgen=no
- # Set the 'development' global.
- . $srcdir/../bfd/development.sh
- 
-+# Set acp_cpp_for_build variable
-+ac_cpp_for_build="$CC_FOR_BUILD -E $CPPFLAGS_FOR_BUILD"
-+
- # Default set of GCC warnings to enable.
- GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
-+GCC_WARN_CFLAGS_FOR_BUILD="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
- 
- # Add -Wshadow if the compiler is a sufficiently recent version of GCC.
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-@@ -11767,6 +11772,36 @@ fi
- rm -f conftest*
- 
- 
-+# Verify CC_FOR_BUILD to be compatible with waring flags
-+
-+# Add -Wshadow if the compiler is a sufficiently recent version of GCC.
-+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-+/* end confdefs.h.  */
-+__GNUC__
-+_ACEOF
-+if (eval "$ac_cpp_for_build conftest.$ac_ext") 2>&5 |
-+  $EGREP "^[0-3]$" >/dev/null 2>&1; then :
-+
-+else
-+  GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wshadow"
-+fi
-+rm -f conftest*
-+
-+
-+# Add -Wstack-usage if the compiler is a sufficiently recent version of GCC.
-+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-+/* end confdefs.h.  */
-+__GNUC__
-+_ACEOF
-+if (eval "$ac_cpp_for_build conftest.$ac_ext") 2>&5 |
-+  $EGREP "^[0-4]$" >/dev/null 2>&1; then :
-+
-+else
-+  GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wstack-usage=262144"
-+fi
-+rm -f conftest*
-+
-+
- # Check whether --enable-werror was given.
- if test "${enable_werror+set}" = set; then :
-   enableval=$enable_werror; case "${enableval}" in
-@@ -11782,6 +11817,7 @@ case "${host}" in
-   *-*-mingw32*)
-     if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then
-       GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wno-format"
-+      GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wno-format"
-     fi
-     ;;
-   *) ;;
-@@ -11795,25 +11831,32 @@ fi
- NO_WERROR=
- if test "${ERROR_ON_WARNING}" = yes ; then
-     GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Werror"
-+    GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Werror"
-     NO_WERROR="-Wno-error"
- fi
- 
- if test "${GCC}" = yes ; then
-   WARN_CFLAGS="${GCC_WARN_CFLAGS}"
-+  WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD}"
- fi
- 
- # Check whether --enable-build-warnings was given.
- if test "${enable_build_warnings+set}" = set; then :
-   enableval=$enable_build_warnings; case "${enableval}" in
--  yes)	WARN_CFLAGS="${GCC_WARN_CFLAGS}";;
-+  yes)	WARN_CFLAGS="${GCC_WARN_CFLAGS}"
-+        WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD}";;
-   no)	if test "${GCC}" = yes ; then
- 	  WARN_CFLAGS="-w"
-+      WARN_CFLAGS_FOR_BUILD="-w"
- 	fi;;
-   ,*)   t=`echo "${enableval}" | sed -e "s/,/ /g"`
--        WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}";;
-+        WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}"
-+        WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD} ${t}";;
-   *,)   t=`echo "${enableval}" | sed -e "s/,/ /g"`
--        WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}";;
--  *)    WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`;;
-+        WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}"
-+        WARN_CFLAGS_FOR_BUILD="${t} ${GCC_WARN_CFLAGS_FOR_BUILD}";;
-+  *)    WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`
-+        WARN_CFLAGS_FOR_BUILD=`echo "${enableval}" | sed -e "s/,/ /g"`;;
- esac
- fi
- 
-@@ -11824,6 +11867,7 @@ fi
- 
- 
- 
-+
- 
- 
- 
---- a/gas/doc/Makefile.in
-+++ b/gas/doc/Makefile.in
-@@ -230,6 +230,7 @@ STRIP = @STRIP@
- USE_NLS = @USE_NLS@
- VERSION = @VERSION@
- WARN_CFLAGS = @WARN_CFLAGS@
-+WARN_CFLAGS_FOR_BUILD = @WARN_CFLAGS_FOR_BUILD@
- WARN_WRITE_STRINGS = @WARN_WRITE_STRINGS@
- XGETTEXT = @XGETTEXT@
- YACC = @YACC@
---- a/gold/Makefile.in
-+++ b/gold/Makefile.in
-@@ -87,8 +87,8 @@ subdir = .
- DIST_COMMON = NEWS README ChangeLog $(srcdir)/Makefile.in \
- 	$(srcdir)/Makefile.am $(top_srcdir)/configure \
- 	$(am__configure_deps) $(srcdir)/config.in \
--	$(srcdir)/../mkinstalldirs $(top_srcdir)/po/Make-in \
--	ftruncate.c pread.c mremap.c ffsll.c yyscript.h yyscript.c \
-+	$(srcdir)/../mkinstalldirs $(top_srcdir)/po/Make-in ffsll.c \
-+	mremap.c ftruncate.c pread.c yyscript.h yyscript.c \
- 	$(srcdir)/../depcomp $(srcdir)/../ylwrap
- ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
- am__aclocal_m4_deps = $(top_srcdir)/../config/depstand.m4 \
-@@ -409,6 +409,7 @@ TARGETOBJS = @TARGETOBJS@
- USE_NLS = @USE_NLS@
- VERSION = @VERSION@
- WARN_CFLAGS = @WARN_CFLAGS@
-+WARN_CFLAGS_FOR_BUILD = @WARN_CFLAGS_FOR_BUILD@
- WARN_CXXFLAGS = @WARN_CXXFLAGS@
- WARN_WRITE_STRINGS = @WARN_WRITE_STRINGS@
- XGETTEXT = @XGETTEXT@
---- a/gold/configure
-+++ b/gold/configure
-@@ -609,6 +609,7 @@ GOLD_LDFLAGS
- WARN_CXXFLAGS
- WARN_WRITE_STRINGS
- NO_WERROR
-+WARN_CFLAGS_FOR_BUILD
- WARN_CFLAGS
- IFUNC_STATIC_FALSE
- IFUNC_STATIC_TRUE
-@@ -6723,8 +6724,12 @@ fi
- # Set the 'development' global.
- . $srcdir/../bfd/development.sh
- 
-+# Set acp_cpp_for_build variable
-+ac_cpp_for_build="$CC_FOR_BUILD -E $CPPFLAGS_FOR_BUILD"
-+
- # Default set of GCC warnings to enable.
- GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
-+GCC_WARN_CFLAGS_FOR_BUILD="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
- 
- # Add -Wshadow if the compiler is a sufficiently recent version of GCC.
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-@@ -6769,6 +6774,36 @@ fi
- rm -f conftest*
- 
- 
-+# Verify CC_FOR_BUILD to be compatible with waring flags
-+
-+# Add -Wshadow if the compiler is a sufficiently recent version of GCC.
-+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-+/* end confdefs.h.  */
-+__GNUC__
-+_ACEOF
-+if (eval "$ac_cpp_for_build conftest.$ac_ext") 2>&5 |
-+  $EGREP "^[0-3]$" >/dev/null 2>&1; then :
-+
-+else
-+  GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wshadow"
-+fi
-+rm -f conftest*
-+
-+
-+# Add -Wstack-usage if the compiler is a sufficiently recent version of GCC.
-+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-+/* end confdefs.h.  */
-+__GNUC__
-+_ACEOF
-+if (eval "$ac_cpp_for_build conftest.$ac_ext") 2>&5 |
-+  $EGREP "^[0-4]$" >/dev/null 2>&1; then :
-+
-+else
-+  GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wstack-usage=262144"
-+fi
-+rm -f conftest*
-+
-+
- # Check whether --enable-werror was given.
- if test "${enable_werror+set}" = set; then :
-   enableval=$enable_werror; case "${enableval}" in
-@@ -6784,6 +6819,7 @@ case "${host}" in
-   *-*-mingw32*)
-     if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then
-       GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wno-format"
-+      GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wno-format"
-     fi
-     ;;
-   *) ;;
-@@ -6797,25 +6833,32 @@ fi
- NO_WERROR=
- if test "${ERROR_ON_WARNING}" = yes ; then
-     GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Werror"
-+    GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Werror"
-     NO_WERROR="-Wno-error"
- fi
- 
- if test "${GCC}" = yes ; then
-   WARN_CFLAGS="${GCC_WARN_CFLAGS}"
-+  WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD}"
- fi
- 
- # Check whether --enable-build-warnings was given.
- if test "${enable_build_warnings+set}" = set; then :
-   enableval=$enable_build_warnings; case "${enableval}" in
--  yes)	WARN_CFLAGS="${GCC_WARN_CFLAGS}";;
-+  yes)	WARN_CFLAGS="${GCC_WARN_CFLAGS}"
-+        WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD}";;
-   no)	if test "${GCC}" = yes ; then
- 	  WARN_CFLAGS="-w"
-+      WARN_CFLAGS_FOR_BUILD="-w"
- 	fi;;
-   ,*)   t=`echo "${enableval}" | sed -e "s/,/ /g"`
--        WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}";;
-+        WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}"
-+        WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD} ${t}";;
-   *,)   t=`echo "${enableval}" | sed -e "s/,/ /g"`
--        WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}";;
--  *)    WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`;;
-+        WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}"
-+        WARN_CFLAGS_FOR_BUILD="${t} ${GCC_WARN_CFLAGS_FOR_BUILD}";;
-+  *)    WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`
-+        WARN_CFLAGS_FOR_BUILD=`echo "${enableval}" | sed -e "s/,/ /g"`;;
- esac
- fi
- 
-@@ -6826,6 +6869,7 @@ fi
- 
- 
- 
-+
- 
- 
- 
---- a/gold/testsuite/Makefile.in
-+++ b/gold/testsuite/Makefile.in
-@@ -2568,6 +2568,7 @@ TARGETOBJS = @TARGETOBJS@
- USE_NLS = @USE_NLS@
- VERSION = @VERSION@
- WARN_CFLAGS = @WARN_CFLAGS@
-+WARN_CFLAGS_FOR_BUILD = @WARN_CFLAGS_FOR_BUILD@
- WARN_CXXFLAGS = @WARN_CXXFLAGS@
- WARN_WRITE_STRINGS = @WARN_WRITE_STRINGS@
- XGETTEXT = @XGETTEXT@
---- a/gprof/Makefile.in
-+++ b/gprof/Makefile.in
-@@ -267,6 +267,7 @@ STRIP = @STRIP@
- USE_NLS = @USE_NLS@
- VERSION = @VERSION@
- WARN_CFLAGS = @WARN_CFLAGS@
-+WARN_CFLAGS_FOR_BUILD = @WARN_CFLAGS_FOR_BUILD@
- WARN_WRITE_STRINGS = @WARN_WRITE_STRINGS@
- XGETTEXT = @XGETTEXT@
- abs_builddir = @abs_builddir@
---- a/gprof/configure
-+++ b/gprof/configure
-@@ -604,6 +604,7 @@ LTLIBOBJS
- LIBOBJS
- WARN_WRITE_STRINGS
- NO_WERROR
-+WARN_CFLAGS_FOR_BUILD
- WARN_CFLAGS
- GENINSRC_NEVER_FALSE
- GENINSRC_NEVER_TRUE
-@@ -10901,7 +10902,7 @@ else
-   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
-   lt_status=$lt_dlunknown
-   cat > conftest.$ac_ext <<_LT_EOF
--#line 10904 "configure"
-+#line 10905 "configure"
- #include "confdefs.h"
- 
- #if HAVE_DLFCN_H
-@@ -11007,7 +11008,7 @@ else
-   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
-   lt_status=$lt_dlunknown
-   cat > conftest.$ac_ext <<_LT_EOF
--#line 11010 "configure"
-+#line 11011 "configure"
- #include "confdefs.h"
- 
- #if HAVE_DLFCN_H
-@@ -12101,8 +12102,12 @@ fi
- # Set the 'development' global.
- . $srcdir/../bfd/development.sh
- 
-+# Set acp_cpp_for_build variable
-+ac_cpp_for_build="$CC_FOR_BUILD -E $CPPFLAGS_FOR_BUILD"
-+
- # Default set of GCC warnings to enable.
- GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
-+GCC_WARN_CFLAGS_FOR_BUILD="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
- 
- # Add -Wshadow if the compiler is a sufficiently recent version of GCC.
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-@@ -12147,6 +12152,36 @@ fi
- rm -f conftest*
- 
- 
-+# Verify CC_FOR_BUILD to be compatible with waring flags
-+
-+# Add -Wshadow if the compiler is a sufficiently recent version of GCC.
-+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-+/* end confdefs.h.  */
-+__GNUC__
-+_ACEOF
-+if (eval "$ac_cpp_for_build conftest.$ac_ext") 2>&5 |
-+  $EGREP "^[0-3]$" >/dev/null 2>&1; then :
-+
-+else
-+  GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wshadow"
-+fi
-+rm -f conftest*
-+
-+
-+# Add -Wstack-usage if the compiler is a sufficiently recent version of GCC.
-+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-+/* end confdefs.h.  */
-+__GNUC__
-+_ACEOF
-+if (eval "$ac_cpp_for_build conftest.$ac_ext") 2>&5 |
-+  $EGREP "^[0-4]$" >/dev/null 2>&1; then :
-+
-+else
-+  GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wstack-usage=262144"
-+fi
-+rm -f conftest*
-+
-+
- # Check whether --enable-werror was given.
- if test "${enable_werror+set}" = set; then :
-   enableval=$enable_werror; case "${enableval}" in
-@@ -12162,6 +12197,7 @@ case "${host}" in
-   *-*-mingw32*)
-     if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then
-       GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wno-format"
-+      GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wno-format"
-     fi
-     ;;
-   *) ;;
-@@ -12175,25 +12211,32 @@ fi
- NO_WERROR=
- if test "${ERROR_ON_WARNING}" = yes ; then
-     GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Werror"
-+    GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Werror"
-     NO_WERROR="-Wno-error"
- fi
- 
- if test "${GCC}" = yes ; then
-   WARN_CFLAGS="${GCC_WARN_CFLAGS}"
-+  WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD}"
- fi
- 
- # Check whether --enable-build-warnings was given.
- if test "${enable_build_warnings+set}" = set; then :
-   enableval=$enable_build_warnings; case "${enableval}" in
--  yes)	WARN_CFLAGS="${GCC_WARN_CFLAGS}";;
-+  yes)	WARN_CFLAGS="${GCC_WARN_CFLAGS}"
-+        WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD}";;
-   no)	if test "${GCC}" = yes ; then
- 	  WARN_CFLAGS="-w"
-+      WARN_CFLAGS_FOR_BUILD="-w"
- 	fi;;
-   ,*)   t=`echo "${enableval}" | sed -e "s/,/ /g"`
--        WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}";;
-+        WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}"
-+        WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD} ${t}";;
-   *,)   t=`echo "${enableval}" | sed -e "s/,/ /g"`
--        WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}";;
--  *)    WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`;;
-+        WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}"
-+        WARN_CFLAGS_FOR_BUILD="${t} ${GCC_WARN_CFLAGS_FOR_BUILD}";;
-+  *)    WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`
-+        WARN_CFLAGS_FOR_BUILD=`echo "${enableval}" | sed -e "s/,/ /g"`;;
- esac
- fi
- 
-@@ -12204,6 +12247,7 @@ fi
- 
- 
- 
-+
- 
- 
- 
---- a/ld/Makefile.in
-+++ b/ld/Makefile.in
-@@ -354,6 +354,7 @@ TESTBFDLIB = @TESTBFDLIB@
- USE_NLS = @USE_NLS@
- VERSION = @VERSION@
- WARN_CFLAGS = @WARN_CFLAGS@
-+WARN_CFLAGS_FOR_BUILD = @WARN_CFLAGS_FOR_BUILD@
- WARN_WRITE_STRINGS = @WARN_WRITE_STRINGS@
- XGETTEXT = @XGETTEXT@
- YACC = `if [ -f ../bison/bison ]; then echo ../bison/bison -y -L$(srcdir)/../bison/; else echo @YACC@; fi`
-@@ -508,7 +509,7 @@ CXX_FOR_TARGET = ` \
-   fi`
- 
- 
--# Strip out sanitization options as they require special host libraries.
-+# Strip out sanitization options as we want to test building binaries without any extra paraphernalia
- CFLAGS_FOR_TARGET = `echo $(CFLAGS) | sed -e 's/-fsanitize=address//g' -e 's/-fsanitize=undefined//g'`
- CXXFLAGS_FOR_TARGET = `echo $(CXXFLAGS) | sed -e 's/-fsanitize=address//g' -e 's/-fsanitize=undefined//g'`
- info_TEXINFOS = ld.texinfo
---- a/ld/configure
-+++ b/ld/configure
-@@ -646,6 +646,7 @@ LIBINTL
- USE_NLS
- WARN_WRITE_STRINGS
- NO_WERROR
-+WARN_CFLAGS_FOR_BUILD
- WARN_CFLAGS
- installed_linker
- install_as_default
-@@ -11723,7 +11724,7 @@ else
-   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
-   lt_status=$lt_dlunknown
-   cat > conftest.$ac_ext <<_LT_EOF
--#line 11726 "configure"
-+#line 11727 "configure"
- #include "confdefs.h"
- 
- #if HAVE_DLFCN_H
-@@ -11829,7 +11830,7 @@ else
-   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
-   lt_status=$lt_dlunknown
-   cat > conftest.$ac_ext <<_LT_EOF
--#line 11832 "configure"
-+#line 11833 "configure"
- #include "confdefs.h"
- 
- #if HAVE_DLFCN_H
-@@ -15558,8 +15559,12 @@ fi
- # Set the 'development' global.
- . $srcdir/../bfd/development.sh
- 
-+# Set acp_cpp_for_build variable
-+ac_cpp_for_build="$CC_FOR_BUILD -E $CPPFLAGS_FOR_BUILD"
-+
- # Default set of GCC warnings to enable.
- GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
-+GCC_WARN_CFLAGS_FOR_BUILD="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
- 
- # Add -Wshadow if the compiler is a sufficiently recent version of GCC.
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-@@ -15604,6 +15609,36 @@ fi
- rm -f conftest*
- 
- 
-+# Verify CC_FOR_BUILD to be compatible with waring flags
-+
-+# Add -Wshadow if the compiler is a sufficiently recent version of GCC.
-+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-+/* end confdefs.h.  */
-+__GNUC__
-+_ACEOF
-+if (eval "$ac_cpp_for_build conftest.$ac_ext") 2>&5 |
-+  $EGREP "^[0-3]$" >/dev/null 2>&1; then :
-+
-+else
-+  GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wshadow"
-+fi
-+rm -f conftest*
-+
-+
-+# Add -Wstack-usage if the compiler is a sufficiently recent version of GCC.
-+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-+/* end confdefs.h.  */
-+__GNUC__
-+_ACEOF
-+if (eval "$ac_cpp_for_build conftest.$ac_ext") 2>&5 |
-+  $EGREP "^[0-4]$" >/dev/null 2>&1; then :
-+
-+else
-+  GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wstack-usage=262144"
-+fi
-+rm -f conftest*
-+
-+
- # Check whether --enable-werror was given.
- if test "${enable_werror+set}" = set; then :
-   enableval=$enable_werror; case "${enableval}" in
-@@ -15619,6 +15654,7 @@ case "${host}" in
-   *-*-mingw32*)
-     if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then
-       GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wno-format"
-+      GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wno-format"
-     fi
-     ;;
-   *) ;;
-@@ -15632,25 +15668,32 @@ fi
- NO_WERROR=
- if test "${ERROR_ON_WARNING}" = yes ; then
-     GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Werror"
-+    GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Werror"
-     NO_WERROR="-Wno-error"
- fi
- 
- if test "${GCC}" = yes ; then
-   WARN_CFLAGS="${GCC_WARN_CFLAGS}"
-+  WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD}"
- fi
- 
- # Check whether --enable-build-warnings was given.
- if test "${enable_build_warnings+set}" = set; then :
-   enableval=$enable_build_warnings; case "${enableval}" in
--  yes)	WARN_CFLAGS="${GCC_WARN_CFLAGS}";;
-+  yes)	WARN_CFLAGS="${GCC_WARN_CFLAGS}"
-+        WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD}";;
-   no)	if test "${GCC}" = yes ; then
- 	  WARN_CFLAGS="-w"
-+      WARN_CFLAGS_FOR_BUILD="-w"
- 	fi;;
-   ,*)   t=`echo "${enableval}" | sed -e "s/,/ /g"`
--        WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}";;
-+        WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}"
-+        WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD} ${t}";;
-   *,)   t=`echo "${enableval}" | sed -e "s/,/ /g"`
--        WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}";;
--  *)    WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`;;
-+        WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}"
-+        WARN_CFLAGS_FOR_BUILD="${t} ${GCC_WARN_CFLAGS_FOR_BUILD}";;
-+  *)    WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`
-+        WARN_CFLAGS_FOR_BUILD=`echo "${enableval}" | sed -e "s/,/ /g"`;;
- esac
- fi
- 
-@@ -15661,6 +15704,7 @@ fi
- 
- 
- 
-+
- 
- 
- 
---- a/opcodes/Makefile.in
-+++ b/opcodes/Makefile.in
-@@ -267,6 +267,7 @@ STRIP = @STRIP@
- USE_NLS = @USE_NLS@
- VERSION = @VERSION@
- WARN_CFLAGS = @WARN_CFLAGS@
-+WARN_CFLAGS_FOR_BUILD = @WARN_CFLAGS_FOR_BUILD@
- WARN_WRITE_STRINGS = @WARN_WRITE_STRINGS@
- XGETTEXT = @XGETTEXT@
- abs_builddir = @abs_builddir@
---- a/opcodes/configure
-+++ b/opcodes/configure
-@@ -643,6 +643,7 @@ MAINTAINER_MODE_TRUE
- NO_WMISSING_FIELD_INITIALIZERS
- WARN_WRITE_STRINGS
- NO_WERROR
-+WARN_CFLAGS_FOR_BUILD
- WARN_CFLAGS
- OTOOL64
- OTOOL
-@@ -11150,7 +11151,7 @@ else
-   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
-   lt_status=$lt_dlunknown
-   cat > conftest.$ac_ext <<_LT_EOF
--#line 11153 "configure"
-+#line 11154 "configure"
- #include "confdefs.h"
- 
- #if HAVE_DLFCN_H
-@@ -11256,7 +11257,7 @@ else
-   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
-   lt_status=$lt_dlunknown
-   cat > conftest.$ac_ext <<_LT_EOF
--#line 11259 "configure"
-+#line 11260 "configure"
- #include "confdefs.h"
- 
- #if HAVE_DLFCN_H
-@@ -11508,8 +11509,12 @@ fi
- # Set the 'development' global.
- . $srcdir/../bfd/development.sh
- 
-+# Set acp_cpp_for_build variable
-+ac_cpp_for_build="$CC_FOR_BUILD -E $CPPFLAGS_FOR_BUILD"
-+
- # Default set of GCC warnings to enable.
- GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
-+GCC_WARN_CFLAGS_FOR_BUILD="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
- 
- # Add -Wshadow if the compiler is a sufficiently recent version of GCC.
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-@@ -11554,6 +11559,36 @@ fi
- rm -f conftest*
- 
- 
-+# Verify CC_FOR_BUILD to be compatible with waring flags
-+
-+# Add -Wshadow if the compiler is a sufficiently recent version of GCC.
-+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-+/* end confdefs.h.  */
-+__GNUC__
-+_ACEOF
-+if (eval "$ac_cpp_for_build conftest.$ac_ext") 2>&5 |
-+  $EGREP "^[0-3]$" >/dev/null 2>&1; then :
-+
-+else
-+  GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wshadow"
-+fi
-+rm -f conftest*
-+
-+
-+# Add -Wstack-usage if the compiler is a sufficiently recent version of GCC.
-+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-+/* end confdefs.h.  */
-+__GNUC__
-+_ACEOF
-+if (eval "$ac_cpp_for_build conftest.$ac_ext") 2>&5 |
-+  $EGREP "^[0-4]$" >/dev/null 2>&1; then :
-+
-+else
-+  GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wstack-usage=262144"
-+fi
-+rm -f conftest*
-+
-+
- # Check whether --enable-werror was given.
- if test "${enable_werror+set}" = set; then :
-   enableval=$enable_werror; case "${enableval}" in
-@@ -11569,6 +11604,7 @@ case "${host}" in
-   *-*-mingw32*)
-     if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then
-       GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wno-format"
-+      GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wno-format"
-     fi
-     ;;
-   *) ;;
-@@ -11582,25 +11618,32 @@ fi
- NO_WERROR=
- if test "${ERROR_ON_WARNING}" = yes ; then
-     GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Werror"
-+    GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Werror"
-     NO_WERROR="-Wno-error"
- fi
- 
- if test "${GCC}" = yes ; then
-   WARN_CFLAGS="${GCC_WARN_CFLAGS}"
-+  WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD}"
- fi
- 
- # Check whether --enable-build-warnings was given.
- if test "${enable_build_warnings+set}" = set; then :
-   enableval=$enable_build_warnings; case "${enableval}" in
--  yes)	WARN_CFLAGS="${GCC_WARN_CFLAGS}";;
-+  yes)	WARN_CFLAGS="${GCC_WARN_CFLAGS}"
-+        WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD}";;
-   no)	if test "${GCC}" = yes ; then
- 	  WARN_CFLAGS="-w"
-+      WARN_CFLAGS_FOR_BUILD="-w"
- 	fi;;
-   ,*)   t=`echo "${enableval}" | sed -e "s/,/ /g"`
--        WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}";;
-+        WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}"
-+        WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD} ${t}";;
-   *,)   t=`echo "${enableval}" | sed -e "s/,/ /g"`
--        WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}";;
--  *)    WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`;;
-+        WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}"
-+        WARN_CFLAGS_FOR_BUILD="${t} ${GCC_WARN_CFLAGS_FOR_BUILD}";;
-+  *)    WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`
-+        WARN_CFLAGS_FOR_BUILD=`echo "${enableval}" | sed -e "s/,/ /g"`;;
- esac
- fi
- 
-@@ -11611,6 +11654,7 @@ fi
- 
- 
- 
-+
- 
- 
- ac_ext=c

+ 0 - 94
package/devel/gdb-arc/Makefile

@@ -1,94 +0,0 @@
-#
-# Copyright (C) 2006-2016 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-include $(TOPDIR)/rules.mk
-
-PKG_NAME:=gdb-arc
-PKG_VERSION:=arc-2016.03-gdb
-PKG_RELEASE:=1
-
-PKG_SOURCE:=gdb-arc-2016.03-gdb.tar.gz
-PKG_SOURCE_URL:=https://github.com/foss-for-synopsys-dwc-arc-processors/binutils-gdb/archive/$(PKG_VERSION)
-PKG_HASH:=6a91f86cc487c1548d3f5d4f29f7226d2019c0db8a63633aeabd5914a340f3f9
-
-PKG_BUILD_DIR:=$(BUILD_DIR)/binutils-gdb-arc-2016.03-gdb
-
-PKG_BUILD_PARALLEL:=1
-PKG_INSTALL:=1
-PKG_LICENSE:=GPL-3.0+
-
-include $(INCLUDE_DIR)/package.mk
-
-define Package/gdb-arc/Default
-  SECTION:=devel
-  CATEGORY:=Development
-  DEPENDS:=+!USE_MUSL:libthread-db +PACKAGE_zlib:zlib @arc
-  URL:=http://www.gnu.org/software/gdb/
-endef
-
-define Package/gdb-arc
-$(call Package/gdb-arc/Default)
-  TITLE:=GNU Debugger for ARC
-  DEPENDS+=+libreadline +libncurses +zlib
-endef
-
-define Package/gdb-arc/description
-GDB, the GNU Project debugger, allows you to see what is going on `inside'
-another program while it executes -- or what another program was doing at the
-moment it crashed.
-endef
-
-define Package/gdbserver-arc
-$(call Package/gdb-arc/Default)
-  TITLE:=Remote server for GNU Debugger
-endef
-
-define Package/gdbserver-arc/description
-GDBSERVER is a program that allows you to run GDB on a different machine than the
-one which is running the program being debugged.
-endef
-
-# XXX: add --disable-werror to prevent build failure with arm
-CONFIGURE_ARGS+= \
-	--with-system-readline \
-	--without-expat \
-	--without-lzma \
-	--disable-werror \
-	--disable-binutils \
-	--disable-ld \
-	--disable-gas \
-	--disable-sim
-
-CONFIGURE_VARS+= \
-	ac_cv_search_tgetent="$(TARGET_LDFLAGS) -lncurses -lreadline"
-
-define Build/Compile
-	+$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
-		DESTDIR="$(PKG_INSTALL_DIR)" \
-		CPPFLAGS="$(TARGET_CPPFLAGS)" \
-		all
-endef
-
-define Build/Install
-	$(MAKE) -C $(PKG_BUILD_DIR) \
-		DESTDIR="$(PKG_INSTALL_DIR)" \
-		CPPFLAGS="$(TARGET_CPPFLAGS)" \
-		install-gdb
-endef
-
-define Package/gdb-arc/install
-	$(INSTALL_DIR) $(1)/usr/bin
-	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/gdb $(1)/usr/bin/
-endef
-
-define Package/gdbserver-arc/install
-	$(INSTALL_DIR) $(1)/usr/bin
-	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/gdbserver $(1)/usr/bin/
-endef
-
-$(eval $(call BuildPackage,gdb-arc))
-$(eval $(call BuildPackage,gdbserver-arc))

+ 0 - 32
package/devel/gdb-arc/patches/100-no_extern_inline.patch

@@ -1,32 +0,0 @@
---- a/sim/common/sim-arange.c
-+++ b/sim/common/sim-arange.c
-@@ -280,11 +280,7 @@ sim_addr_range_delete (ADDR_RANGE *ar, a
-   build_search_tree (ar);
- }
- 
--#endif /* DEFINE_NON_INLINE_P */
--
--#if DEFINE_INLINE_P
--
--SIM_ARANGE_INLINE int
-+int
- sim_addr_range_hit_p (ADDR_RANGE *ar, address_word addr)
- {
-   ADDR_RANGE_TREE *t = ar->range_tree;
-@@ -301,4 +297,4 @@ sim_addr_range_hit_p (ADDR_RANGE *ar, ad
-   return 0;
- }
- 
--#endif /* DEFINE_INLINE_P */
-+#endif /* DEFINE_NON_INLINE_P */
---- a/sim/common/sim-arange.h
-+++ b/sim/common/sim-arange.h
-@@ -73,7 +73,7 @@ extern void sim_addr_range_delete (ADDR_
- 
- /* Return non-zero if ADDR is in range AR, traversing the entire tree.
-    If no range is specified, that is defined to mean "everything".  */
--SIM_ARANGE_INLINE int
-+extern int
- sim_addr_range_hit_p (ADDR_RANGE * /*ar*/, address_word /*addr*/);
- #define ADDR_RANGE_HIT_P(ar, addr) \
-   ((ar)->range_tree == NULL || sim_addr_range_hit_p ((ar), (addr)))

+ 0 - 21
package/devel/gdb-arc/patches/110-no_testsuite.patch

@@ -1,21 +0,0 @@
---- a/gdb/configure
-+++ b/gdb/configure
-@@ -870,8 +870,7 @@ MAKEINFOFLAGS
- YACC
- YFLAGS
- XMKMF'
--ac_subdirs_all='testsuite
--gdbtk
-+ac_subdirs_all='gdbtk
- multi-ice
- gdbserver'
- 
-@@ -5610,7 +5610,7 @@ $as_echo "$with_auto_load_safe_path" >&6
- 
- 
- 
--subdirs="$subdirs testsuite"
-+subdirs="$subdirs"
- 
- 
- # Check whether to support alternative target configurations

+ 0 - 11
package/devel/gdb-arc/patches/120-fix-compile-flag-mismatch.patch

@@ -1,11 +0,0 @@
---- a/gdb/gdbserver/configure
-+++ b/gdb/gdbserver/configure
-@@ -2468,7 +2468,7 @@ $as_echo "$as_me: error: \`$ac_var' was
-       ac_cache_corrupted=: ;;
-     ,);;
-     *)
--      if test "x$ac_old_val" != "x$ac_new_val"; then
-+      if test "`echo x$ac_old_val`" != "`echo x$ac_new_val`"; then
- 	# differences in whitespace do not lead to failure.
- 	ac_old_val_w=`echo x $ac_old_val`
- 	ac_new_val_w=`echo x $ac_new_val`

+ 0 - 88
package/devel/gdb/Makefile

@@ -1,88 +0,0 @@
-#
-# Copyright (C) 2006-2016 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-include $(TOPDIR)/rules.mk
-
-PKG_NAME:=gdb
-PKG_VERSION:=7.11.1
-PKG_RELEASE:=1
-
-PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
-PKG_SOURCE_URL:=@GNU/gdb
-PKG_HASH:=e9216da4e3755e9f414c1aa0026b626251dfc57ffe572a266e98da4f6988fc70
-
-PKG_BUILD_PARALLEL:=1
-PKG_INSTALL:=1
-PKG_LICENSE:=GPL-3.0+
-
-include $(INCLUDE_DIR)/package.mk
-
-define Package/gdb/Default
-  SECTION:=devel
-  CATEGORY:=Development
-  DEPENDS:=+!USE_MUSL:libthread-db +PACKAGE_zlib:zlib @!arc
-  URL:=http://www.gnu.org/software/gdb/
-endef
-
-define Package/gdb
-$(call Package/gdb/Default)
-  TITLE:=GNU Debugger
-  DEPENDS+=+libreadline +libncurses +zlib
-endef
-
-define Package/gdb/description
-GDB, the GNU Project debugger, allows you to see what is going on `inside'
-another program while it executes -- or what another program was doing at the
-moment it crashed.
-endef
-
-define Package/gdbserver
-$(call Package/gdb/Default)
-  TITLE:=Remote server for GNU Debugger
-endef
-
-define Package/gdbserver/description
-GDBSERVER is a program that allows you to run GDB on a different machine than the
-one which is running the program being debugged.
-endef
-
-# XXX: add --disable-werror to prevent build failure with arm
-CONFIGURE_ARGS+= \
-	--with-system-readline \
-	--without-expat \
-	--without-lzma \
-	--disable-werror
-
-CONFIGURE_VARS+= \
-	ac_cv_search_tgetent="$(TARGET_LDFLAGS) -lncurses -lreadline"
-
-define Build/Compile
-	+$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
-		DESTDIR="$(PKG_INSTALL_DIR)" \
-		CPPFLAGS="$(TARGET_CPPFLAGS)" \
-		all
-endef
-
-define Build/Install
-	$(MAKE) -C $(PKG_BUILD_DIR) \
-		DESTDIR="$(PKG_INSTALL_DIR)" \
-		CPPFLAGS="$(TARGET_CPPFLAGS)" \
-		install-gdb
-endef
-
-define Package/gdb/install
-	$(INSTALL_DIR) $(1)/usr/bin
-	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/gdb $(1)/usr/bin/
-endef
-
-define Package/gdbserver/install
-	$(INSTALL_DIR) $(1)/usr/bin
-	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/gdbserver $(1)/usr/bin/
-endef
-
-$(eval $(call BuildPackage,gdb))
-$(eval $(call BuildPackage,gdbserver))

+ 0 - 16
package/devel/gdb/patches/001-gdb-pr14523-mips-signal-number.patch

@@ -1,16 +0,0 @@
-See http://sourceware.org/bugzilla/show_bug.cgi?id=14523
----
---- a/gdb/common/signals.c
-+++ b/gdb/common/signals.c
-@@ -344,6 +344,11 @@ gdb_signal_from_host (int hostsig)
-       else if (64 <= hostsig && hostsig <= 127)
- 	return (enum gdb_signal)
- 	  (hostsig - 64 + (int) GDB_SIGNAL_REALTIME_64);
-+      else if (hostsig == 128)
-+	/* Some platforms, such as Linux MIPS, have NSIG == 128, in which case
-+	   signal 128 is the highest realtime signal. There is no constant for
-+	   that though. */
-+	return GDB_SIGNAL_UNKNOWN;
-       else
- 	error (_("GDB bug: target.c (gdb_signal_from_host): "
- 	       "unrecognized real-time signal"));

+ 0 - 53
package/devel/gdb/patches/100-musl_fix.patch

@@ -1,53 +0,0 @@
---- a/gdb/linux-nat.c
-+++ b/gdb/linux-nat.c
-@@ -17,6 +17,7 @@
-    You should have received a copy of the GNU General Public License
-    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
- 
-+#include "stopcode.h"
- #include "defs.h"
- #include "inferior.h"
- #include "infrun.h"
-@@ -71,6 +72,10 @@
- #define SPUFS_MAGIC 0x23c9b64e
- #endif
- 
-+#ifndef __SIGRTMIN
-+#define __SIGRTMIN SIGRTMIN
-+#endif
-+
- /* This comment documents high-level logic of this file.
- 
- Waiting for events in sync mode
---- /dev/null
-+++ b/gdb/stopcode.h
-@@ -0,0 +1,4 @@
-+#ifndef W_STOPCODE
-+#define W_STOPCODE(sig) ((sig) << 8 | 0x7f)
-+#endif
-+
---- a/gdb/nat/ppc-linux.h
-+++ b/gdb/nat/ppc-linux.h
-@@ -18,7 +18,10 @@
- #ifndef PPC_LINUX_H
- #define PPC_LINUX_H 1
- 
-+#define pt_regs __pt_regs
- #include <asm/ptrace.h>
-+#undef pt_regs
-+
- #include <asm/cputable.h>
- 
- /* This sometimes isn't defined.  */
---- a/gdb/gdbserver/linux-ppc-low.c
-+++ b/gdb/gdbserver/linux-ppc-low.c
-@@ -21,7 +21,9 @@
- #include "linux-low.h"
- 
- #include <elf.h>
-+#define pt_regs __pt_regs
- #include <asm/ptrace.h>
-+#undef pt_regs
- 
- #include "nat/ppc-linux.h"
- 

+ 0 - 79
package/devel/perf/Makefile

@@ -1,79 +0,0 @@
-#
-# Copyright (C) 2011-2013 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-include $(TOPDIR)/rules.mk
-include $(INCLUDE_DIR)/kernel.mk
-
-PKG_NAME:=perf
-PKG_VERSION:=$(LINUX_VERSION)
-PKG_RELEASE:=2
-
-PKG_USE_MIPS16:=0
-PKG_BUILD_PARALLEL:=1
-PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
-PKG_FLAGS:=nonshared
-
-# Perf's makefile and headers are not relocatable and must be built from the
-# Linux sources directory
-PKG_BUILD_DIR:=$(LINUX_DIR)/tools/perf-$(TARGET_DIR_NAME)
-
-include $(INCLUDE_DIR)/package.mk
-
-define Package/perf
-  SECTION:=devel
-  CATEGORY:=Development
-  DEPENDS:= +libelf1 +libdw +libpthread +librt +objdump @!LINUX_3_18 @!IN_SDK
-  TITLE:=Linux performance monitoring tool
-  VERSION:=$(LINUX_VERSION)-$(PKG_RELEASE)
-  URL:=http://www.kernel.org
-endef
-
-define Package/perf/description
-  perf is the Linux performance monitoring tool
-endef
-
-define Build/Prepare
-	$(CP) $(LINUX_DIR)/tools/perf/* $(PKG_BUILD_DIR)/
-endef
-
-MAKE_FLAGS = \
-	ARCH="$(LINUX_KARCH)" \
-	NO_LIBPERL=1 \
-	NO_LIBPYTHON=1 \
-	NO_NEWT=1 \
-	NO_LZMA=1 \
-	NO_BACKTRACE=1 \
-	NO_LIBNUMA=1 \
-	NO_GTK2=1 \
-	NO_LIBAUDIT=1 \
-	NO_LIBCRYPTO=1 \
-	CROSS_COMPILE="$(TARGET_CROSS)" \
-	CC="$(TARGET_CC)" \
-	LD="$(TARGET_CROSS)ld" \
-	CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS)" \
-	LDFLAGS="$(TARGET_LDFLAGS)" \
-	$(if $(findstring c,$(OPENWRT_VERBOSE)),V=1,V='') \
-	WERROR=0 \
-	prefix=/usr
-
-ifdef CONFIG_USE_MUSL
- MAKE_FLAGS += EXTRA_CFLAGS="-I$(CURDIR)/musl-include -include $(CURDIR)/musl-compat.h -D__UCLIBC__"
-endif
-
-define Build/Compile
-	+$(MAKE_FLAGS) $(MAKE) $(PKG_JOBS) \
-		-C $(PKG_BUILD_DIR) \
-		-f Makefile.perf \
-		--no-print-directory
-endef
-
-define Package/perf/install
-	$(INSTALL_DIR) $(1)/usr/bin
-	$(INSTALL_BIN) $(PKG_BUILD_DIR)/perf $(1)/usr/bin/
-endef
-
-$(eval $(call BuildPackage,perf))

+ 0 - 43
package/devel/perf/musl-compat.h

@@ -1,43 +0,0 @@
-#ifndef __PERF_MUSL_COMPAT_H
-#define __PERF_MUSL_COMPAT_H
-
-#ifndef __ASSEMBLER__
-
-#include <sys/ioctl.h>
-#include <asm/unistd.h>
-#include <unistd.h>
-#include <stdio.h>
-
-#undef _IOWR
-#undef _IOR
-#undef _IOW
-#undef _IOC
-#undef _IO
-
-#define _SC_LEVEL1_DCACHE_LINESIZE -1
-
-static inline long sysconf_wrap(int name)
-{
-	FILE *f;
-	int val;
-
-	switch (name) {
-	case _SC_LEVEL1_DCACHE_LINESIZE:
-		f = fopen("/sys/devices/system/cpu/cpu0/cache/index0/coherency_line_size", "r");
-		if (!f)
-			return 0;
-
-		if (fscanf(f, "%d", &val) != 1)
-			return 0;
-
-		fclose(f);
-		return val;
-	default:
-		return sysconf(name);
-	}
-}
-
-#define sysconf(_n) sysconf_wrap(_n)
-
-#endif
-#endif

+ 0 - 8
package/devel/perf/musl-include/asm/errno.h

@@ -1,8 +0,0 @@
-#ifndef __MUSL_COMPAT_ASM_ERRNO_H
-#define __MUSL_COMPAT_ASM_ERRNO_H
-
-/* Avoid including different versions of errno.h, the defines (incorrectly)
- * cause a redefinition error on PowerPC */
-#include <errno.h>
-
-#endif

+ 0 - 18
package/devel/perf/musl-include/string.h

@@ -1,18 +0,0 @@
-#ifndef __MUSL_COMPAT_STRING_H
-#define __MUSL_COMPAT_STRING_H
-
-#include_next <string.h>
-
-/* Change XSI compliant version into GNU extension hackery */
-static inline char *
-gnu_strerror_r(int err, char *buf, size_t buflen)
-{
-	if (strerror_r(err, buf, buflen))
-		return NULL;
-	return buf;
-}
-#ifdef _GNU_SOURCE
-#define strerror_r gnu_strerror_r
-#endif
-
-#endif

+ 0 - 67
package/devel/strace/Makefile

@@ -1,67 +0,0 @@
-#
-# Copyright (C) 2006-2016 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-include $(TOPDIR)/rules.mk
-include $(INCLUDE_DIR)/kernel.mk
-
-PKG_NAME:=strace
-
-PKG_VERSION:=4.15
-PKG_RELEASE:=1
-PKG_HASH:=c0cdc094d6141fd9dbf6aaad605142d651ae10998b660fda57fc61f7ad583ca9
-
-PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
-PKG_SOURCE_URL:=@SF/$(PKG_NAME)
-
-PKG_LICENSE:=BSD-3c
-PKG_LICENSE_FILES:=COPYRIGHT
-
-PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
-
-PKG_FIXUP:=autoreconf
-PKG_CONFIG_DEPENDS:=CONFIG_PACKAGE_strace_libunwind
-PKG_INSTALL:=1
-
-include $(INCLUDE_DIR)/package.mk
-
-HOST_CFLAGS += -I$(LINUX_DIR)/user_headers/include
-
-CONFIGURE_VARS+= \
-	LDFLAGS_FOR_BUILD="$(HOST_LDFLAGS)" \
-	CPPFLAGS_FOR_BUILD="$(HOST_CPPFLAGS)" \
-	CFLAGS_FOR_BUILD="$(HOST_CFLAGS)" \
-	CC_FOR_BUILD="$(HOST_CC)"
-
-define Package/strace
-  SECTION:=utils
-  CATEGORY:=Utilities
-  TITLE:=System call tracer
-  DEPENDS:=+PACKAGE_strace_libunwind:libunwind
-  URL:=http://strace.sourceforge.net/
-endef
-
-define Package/strace/description
-A useful diagnostic, instructional, and debugging tool. Allows you to track what
-system calls a program makes while it is running.
-endef
-
-define Package/strace/config
-config PACKAGE_strace_libunwind
-	bool "Enable stack tracing support using libunwind (experimental)"
-	default n
-endef
-
-CONFIGURE_ARGS += --with-libunwind=$(if $(CONFIG_PACKAGE_strace_libunwind),yes,no)
-MAKE_FLAGS := \
-	CCOPT="$(TARGET_CFLAGS)"
-
-define Package/strace/install
-	$(INSTALL_DIR) $(1)/usr/bin
-	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/strace $(1)/usr/bin/
-endef
-
-$(eval $(call BuildPackage,strace))

+ 0 - 17
package/devel/strace/patches/100-workaround--pt-reg-collisions-ppc.patch

@@ -1,17 +0,0 @@
---- a/ptrace.h
-+++ b/ptrace.h
-@@ -55,7 +55,14 @@ extern long ptrace(int, int, char *, lon
- # define ptrace_peeksiginfo_args XXX_ptrace_peeksiginfo_args
- #endif
- 
-+#if POWERPC
-+#include <linux/types.h>
-+#define __ASSEMBLY__
-+#endif
- #include <linux/ptrace.h>
-+#if POWERPC
-+#undef __ASSEMBLY__
-+#endif
- 
- #ifdef HAVE_STRUCT_IA64_FPREG
- # undef ia64_fpreg

+ 0 - 63
package/devel/trace-cmd/Makefile

@@ -1,63 +0,0 @@
-include $(TOPDIR)/rules.mk
-
-PKG_NAME:=trace-cmd
-PKG_VERSION:=v2.6
-PKG_RELEASE=1
-
-PKG_SOURCE_PROTO:=git
-PKG_SOURCE_URL:=\
-		https://kernel.googlesource.com/pub/scm/linux/kernel/git/rostedt/trace-cmd \
-		https://git.kernel.org/pub/scm/linux/kernel/git/rostedt/trace-cmd.git
-PKG_SOURCE_VERSION:=9be5d74805830a291615f2f34a27c903f6a37b1e
-PKG_MIRROR_HASH:=735b69f61a8c627037dcc01361cdb8415e5ab0ec892fbd731236c444003b0c71
-PKG_INSTALL:=1
-PKG_USE_MIPS16:=0
-PKG_LICENSE:=GPL-2.0
-
-PKG_BUILD_PARALLEL:=1
-
-include $(INCLUDE_DIR)/package.mk
-
-define Package/trace-cmd
-  SECTION:=devel
-  CATEGORY:=Development
-  TITLE:=Linux trace command line utility
-  DEPENDS:=
-endef
-
-define Package/trace-cmd-extra
-  SECTION:=devel
-  CATEGORY:=Development
-  TITLE:=Extra plugins for trace-cmd
-  DEPENDS:=
-endef
-
-MAKE_FLAGS += \
-	NO_PYTHON=1 \
-	prefix=/usr
-
-PLUGINS_DIR := $(PKG_INSTALL_DIR)/usr/lib/trace-cmd/plugins
-PLUGINS_MAIN := function hrtimer mac80211 sched_switch
-
-TARGET_CFLAGS += --std=gnu99 -D_GNU_SOURCE
-
-define Package/trace-cmd/install
-	$(INSTALL_DIR) $(1)/usr/bin $(1)/usr/lib/trace-cmd/plugins
-	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/trace-cmd $(1)/usr/bin/
-	$(CP) \
-		$(patsubst %,$(PLUGINS_DIR)/plugin_%.so,$(PLUGINS_MAIN)) \
-		$(1)/usr/lib/trace-cmd/plugins
-endef
-
-define Package/trace-cmd-extra/install
-	$(INSTALL_DIR) $(1)/usr/lib/trace-cmd/plugins
-	$(CP) \
-		$$(patsubst %,$(PLUGINS_DIR)/plugin_%.so, \
-			$$(filter-out $(PLUGINS_MAIN), \
-				$$(patsubst $(PLUGINS_DIR)/plugin_%.so,%, \
-					$$(wildcard $(PLUGINS_DIR)/plugin_*.so)))) \
-		$(1)/usr/lib/trace-cmd/plugins
-endef
-
-$(eval $(call BuildPackage,trace-cmd))
-$(eval $(call BuildPackage,trace-cmd-extra))

+ 0 - 24
package/devel/trace-cmd/patches/110-mac80211_tracepoint.patch

@@ -1,24 +0,0 @@
---- a/plugin_mac80211.c
-+++ b/plugin_mac80211.c
-@@ -179,12 +179,15 @@ static int drv_config(struct trace_seq *
- 		{ 2, "IDLE" },
- 		{ 3, "QOS"},
- 	);
--	pevent_print_num_field(s, " chan:%d/", event, "center_freq", record, 1);
--	print_enum(s, event, "channel_type", data,
--		{ 0, "noht" },
--		{ 1, "ht20" },
--		{ 2, "ht40-" },
--		{ 3, "ht40+" });
-+	pevent_print_num_field(s, " chan:%d@", event, "control_freq", record, 1);
-+	print_enum(s, event, "chan_width", data,
-+		{ 0, "20_noht" },
-+		{ 1, "20" },
-+		{ 2, "40" },
-+		{ 3, "80" },
-+		{ 4, "80p80" },
-+		{ 5, "160" });
-+
- 	trace_seq_putc(s, ' ');
- 	SF("power_level");
- 

+ 0 - 179
package/devel/valgrind/Makefile

@@ -1,179 +0,0 @@
-#
-# Copyright (C) 2006-2013 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-include $(TOPDIR)/rules.mk
-
-PKG_NAME:=valgrind
-PKG_VERSION:=3.12.0
-PKG_RELEASE:=1
-
-PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
-PKG_SOURCE_URL:=http://valgrind.org/downloads/
-PKG_HASH:=67ca4395b2527247780f36148b084f5743a68ab0c850cb43e4a5b4b012cf76a1
-
-PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
-PKG_LICENSE:=GPL-2.0+
-
-PKG_FIXUP = autoreconf
-PKG_INSTALL := 1
-PKG_BUILD_PARALLEL := 1
-PKG_USE_MIPS16:=0
-PKG_SSP:=0
-
-include $(INCLUDE_DIR)/package.mk
-include $(INCLUDE_DIR)/kernel.mk
-
-define Package/valgrind
-  SECTION:=devel
-  CATEGORY:=Development
-  DEPENDS:=@mips||mipsel||i386||x86_64||powerpc||arm_v7 +libpthread +librt
-  TITLE:=debugging and profiling tools for Linux
-  URL:=http://www.valgrind.org
-endef
-
-define Package/valgrind/default
-  $(Package/valgrind)
-  DEPENDS := valgrind
-endef
-
-define Package/valgrind-cachegrind
-  $(Package/valgrind/default)
-  TITLE += (cache profiling)
-endef
-
-define Package/valgrind-callgrind
-  $(Package/valgrind/default)
-  TITLE += (callgraph profiling)
-endef
-
-define Package/valgrind-drd
-  $(Package/valgrind/default)
-  TITLE += (thread error detection)
-endef
-
-define Package/valgrind-massif
-  $(Package/valgrind/default)
-  TITLE += (heap profiling)
-endef
-
-define Package/valgrind-helgrind
-  $(Package/valgrind/default)
-  TITLE += (thread debugging)
-endef
-
-define Package/valgrind-vgdb
-  $(Package/valgrind/default)
-  TITLE += (GDB interface)
-endef
-
-define Package/valgrind/description
-	Valgrind is an award-winning suite of tools for debugging and
-	profiling Linux programs. With the tools that come with Valgrind,
-	you can automatically detect many memory management and threading
-	bugs, avoiding hours of frustrating bug-hunting, making your
-	programs more stable. You can also perform detailed profiling,
-	to speed up and reduce memory use of your programs.
-endef
-
-CPU := $(patsubst x86_64,amd64,$(patsubst x86,i386,$(patsubst um,$(ARCH),$(LINUX_KARCH))))
-
-CONFIGURE_VARS += \
-	UNAME_R=$(LINUX_VERSION)
-
-ifeq ($(ARCH),x86_64)
-	CONFIGURE_ARGS += \
-		--enable-only64bit
-	BITS := 64bit
-else
-	CONFIGURE_ARGS += \
-		--enable-only32bit
-	BITS := 32bit
-endif
-
-CONFIGURE_ARGS += \
-	--enable-tls \
-	--without-x \
-	--without-mpicc \
-	--without-uiout \
-	--disable-valgrindmi \
-	--disable-tui \
-	--disable-valgrindtk \
-	--without-included-gettext \
-	--with-pagesize=4 \
-
-define Package/valgrind/install	
-	$(INSTALL_DIR) $(1)/usr/bin
-	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/valgrind* $(1)/usr/bin/
-	$(INSTALL_DIR) $(1)/usr/lib/valgrind
-	$(CP) \
-		./files/default.supp \
-		$(PKG_INSTALL_DIR)/usr/lib/valgrind/none-* \
-		$(PKG_INSTALL_DIR)/usr/lib/valgrind/vgpreload_core*.so \
-		$(PKG_INSTALL_DIR)/usr/lib/valgrind/$(CPU)-*.xml \
-		$(PKG_INSTALL_DIR)/usr/lib/valgrind/$(BITS)-core*.xml \
-		$(PKG_INSTALL_DIR)/usr/lib/valgrind/$(BITS)-linux*.xml \
-		$(PKG_INSTALL_DIR)/usr/lib/valgrind/memcheck-* \
-		$(PKG_INSTALL_DIR)/usr/lib/valgrind/vgpreload_memcheck*.so \
-		$(1)/usr/lib/valgrind/
-endef
-
-define Package/valgrind-cachegrind/install
-	$(INSTALL_DIR) $(1)/usr/bin
-	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/cg_* $(1)/usr/bin/
-	$(INSTALL_DIR) $(1)/usr/lib/valgrind
-	$(CP) \
-		$(PKG_INSTALL_DIR)/usr/lib/valgrind/cachegrind-* \
-		$(1)/usr/lib/valgrind/
-endef
-
-define Package/valgrind-callgrind/install
-	$(INSTALL_DIR) $(1)/usr/bin
-	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/callgrind* $(1)/usr/bin/
-	$(INSTALL_DIR) $(1)/usr/lib/valgrind
-	$(CP) \
-		$(PKG_INSTALL_DIR)/usr/lib/valgrind/callgrind-* \
-		$(1)/usr/lib/valgrind/
-endef
-
-define Package/valgrind-drd/install
-	$(INSTALL_DIR) $(1)/usr/lib/valgrind
-	$(CP) \
-		$(PKG_INSTALL_DIR)/usr/lib/valgrind/drd-* \
-		$(PKG_INSTALL_DIR)/usr/lib/valgrind/vgpreload_drd*.so \
-		$(1)/usr/lib/valgrind/
-endef
-
-define Package/valgrind-massif/install
-	$(INSTALL_DIR) $(1)/usr/bin
-	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ms_print $(1)/usr/bin/
-	$(INSTALL_DIR) $(1)/usr/lib/valgrind
-	$(CP) \
-		$(PKG_INSTALL_DIR)/usr/lib/valgrind/massif-* \
-		$(PKG_INSTALL_DIR)/usr/lib/valgrind/vgpreload_massif*.so \
-		$(1)/usr/lib/valgrind/
-endef
-
-define Package/valgrind-helgrind/install
-	$(INSTALL_DIR) $(1)/usr/lib/valgrind
-	$(CP) \
-		$(PKG_INSTALL_DIR)/usr/lib/valgrind/helgrind-* \
-		$(PKG_INSTALL_DIR)/usr/lib/valgrind/vgpreload_helgrind*.so \
-		$(1)/usr/lib/valgrind/
-endef
-
-define Package/valgrind-vgdb/install
-	$(INSTALL_DIR) $(1)/usr/bin
-	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/vgdb $(1)/usr/bin/
-endef
-
-$(eval $(call BuildPackage,valgrind))
-$(eval $(call BuildPackage,valgrind-cachegrind))
-$(eval $(call BuildPackage,valgrind-callgrind))
-$(eval $(call BuildPackage,valgrind-drd))
-$(eval $(call BuildPackage,valgrind-massif))
-$(eval $(call BuildPackage,valgrind-helgrind))
-$(eval $(call BuildPackage,valgrind-vgdb))

+ 0 - 42
package/devel/valgrind/files/default.supp

@@ -1,42 +0,0 @@
-{
-   ld(Addr1)
-   Memcheck:Addr1
-   fun:*
-   obj:/lib/ld-*
-}
-{
-   ld(Addr2)
-   Memcheck:Addr2
-   fun:*
-   obj:/lib/ld-*
-}
-{
-   ld(Addr4)
-   Memcheck:Addr4
-   fun:*
-   obj:/lib/ld-*
-}
-{
-   ld(Cond)
-   Memcheck:Cond
-   fun:*
-   obj:/lib/ld-*
-}
-{
-	strlen(Cond)
-	Memcheck:Cond
-	fun:strlen
-	fun:*
-}
-{
-	strnlen(Cond)
-	Memcheck:Cond
-	fun:strnlen
-	fun:*
-}
-{
-	index(Cond)
-	Memcheck:Cond
-	fun:index
-	fun:*
-}

+ 0 - 11
package/devel/valgrind/patches/100-fix_configure_check.patch

@@ -1,11 +0,0 @@
---- a/configure.ac
-+++ b/configure.ac
-@@ -328,7 +328,7 @@ case "${host_os}" in
-         # Ok, this is linux. Check the kernel version
-         AC_MSG_CHECKING([for the kernel version])
- 
--        kernel=`uname -r`
-+        kernel=${UNAME_R:-`uname -r`}
- 
-         case "${kernel}" in
-              0.*|1.*|2.0.*|2.1.*|2.2.*|2.3.*|2.4.*|2.5.*) 

+ 0 - 17
package/devel/valgrind/patches/130-fix_arm_arch_detection.patch

@@ -1,17 +0,0 @@
-Description: Fix FTBFS on armhf by correctly detecting the architecture
-Origin: vendor
-Bug-Debian: http://bugs.debian.org/730844
-Author: Alessandro Ghedini <ghedo@debian.org>
-Last-Update: 2013-11-30
-
---- a/configure.ac
-+++ b/configure.ac
-@@ -234,7 +234,7 @@ case "${host_cpu}" in
-         ARCH_MAX="s390x"
-         ;;
- 
--     armv7*)
-+     arm*)
- 	AC_MSG_RESULT([ok (${host_cpu})])
- 	ARCH_MAX="arm"
- 	;;

+ 0 - 45
package/devel/valgrind/patches/200-musl_fix.patch

@@ -1,45 +0,0 @@
---- a/coregrind/vg_preloaded.c
-+++ b/coregrind/vg_preloaded.c
-@@ -57,7 +57,7 @@
- void VG_NOTIFY_ON_LOAD(freeres)(Vg_FreeresToRun to_run);
- void VG_NOTIFY_ON_LOAD(freeres)(Vg_FreeresToRun to_run)
- {
--#  if !defined(__UCLIBC__) \
-+#  if !defined(__UCLIBC__) && defined(__GLIBC__) \
-       && !defined(VGPV_arm_linux_android) \
-       && !defined(VGPV_x86_linux_android) \
-       && !defined(VGPV_mips32_linux_android) \
---- a/include/pub_tool_redir.h
-+++ b/include/pub_tool_redir.h
-@@ -243,7 +243,7 @@
- /* --- Soname of the standard C library. --- */
- 
- #if defined(VGO_linux) || defined(VGO_solaris)
--#  define  VG_Z_LIBC_SONAME  libcZdsoZa              // libc.so*
-+#  define  VG_Z_LIBC_SONAME  libcZdZa                // libc.*
- 
- #elif defined(VGO_darwin) && (DARWIN_VERS <= DARWIN_10_6)
- #  define  VG_Z_LIBC_SONAME  libSystemZdZaZddylib    // libSystem.*.dylib
-@@ -275,7 +275,11 @@
- /* --- Soname of the pthreads library. --- */
- 
- #if defined(VGO_linux)
-+# if defined(__GLIBC__) || defined(__UCLIBC__)
- #  define  VG_Z_LIBPTHREAD_SONAME  libpthreadZdsoZd0     // libpthread.so.0
-+# else
-+#  define  VG_Z_LIBPTHREAD_SONAME  libcZdZa              // libc.*
-+# endif
- #elif defined(VGO_darwin)
- #  define  VG_Z_LIBPTHREAD_SONAME  libSystemZdZaZddylib  // libSystem.*.dylib
- #elif defined(VGO_solaris)
---- a/configure.ac
-+++ b/configure.ac
-@@ -1047,8 +1047,6 @@ case "${GLIBC_VERSION}" in
- 	;;
-      2.0|2.1|*)
- 	AC_MSG_RESULT([unsupported version ${GLIBC_VERSION}])
--	AC_MSG_ERROR([Valgrind requires glibc version 2.2 or later,])
--	AC_MSG_ERROR([Darwin libc, Bionic libc or Solaris libc])
- 	;;
- esac
- 

+ 39 - 0
package/firmware/linux-libre-firmware/Makefile

@@ -0,0 +1,39 @@
+#
+# Copyright (C) 2014 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=linux-libre-firmware
+PKG_RELEASE:=1
+
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_URL:=https://gogs.librecmc.org/libreCMC/libre_firmware.git
+PKG_SOURCE_DATE:=2017-12-14
+PKG_SOURCE_VERSION:=1afb874fa73dc1f4b7a4ffae49ed8dd32e2e772c
+PKG_MIRROR_HASH:=
+
+PKG_MAINTAINER:=
+
+SCAN_DEPS = *.mk
+
+include $(INCLUDE_DIR)/host-build.mk
+include $(INCLUDE_DIR)/package.mk
+
+define Package/firmware-default
+  SECTION:=firmware
+  CATEGORY:=Firmware
+  URL:=https://gogs.librecmc.org/libreCMC/libre_firmware.git
+  TITLE:=$(1)
+endef
+
+define Build/Compile
+
+endef
+
+include $(wildcard ./*.mk)
+$(eval $(call HostBuild))
+#$(eval $(call BuildPackage,linux-libre-firmware))

+ 16 - 0
package/firmware/linux-libre-firmware/qca.mk

@@ -0,0 +1,16 @@
+Package/ath9k-htc-firmware = $(call Package/firmware-default,AR9271/AR7010 firmware)
+define Package/ath9k-htc-firmware/install
+	$(INSTALL_DIR) $(1)/lib/firmware/ath9k_htc
+	$(INSTALL_DATA) \
+		$(PKG_BUILD_DIR)/htc_9271.fw \
+		$(PKG_BUILD_DIR)/htc_7010.fw \
+		$(1)/lib/firmware/ath9k_htc
+endef
+$(eval $(call BuildPackage,ath9k-htc-firmware))
+
+Package/carl9170-firmware = $(call Package/firmware-default,AR9170 firmware)
+define Package/carl9170-firmware/install
+	$(INSTALL_DIR) $(1)/lib/firmware
+	$(INSTALL_DATA) $(PKG_BUILD_DIR)/carl9170-1.fw $(1)/lib/firmware
+endef
+$(eval $(call BuildPackage,carl9170-firmware))

+ 0 - 30
package/kernel/hwmon-gsc/Makefile

@@ -1,30 +0,0 @@
-include $(TOPDIR)/rules.mk
-include $(INCLUDE_DIR)/kernel.mk
-
-PKG_NAME:=hwmon-gsc
-PKG_RELEASE:=1
-
-include $(INCLUDE_DIR)/package.mk
-
-define KernelPackage/hwmon-gsc
-  SUBMENU:=Hardware Monitoring Support
-  DEPENDS:=@TARGET_imx6||TARGET_cns3xxx kmod-hwmon-core +kmod-i2c-core
-  TITLE:=Driver for the Gateworks System Controller
-  AUTOLOAD:=$(call AutoLoad,60,gsc)
-  FILES:=$(PKG_BUILD_DIR)/gsc.ko
-endef
-
-define KernelPackage/hwmon-gsc/description
-  Kernel module for the Gateworks System Controller chips.
-endef
-
-define Build/Compile
-	$(MAKE) -C "$(LINUX_DIR)" \
-		CROSS_COMPILE="$(TARGET_CROSS)" \
-		ARCH="$(LINUX_KARCH)" \
-		SUBDIRS="$(PKG_BUILD_DIR)" \
-		EXTRA_CFLAGS="$(BUILDFLAGS)" \
-		modules
-endef
-
-$(eval $(call KernelPackage,hwmon-gsc))

+ 0 - 1
package/kernel/hwmon-gsc/src/Makefile

@@ -1 +0,0 @@
-obj-m := gsc.o

+ 0 - 308
package/kernel/hwmon-gsc/src/gsc.c

@@ -1,308 +0,0 @@
-/*
- * A hwmon driver for the Gateworks System Controller 
- * Copyright (C) 2009 Gateworks Corporation
- *
- * Author: Chris Lang <clang@gateworks.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License,
- * as published by the Free Software Foundation - version 2.
- */
-
-#include <linux/module.h>
-#include <linux/i2c.h>
-#include <linux/hwmon.h>
-#include <linux/hwmon-sysfs.h>
-#include <linux/err.h>
-#include <linux/slab.h>
-
-#define DRV_VERSION "0.2"
-
-enum chips { gsp };
-
-/* AD7418 registers */
-#define GSP_REG_TEMP_IN		0x00
-#define GSP_REG_VIN		0x02
-#define GSP_REG_3P3		0x05
-#define GSP_REG_BAT		0x08
-#define GSP_REG_5P0		0x0b
-#define GSP_REG_CORE		0x0e
-#define GSP_REG_CPU1		0x11
-#define GSP_REG_CPU2		0x14
-#define GSP_REG_DRAM		0x17
-#define GSP_REG_EXT_BAT		0x1a
-#define GSP_REG_IO1		0x1d
-#define GSP_REG_IO2 		0x20
-#define GSP_REG_PCIE		0x23
-#define GSP_REG_CURRENT		0x26
-#define GSP_FAN_0		0x2C
-#define GSP_FAN_1		0x2E
-#define GSP_FAN_2		0x30
-#define GSP_FAN_3		0x32
-#define GSP_FAN_4		0x34
-#define GSP_FAN_5		0x36
-
-struct gsp_sensor_info {
-	const char* name;
-	int reg;
-};
-
-static const struct gsp_sensor_info gsp_sensors[] = {
-	{"temp", GSP_REG_TEMP_IN},
-	{"vin", GSP_REG_VIN},
-	{"3p3", GSP_REG_3P3},
-	{"bat", GSP_REG_BAT},
-	{"5p0", GSP_REG_5P0},
-	{"core", GSP_REG_CORE},
-	{"cpu1", GSP_REG_CPU1},
-	{"cpu2", GSP_REG_CPU2},
-	{"dram", GSP_REG_DRAM},
-	{"ext_bat", GSP_REG_EXT_BAT},
-	{"io1", GSP_REG_IO1},
-	{"io2", GSP_REG_IO2},
-	{"pci2", GSP_REG_PCIE},
-	{"current", GSP_REG_CURRENT},
-	{"fan_point0", GSP_FAN_0},
-	{"fan_point1", GSP_FAN_1},
-	{"fan_point2", GSP_FAN_2},
-	{"fan_point3", GSP_FAN_3},
-	{"fan_point4", GSP_FAN_4},
-	{"fan_point5", GSP_FAN_5},
-};
-
-struct gsp_data {
-	struct device		*hwmon_dev;
-	struct attribute_group	attrs;
-	enum chips		type;
-};
-
-static int gsp_probe(struct i2c_client *client,
-			const struct i2c_device_id *id);
-static int gsp_remove(struct i2c_client *client);
-
-static const struct i2c_device_id gsp_id[] = {
-	{ "gsp", 0 },
-	{ }
-};
-MODULE_DEVICE_TABLE(i2c, gsp_id);
-
-static struct i2c_driver gsp_driver = {
-	.driver = {
-		.name	= "gsp",
-	},
-	.probe		= gsp_probe,
-	.remove		= gsp_remove,
-	.id_table	= gsp_id,
-};
-
-/* All registers are word-sized, except for the configuration registers.
- * AD7418 uses a high-byte first convention. Do NOT use those functions to
- * access the configuration registers CONF and CONF2, as they are byte-sized.
- */
-static inline int gsp_read(struct i2c_client *client, u8 reg)
-{
-	unsigned int adc = 0;
-	if (reg == GSP_REG_TEMP_IN || reg > GSP_REG_CURRENT)
-	{
-		adc |= i2c_smbus_read_byte_data(client, reg);
-		adc |= i2c_smbus_read_byte_data(client, reg + 1) << 8;
-		return adc;
-	}
-	else
-	{
-		adc |= i2c_smbus_read_byte_data(client, reg);
-		adc |= i2c_smbus_read_byte_data(client, reg + 1) << 8;
-		adc |= i2c_smbus_read_byte_data(client, reg + 2) << 16;
-		return adc;
-	}
-}
-
-static inline int gsp_write(struct i2c_client *client, u8 reg, u16 value)
-{
-	i2c_smbus_write_byte_data(client, reg, value & 0xff);
-	i2c_smbus_write_byte_data(client, reg + 1, ((value >> 8) & 0xff));
-	return 1;
-}
-
-static ssize_t show_adc(struct device *dev, struct device_attribute *devattr,
-			char *buf)
-{
-	struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
-	struct i2c_client *client = to_i2c_client(dev);
-	return sprintf(buf, "%d\n", gsp_read(client, gsp_sensors[attr->index].reg));
-}
-
-static ssize_t show_label(struct device *dev,
-			struct device_attribute *devattr, char *buf)
-{
-	struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
-
-	return sprintf(buf, "%s\n", gsp_sensors[attr->index].name);
-}
-
-static ssize_t store_fan(struct device *dev,
-			struct device_attribute *devattr, const char *buf, size_t count)
-{
-	u16 val;
-	struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
-	struct i2c_client *client = to_i2c_client(dev);
-	val = simple_strtoul(buf, NULL, 10);
-	gsp_write(client, gsp_sensors[attr->index].reg, val);
-	return count;
-}
-
-static SENSOR_DEVICE_ATTR(temp0_input, S_IRUGO, show_adc, NULL, 0);
-static SENSOR_DEVICE_ATTR(temp0_label, S_IRUGO, show_label, NULL, 0);
-
-static SENSOR_DEVICE_ATTR(in0_input, S_IRUGO, show_adc, NULL, 1);
-static SENSOR_DEVICE_ATTR(in0_label, S_IRUGO, show_label, NULL, 1);
-static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO, show_adc, NULL, 2);
-static SENSOR_DEVICE_ATTR(in1_label, S_IRUGO, show_label, NULL, 2);
-static SENSOR_DEVICE_ATTR(in2_input, S_IRUGO, show_adc, NULL, 3);
-static SENSOR_DEVICE_ATTR(in2_label, S_IRUGO, show_label, NULL, 3);
-static SENSOR_DEVICE_ATTR(in3_input, S_IRUGO, show_adc, NULL, 4);
-static SENSOR_DEVICE_ATTR(in3_label, S_IRUGO, show_label, NULL, 4);
-static SENSOR_DEVICE_ATTR(in4_input, S_IRUGO, show_adc, NULL, 5);
-static SENSOR_DEVICE_ATTR(in4_label, S_IRUGO, show_label, NULL, 5);
-static SENSOR_DEVICE_ATTR(in5_input, S_IRUGO, show_adc, NULL, 6);
-static SENSOR_DEVICE_ATTR(in5_label, S_IRUGO, show_label, NULL, 6);
-static SENSOR_DEVICE_ATTR(in6_input, S_IRUGO, show_adc, NULL, 7);
-static SENSOR_DEVICE_ATTR(in6_label, S_IRUGO, show_label, NULL, 7);
-static SENSOR_DEVICE_ATTR(in7_input, S_IRUGO, show_adc, NULL, 8);
-static SENSOR_DEVICE_ATTR(in7_label, S_IRUGO, show_label, NULL, 8);
-static SENSOR_DEVICE_ATTR(in8_input, S_IRUGO, show_adc, NULL, 9);
-static SENSOR_DEVICE_ATTR(in8_label, S_IRUGO, show_label, NULL, 9);
-static SENSOR_DEVICE_ATTR(in9_input, S_IRUGO, show_adc, NULL, 10);
-static SENSOR_DEVICE_ATTR(in9_label, S_IRUGO, show_label, NULL, 10);
-static SENSOR_DEVICE_ATTR(in10_input, S_IRUGO, show_adc, NULL, 11);
-static SENSOR_DEVICE_ATTR(in10_label, S_IRUGO, show_label, NULL, 11);
-static SENSOR_DEVICE_ATTR(in11_input, S_IRUGO, show_adc, NULL, 12);
-static SENSOR_DEVICE_ATTR(in11_label, S_IRUGO, show_label, NULL, 12);
-static SENSOR_DEVICE_ATTR(in12_input, S_IRUGO, show_adc, NULL, 13);
-static SENSOR_DEVICE_ATTR(in12_label, S_IRUGO, show_label, NULL, 13);
-
-static SENSOR_DEVICE_ATTR(fan0_point0, S_IRUGO | S_IWUSR, show_adc, store_fan, 14);
-static SENSOR_DEVICE_ATTR(fan0_point1, S_IRUGO | S_IWUSR, show_adc, store_fan, 15);
-static SENSOR_DEVICE_ATTR(fan0_point2, S_IRUGO | S_IWUSR, show_adc, store_fan, 16);
-static SENSOR_DEVICE_ATTR(fan0_point3, S_IRUGO | S_IWUSR, show_adc, store_fan, 17);
-static SENSOR_DEVICE_ATTR(fan0_point4, S_IRUGO | S_IWUSR, show_adc, store_fan, 18);
-static SENSOR_DEVICE_ATTR(fan0_point5, S_IRUGO | S_IWUSR, show_adc, store_fan, 19);
-
-static struct attribute *gsp_attributes[] = {
-	&sensor_dev_attr_temp0_input.dev_attr.attr,
-	&sensor_dev_attr_in0_input.dev_attr.attr,
-	&sensor_dev_attr_in1_input.dev_attr.attr,
-	&sensor_dev_attr_in2_input.dev_attr.attr,
-	&sensor_dev_attr_in3_input.dev_attr.attr,
-	&sensor_dev_attr_in4_input.dev_attr.attr,
-	&sensor_dev_attr_in5_input.dev_attr.attr,
-	&sensor_dev_attr_in6_input.dev_attr.attr,
-	&sensor_dev_attr_in7_input.dev_attr.attr,
-	&sensor_dev_attr_in8_input.dev_attr.attr,
-	&sensor_dev_attr_in9_input.dev_attr.attr,
-	&sensor_dev_attr_in10_input.dev_attr.attr,
-	&sensor_dev_attr_in11_input.dev_attr.attr,
-	&sensor_dev_attr_in12_input.dev_attr.attr,
-
-	&sensor_dev_attr_temp0_label.dev_attr.attr,
-	&sensor_dev_attr_in0_label.dev_attr.attr,
-	&sensor_dev_attr_in1_label.dev_attr.attr,
-	&sensor_dev_attr_in2_label.dev_attr.attr,
-	&sensor_dev_attr_in3_label.dev_attr.attr,
-	&sensor_dev_attr_in4_label.dev_attr.attr,
-	&sensor_dev_attr_in5_label.dev_attr.attr,
-	&sensor_dev_attr_in6_label.dev_attr.attr,
-	&sensor_dev_attr_in7_label.dev_attr.attr,
-	&sensor_dev_attr_in8_label.dev_attr.attr,
-	&sensor_dev_attr_in9_label.dev_attr.attr,
-	&sensor_dev_attr_in10_label.dev_attr.attr,
-	&sensor_dev_attr_in11_label.dev_attr.attr,
-	&sensor_dev_attr_in12_label.dev_attr.attr,
-
-	&sensor_dev_attr_fan0_point0.dev_attr.attr,
-	&sensor_dev_attr_fan0_point1.dev_attr.attr,
-	&sensor_dev_attr_fan0_point2.dev_attr.attr,
-	&sensor_dev_attr_fan0_point3.dev_attr.attr,
-	&sensor_dev_attr_fan0_point4.dev_attr.attr,
-	&sensor_dev_attr_fan0_point5.dev_attr.attr,
-	NULL
-};
-
-
-static int gsp_probe(struct i2c_client *client,
-			 const struct i2c_device_id *id)
-{
-	struct i2c_adapter *adapter = client->adapter;
-	struct gsp_data *data;
-	int err;
-
-	if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA |
-					I2C_FUNC_SMBUS_WORD_DATA)) {
-		err = -EOPNOTSUPP;
-		goto exit;
-	}
-
-	if (!(data = kzalloc(sizeof(struct gsp_data), GFP_KERNEL))) {
-		err = -ENOMEM;
-		goto exit;
-	}
-
-	i2c_set_clientdata(client, data);
-
-	data->type = id->driver_data;
-
-	switch (data->type) {
-	case 0:
-		data->attrs.attrs = gsp_attributes;
-		break;
-	}
-
-	dev_info(&client->dev, "%s chip found\n", client->name);
-
-	/* Register sysfs hooks */
-	if ((err = sysfs_create_group(&client->dev.kobj, &data->attrs)))
-		goto exit_free;
-
-	data->hwmon_dev = hwmon_device_register(&client->dev);
-	if (IS_ERR(data->hwmon_dev)) {
-		err = PTR_ERR(data->hwmon_dev);
-		goto exit_remove;
-	}
-
-	return 0;
-
-exit_remove:
-	sysfs_remove_group(&client->dev.kobj, &data->attrs);
-exit_free:
-	kfree(data);
-exit:
-	return err;
-}
-
-static int gsp_remove(struct i2c_client *client)
-{
-	struct gsp_data *data = i2c_get_clientdata(client);
-	hwmon_device_unregister(data->hwmon_dev);
-	sysfs_remove_group(&client->dev.kobj, &data->attrs);
-	kfree(data);
-	return 0;
-}
-
-static int __init gsp_init(void)
-{
-	return i2c_add_driver(&gsp_driver);
-}
-
-static void __exit gsp_exit(void)
-{
-	i2c_del_driver(&gsp_driver);
-}
-
-module_init(gsp_init);
-module_exit(gsp_exit);
-
-MODULE_AUTHOR("Chris Lang <clang@gateworks.com>");
-MODULE_DESCRIPTION("GSC HWMON driver");
-MODULE_LICENSE("GPL");
-MODULE_VERSION(DRV_VERSION);
-

+ 3 - 4
package/kernel/kmod-sched-cake/Makefile

@@ -13,10 +13,9 @@ PKG_RELEASE:=1
 
 PKG_SOURCE_PROTO:=git
 PKG_SOURCE_URL:=https://github.com/dtaht/sch_cake.git
-PKG_SOURCE_DATE:=2017-01-28
-PKG_SOURCE_VERSION:=9789742cfc596d48583ba4cdbc8f38d026121fa6
-PKG_MIRROR_HASH:=2a5afc45722c28ca8778eb50452eb305306e7898b32d7d6d73d3e77edf3cce99
-PKG_MAINTAINER:=Kevin Darbyshire-Bryant <kevin@darbyshire-bryant.me.uk>
+PKG_SOURCE_DATE:=2017-12-22
+PKG_SOURCE_VERSION:=5bf0b6596721e18269ee4bae6e3549c75cba923a
+PKG_MIRROR_HASH:=95c0f886a3ad8ccfd7b35fa19af8b5ecbf0b2f74caea73fbabd6574f1c3be2db
 
 include $(INCLUDE_DIR)/package.mk
 

+ 1 - 18
package/kernel/linux/modules/netdevices.mk

@@ -411,24 +411,6 @@ endef
 $(eval $(call KernelPackage,8139cp))
 
 
-define KernelPackage/r8169
-  SUBMENU:=$(NETWORK_DEVICES_MENU)
-  TITLE:=RealTek RTL-8169 PCI Gigabit Ethernet Adapter kernel support
-  DEPENDS:=@PCI_SUPPORT +kmod-mii +r8169-firmware
-  KCONFIG:=CONFIG_R8169 \
-    CONFIG_R8169_NAPI=y \
-    CONFIG_R8169_VLAN=n
-  FILES:=$(LINUX_DIR)/drivers/net/ethernet/realtek/r8169.ko
-  AUTOLOAD:=$(call AutoProbe,r8169)
-endef
-
-define KernelPackage/r8169/description
- Kernel modules for RealTek RTL-8169 PCI Gigabit Ethernet adapters
-endef
-
-$(eval $(call KernelPackage,r8169))
-
-
 define KernelPackage/ne2k-pci
   SUBMENU:=$(NETWORK_DEVICES_MENU)
   TITLE:=ne2k-pci Ethernet Adapter kernel support
@@ -446,6 +428,7 @@ endef
 
 $(eval $(call KernelPackage,ne2k-pci))
 
+
 define KernelPackage/e1000
   SUBMENU:=$(NETWORK_DEVICES_MENU)
   TITLE:=Intel(R) PRO/1000 PCI cards kernel support

+ 19 - 12
package/kernel/mac80211/files/regdb.txt

@@ -85,12 +85,20 @@ country AT: DFS-ETSI
 	# 60 GHz band channels 1-4, ref: Etsi En 302 567
 	(57000 - 66000 @ 2160), (40)
 
+# Source:
+# https://www.legislation.gov.au/Details/F2016C00432
+# Both DFS-ETSI and DFS-FCC are acceptable per AS/NZS 4268 Appendix B.
+# The EIRP for DFS bands can be increased by 3dB if TPC is implemented.
+# In order to allow 80MHz operation between 5650-5730MHz the upper boundary
+# of this more restrictive band has been shifted up by 5MHz from 5725MHz.
 country AU: DFS-ETSI
-	(2402 - 2482 @ 40), (20)
-	(5170 - 5250 @ 80), (17), AUTO-BW
-	(5250 - 5330 @ 80), (24), DFS, AUTO-BW
-	(5490 - 5710 @ 160), (24), DFS
-	(5735 - 5835 @ 80), (30)
+	(2400 - 2483.5 @ 40), (36)
+	(5150 - 5250 @ 80), (23), NO-OUTDOOR, AUTO-BW
+	(5250 - 5350 @ 80), (20), NO-OUTDOOR, AUTO-BW, DFS
+	(5470 - 5600 @ 80), (27), DFS
+	(5650 - 5730 @ 80), (27), DFS
+	(5730 - 5850 @ 80), (36)
+	(57000 - 66000 @ 2160), (43), NO-OUTDOOR
 
 country AW: DFS-ETSI
 	(2402 - 2482 @ 40), (20)
@@ -230,9 +238,9 @@ country BZ: DFS-JP
 
 country CA: DFS-FCC
 	(2402 - 2472 @ 40), (30)
-	(5170 - 5250 @ 80), (17), AUTO-BW
-	(5250 - 5330 @ 80), (24), DFS, AUTO-BW
-	(5490 - 5600 @ 80), (24), DFS
+	(5150 - 5250 @ 80), (23), AUTO-BW
+	(5250 - 5350 @ 80), (24), DFS, AUTO-BW
+	(5470 - 5600 @ 80), (24), DFS
 	(5650 - 5730 @ 80), (24), DFS
 	(5735 - 5835 @ 80), (30)
 
@@ -580,11 +588,10 @@ country IL: DFS-ETSI
 	(5150 - 5250 @ 80), (200 mW), NO-OUTDOOR, AUTO-BW
 	(5250 - 5350 @ 80), (200 mW), NO-OUTDOOR, DFS, AUTO-BW
 
-country IN: DFS-JP
+country IN:
 	(2402 - 2482 @ 40), (20)
-	(5170 - 5250 @ 80), (20), AUTO-BW
-	(5250 - 5330 @ 80), (20), DFS, AUTO-BW
-	(5735 - 5835 @ 80), (20)
+	(5150 - 5350 @ 160), (23)
+	(5725 - 5875 @ 80), (23)
 
 country IR: DFS-JP
 	(2402 - 2482 @ 40), (20)

+ 1 - 9
package/kernel/om-watchdog/Makefile

@@ -8,7 +8,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=om-watchdog
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 PKG_VERSION:=1
 
 include $(INCLUDE_DIR)/package.mk
@@ -24,12 +24,6 @@ define Package/om-watchdog/description
  This package contains the hw watchdog script for the OM1P and OM2P device.
 endef
 
-define Build/Prepare
-endef
-
-define Build/Compile
-endef
-
 define Build/Compile
 endef
 
@@ -40,6 +34,4 @@ define Package/om-watchdog/install
 	$(INSTALL_BIN) ./files/om-watchdog $(1)/sbin/om-watchdog
 endef
 
-
 $(eval $(call BuildPackage,om-watchdog))
-

+ 40 - 31
package/kernel/om-watchdog/files/om-watchdog.init

@@ -16,37 +16,46 @@ get_gpio() {
 		local board=$(ar71xx_board_name)
 
 		case "$board" in
-			"om2p" | \
-			"om2pv4" | \
-			"om2p-hs" | \
-			"om2p-hsv2" | \
-			"om2p-hsv3" | \
-			"om2p-hsv4" | \
-			"om5p-acv2")
-				return 12
-				;;
-			"om2pv2" | \
-			"om2p-lc")
-				return 26
-				;;
-			"om5p" | \
-			"om5p-an")
-				return 11
-				;;
-			"om5p-ac")
-				return 17
-				;;
-			"mr600v2")
-				return 15
-				;;
-			"mr900" | \
-			"mr900v2" | \
-			"mr1750" | \
-			"mr1750v2" | \
-			"a40" | \
-			"a60")
-				return 16
-				;;
+		"a40"|\
+		"a60"|\
+		"mr1750"|\
+		"mr1750v2"|\
+		"mr900"|\
+		"mr900v2")
+			return 16
+			;;
+		"mr600v2")
+			return 15
+			;;
+		"om2p"|\
+		"om2p-hs"|\
+		"om2p-hsv2"|\
+		"om2p-hsv3"|\
+		"om2p-hsv4"|\
+		"om2pv4"|\
+		"om5p-acv2")
+			return 12
+			;;
+		"om2p-lc"|\
+		"om2pv2")
+			return 26
+			;;
+		"om5p"|\
+		"om5p-an")
+			return 11
+			;;
+		"om5p-ac")
+			return 17
+			;;
+		esac
+	elif [ -r /lib/ramips.sh ]; then
+		. /lib/ramips.sh
+		local board=$(ramips_board_name)
+
+		case "$board" in
+		"rut5xx")
+			return 11
+			;;
 		esac
 	else
 		#we assume it is om1p in this case

+ 0 - 33
package/kernel/rtc-rv5c386a/Makefile

@@ -1,33 +0,0 @@
-#
-# Copyright (C) 2006-2009 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-include $(TOPDIR)/rules.mk
-include $(INCLUDE_DIR)/kernel.mk
-
-PKG_NAME:=rtc-rv5c386a
-PKG_RELEASE:=1
-
-include $(INCLUDE_DIR)/package.mk
-
-define KernelPackage/rtc-rv5c386a
-  SUBMENU:=Other modules
-  DEPENDS:=@TARGET_brcm47xx @!IN_SDK
-  TITLE:=Driver for RTC RV5C386A (used in WL-700gE and WL-HDD)
-  AUTOLOAD:=$(call AutoLoad,70,rtc)
-  FILES:=$(PKG_BUILD_DIR)/rtc.ko
-endef
-
-define Build/Compile
-	$(MAKE) -C "$(LINUX_DIR)" \
-		CROSS_COMPILE="$(TARGET_CROSS)" \
-		ARCH="$(LINUX_KARCH)" \
-		SUBDIRS="$(PKG_BUILD_DIR)" \
-		EXTRA_CFLAGS="$(BUILDFLAGS)" \
-		modules
-endef
-
-$(eval $(call KernelPackage,rtc-rv5c386a))

+ 0 - 18
package/kernel/rtc-rv5c386a/src/Makefile

@@ -1,18 +0,0 @@
-# $Id$
-#
-# Makefile for Real Time Clock driver for WL-HDD
-#
-# Copyright (C) 2007 Andreas Engel
-#
-# 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.
-#
-
-obj-m := rtc.o
-
-ifeq ($(MAKING_MODULES),1)
-
--include $(TOPDIR)/Rules.make
-endif

+ 0 - 613
package/kernel/rtc-rv5c386a/src/rtc.c

@@ -1,613 +0,0 @@
-/*
- * Real Time Clock driver for WL-HDD
- *
- * Copyright (C) 2007 Andreas Engel
- *
- * Hacked together mostly by copying the relevant code parts from:
- *   drivers/i2c/i2c-bcm5365.c
- *   drivers/i2c/i2c-algo-bit.c
- *   drivers/char/rtc.c
- *
- * Note 1:
- * This module uses the standard char device (10,135), while the Asus module
- * rtcdrv.o uses (12,0). So, both can coexist which might be handy during
- * development (but see the comment in rtc_open()).
- *
- * Note 2:
- * You might need to set the clock once after loading the driver the first
- * time because the driver switches the chip into 24h mode if it is running
- * in 12h mode.
- *
- * Usage:
- * For compatibility reasons with the original asus driver, the time can be
- * read and set via the /dev/rtc device entry. The only accepted data format
- * is "YYYY:MM:DD:W:HH:MM:SS\n". See OpenWrt wiki for a script which handles
- * this format.
- *
- * In addition, this driver supports the standard ioctl() calls for setting
- * and reading the hardware clock, so the ordinary hwclock utility can also
- * be used.
- *
- * 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.
- *
- * TODO:
- * - add a /proc/driver/rtc interface?
- * - make the battery failure bit available through the /proc interface?
- *
- * $Id: rtc.c 7 2007-05-25 19:37:01Z ae $
- */
-
-#include <linux/module.h>
-#include <linux/kmod.h>
-#include <linux/kernel.h>
-#include <linux/types.h>
-#include <linux/miscdevice.h>
-#include <linux/ioport.h>
-#include <linux/fcntl.h>
-#include <linux/mc146818rtc.h>
-#include <linux/init.h>
-#include <linux/spinlock.h>
-#include <linux/rtc.h>
-#include <linux/delay.h>
-#include <linux/version.h>
-#include <linux/gpio.h>
-#include <linux/uaccess.h>
-
-#include <asm/current.h>
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)
-#include <asm/system.h>
-#endif
-
-#include <bcm47xx.h>
-#include <linux/bcm47xx_nvram.h>
-
-#define RTC_IS_OPEN		0x01	/* Means /dev/rtc is in use.  */
-
-/* Can be changed via a module parameter.  */
-static int rtc_debug = 0;
-
-static unsigned long rtc_status = 0;	/* Bitmapped status byte.	*/
-
-/* These settings are platform dependents.  */
-unsigned int sda_index = 0;
-unsigned int scl_index = 0;
-
-#define I2C_READ_MASK  1
-#define I2C_WRITE_MASK 0
-
-#define I2C_ACK 1
-#define I2C_NAK 0
-
-#define RTC_EPOCH		1900
-#define RTC_I2C_ADDRESS		(0x32 << 1)
-#define RTC_24HOUR_MODE_MASK	0x20
-#define RTC_PM_MASK		0x20
-#define RTC_VDET_MASK		0x40
-#define RTC_Y2K_MASK		0x80
-
-/*
- * Delay in microseconds for generating the pulses on the I2C bus. We use
- * a rather conservative setting here.  See datasheet of the RTC chip.
- */
-#define ADAP_DELAY 50
-
-/* Avoid spurious compiler warnings.  */
-#define UNUSED __attribute__((unused))
-
-MODULE_AUTHOR("Andreas Engel");
-MODULE_LICENSE("GPL");
-
-/* Test stolen from switch-adm.c.  */
-module_param(rtc_debug, int, 0);
-
-static inline void sdalo(void)
-{
-	gpio_direction_output(sda_index, 1);
-	udelay(ADAP_DELAY);
-}
-
-static inline void sdahi(void)
-{
-	gpio_direction_input(sda_index);
-	udelay(ADAP_DELAY);
-}
-
-static inline void scllo(void)
-{
-   gpio_direction_output(scl_index, 1);
-	udelay(ADAP_DELAY);
-}
-
-static inline int getscl(void)
-{
-	return (gpio_get_value(scl_index));
-}
-
-static inline int getsda(void)
-{
-	return (gpio_get_value(sda_index));
-}
-
-/*
- * We shouldn't simply set the SCL pin to high. Like SDA, the SCL line is
- * bidirectional too. According to the I2C spec, the slave is allowed to
- * pull down the SCL line to slow down the clock, so we need to check this.
- * Generally, we'd need a timeout here, but in our case, we just check the
- * line, assuming the RTC chip behaves well.
- */
-static int sclhi(void)
-{
-	gpio_direction_input(scl_index);
-	udelay(ADAP_DELAY);
-	if (!getscl()) {
-		printk(KERN_ERR "SCL pin should be low\n");
-		return -ETIMEDOUT;
-	}
-	return 0;
-}
-
-static void i2c_start(void)
-{
-	sdalo();
-	scllo();
-}
-
-static void i2c_stop(void)
-{
-	sdalo();
-	sclhi();
-	sdahi();
-}
-
-static int i2c_outb(int c)
-{
-	int i;
-	int ack;
-
-	/* assert: scl is low */
-	for (i = 7; i >= 0; i--) {
-		if (c & ( 1 << i )) {
-			sdahi();
-		} else {
-			sdalo();
-		}
-		if (sclhi() < 0) { /* timed out */
-			sdahi(); /* we don't want to block the net */
-			return -ETIMEDOUT;
-		};
-		scllo();
-	}
-	sdahi();
-	if (sclhi() < 0) {
-		return -ETIMEDOUT;
-	};
-	/* read ack: SDA should be pulled down by slave */
-	ack = getsda() == 0;	/* ack: sda is pulled low ->success.	 */
-	scllo();
-
-	if (rtc_debug)
-		printk(KERN_DEBUG "i2c_outb(0x%02x) -> %s\n",
-		       c, ack ? "ACK": "NAK");
-
-	return ack;		/* return 1 if device acked	 */
-	/* assert: scl is low (sda undef) */
-}
-
-static int i2c_inb(int ack)
-{
-	int i;
-	unsigned int indata = 0;
-
-	/* assert: scl is low */
-
-	sdahi();
-	for (i = 0; i < 8; i++) {
-		if (sclhi() < 0) {
-			return -ETIMEDOUT;
-		};
-		indata *= 2;
-		if (getsda())
-			indata |= 0x01;
-		scllo();
-	}
-	if (ack) {
-		sdalo();
-	} else {
-		sdahi();
-	}
-
-	if (sclhi() < 0) {
-		sdahi();
-		return -ETIMEDOUT;
-	}
-	scllo();
-	sdahi();
-
-	if (rtc_debug)
-		printk(KERN_DEBUG "i2c_inb() -> 0x%02x\n", indata);
-
-	/* assert: scl is low */
-	return indata & 0xff;
-}
-
-static void i2c_init(void)
-{
-    /* no gpio_control for EXTIF */
-	// ssb_gpio_control(&ssb, sda_mask | scl_mask, 0);
-
-   gpio_set_value(sda_index, 0);
-   gpio_set_value(scl_index, 0);
-	sdahi();
-	sclhi();
-}
-
-static int rtc_open(UNUSED struct inode *inode, UNUSED struct file *filp)
-{
-	spin_lock_irq(&rtc_lock);
-
-	if (rtc_status & RTC_IS_OPEN) {
-		spin_unlock_irq(&rtc_lock);
-		return -EBUSY;
-	}
-
-	rtc_status |= RTC_IS_OPEN;
-
-	/*
-	 * The following call is only necessary if we use both this driver and
-	 * the proprietary one from asus at the same time (which, b.t.w. only
-	 * makes sense during development). Otherwise, each access via the asus
-	 * driver will make access via this driver impossible.
-	 */
-	i2c_init();
-
-	spin_unlock_irq(&rtc_lock);
-
-	return 0;
-}
-
-static int rtc_release(UNUSED struct inode *inode, UNUSED struct file *filp)
-{
-	/* No need for locking here. */
-	rtc_status &= ~RTC_IS_OPEN;
-	return 0;
-}
-
-static int from_bcd(int bcdnum)
-{
-	int fac, num = 0;
-
-	for (fac = 1; bcdnum; fac *= 10) {
-		num += (bcdnum % 16) * fac;
-		bcdnum /= 16;
-	}
-
-	return num;
-}
-
-static int to_bcd(int decnum)
-{
-	int fac, num = 0;
-
-	for (fac = 1; decnum; fac *= 16) {
-		num += (decnum % 10) * fac;
-		decnum /= 10;
-	}
-
-	return num;
-}
-
-static void get_rtc_time(struct rtc_time *rtc_tm)
-{
-	int cr2;
-
-	/*
-	 * Read date and time from the RTC. We use read method (3).
-	 */
-
-	spin_lock_irq(&rtc_lock);
-	i2c_start();
-	i2c_outb(RTC_I2C_ADDRESS | I2C_READ_MASK);
-	cr2             = i2c_inb(I2C_ACK);
-	rtc_tm->tm_sec  = i2c_inb(I2C_ACK);
-	rtc_tm->tm_min  = i2c_inb(I2C_ACK);
-	rtc_tm->tm_hour = i2c_inb(I2C_ACK);
-	rtc_tm->tm_wday = i2c_inb(I2C_ACK);
-	rtc_tm->tm_mday = i2c_inb(I2C_ACK);
-	rtc_tm->tm_mon  = i2c_inb(I2C_ACK);
-	rtc_tm->tm_year = i2c_inb(I2C_NAK);
-	i2c_stop();
-	spin_unlock_irq(&rtc_lock);
-
-	if (cr2 & RTC_VDET_MASK) {
-		printk(KERN_WARNING "***RTC BATTERY FAILURE***\n");
-	}
-
-	/* Handle century bit */
-	if (rtc_tm->tm_mon & RTC_Y2K_MASK) {
-		rtc_tm->tm_mon &= ~RTC_Y2K_MASK;
-		rtc_tm->tm_year += 0x100;
-	}
-
-	rtc_tm->tm_sec  = from_bcd(rtc_tm->tm_sec);
-	rtc_tm->tm_min  = from_bcd(rtc_tm->tm_min);
-	rtc_tm->tm_hour = from_bcd(rtc_tm->tm_hour);
-	rtc_tm->tm_mday = from_bcd(rtc_tm->tm_mday);
-	rtc_tm->tm_mon  = from_bcd(rtc_tm->tm_mon) - 1;
-	rtc_tm->tm_year = from_bcd(rtc_tm->tm_year);
-
-	rtc_tm->tm_isdst = -1; /* DST not known */
-}
-
-static void set_rtc_time(struct rtc_time *rtc_tm)
-{
-	rtc_tm->tm_sec  = to_bcd(rtc_tm->tm_sec);
-	rtc_tm->tm_min  = to_bcd(rtc_tm->tm_min);
-	rtc_tm->tm_hour = to_bcd(rtc_tm->tm_hour);
-	rtc_tm->tm_mday = to_bcd(rtc_tm->tm_mday);
-	rtc_tm->tm_mon  = to_bcd(rtc_tm->tm_mon + 1);
-	rtc_tm->tm_year = to_bcd(rtc_tm->tm_year);
-
-	if (rtc_tm->tm_year >= 0x100) {
-		rtc_tm->tm_year -= 0x100;
-		rtc_tm->tm_mon |= RTC_Y2K_MASK;
-	}
-
-	spin_lock_irq(&rtc_lock);
-	i2c_start();
-	i2c_outb(RTC_I2C_ADDRESS | I2C_WRITE_MASK);
-	i2c_outb(0x00);	/* set starting register to 0 (=seconds) */
-	i2c_outb(rtc_tm->tm_sec);
-	i2c_outb(rtc_tm->tm_min);
-	i2c_outb(rtc_tm->tm_hour);
-	i2c_outb(rtc_tm->tm_wday);
-	i2c_outb(rtc_tm->tm_mday);
-	i2c_outb(rtc_tm->tm_mon);
-	i2c_outb(rtc_tm->tm_year);
-	i2c_stop();
-	spin_unlock_irq(&rtc_lock);
-}
-
-static ssize_t rtc_write(UNUSED struct file *filp, const char *buf,
-                         size_t count, loff_t *ppos)
-{
-	struct rtc_time rtc_tm;
-	char buffer[23];
-	char *p;
-
-	if (!capable(CAP_SYS_TIME))
-		return -EACCES;
-
-	if (ppos != &filp->f_pos)
-		return -ESPIPE;
-
-	/*
-	 * For simplicity, the only acceptable format is:
-	 * YYYY:MM:DD:W:HH:MM:SS\n
-	 */
-
-	if (count != 22)
-		goto err_out;
-
-	if (copy_from_user(buffer, buf, count))
-		return -EFAULT;
-
-	buffer[sizeof(buffer)-1] = '\0';
-
-	p = &buffer[0];
-
-	rtc_tm.tm_year  = simple_strtoul(p, &p, 10);
-	if (*p++ != ':') goto err_out;
-
-	rtc_tm.tm_mon = simple_strtoul(p, &p, 10) - 1;
-	if (*p++ != ':') goto err_out;
-
-	rtc_tm.tm_mday = simple_strtoul(p, &p, 10);
-	if (*p++ != ':') goto err_out;
-
-	rtc_tm.tm_wday = simple_strtoul(p, &p, 10);
-	if (*p++ != ':') goto err_out;
-
-	rtc_tm.tm_hour = simple_strtoul(p, &p, 10);
-	if (*p++ != ':') goto err_out;
-
-	rtc_tm.tm_min = simple_strtoul(p, &p, 10);
-	if (*p++ != ':') goto err_out;
-
-	rtc_tm.tm_sec = simple_strtoul(p, &p, 10);
-	if (*p != '\n') goto err_out;
-
-	rtc_tm.tm_year -= RTC_EPOCH;
-
-	set_rtc_time(&rtc_tm);
-
-	*ppos += count;
-
-	return count;
-
- err_out:
-	printk(KERN_ERR "invalid format: use YYYY:MM:DD:W:HH:MM:SS\\n\n");
-	return -EINVAL;
-}
-
-
-static ssize_t rtc_read(UNUSED struct file *filp, char *buf, size_t count,
-                        loff_t *ppos)
-{
-	char wbuf[23];
-	struct rtc_time tm;
-	ssize_t len;
-
-	if (count == 0 || *ppos != 0)
-		return 0;
-
-	get_rtc_time(&tm);
-
-	len = sprintf(wbuf, "%04d:%02d:%02d:%d:%02d:%02d:%02d\n",
-		      tm.tm_year + RTC_EPOCH,
-		      tm.tm_mon + 1,
-		      tm.tm_mday,
-		      tm.tm_wday,
-		      tm.tm_hour,
-		      tm.tm_min,
-		      tm.tm_sec);
-
-	if (len > (ssize_t)count)
-		len = count;
-
-	if (copy_to_user(buf, wbuf, len))
-		return -EFAULT;
-
-	*ppos += len;
-
-	return len;
-}
-
-static int rtc_do_ioctl(unsigned int cmd, unsigned long arg)
-{
-	struct rtc_time rtc_tm;
-
-	switch (cmd) {
-		case RTC_RD_TIME:
-			memset(&rtc_tm, 0, sizeof(struct rtc_time));
-			get_rtc_time(&rtc_tm);
-			if (copy_to_user((void *)arg, &rtc_tm, sizeof(rtc_tm)))
-				return -EFAULT;
-			break;
-
-		case RTC_SET_TIME:
-			if (!capable(CAP_SYS_TIME))
-				return -EACCES;
-
-			if (copy_from_user(&rtc_tm, (struct rtc_time *)arg,
-					   sizeof(struct rtc_time)))
-				return -EFAULT;
-
-			set_rtc_time(&rtc_tm);
-			break;
-
-		default:
-			return -ENOTTY;
-	}
-
-	return 0;
-}
-
-static long rtc_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
-{
-	long ret;
-	ret = rtc_do_ioctl(cmd, arg);
-	return ret;
-}
-
-static const struct file_operations rtc_fops = {
-	.owner		= THIS_MODULE,
-	.llseek		= no_llseek,
-	.read		= rtc_read,
-	.write		= rtc_write,
-	.unlocked_ioctl	= rtc_ioctl,
-	.open		= rtc_open,
-	.release	= rtc_release,
-};
-
-static struct miscdevice rtc_dev = {
-	.minor = RTC_MINOR,
-	.name  = "rtc",
-	.fops  = &rtc_fops,
-};
-
-/* Savagely ripped from diag.c.  */
-static inline int startswith (char *source, char *cmp)
-{
-	return !strncmp(source, cmp, strlen(cmp));
-}
-
-static void platform_detect(void)
-{
-	char buf[20];
-	int et0phyaddr, et1phyaddr;
-
-	/* Based on "model_no".  */
-	if (bcm47xx_nvram_getenv("model_no", buf, sizeof(buf)) >= 0) {
-		if (startswith(buf, "WL700")) { /* WL700* */
-			sda_index = 2;
-			scl_index = 5;
-			return;
-		}
-	}
-
-	if (bcm47xx_nvram_getenv("et0phyaddr", buf, sizeof(buf)) >= 0 )
-		et0phyaddr = simple_strtoul(buf, NULL, 0);
-	if (bcm47xx_nvram_getenv("et1phyaddr", buf, sizeof(buf)) >= 0 )
-		et1phyaddr = simple_strtoul(buf, NULL, 0);
-
-	if (bcm47xx_nvram_getenv("hardware_version", buf, sizeof(buf)) >= 0) {
-		/* Either WL-300g or WL-HDD, do more extensive checks */
-		if (startswith(buf, "WL300-") && et0phyaddr == 0 && et1phyaddr == 1) {
-			sda_index = 4;
-			scl_index = 5;
-			return;
-		}
-	}
-	/* not found */
-}
-
-static int __init rtc_init(void)
-{
-	int cr1;
-
-	platform_detect();
-
-	if (sda_index == scl_index) {
-		printk(KERN_ERR "RTC-RV5C386A: unrecognized platform!\n");
-		return -ENODEV;
-	}
-
-	i2c_init();
-
-	/*
-	 * Switch RTC to 24h mode
-	 */
-	spin_lock_irq(&rtc_lock);
-	i2c_start();
-	i2c_outb(RTC_I2C_ADDRESS | I2C_WRITE_MASK);
-	i2c_outb(0xE4); /* start at address 0xE, transmission mode 4 */
-	cr1 = i2c_inb(I2C_NAK);
-	i2c_stop();
-	spin_unlock_irq(&rtc_lock);
-	if ((cr1 & RTC_24HOUR_MODE_MASK) == 0) {
-		/* RTC is running in 12h mode */
-		printk(KERN_INFO "rtc.o: switching to 24h mode\n");
-		spin_lock_irq(&rtc_lock);
-		i2c_start();
-		i2c_outb(RTC_I2C_ADDRESS | I2C_WRITE_MASK);
-		i2c_outb(0xE0);
-		i2c_outb(cr1 | RTC_24HOUR_MODE_MASK);
-		i2c_stop();
-		spin_unlock_irq(&rtc_lock);
-	}
-
-	misc_register(&rtc_dev);
-
-	printk(KERN_INFO "RV5C386A Real Time Clock Driver loaded\n");
-
-	return 0;
-}
-
-static void __exit rtc_exit (void)
-{
-	misc_deregister(&rtc_dev);
-	printk(KERN_INFO "Successfully removed RTC RV5C386A driver\n");
-}
-
-module_init(rtc_init);
-module_exit(rtc_exit);
-
-/*
- * Local Variables:
- * indent-tabs-mode:t
- * c-basic-offset:8
- * End:
- */

+ 0 - 38
package/kernel/wrt55agv2-spidevs/Makefile

@@ -1,38 +0,0 @@
-#
-# Copyright (C) 2008 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-include $(TOPDIR)/rules.mk
-include $(INCLUDE_DIR)/kernel.mk
-
-PKG_NAME:=wrt55agv2-spidevs
-PKG_RELEASE:=1
-
-include $(INCLUDE_DIR)/package.mk
-
-define KernelPackage/wrt55agv2-spidevs
-  SUBMENU:=Other modules
-  TITLE:=WRT55AG v2 SPI devices support
-  DEPENDS:=@TARGET_ath25 +kmod-spi-gpio-old +kmod-spi-ks8995
-  FILES:=$(PKG_BUILD_DIR)/wrt55agv2_spidevs.ko
-endef
-
-define KernelPackage/wrt55agv2-spidevs/description
-  Kernel module for the SPI devices on the WRT55AG v2 board.
-endef
-
-MAKE_OPTS:= \
-	ARCH="$(LINUX_KARCH)" \
-	CROSS_COMPILE="$(TARGET_CROSS)" \
-	SUBDIRS="$(PKG_BUILD_DIR)"
-
-define Build/Compile
-	$(MAKE) -C "$(LINUX_DIR)" \
-		$(MAKE_OPTS) \
-		modules
-endef
-
-$(eval $(call KernelPackage,wrt55agv2-spidevs))

+ 0 - 3
package/kernel/wrt55agv2-spidevs/src/Kconfig

@@ -1,3 +0,0 @@
-config WRT55AGV2_SPIDEVS
-	tristate "SPI device support for the WRT55AG v2 board"
-	depends on SPI && MIPS_ATHEROS

Some files were not shown because too many files changed in this diff