diff --git a/README.md b/README.md index 7e56d7d8c..3f56a732a 100644 --- a/README.md +++ b/README.md @@ -1,39 +1,7 @@ -# Armbian +# Armbian - Helios4 -Ubuntu and Debian images for ARM based single-board computers -https://www.armbian.com +**This repo is only for developement of Helios4 support in Armbian Build Framework** -## How to build my own image or kernel? +To get latest Armbian please go to the [Official Armbian Git](https://github.com/armbian/build) -Supported build environments: -- [Ubuntu Xenial 16.04 x64](http://archive.ubuntu.com/ubuntu/dists/xenial-updates/main/installer-amd64/current/images/netboot/mini.iso) guest inside a [VirtualBox](https://www.virtualbox.org/wiki/Downloads) or other virtualization software, -- [Ubuntu Xenial 16.04 x64](http://archive.ubuntu.com/ubuntu/dists/xenial-updates/main/installer-amd64/current/images/netboot/mini.iso) guest managed by [Vagrant](https://www.vagrantup.com/). This uses Virtualbox (as above) but does so in an easily repeatable way. Please check the [Armbian with Vagrant README](https://docs.armbian.com/Developer-Guide_Using-Vagrant/) for a quick start HOWTO, -- [Ubuntu Xenial 16.04 x64](http://archive.ubuntu.com/ubuntu/dists/xenial-updates/main/installer-amd64/current/images/netboot/mini.iso) inside a [Docker](https://www.docker.com/), [systemd-nspawn](https://www.freedesktop.org/software/systemd/man/systemd-nspawn.html) or other container environment [(example)](https://github.com/igorpecovnik/lib/pull/255#issuecomment-205045273). Building full OS images inside containers may not work, so this option is mostly for the kernel compilation, -- [Ubuntu Xenial 16.04 x64](http://archive.ubuntu.com/ubuntu/dists/xenial-updates/main/installer-amd64/current/images/netboot/mini.iso) running natively on a dedicated PC or a server (**not** recommended unless you build kernel only, for full OS images always use virtualization as outlined above), -- **20GB disk space** or more and **2GB RAM** or more available for the VM, container or native OS, -- superuser rights (configured `sudo` or root access). - -**Execution** - - apt-get -y install git - git clone https://github.com/armbian/build - cd build - ./compile.sh - -Make sure that full path to the build script does not contain spaces. - -You will be prompted with a selection menu for a build option, a board name, a kernel branch and an OS release. Please check the documentation for [advanced options](https://docs.armbian.com/Developer-Guide_Build-Options/) and [additional customization](https://docs.armbian.com/Developer-Guide_User-Configurations/). - -Build process uses caching for the compilation and the debootstrap process, so consecutive runs with similar settings will be much faster. - -## Reporting issues - -Please read [this](https://github.com/igorpecovnik/lib/blob/master/.github/ISSUE_TEMPLATE.md) notice first before opening an issue. - -## More info: - -- [Documentation](https://docs.armbian.com/Developer-Guide_Build-Preparation/) -- [Prebuilt images](https://www.armbian.com/download/) -- [Support forums](https://forum.armbian.com/ "Armbian support forum") -- [Project at Github](https://github.com/igorpecovnik/lib) diff --git a/config/boards/helios4.conf b/config/boards/helios4.conf new file mode 100644 index 000000000..18eccb458 --- /dev/null +++ b/config/boards/helios4.conf @@ -0,0 +1,19 @@ +# Marvell Armada 388 2GB-ECC 4xSATA 2xUSB3.0 1xGBE +BOARD_NAME="Helios4" +LINUXFAMILY="mvebu" +BOOTCONFIG="armada_38x_helios4_config" +MODULES="mv_cesa" +BUILD_DESKTOP="no" +# +KERNEL_TARGET="default" +CLI_TARGET="jessie:default" + +CLI_BETA_TARGET="" +# +RECOMMENDED="Debian_jessie_default:90" +# +BOARDRATING="" +CHIP="https://kobol.io/helios4" +REVIEW="" +HARDWARE="https://wiki.kobol.io" +FORUMS="" diff --git a/config/bootenv/helios4-default.txt b/config/bootenv/helios4-default.txt new file mode 100644 index 000000000..682c692d2 --- /dev/null +++ b/config/bootenv/helios4-default.txt @@ -0,0 +1,3 @@ +verbosity=1 +ethaddr=00:50:43:84:fb:2f + diff --git a/config/bootscripts/boot-helios4.cmd b/config/bootscripts/boot-helios4.cmd new file mode 100644 index 000000000..7c0ea6aaf --- /dev/null +++ b/config/bootscripts/boot-helios4.cmd @@ -0,0 +1,37 @@ +# DO NOT EDIT THIS FILE +# +# Please edit /boot/armbianEnv.txt to set supported parameters +# + +# default values +setenv rootdev "/dev/mmcblk0p1" +setenv rootfstype "ext4" +setenv verbosity "1" +setenv ethaddr "00:50:43:84:fb:2f" + +# fdtfile should come from compile-time u-boot patches +if test -z "${fdtfile}"; then + setenv fdtfile "armada-388-helios4.dtb" +fi + +test -z "${boot_interface}" && setenv boot_interface "mmc" + +echo "Boot script loaded from ${boot_interface}" + +if load ${boot_interface} 0:1 ${loadaddr} ${prefix}armbianEnv.txt; then + env import -t ${loadaddr} ${filesize} +fi + +setenv bootargs "console=ttyS0,115200 root=${rootdev} rootwait rootfstype=${rootfstype} ubootdev=${boot_interface} scandelay loglevel=${verbosity} ${extraargs}" + +load ${boot_interface} 0:1 ${fdt_addr} ${prefix}dtb/${fdtfile} +load ${boot_interface} 0:1 ${ramdisk_addr_r} ${prefix}uInitrd +load ${boot_interface} 0:1 ${kernel_addr_r} ${prefix}zImage + +setenv fdt_high 0xffffffff +setenv initrd_high 0xffffffff + +bootz ${kernel_addr_r} ${ramdisk_addr_r} ${fdt_addr} + +# Recompile with: +# mkimage -C none -A arm -T script -d /boot/boot.cmd /boot/boot.scr diff --git a/config/kernel/linux-mvebu-default.config b/config/kernel/linux-mvebu-default.config index 6ccd3fc77..e2b64a7e8 100644 --- a/config/kernel/linux-mvebu-default.config +++ b/config/kernel/linux-mvebu-default.config @@ -1933,6 +1933,8 @@ CONFIG_SCSI_OSD_DPRINT_SENSE=1 CONFIG_ATA=y # CONFIG_ATA_NONSTANDARD is not set # CONFIG_ATA_VERBOSE_ERROR is not set +CONFIG_ARCH_WANT_LIBATA_LEDS=y +CONFIG_ATA_LEDS=y CONFIG_SATA_PMP=y # @@ -3004,7 +3006,7 @@ CONFIG_SENSORS_GPIO_FAN=m # CONFIG_SENSORS_LM63 is not set # CONFIG_SENSORS_LM70 is not set # CONFIG_SENSORS_LM73 is not set -# CONFIG_SENSORS_LM75 is not set +CONFIG_SENSORS_LM75=m # CONFIG_SENSORS_LM77 is not set # CONFIG_SENSORS_LM78 is not set # CONFIG_SENSORS_LM80 is not set @@ -3026,6 +3028,7 @@ CONFIG_SENSORS_GPIO_FAN=m # CONFIG_SENSORS_NCT7904 is not set # CONFIG_SENSORS_PCF8591 is not set # CONFIG_PMBUS is not set +CONFIG_SENSORS_PWM_FAN=m # CONFIG_SENSORS_SHT15 is not set # CONFIG_SENSORS_SHT21 is not set # CONFIG_SENSORS_SHTC1 is not set @@ -3274,6 +3277,7 @@ CONFIG_REGULATOR_GPIO=m # CONFIG_REGULATOR_MAX8973 is not set # CONFIG_REGULATOR_MT6311 is not set # CONFIG_REGULATOR_PFUZE100 is not set +CONFIG_REGULATOR_PWM=m # CONFIG_REGULATOR_TPS51632 is not set # CONFIG_REGULATOR_TPS62360 is not set # CONFIG_REGULATOR_TPS65023 is not set @@ -3371,11 +3375,14 @@ CONFIG_LCD_LMS501KF03=m CONFIG_LCD_HX8357=m CONFIG_BACKLIGHT_CLASS_DEVICE=m CONFIG_BACKLIGHT_GENERIC=m +CONFIG_BACKLIGHT_PWM=m CONFIG_BACKLIGHT_PM8941_WLED=m CONFIG_BACKLIGHT_ADP8860=m CONFIG_BACKLIGHT_ADP8870=m CONFIG_BACKLIGHT_88PM860X=m +# CONFIG_BACKLIGHT_LM3630A is not set CONFIG_BACKLIGHT_LM3639=m +# CONFIG_BACKLIGHT_LP855X is not set CONFIG_BACKLIGHT_GPIO=m CONFIG_BACKLIGHT_LV5207LP=m CONFIG_BACKLIGHT_BD6107=m @@ -3847,6 +3854,7 @@ CONFIG_LEDS_GPIO=m # CONFIG_LEDS_PCA955X is not set # CONFIG_LEDS_PCA963X is not set # CONFIG_LEDS_DAC124S085 is not set +CONFIG_LEDS_PWM=m CONFIG_LEDS_REGULATOR=m # CONFIG_LEDS_BD2802 is not set # CONFIG_LEDS_LT3593 is not set @@ -4218,6 +4226,7 @@ CONFIG_COMMON_CLK_SCPI=m # CONFIG_COMMON_CLK_SI570 is not set # CONFIG_COMMON_CLK_CDCE925 is not set # CONFIG_CLK_QORIQ is not set +CONFIG_COMMON_CLK_PWM=y # CONFIG_COMMON_CLK_PXA is not set # CONFIG_COMMON_CLK_CDCE706 is not set CONFIG_MVEBU_CLK_COMMON=y @@ -4526,7 +4535,10 @@ CONFIG_IIO_SYSFS_TRIGGER=m # CONFIG_TSYS02D is not set # CONFIG_NTB is not set # CONFIG_VME_BUS is not set -# CONFIG_PWM is not set +CONFIG_PWM=y +CONFIG_PWM_SYSFS=y +# CONFIG_PWM_FSL_FTM is not set +# CONFIG_PWM_PCA9685 is not set CONFIG_IRQCHIP=y CONFIG_ARM_GIC=y CONFIG_ARMADA_370_XP_IRQ=y diff --git a/config/sources/mvebu.conf b/config/sources/mvebu.conf index 51cfb3e05..8d74df18b 100644 --- a/config/sources/mvebu.conf +++ b/config/sources/mvebu.conf @@ -1,16 +1,33 @@ -BOOTSOURCE='https://github.com/SolidRun/u-boot-armada38x' -BOOTBRANCH='branch:u-boot-2013.01-15t1-clearfog' -BOOTDIR='u-boot-armada' -BOOTSCRIPT='boot-marvell.cmd:boot.cmd' +case $BOARD in + helios4) + BOOTSOURCE='https://github.com/helios-4/u-boot-marvell.git' + BOOTBRANCH='branch:u-boot-2013.01-15t1-helios4' + BOOTDIR='u-boot-helios4' + BOOTPATCHDIR='u-boot-helios4' + BOOTSCRIPT='boot-helios4.cmd:boot.cmd' -UBOOT_TARGET_MAP="u-boot.mmc;;u-boot.mmc u-boot-uart.mmc + UBOOT_TARGET_MAP="u-boot.mmc;;u-boot.mmc" + + BOOTENV_FILE='helios4-default.txt' + ;; + + *) + BOOTSOURCE='https://github.com/SolidRun/u-boot-armada38x' + BOOTBRANCH='branch:u-boot-2013.01-15t1-clearfog' + BOOTDIR='u-boot-armada' + BOOTSCRIPT='boot-marvell.cmd:boot.cmd' + + UBOOT_TARGET_MAP="u-boot.mmc;;u-boot.mmc u-boot-uart.mmc u-boot.sata;sata;u-boot.sata u-boot-uart.sata u-boot.flash;spi;u-boot.flash u-boot-uart.flash" -UBOOT_USE_GCC='== 4.9' -UBOOT_COMPILER='arm-linux-gnueabi-' + BOOTENV_FILE='clearfog-default.txt' + ;; +esac -BOOTENV_FILE='clearfog-default.txt' + +UBOOT_USE_GCC='< 5.0' +UBOOT_COMPILER='arm-linux-gnueabi-' HAS_UUID_SUPPORT=yes case $BRANCH in diff --git a/patch/kernel/mvebu-default/add-dtb-file-for-backwards-compatibility.patch b/patch/kernel/mvebu-default/board_clearfogbase/add-dtb-file-for-backwards-compatibility.patch similarity index 100% rename from patch/kernel/mvebu-default/add-dtb-file-for-backwards-compatibility.patch rename to patch/kernel/mvebu-default/board_clearfogbase/add-dtb-file-for-backwards-compatibility.patch diff --git a/patch/kernel/mvebu-default/add-spi-flash.patch b/patch/kernel/mvebu-default/board_clearfogbase/add-spi-flash.patch similarity index 100% rename from patch/kernel/mvebu-default/add-spi-flash.patch rename to patch/kernel/mvebu-default/board_clearfogbase/add-spi-flash.patch diff --git a/patch/kernel/mvebu-default/board_clearfogpro/add-dtb-file-for-backwards-compatibility.patch b/patch/kernel/mvebu-default/board_clearfogpro/add-dtb-file-for-backwards-compatibility.patch new file mode 100644 index 000000000..b3f11fb83 --- /dev/null +++ b/patch/kernel/mvebu-default/board_clearfogpro/add-dtb-file-for-backwards-compatibility.patch @@ -0,0 +1,29 @@ +diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile +index face816..9dc5e06 100644 +--- a/arch/arm/boot/dts/Makefile ++++ b/arch/arm/boot/dts/Makefile +@@ -751,6 +751,7 @@ dtb-$(CONFIG_MACH_ARMADA_38X) += \ + armada-385-linksys-cobra.dtb \ + armada-388-clearfog-base.dtb \ + armada-388-clearfog-pro.dtb \ ++ armada-388-clearfog.dtb \ + armada-388-db.dtb \ + armada-388-gp.dtb \ + armada-388-rd.dtb +diff --git a/arch/arm/boot/dts/armada-388-clearfog.dts b/arch/arm/boot/dts/armada-388-clearfog.dts +new file mode 100644 +index 0000000..7d906da +--- /dev/null ++++ b/arch/arm/boot/dts/armada-388-clearfog.dts +@@ -0,0 +1,11 @@ ++/* ++ * Device Tree file for backwards compatibility with old file name expected by boot script ++ * ++ * This file is distributed in the hope that it will be useful ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ */ ++ ++#include "armada-388-clearfog-pro.dts" diff --git a/patch/kernel/mvebu-default/board_clearfogpro/add-spi-flash.patch b/patch/kernel/mvebu-default/board_clearfogpro/add-spi-flash.patch new file mode 100644 index 000000000..4dd79d3d0 --- /dev/null +++ b/patch/kernel/mvebu-default/board_clearfogpro/add-spi-flash.patch @@ -0,0 +1,34 @@ +diff --git a/arch/arm/boot/dts/armada-388-clearfog.dtsi b/arch/arm/boot/dts/armada-388-clearfog.dtsi +index 1307e83e..e019ca23 100644 +--- a/arch/arm/boot/dts/armada-388-clearfog.dtsi ++++ b/arch/arm/boot/dts/armada-388-clearfog.dtsi +@@ -263,7 +263,28 @@ + compatible = "w25q32", "jedec,spi-nor"; + reg = <0>; /* Chip select 0 */ + spi-max-frequency = <3000000>; +- status = "enabled"; ++ status = "okay"; ++ ++ partitions { ++ compatible = "fixed-partitions"; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ++ partition@0 { ++ label = "uboot"; ++ reg = <0x0 0x100000>; ++ }; ++ ++ partition@100000 { ++ label = "env"; ++ reg = <0x100000 0x100000>; ++ }; ++ ++ partition@200000 { ++ label = "data"; ++ reg = <0x200000 0x200000>; ++ }; ++ }; + }; + }; + diff --git a/patch/kernel/mvebu-default/board_helios4/0001-gpio-mvebu-Add-limited-PWM-support.patch.disabled b/patch/kernel/mvebu-default/board_helios4/0001-gpio-mvebu-Add-limited-PWM-support.patch.disabled new file mode 100644 index 000000000..045c82886 --- /dev/null +++ b/patch/kernel/mvebu-default/board_helios4/0001-gpio-mvebu-Add-limited-PWM-support.patch.disabled @@ -0,0 +1,488 @@ +From 65bce3cd01230b283915be86196f5e1318c18dd6 Mon Sep 17 00:00:00 2001 +From: aprayoga +Date: Sun, 3 Sep 2017 15:59:11 +0800 +Subject: gpio: mvebu: Add limited PWM support + +backported from https://patchwork.kernel.org/patch/9681399/ + +* Remove atomic PWM API portion as this is not supported on LK4.4 +and use https://patchwork.ozlabs.org/patch/739591/ instead. +--- + .../devicetree/bindings/gpio/gpio-mvebu.txt | 31 +++ + MAINTAINERS | 2 + + drivers/gpio/gpio-mvebu.c | 309 ++++++++++++++++++++- + 3 files changed, 328 insertions(+), 14 deletions(-) + +diff --git a/Documentation/devicetree/bindings/gpio/gpio-mvebu.txt b/Documentation/devicetree/bindings/gpio/gpio-mvebu.txt +index 6b76891..b6cdcb2 100644 +--- a/Documentation/devicetree/bindings/gpio/gpio-mvebu.txt ++++ b/Documentation/devicetree/bindings/gpio/gpio-mvebu.txt +@@ -46,6 +46,23 @@ Optional: + The base of CP0 bank0 should be 20 (after AP-806 pins) the base of CP0 bank1 should be + 52 (after AP-806, and CP0 bank0 pins) + ++Optional properties: ++ ++In order to use the gpio lines in PWM mode, some additional optional ++properties are required. Only Armada 370 and XP support these properties. ++ ++- reg: an additional register set is needed, for the GPIO Blink ++ Counter on/off registers. ++ ++- reg-names: Must contain an entry "pwm" corresponding to the ++ additional register range needed for pwm operation. ++ ++- #pwm-cells: Should be two. The first cell is the pin number. The ++ second cell is reserved for flags and should be set to 0, so it has a ++ known value. It then becomes possible to use it in the future. ++ ++- clocks: Must be a phandle to the clock for the gpio controller. ++ + Example: + + gpio0: gpio@d0018100 { +@@ -59,3 +76,17 @@ Example: + #interrupt-cells = <2>; + interrupts = <16>, <17>, <18>, <19>; + }; ++ ++ gpio1: gpio@18140 { ++ compatible = "marvell,armada-370-xp-gpio"; ++ reg = <0x18140 0x40>, <0x181c8 0x08>; ++ reg-names = "gpio", "pwm"; ++ ngpios = <17>; ++ gpio-controller; ++ #gpio-cells = <2>; ++ #pwm-cells = <2>; ++ interrupt-controller; ++ #interrupt-cells = <2>; ++ interrupts = <87>, <88>, <89>; ++ clocks = <&coreclk 0>; ++ }; +diff --git a/MAINTAINERS b/MAINTAINERS +index 7008b0d..d272aca 100644 +--- a/MAINTAINERS ++++ b/MAINTAINERS +@@ -8635,6 +8635,8 @@ F: include/linux/pwm.h + F: drivers/pwm/ + F: drivers/video/backlight/pwm_bl.c + F: include/linux/pwm_backlight.h ++F: drivers/gpio/gpio-mvebu.c ++F: Documentation/devicetree/bindings/gpio/gpio-mvebu.txt + + PXA2xx/PXA3xx SUPPORT + M: Daniel Mack +diff --git a/drivers/gpio/gpio-mvebu.c b/drivers/gpio/gpio-mvebu.c +index ffea532..8775123 100644 +--- a/drivers/gpio/gpio-mvebu.c ++++ b/drivers/gpio/gpio-mvebu.c +@@ -42,29 +42,43 @@ + #include + #include + #include ++#include + #include + #include + #include ++#include ++ ++#include "gpiolib.h" + + /* + * GPIO unit register offsets. + */ +-#define GPIO_OUT_OFF 0x0000 +-#define GPIO_IO_CONF_OFF 0x0004 +-#define GPIO_BLINK_EN_OFF 0x0008 +-#define GPIO_IN_POL_OFF 0x000c +-#define GPIO_DATA_IN_OFF 0x0010 +-#define GPIO_EDGE_CAUSE_OFF 0x0014 +-#define GPIO_EDGE_MASK_OFF 0x0018 +-#define GPIO_LEVEL_MASK_OFF 0x001c ++#define GPIO_OUT_OFF 0x0000 ++#define GPIO_IO_CONF_OFF 0x0004 ++#define GPIO_BLINK_EN_OFF 0x0008 ++#define GPIO_IN_POL_OFF 0x000c ++#define GPIO_DATA_IN_OFF 0x0010 ++#define GPIO_EDGE_CAUSE_OFF 0x0014 ++#define GPIO_EDGE_MASK_OFF 0x0018 ++#define GPIO_LEVEL_MASK_OFF 0x001c ++#define GPIO_BLINK_CNT_SELECT_OFF 0x0020 ++ ++/* ++ * PWM register offsets. ++ */ ++#define PWM_BLINK_ON_DURATION_OFF 0x0 ++#define PWM_BLINK_OFF_DURATION_OFF 0x4 ++ + + /* The MV78200 has per-CPU registers for edge mask and level mask */ + #define GPIO_EDGE_MASK_MV78200_OFF(cpu) ((cpu) ? 0x30 : 0x18) + #define GPIO_LEVEL_MASK_MV78200_OFF(cpu) ((cpu) ? 0x34 : 0x1C) + +-/* The Armada XP has per-CPU registers for interrupt cause, interrupt ++/* ++ * The Armada XP has per-CPU registers for interrupt cause, interrupt + * mask and interrupt level mask. Those are relative to the +- * percpu_membase. */ ++ * percpu_membase. ++ */ + #define GPIO_EDGE_CAUSE_ARMADAXP_OFF(cpu) ((cpu) * 0x4) + #define GPIO_EDGE_MASK_ARMADAXP_OFF(cpu) (0x10 + (cpu) * 0x4) + #define GPIO_LEVEL_MASK_ARMADAXP_OFF(cpu) (0x20 + (cpu) * 0x4) +@@ -75,6 +89,23 @@ + + #define MVEBU_MAX_GPIO_PER_BANK 32 + ++struct mvebu_pwm { ++ void __iomem *membase; ++ unsigned long clk_rate; ++ struct gpio_desc *gpiod; ++ bool used; ++ unsigned int pin; ++ struct pwm_chip chip; ++ int id; ++ spinlock_t lock; ++ struct mvebu_gpio_chip *mvchip; ++ ++ /* Used to preserve GPIO/PWM registers across suspend/resume */ ++ u32 blink_select; ++ u32 blink_on_duration; ++ u32 blink_off_duration; ++}; ++ + struct mvebu_gpio_chip { + struct gpio_chip chip; + spinlock_t lock; +@@ -84,6 +115,10 @@ struct mvebu_gpio_chip { + struct irq_domain *domain; + int soc_variant; + ++ /* Used for PWM support */ ++ struct clk *clk; ++ struct mvebu_pwm *mvpwm; ++ + /* Used to preserve GPIO registers across suspend/resume */ + u32 out_reg; + u32 io_conf_reg; +@@ -102,6 +137,11 @@ static inline void __iomem *mvebu_gpioreg_out(struct mvebu_gpio_chip *mvchip) + return mvchip->membase + GPIO_OUT_OFF; + } + ++static void __iomem *mvebu_gpioreg_blink_select(struct mvebu_gpio_chip *mvchip) ++{ ++ return mvchip->membase + GPIO_BLINK_CNT_SELECT_OFF; ++} ++ + static inline void __iomem *mvebu_gpioreg_blink(struct mvebu_gpio_chip *mvchip) + { + return mvchip->membase + GPIO_BLINK_EN_OFF; +@@ -182,6 +222,20 @@ static void __iomem *mvebu_gpioreg_level_mask(struct mvebu_gpio_chip *mvchip) + } + + /* ++ * Functions returning addresses of individual registers for a given ++ * PWM controller. ++ */ ++static void __iomem *mvebu_pwmreg_blink_on_duration(struct mvebu_pwm *mvpwm) ++{ ++ return mvpwm->membase + PWM_BLINK_ON_DURATION_OFF; ++} ++ ++static void __iomem *mvebu_pwmreg_blink_off_duration(struct mvebu_pwm *mvpwm) ++{ ++ return mvpwm->membase + PWM_BLINK_OFF_DURATION_OFF; ++} ++ ++/* + * Functions implementing the gpio_chip methods + */ + +@@ -489,6 +543,220 @@ static void mvebu_gpio_irq_handler(struct irq_desc *desc) + chained_irq_exit(chip, desc); + } + ++/* ++ * Functions implementing the pwm_chip methods ++ */ ++static struct mvebu_pwm *to_mvebu_pwm(struct pwm_chip *chip) ++{ ++ return container_of(chip, struct mvebu_pwm, chip); ++} ++ ++static int mvebu_pwm_request(struct pwm_chip *chip, struct pwm_device *pwm) ++{ ++ struct mvebu_pwm *mvpwm = to_mvebu_pwm(chip); ++ struct mvebu_gpio_chip *mvchip = mvpwm->mvchip; ++ struct gpio_desc *desc; ++ unsigned long flags; ++ int ret = 0; ++ ++ spin_lock_irqsave(&mvpwm->lock, flags); ++ if (mvpwm->gpiod) { ++ ret = -EBUSY; ++ } else { ++ desc = gpio_to_desc(mvchip->chip.base + pwm->hwpwm); ++ if (!desc) { ++ ret = -ENODEV; ++ goto out; ++ } ++ ret = gpiod_request(desc, "mvebu-pwm"); ++ if (ret) ++ goto out; ++ ++ ret = gpiod_direction_output(desc, 0); ++ if (ret) { ++ gpiod_free(desc); ++ goto out; ++ } ++ ++ mvpwm->gpiod = desc; ++ mvpwm->pin = pwm->pwm - mvchip->chip.base; ++ mvpwm->used = true; ++ } ++ ++out: ++ spin_unlock_irqrestore(&mvpwm->lock, flags); ++ return ret; ++} ++ ++static void mvebu_pwm_free(struct pwm_chip *chip, struct pwm_device *pwm) ++{ ++ struct mvebu_pwm *mvpwm = to_mvebu_pwm(chip); ++ unsigned long flags; ++ ++ spin_lock_irqsave(&mvpwm->lock, flags); ++ gpiod_free(mvpwm->gpiod); ++ mvpwm->used = false; ++ spin_unlock_irqrestore(&mvpwm->lock, flags); ++} ++ ++static int mvebu_pwm_config(struct pwm_chip *chip, struct pwm_device *pwmd, ++ int duty_ns, int period_ns) ++{ ++ struct mvebu_pwm *pwm = to_mvebu_pwm(chip); ++ struct mvebu_gpio_chip *mvchip = pwm->mvchip; ++ unsigned int on, off; ++ unsigned long long val; ++ u32 u; ++ ++ val = (unsigned long long) pwm->clk_rate * duty_ns; ++ do_div(val, NSEC_PER_SEC); ++ if (val > UINT_MAX) ++ return -EINVAL; ++ if (val) ++ on = val; ++ else ++ on = 1; ++ ++ val = (unsigned long long) pwm->clk_rate * (period_ns - duty_ns); ++ do_div(val, NSEC_PER_SEC); ++ if (val > UINT_MAX) ++ return -EINVAL; ++ if (val) ++ off = val; ++ else ++ off = 1; ++ ++ u = readl_relaxed(mvebu_gpioreg_blink_select(mvchip)); ++ u &= ~(1 << pwm->pin); ++ u |= (pwm->id << pwm->pin); ++ writel_relaxed(u, mvebu_gpioreg_blink_select(mvchip)); ++ ++ writel_relaxed(on, mvebu_pwmreg_blink_on_duration(pwm)); ++ writel_relaxed(off, mvebu_pwmreg_blink_off_duration(pwm)); ++ ++ return 0; ++} ++ ++static int mvebu_pwm_enable(struct pwm_chip *chip, struct pwm_device *pwm) ++{ ++ struct mvebu_pwm *mvpwm = to_mvebu_pwm(chip); ++ struct mvebu_gpio_chip *mvchip = mvpwm->mvchip; ++ ++ mvebu_gpio_blink(&mvchip->chip, mvpwm->pin, 1); ++ ++ return 0; ++} ++ ++static void mvebu_pwm_disable(struct pwm_chip *chip, struct pwm_device *pwm) ++{ ++ struct mvebu_pwm *mvpwm = to_mvebu_pwm(chip); ++ struct mvebu_gpio_chip *mvchip = mvpwm->mvchip; ++ ++ mvebu_gpio_blink(&mvchip->chip, mvpwm->pin, 0); ++} ++ ++static const struct pwm_ops mvebu_pwm_ops = { ++ .request = mvebu_pwm_request, ++ .free = mvebu_pwm_free, ++ .config = mvebu_pwm_config, ++ .enable = mvebu_pwm_enable, ++ .disable = mvebu_pwm_disable, ++ .owner = THIS_MODULE, ++}; ++ ++static void mvebu_pwm_suspend(struct mvebu_gpio_chip *mvchip) ++{ ++ struct mvebu_pwm *mvpwm = mvchip->mvpwm; ++ ++ mvpwm->blink_select = ++ readl_relaxed(mvebu_gpioreg_blink_select(mvchip)); ++ mvpwm->blink_on_duration = ++ readl_relaxed(mvebu_pwmreg_blink_on_duration(mvpwm)); ++ mvpwm->blink_off_duration = ++ readl_relaxed(mvebu_pwmreg_blink_off_duration(mvpwm)); ++} ++ ++static void mvebu_pwm_resume(struct mvebu_gpio_chip *mvchip) ++{ ++ struct mvebu_pwm *mvpwm = mvchip->mvpwm; ++ ++ writel_relaxed(mvpwm->blink_select, ++ mvebu_gpioreg_blink_select(mvchip)); ++ writel_relaxed(mvpwm->blink_on_duration, ++ mvebu_pwmreg_blink_on_duration(mvpwm)); ++ writel_relaxed(mvpwm->blink_off_duration, ++ mvebu_pwmreg_blink_off_duration(mvpwm)); ++} ++ ++/* ++ * Armada 370/XP has simple PWM support for gpio lines. Other SoCs ++ * don't have this hardware. So if we don't have the necessary ++ * resource, it is not an error. ++ */ ++static int mvebu_pwm_probe(struct platform_device *pdev, ++ struct mvebu_gpio_chip *mvchip, ++ int id) ++{ ++ struct device *dev = &pdev->dev; ++ struct mvebu_pwm *mvpwm; ++ struct resource *res; ++ u32 set; ++ ++ if (!of_device_is_compatible(mvchip->chip.of_node, ++ "marvell,armada-370-xp-gpio")) ++ return 0; ++ ++ if (IS_ERR(mvchip->clk)) ++ return PTR_ERR(mvchip->clk); ++ ++ /* ++ * There are only two sets of PWM configuration registers for ++ * all the GPIO lines on those SoCs which this driver reserves ++ * for the first two GPIO chips. So if the resource is missing ++ * we can't treat it as an error. ++ */ ++ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "pwm"); ++ if (!res) ++ return 0; ++ ++ /* ++ * Use set A for lines of GPIO chip with id 0, B for GPIO chip ++ * with id 1. Don't allow further GPIO chips to be used for PWM. ++ */ ++ if (id == 0) ++ set = 0; ++ else if (id == 1) ++ set = U32_MAX; ++ else ++ return -EINVAL; ++ writel_relaxed(set, mvebu_gpioreg_blink_select(mvchip)); ++ mvpwm->id = id; ++ ++ mvpwm = devm_kzalloc(dev, sizeof(struct mvebu_pwm), GFP_KERNEL); ++ if (!mvpwm) ++ return -ENOMEM; ++ mvchip->mvpwm = mvpwm; ++ mvpwm->mvchip = mvchip; ++ ++ mvpwm->membase = devm_ioremap_resource(dev, res); ++ if (IS_ERR(mvpwm->membase)) ++ return PTR_ERR(mvpwm->membase); ++ ++ mvpwm->clk_rate = clk_get_rate(mvchip->clk); ++ if (!mvpwm->clk_rate) { ++ dev_err(dev, "failed to get clock rate\n"); ++ return -EINVAL; ++ } ++ ++ mvpwm->chip.dev = dev; ++ mvpwm->chip.ops = &mvebu_pwm_ops; ++ mvpwm->chip.npwm = mvchip->chip.ngpio; ++ ++ spin_lock_init(&mvpwm->lock); ++ ++ return pwmchip_add(&mvpwm->chip); ++} ++ + #ifdef CONFIG_DEBUG_FS + #include + +@@ -561,6 +829,10 @@ static const struct of_device_id mvebu_gpio_of_match[] = { + .data = (void *) MVEBU_GPIO_SOC_VARIANT_ARMADAXP, + }, + { ++ .compatible = "marvell,armada-370-xp-gpio", ++ .data = (void *) MVEBU_GPIO_SOC_VARIANT_ORION, ++ }, ++ { + /* sentinel */ + }, + }; +@@ -607,6 +879,9 @@ static int mvebu_gpio_suspend(struct platform_device *pdev, pm_message_t state) + BUG(); + } + ++ if (IS_ENABLED(CONFIG_PWM)) ++ mvebu_pwm_suspend(mvchip); ++ + return 0; + } + +@@ -650,6 +925,9 @@ static int mvebu_gpio_resume(struct platform_device *pdev) + BUG(); + } + ++ if (IS_ENABLED(CONFIG_PWM)) ++ mvebu_pwm_resume(mvchip); ++ + return 0; + } + +@@ -661,7 +939,6 @@ static int mvebu_gpio_probe(struct platform_device *pdev) + struct resource *res; + struct irq_chip_generic *gc; + struct irq_chip_type *ct; +- struct clk *clk; + unsigned int ngpios; + unsigned int gpio_base = -1; + int soc_variant; +@@ -695,10 +972,10 @@ static int mvebu_gpio_probe(struct platform_device *pdev) + return id; + } + +- clk = devm_clk_get(&pdev->dev, NULL); ++ mvchip->clk = devm_clk_get(&pdev->dev, NULL); + /* Not all SoCs require a clock.*/ +- if (!IS_ERR(clk)) +- clk_prepare_enable(clk); ++ if (!IS_ERR(mvchip->clk)) ++ clk_prepare_enable(mvchip->clk); + + mvchip->soc_variant = soc_variant; + mvchip->chip.label = dev_name(&pdev->dev); +@@ -835,6 +1112,10 @@ static int mvebu_gpio_probe(struct platform_device *pdev) + goto err_generic_chip; + } + ++ /* Armada 370/XP has simple PWM support for GPIO lines */ ++ if (IS_ENABLED(CONFIG_PWM)) ++ return mvebu_pwm_probe(pdev, mvchip, id); ++ + return 0; + + err_generic_chip: +-- +2.7.4 + diff --git a/patch/kernel/mvebu-default/board_helios4/0002-ARM-dts-mvebu-Add-PWM-properties-to-.dtsi-armada-38x.patch.disabled b/patch/kernel/mvebu-default/board_helios4/0002-ARM-dts-mvebu-Add-PWM-properties-to-.dtsi-armada-38x.patch.disabled new file mode 100644 index 000000000..e19aa068d --- /dev/null +++ b/patch/kernel/mvebu-default/board_helios4/0002-ARM-dts-mvebu-Add-PWM-properties-to-.dtsi-armada-38x.patch.disabled @@ -0,0 +1,62 @@ +From e85a492b45f49e374f544bbffe8c975b1dabe87f Mon Sep 17 00:00:00 2001 +From: aprayoga +Date: Sun, 3 Sep 2017 16:08:59 +0800 +Subject: ARM: dts: mvebu: Add PWM properties to .dtsi (armada-38x) + +reference: +https://patchwork.kernel.org/patch/9681397/ +--- + arch/arm/boot/dts/armada-38x.dtsi | 16 ++++++++++++---- + 1 file changed, 12 insertions(+), 4 deletions(-) + +diff --git a/arch/arm/boot/dts/armada-38x.dtsi b/arch/arm/boot/dts/armada-38x.dtsi +index a73cbe2..f87204f 100644 +--- a/arch/arm/boot/dts/armada-38x.dtsi ++++ b/arch/arm/boot/dts/armada-38x.dtsi +@@ -345,31 +345,39 @@ + }; + + gpio0: gpio@18100 { +- compatible = "marvell,orion-gpio"; +- reg = <0x18100 0x40>; ++ compatible = "marvell,armada-370-xp-gpio", ++ "marvell,orion-gpio"; ++ reg = <0x18100 0x40>, <0x181c0 0x08>; ++ reg-names = "gpio", "pwm"; + ngpios = <32>; + gpio-controller; + #gpio-cells = <2>; ++ #pwm-cells = <2>; + interrupt-controller; + #interrupt-cells = <2>; + interrupts = , + , + , + ; ++ clocks = <&coreclk 0>; + }; + + gpio1: gpio@18140 { +- compatible = "marvell,orion-gpio"; +- reg = <0x18140 0x40>; ++ compatible = "marvell,armada-370-xp-gpio", ++ "marvell,orion-gpio"; ++ reg = <0x18140 0x40>, <0x181c8 0x08>; ++ reg-names = "gpio", "pwm"; + ngpios = <28>; + gpio-controller; + #gpio-cells = <2>; ++ #pwm-cells = <2>; + interrupt-controller; + #interrupt-cells = <2>; + interrupts = , + , + , + ; ++ clocks = <&coreclk 0>; + }; + + system-controller@18200 { +-- +2.7.4 + diff --git a/patch/kernel/mvebu-default/board_helios4/0003-ARM-mvebu-Enable-SENSORS_PWM_FAN-in-defconfig.patch.disabled b/patch/kernel/mvebu-default/board_helios4/0003-ARM-mvebu-Enable-SENSORS_PWM_FAN-in-defconfig.patch.disabled new file mode 100644 index 000000000..5180ec9a1 --- /dev/null +++ b/patch/kernel/mvebu-default/board_helios4/0003-ARM-mvebu-Enable-SENSORS_PWM_FAN-in-defconfig.patch.disabled @@ -0,0 +1,35 @@ +From facb61a995ceac9b307159f0eb1e8666ce353ef0 Mon Sep 17 00:00:00 2001 +From: Andrew Lunn +Date: Fri, 14 Apr 2017 17:40:54 +0200 +Subject: ARM: mvebu: Enable SENSORS_PWM_FAN in defconfig + +Now that the GPIO driver also supports PWM operation, enable the PWM +framework and fan driver in mvebu_v7_defconfig. + +Signed-off-by: Andrew Lunn +URL: https://patchwork.ozlabs.org/patch/427297/ +[Ralph Sennhauser: add fan driver to defconfig] +Signed-off-by: Ralph Sennhauser +Tested-by: Andrew Lunn +Acked-by: Linus Walleij +Signed-off-by: Gregory CLEMENT +--- + arch/arm/configs/mvebu_v7_defconfig | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/arch/arm/configs/mvebu_v7_defconfig b/arch/arm/configs/mvebu_v7_defconfig +index cf363ab..98cc3da 100644 +--- a/arch/arm/configs/mvebu_v7_defconfig ++++ b/arch/arm/configs/mvebu_v7_defconfig +@@ -132,6 +132,8 @@ CONFIG_DMADEVICES=y + CONFIG_MV_XOR=y + # CONFIG_IOMMU_SUPPORT is not set + CONFIG_MEMORY=y ++CONFIG_PWM=y ++CONFIG_SENSORS_PWM_FAN=y + CONFIG_EXT4_FS=y + CONFIG_ISO9660_FS=y + CONFIG_JOLIET=y +-- +2.7.4 + diff --git a/patch/kernel/mvebu-default/board_helios4/0004-libata-add-ledtrig-support.patch b/patch/kernel/mvebu-default/board_helios4/0004-libata-add-ledtrig-support.patch new file mode 100644 index 000000000..272964ec1 --- /dev/null +++ b/patch/kernel/mvebu-default/board_helios4/0004-libata-add-ledtrig-support.patch @@ -0,0 +1,179 @@ +From 5843af891d0dabf9bb80039cfe807d01e9495154 Mon Sep 17 00:00:00 2001 +From: Daniel Golle +Date: Fri, 12 Dec 2014 13:38:33 +0100 +Subject: libata: add ledtrig support + +This adds a LED trigger for each ATA port indicating disk activity. + +As this is needed only on specific platforms (NAS SoCs and such), +these platforms should define ARCH_WANTS_LIBATA_LEDS if there +are boards with LED(s) intended to indicate ATA disk activity and +need the OS to take care of that. +In that way, if not selected, LED trigger support not will be +included in libata-core and both, codepaths and structures remain +untouched. + +Signed-off-by: Daniel Golle +--- + drivers/ata/Kconfig | 16 ++++++++++++++ + drivers/ata/libata-core.c | 56 +++++++++++++++++++++++++++++++++++++++++++++++ + include/linux/libata.h | 7 ++++++ + 3 files changed, 79 insertions(+) + +diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig +index 6aaa3f8..4e24b64 100644 +--- a/drivers/ata/Kconfig ++++ b/drivers/ata/Kconfig +@@ -46,6 +46,22 @@ config ATA_VERBOSE_ERROR + + If unsure, say Y. + ++config ARCH_WANT_LIBATA_LEDS ++ bool ++ ++config ATA_LEDS ++ bool "support ATA port LED triggers" ++ depends on ARCH_WANT_LIBATA_LEDS ++ select NEW_LEDS ++ select LEDS_CLASS ++ select LEDS_TRIGGERS ++ default y ++ help ++ This option adds a LED trigger for each registered ATA port. ++ It is used to drive disk activity leds connected via GPIO. ++ ++ If unsure, say N. ++ + config ATA_ACPI + bool "ATA ACPI Support" + depends on ACPI +diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c +index b0b77b6..1400f4d 100644 +--- a/drivers/ata/libata-core.c ++++ b/drivers/ata/libata-core.c +@@ -728,6 +728,7 @@ u64 ata_tf_read_block(struct ata_taskfile *tf, struct ata_device *dev) + return block; + } + ++ + /** + * ata_build_rw_tf - Build ATA taskfile for given read/write request + * @tf: Target ATA taskfile +@@ -4757,6 +4758,30 @@ void swap_buf_le16(u16 *buf, unsigned int buf_words) + } + + /** ++ * ata_led_act - Trigger port activity LED ++ * @ap: indicating port ++ * ++ * Blinks any LEDs registered to the trigger. ++ * Commonly used with leds-gpio on NAS systems with disk activity ++ * indicator LEDs. ++ * ++ * LOCKING: ++ * None. ++ */ ++static inline void ata_led_act(struct ata_port *ap) ++{ ++#if CONFIG_ATA_LEDS ++#define LIBATA_BLINK_DELAY 20 /* ms */ ++ unsigned long led_delay = LIBATA_BLINK_DELAY; ++ ++ if (unlikely(!ap->ledtrig)) ++ return; ++ ++ led_trigger_blink_oneshot(ap->ledtrig, &led_delay, &led_delay, 0); ++#endif /* CONFIG_ATA_LEDS */ ++} ++ ++/** + * ata_qc_new_init - Request an available ATA command, and initialize it + * @dev: Device from whom we request an available command structure + * @tag: tag +@@ -4780,6 +4805,9 @@ struct ata_queued_cmd *ata_qc_new_init(struct ata_device *dev, int tag) + if (tag < 0) + return NULL; + } ++#if CONFIG_ATA_LEDS ++ ata_led_act(ap); ++#endif + + qc = __ata_qc_from_tag(ap, tag); + qc->tag = tag; +@@ -5677,6 +5705,9 @@ struct ata_port *ata_port_alloc(struct ata_host *host) + ap->stats.unhandled_irq = 1; + ap->stats.idle_irq = 1; + #endif ++#if CONFIG_ATA_LEDS ++ ap->ledtrig = kzalloc(sizeof(struct led_trigger), GFP_KERNEL); ++#endif + ata_sff_port_init(ap); + + return ap; +@@ -5698,6 +5729,12 @@ static void ata_host_release(struct device *gendev, void *res) + + kfree(ap->pmp_link); + kfree(ap->slave_link); ++#if CONFIG_ATA_LEDS ++ if (ap->ledtrig) { ++ led_trigger_unregister(ap->ledtrig); ++ kfree(ap->ledtrig); ++ }; ++#endif + kfree(ap); + host->ports[i] = NULL; + } +@@ -6145,6 +6182,25 @@ int ata_host_register(struct ata_host *host, struct scsi_host_template *sht) + host->ports[i]->local_port_no = i + 1; + } + ++#if CONFIG_ATA_LEDS ++ /* register LED triggers for all ports */ ++ for (i = 0; i < host->n_ports; i++) { ++ if (unlikely(!host->ports[i]->ledtrig)) ++ continue; ++ ++ snprintf(host->ports[i]->ledtrig_name, ++ sizeof(host->ports[i]->ledtrig_name), "ata%u", ++ host->ports[i]->print_id); ++ ++ host->ports[i]->ledtrig->name = host->ports[i]->ledtrig_name; ++ ++ if (led_trigger_register(host->ports[i]->ledtrig)) { ++ kfree(host->ports[i]->ledtrig); ++ host->ports[i]->ledtrig = NULL; ++ } ++ } ++#endif ++ + /* Create associated sysfs transport objects */ + for (i = 0; i < host->n_ports; i++) { + rc = ata_tport_add(host->dev,host->ports[i]); +diff --git a/include/linux/libata.h b/include/linux/libata.h +index b20a275..50eeee3 100644 +--- a/include/linux/libata.h ++++ b/include/linux/libata.h +@@ -38,6 +38,7 @@ + #include + #include + #include ++#include + + /* + * Define if arch has non-standard setup. This is a _PCI_ standard +@@ -877,6 +878,12 @@ struct ata_port { + #ifdef CONFIG_ATA_ACPI + struct ata_acpi_gtm __acpi_init_gtm; /* use ata_acpi_init_gtm() */ + #endif ++ ++#ifdef CONFIG_ATA_LEDS ++ struct led_trigger *ledtrig; ++ char ledtrig_name[8]; ++#endif ++ + /* owned by EH */ + u8 sector_buf[ATA_SECT_SIZE] ____cacheline_aligned; + }; +-- +2.7.4 + diff --git a/patch/kernel/mvebu-default/board_helios4/0005-Enable-ATA-port-LED-trigger.patch b/patch/kernel/mvebu-default/board_helios4/0005-Enable-ATA-port-LED-trigger.patch new file mode 100644 index 000000000..2b5952f12 --- /dev/null +++ b/patch/kernel/mvebu-default/board_helios4/0005-Enable-ATA-port-LED-trigger.patch @@ -0,0 +1,37 @@ +From 9ee6345ef82f7af5f98e17a40e667f8ad6b2fa1b Mon Sep 17 00:00:00 2001 +From: aprayoga +Date: Sun, 3 Sep 2017 18:10:12 +0800 +Subject: Enable ATA port LED trigger + +--- + arch/arm/configs/mvebu_v7_defconfig | 1 + + arch/arm/mach-mvebu/Kconfig | 1 + + 2 files changed, 2 insertions(+) + +diff --git a/arch/arm/configs/mvebu_v7_defconfig b/arch/arm/configs/mvebu_v7_defconfig +index cf363ab..19449d3 100644 +--- a/arch/arm/configs/mvebu_v7_defconfig ++++ b/arch/arm/configs/mvebu_v7_defconfig +@@ -61,6 +61,7 @@ CONFIG_MTD_SPI_NOR=y + CONFIG_EEPROM_AT24=y + CONFIG_BLK_DEV_SD=y + CONFIG_ATA=y ++CONFIG_ATA_LEDS=y + CONFIG_SATA_AHCI=y + CONFIG_AHCI_MVEBU=y + CONFIG_SATA_MV=y +diff --git a/arch/arm/mach-mvebu/Kconfig b/arch/arm/mach-mvebu/Kconfig +index 053ea9d..aa1f389 100644 +--- a/arch/arm/mach-mvebu/Kconfig ++++ b/arch/arm/mach-mvebu/Kconfig +@@ -52,6 +52,7 @@ config MACH_ARMADA_375 + + config MACH_ARMADA_38X + bool "Marvell Armada 380/385 boards" if ARCH_MULTI_V7 ++ select ARCH_WANT_LIBATA_LEDS + select ARM_ERRATA_720789 + select ARM_ERRATA_753970 + select ARM_GIC +-- +2.7.4 + diff --git a/patch/kernel/mvebu-default/board_helios4/0006-helios4-device-tree.patch b/patch/kernel/mvebu-default/board_helios4/0006-helios4-device-tree.patch new file mode 100644 index 000000000..0a1ec90cc --- /dev/null +++ b/patch/kernel/mvebu-default/board_helios4/0006-helios4-device-tree.patch @@ -0,0 +1,387 @@ +From 9fe4b82ed5e62ac82df8294e9e02b4ffab23bb47 Mon Sep 17 00:00:00 2001 +From: Aditya Prayoga +Date: Sun, 19 Mar 2017 17:27:01 +0800 +Subject: Initial device tree + +- Tested using clearfrog u-boot +- Increase SD Card clock to 50 MHz from default 25 MHz +- All 7 LED declared as led-gpio +- LED1 (system) default to hearbeat +- LED7 (USB) triggered by USB Host activity +- GPIO23 (MPP23) declared as GPIO button +- SPI NOR flash declared as MTD +- Enable IO expander interrupt +- Allocate GPIOs for fans +--- + arch/arm/boot/dts/armada-388-helios4.dts | 318 ++++++++++++++++++++++++++++++ + 1 file changed, 318 insertions(+) + create mode 100644 arch/arm/boot/dts/armada-388-helios4.dts + +diff --git a/arch/arm/boot/dts/armada-388-helios4.dts b/arch/arm/boot/dts/armada-388-helios4.dts +new file mode 100644 +index 0000000..b7a2122 +--- /dev/null ++++ b/arch/arm/boot/dts/armada-388-helios4.dts +@@ -0,0 +1,346 @@ ++/* ++ * Device Tree file for Helios4 ++ * based on SolidRun Clearfog revision A1 rev 2.0 (88F6828) ++ * ++ * Copyright (C) 2017 ++ * ++ */ ++ ++/dts-v1/; ++#include "armada-388.dtsi" ++#include "armada-38x-solidrun-microsom.dtsi" ++ ++/ { ++ model = "Helios4"; ++ compatible = "marvell,armada388", ++ "marvell,armada385", "marvell,armada380"; ++ ++ memory { ++ device_type = "memory"; ++ reg = <0x00000000 0x40000000>; /* 1 GB */ ++ }; ++ ++ aliases { ++ /* So that mvebu u-boot can update the MAC addresses */ ++ ethernet1 = ð0; ++ }; ++ ++ chosen { ++ stdout-path = "serial0:115200n8"; ++ }; ++ ++ reg_12v: regulator-12v { ++ compatible = "regulator-fixed"; ++ regulator-name = "power_brick_12V"; ++ regulator-min-microvolt = <12000000>; ++ regulator-max-microvolt = <12000000>; ++ regulator-always-on; ++ }; ++ ++ reg_3p3v: regulator-3p3v { ++ compatible = "regulator-fixed"; ++ regulator-name = "3P3V"; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ regulator-always-on; ++ vin-supply = <®_12v>; ++ }; ++ ++ reg_5p0v_hdd: regulator-5v-hdd { ++ compatible = "regulator-fixed"; ++ regulator-name = "5V_HDD"; ++ regulator-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5000000>; ++ regulator-always-on; ++ vin-supply = <®_12v>; ++ }; ++ ++ reg_5p0v_usb: regulator-5v-usb { ++ compatible = "regulator-fixed"; ++ regulator-name = "USB-PWR"; ++ regulator-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5000000>; ++ regulator-boot-on; ++ regulator-always-on; ++ enable-active-high; ++ gpio = <&expander0 6 GPIO_ACTIVE_HIGH>; ++ vin-supply = <®_12v>; ++ }; ++ ++ gpio-keys { ++ compatible = "gpio-keys"; ++ pinctrl-0 = <&user_button_pins>; ++ pinctrl-names = "default"; ++ ++ button_0 { ++ label = "User Button"; ++ gpios = <&gpio0 23 GPIO_ACTIVE_LOW>; ++ linux,can-disable; ++ linux,code = ; ++ }; ++ }; ++ ++ system-leds { ++ compatible = "gpio-leds"; ++ status-led { ++ label = "helios4:green:status"; ++ gpios = <&gpio0 24 GPIO_ACTIVE_LOW>; ++ linux,default-trigger = "heartbeat"; ++ default-state = "on"; ++ }; ++ ++ fault-led { ++ label = "helios4:red:fault"; ++ gpios = <&gpio1 16 GPIO_ACTIVE_LOW>; ++ default-state = "keep"; ++ }; ++ }; ++ ++ io-leds { ++ compatible = "gpio-leds"; ++ sata1-led { ++ label = "helios4:green:ata1"; ++ gpios = <&gpio1 17 GPIO_ACTIVE_LOW>; ++ linux,default-trigger = "ata1"; ++ default-state = "off"; ++ }; ++ sata2-led { ++ label = "helios4:green:ata2"; ++ gpios = <&gpio1 18 GPIO_ACTIVE_LOW>; ++ linux,default-trigger = "ata2"; ++ default-state = "off"; ++ }; ++ sata3-led { ++ label = "helios4:green:ata3"; ++ gpios = <&gpio1 20 GPIO_ACTIVE_LOW>; ++ linux,default-trigger = "ata3"; ++ default-state = "off"; ++ }; ++ sata4-led { ++ label = "helios4:green:ata4"; ++ gpios = <&gpio1 21 GPIO_ACTIVE_LOW>; ++ linux,default-trigger = "ata4"; ++ default-state = "off"; ++ }; ++ usb-led { ++ label = "helios4:green:usb"; ++ gpios = <&gpio1 22 GPIO_ACTIVE_LOW>; ++ linux,default-trigger = "usb-host"; ++ default-state = "off"; ++ }; ++ }; ++ ++ fan1: j10-pwm { ++ compatible = "pwm-fan"; ++ pwms = <&gpio1 9 3000>; ++ }; ++ ++ fan2: j17-pwm { ++ compatible = "pwm-fan"; ++ pwms = <&gpio1 4 4500>; ++ }; ++ ++ usb2_phy: usb2-phy { ++ compatible = "usb-nop-xceiv"; ++ vbus-regulator = <®_5p0v_usb>; ++ }; ++ ++ usb3_phy: usb3-phy { ++ compatible = "usb-nop-xceiv"; ++ //vbus-regulator = <®_5p0v_usb>; ++ }; ++ ++ soc { ++ internal-regs { ++ i2c@11000 { ++ clock-frequency = <100000>; ++ pinctrl-0 = <&i2c0_pins>; ++ pinctrl-names = "default"; ++ status = "okay"; ++ ++ /* ++ * PCA9655 GPIO expander, up to 1MHz clock. ++ * 0-Board Revision bit 0 # ++ * 1-Board Revision bit 1 # ++ * 5-USB3 overcurrent ++ * 6-USB3 power ++ */ ++ expander0: gpio-expander@20 { ++ /* ++ * This is how it should be: ++ * compatible = "onnn,pca9655", ++ * "nxp,pca9555"; ++ * but you can't do this because of ++ * the way I2C works. ++ */ ++ compatible = "nxp,pca9555"; ++ gpio-controller; ++ #gpio-cells = <2>; ++ reg = <0x20>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pca0_pins>; ++ interrupt-parent = <&gpio0>; ++ interrupts = <18 IRQ_TYPE_EDGE_FALLING>; ++ interrupt-controller; ++ #interrupt-cells = <2>; ++ ++ board_rev_bit_0 { ++ gpio-hog; ++ gpios = <0 GPIO_ACTIVE_LOW>; ++ input; ++ line-name = "board-rev-0"; ++ }; ++ board_rev_bit_1 { ++ gpio-hog; ++ gpios = <1 GPIO_ACTIVE_LOW>; ++ input; ++ line-name = "board-rev-1"; ++ }; ++ usb3_ilimit { ++ gpio-hog; ++ gpios = <5 GPIO_ACTIVE_HIGH>; ++ input; ++ line-name = "usb-overcurrent-status"; ++ }; ++ }; ++ ++ temp_sensor: temp@4c { ++ compatible = "ti,lm75"; ++ reg = <0x4c>; ++ vcc-supply = <®_3p3v>; ++ }; ++ ++ /* What device at 0x64 ? */ ++ }; ++ ++ i2c@11100 { ++ /* ++ * External I2C Bus for user peripheral ++ */ ++ clock-frequency = <400000>; ++ pinctrl-0 = <&helios_i2c1_pins>; ++ pinctrl-names = "default"; ++ status = "okay"; ++ }; ++ ++ sata@a8000 { ++ status = "okay"; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ sata0: sata-port@0 { ++ reg = <0>; ++ }; ++ ++ sata1: sata-port@1 { ++ reg = <1>; ++ }; ++ }; ++ ++ sata@e0000 { ++ status = "okay"; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ sata2: sata-port@0 { ++ reg = <0>; ++ }; ++ ++ sata3: sata-port@1 { ++ reg = <1>; ++ }; ++ }; ++ ++ spi@10680 { ++ pinctrl-0 = <&spi1_pins ++ µsom_spi1_cs_pins>; ++ pinctrl-names = "default"; ++ status = "okay"; ++ ++ spi-flash@0 { ++ #address-cells = <1>; ++ #size-cells = <1>; ++ compatible = "w25q32", "jedec,spi-nor"; ++ reg = <0>; /* Chip select 0 */ ++ spi-max-frequency = <104000000>; ++ spi-cpha; ++ status = "okay"; ++ }; ++ }; ++ ++ sdhci@d8000 { ++ bus-width = <4>; ++ cd-gpios = <&gpio0 20 GPIO_ACTIVE_LOW>; ++ no-1-8-v; ++ pinctrl-0 = <&helios_sdhci_pins ++ &helios_sdhci_cd_pins>; ++ pinctrl-names = "default"; ++ status = "okay"; ++ vmmc = <®_3p3v>; ++ wp-inverted; ++ max-frequency = <50000000>; ++ cap-sd-highspeed; ++ sd-uhs-sdr12; ++ sd-uhs-sdr25; ++ sd-uhs-sdr50; ++ keep-power-in-suspend; ++ wakeup-source; ++ }; ++ ++ usb@58000 { ++ //vcc-supply = <®_5p0v_usb>; ++ usb-phy = <&usb2_phy>; ++ status = "okay"; ++ }; ++ ++ usb3@f0000 { ++ status = "okay"; ++ }; ++ ++ usb3@f8000 { ++ status = "okay"; ++ }; ++ ++ pinctrl@18000 { ++ pca0_pins: pca0_pins { ++ marvell,pins = "mpp18"; ++ marvell,function = "gpio"; ++ }; ++ helios_i2c1_pins: i2c1-pins { ++ marvell,pins = "mpp26", "mpp27"; ++ marvell,function = "i2c1"; ++ }; ++ helios_sdhci_cd_pins: helios-sdhci-cd-pins { ++ marvell,pins = "mpp20"; ++ marvell,function = "gpio"; ++ }; ++ helios_sdhci_pins: helios-sdhci-pins { ++ marvell,pins = "mpp21", "mpp28", ++ "mpp37", "mpp38", ++ "mpp39", "mpp40"; ++ marvell,function = "sd0"; ++ }; ++ helios_led_pins: helios-led-pins { ++ marvell,pins = "mpp24", "mpp25", ++ "mpp49", "mpp50", ++ "mpp52", "mpp53", ++ "mpp54"; ++ marvell,function = "gpio"; ++ }; ++ helios_fan_pins: helios-fan-pins { ++ marvell,pins = "mpp41", "mpp43", ++ "mpp36", "mpp25"; ++ marvell,function = "gpio"; ++ }; ++ microsom_spi1_cs_pins: spi1-cs-pins { ++ marvell,pins = "mpp59"; ++ marvell,function = "spi1"; ++ }; ++ user_button_pins: user-button-pins { ++ marvell,pins = "mpp23"; ++ marvell,function = "gpio"; ++ }; ++ }; ++ }; ++ }; ++}; + +diff -u a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile +--- a/arch/arm/boot/dts/Makefile 2017-10-19 03:51:29.758061000 +0800 ++++ b/arch/arm/boot/dts/Makefile 2017-10-19 05:58:52.613043929 +0800 +@@ -751,6 +751,7 @@ + armada-385-linksys-cobra.dtb \ + armada-388-clearfog-base.dtb \ + armada-388-clearfog-pro.dtb \ ++ armada-388-helios4.dtb \ + armada-388-db.dtb \ + armada-388-gp.dtb \ + armada-388-rd.dtb + +-- +2.7.4 + diff --git a/patch/u-boot/u-boot-helios4/add-fdtfile-env.patch b/patch/u-boot/u-boot-helios4/add-fdtfile-env.patch new file mode 100644 index 000000000..d8e3d0cd3 --- /dev/null +++ b/patch/u-boot/u-boot-helios4/add-fdtfile-env.patch @@ -0,0 +1,15 @@ +diff --git a/board/mv_ebu/a38x/mv_main_a38x.c b/board/mv_ebu/a38x/mv_main_a38x.c +index 4b43a9c..cf77da9 100755 +--- a/board/mv_ebu/a38x/mv_main_a38x.c ++++ b/board/mv_ebu/a38x/mv_main_a38x.c +@@ -331,6 +331,10 @@ void misc_init_r_env(void) + if (!env) + setenv("console", "console=ttyS0,115200"); + ++ env = getenv("fdtfile"); ++ if (!env) ++ setenv("fdtfile", "armada-388-helios4.dtb"); ++ + env = getenv("mtdids"); + if (!env) { + #if defined(MV_NAND) && defined(MV_INCLUDE_SPI) diff --git a/patch/u-boot/u-boot-helios4/add-mmc-target.patch b/patch/u-boot/u-boot-helios4/add-mmc-target.patch new file mode 100644 index 000000000..e2997955b --- /dev/null +++ b/patch/u-boot/u-boot-helios4/add-mmc-target.patch @@ -0,0 +1,53 @@ +diff --git a/Makefile b/Makefile +index 07debc4..3d91d1d 100755 +--- a/Makefile ++++ b/Makefile +@@ -477,6 +477,9 @@ ifndef CONFIG_SYS_UBOOT_START + CONFIG_SYS_UBOOT_START := 0 + endif + ++$(obj)u-boot.mmc: $(obj)u-boot.bin ++ echo y | $(obj)tools/marvell/doimage -T mmc -D 0x0 -E 0x0 -G $(obj)tools/marvell/bin_hdr/bin_hdr.bin u-boot.bin u-boot.mmc ++ + $(obj)u-boot.img: $(obj)u-boot.bin + $(obj)tools/mkimage -A $(ARCH) -T firmware -C none \ + -O u-boot -a $(CONFIG_SYS_TEXT_BASE) \ +diff --git a/boards.cfg b/boards.cfg +index 7e8d713..4d9f810 100644 +--- a/boards.cfg ++++ b/boards.cfg +@@ -55,7 +55,7 @@ armada_38x arm armv7 a38x mv_ebu + armada_38x_customer0 arm armv7 a38x mv_ebu mvca9 armada_38x:CUSTOMER_BOARD_0,ARMADA_38X + armada_38x_customer1 arm armv7 a38x mv_ebu mvca9 armada_38x:CUSTOMER_BOARD_1,ARMADA_38X + armada_38x_clearfog arm armv7 a38x mv_ebu mvca9 armada_38x:CLEARFOG_BOARD,ARMADA_38X +-armada_38x_helios4 arm armv7 a38x mv_ebu mvca9 armada_38x:HELIOS4_BOARD,ARMADA_38X ++armada_38x_helios4 arm armv7 a38x mv_ebu mvca9 armada_38x:HELIOS4_BOARD,ARMADA_38X,MV_MMC_BOOT,MV_INCLUDE_SPI,DDR3 + armada_39x arm armv7 a38x mv_ebu mvca9 armada_38x:ARMADA_39X + armada_39x_customer0 arm armv7 a38x mv_ebu mvca9 armada_38x:CUSTOMER_BOARD_0,ARMADA_39X + armada_39x_customer1 arm armv7 a38x mv_ebu mvca9 armada_38x:CUSTOMER_BOARD_1,ARMADA_39X +diff --git a/include/configs/armada_38x.h b/include/configs/armada_38x.h +index 1ae5256..23d681d 100644 +--- a/include/configs/armada_38x.h ++++ b/include/configs/armada_38x.h +@@ -286,6 +286,10 @@ extern unsigned int mvUartPortGet(void); + + /* SPI Flash configuration */ + /*****************************/ ++#if defined(CONFIG_MV_INCLUDE_SPI) ++ #define MV_INCLUDE_SPI ++#endif ++ + #if defined(MV_INCLUDE_SPI) + #define CONFIG_CMD_SPI + #define CONFIG_CMD_SF +@@ -563,6 +567,10 @@ extern int nand_get_env_offs(void); + /*****************************/ + //#define CONFIG_MMC_TRACE + /* Boot from MMC settings */ ++#if defined(CONFIG_MV_MMC_BOOT) ++ #define MV_MMC_BOOT ++#endif ++ + #if defined(MV_MMC_BOOT) + /* the following commands are supported only with SPI/NAND interfaces */ + #if (!defined(MV_INCLUDE_SPI) && !defined(MV_NAND)) diff --git a/patch/u-boot/u-boot-helios4/binary-header-toolchain-auto-select.patch b/patch/u-boot/u-boot-helios4/binary-header-toolchain-auto-select.patch new file mode 100644 index 000000000..755bc762e --- /dev/null +++ b/patch/u-boot/u-boot-helios4/binary-header-toolchain-auto-select.patch @@ -0,0 +1,17 @@ +diff --git a/tools/marvell/bin_hdr/base.mk b/tools/marvell/bin_hdr/base.mk +index 6e0078a..ad3011a 100755 +--- a/tools/marvell/bin_hdr/base.mk ++++ b/tools/marvell/bin_hdr/base.mk +@@ -183,7 +183,11 @@ ifeq "$(CONFIG_ALLEYCAT3)" "y" + CFLAGS += -DCONFIG_ALLEYCAT3 + endif + +-CROSS = $(CROSS_COMPILE_BH) ++ifneq "$(CROSS_COMPILE_BH)" "" ++ CROSS = $(CROSS_COMPILE_BH) ++else ++ CROSS = $(CROSS_COMPILE) ++endif + LD = $(CROSS)ld + CC = $(CROSS)gcc + AS = $(CROSS)as diff --git a/patch/u-boot/u-boot-helios4/disable-jffs-support.patch b/patch/u-boot/u-boot-helios4/disable-jffs-support.patch new file mode 100644 index 000000000..f0760ce8f --- /dev/null +++ b/patch/u-boot/u-boot-helios4/disable-jffs-support.patch @@ -0,0 +1,12 @@ +diff --git a/include/configs/armada_38x.h b/include/configs/armada_38x.h +index 75b8bf5..63475cd 100644 +--- a/include/configs/armada_38x.h ++++ b/include/configs/armada_38x.h +@@ -203,7 +204,6 @@ extern unsigned int mvUartPortGet(void); + #define CONFIG_FS_EXT4 + #define CONFIG_CMD_EXT4_WRITE + #define CONFIG_EXT4_WRITE +-#define CONFIG_CMD_JFFS2 + #define CONFIG_CMD_FAT + #define CONFIG_FS_FAT + #define CONFIG_SUPPORT_VFAT diff --git a/patch/u-boot/u-boot-helios4/loading-boot-scr.patch b/patch/u-boot/u-boot-helios4/loading-boot-scr.patch new file mode 100644 index 000000000..8092975ef --- /dev/null +++ b/patch/u-boot/u-boot-helios4/loading-boot-scr.patch @@ -0,0 +1,79 @@ +diff --git a/board/mv_ebu/a38x/mv_main_a38x.c b/board/mv_ebu/a38x/mv_main_a38x.c +index 0dce7f6..6d69879 100755 +--- a/board/mv_ebu/a38x/mv_main_a38x.c ++++ b/board/mv_ebu/a38x/mv_main_a38x.c +@@ -679,25 +679,33 @@ void misc_init_r_env(void) + setenv("enaLPAE", "no"); + #endif + +- /* Flatten Device Tree environment setup */ +-#ifdef CONFIG_CUSTOMER_BOARD_SUPPORT +- #ifdef CONFIG_ARMADA_38X +- fdt_env_setup("armada-38x.dtb", MV_FALSE); /* static setup: Skip DT update for customer */ +- #else +- fdt_env_setup("armada-39x.dtb", MV_FALSE); +- #endif +-#else +- #ifdef CONFIG_ARMADA_38X +- fdt_env_setup("armada-38x-modular.dtb", MV_TRUE); /* dynamic setup: run DT update */ +- #else +- fdt_env_setup("armada-39x.dtb", MV_FALSE); /* static setup: Skip DT update */ +- #endif +-#endif ++ setenv("fdt_skip_update", "yes"); ++ setenv("boot_a_script", ++ "for prefix in /boot/ /; do \ ++ load ${boot_interface} 0:1 ${script_addr_r} ${prefix}boot.scr && \ ++ source ${script_addr_r}; \ ++ done"); ++ setenv("mmcboot", ++ "setenv boot_interface mmc; run boot_a_script;"); ++ setenv("sataboot", ++ "scsi init; setenv boot_interface scsi; run boot_a_script;"); ++ setenv("usbboot", ++ "setenv usbActive 1; setenv usbType 3; usb start; setenv boot_interface usb; run boot_a_script;"); + + #if (CONFIG_BOOTDELAY >= 0) + env = getenv("bootcmd"); + if (!env) +- setenv("bootcmd", "tftpboot 0x2000000 $image_name;tftpboot $fdtaddr $fdtfile;" ++ setenv("bootcmd", ++#if defined (MV_MMC_BOOT) ++ "echo Trying to boot from MMC; run mmcboot;" ++#elif defined (MV_SATA_BOOT) ++ "echo Trying to boot from SATA; run sataboot;" ++#elif defined (MV_NOR_BOOT) ++ "echo Please store the boot environment on the NOR SPI flash to override the default boot sequence;" ++#endif /* MV_NOR_BOOT */ ++ "echo Trying to boot from USB; run usbboot;" ++ "echo Default boot sequence failed - falling back to TFTP;" ++ "tftpboot 0x2000000 $image_name;tftpboot $fdtaddr $fdtfile;" + "setenv bootargs $console $nandEcc $mtdparts $bootargs_root nfsroot=$serverip:$rootpath " + "ip=$ipaddr:$serverip$bootargs_end $mvNetConfig video=dovefb:lcd0:$lcd0_params " + "clcd.lcd0_enable=$lcd0_enable clcd.lcd_panel=$lcd_panel; bootz 0x2000000 - $fdtaddr;"); +diff --git a/common/cmd_fs.c b/common/cmd_fs.c +index a681d03..9cc5013 100644 +--- a/common/cmd_fs.c ++++ b/common/cmd_fs.c +@@ -22,7 +22,7 @@ + + int do_load_wrapper(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) + { +- return do_load(cmdtp, flag, argc, argv, FS_TYPE_ANY, 0); ++ return do_load(cmdtp, flag, argc, argv, FS_TYPE_ANY, 16); + } + + U_BOOT_CMD( +diff --git a/include/configs/armada_38x.h b/include/configs/armada_38x.h +index 1ae5256..2086859 100644 +--- a/include/configs/armada_38x.h ++++ b/include/configs/armada_38x.h +@@ -164,7 +164,7 @@ extern unsigned int mvUartPortGet(void); + #define CONFIG_CMD_RCVR + #define CONFIG_CMD_BOOT_MENU + #define CONFIG_CMD_SYS_RESTORE +- ++#define CONFIG_CMD_FS_GENERIC + + /* Open this define for enabling Secure Boot Mode eFuses modification + #define CONFIG_CMD_EFUSE diff --git a/patch/u-boot/u-boot-helios4/make-build-more-silent.patch b/patch/u-boot/u-boot-helios4/make-build-more-silent.patch new file mode 100644 index 000000000..d8e91be65 --- /dev/null +++ b/patch/u-boot/u-boot-helios4/make-build-more-silent.patch @@ -0,0 +1,13 @@ +diff --git a/Makefile b/Makefile +index 9fd8afe..7591a9e 100755 +--- a/Makefile ++++ b/Makefile +@@ -64,6 +64,8 @@ else + XECHO = : + endif + ++MAKEFLAGS += --no-print-directory ++ + ######################################################################### + # + # U-boot build supports producing a object files to the separate external diff --git a/patch/u-boot/u-boot-helios4/tools-bin_hdr-compiler-fixes.patch b/patch/u-boot/u-boot-helios4/tools-bin_hdr-compiler-fixes.patch new file mode 100644 index 000000000..c5d1c0c81 --- /dev/null +++ b/patch/u-boot/u-boot-helios4/tools-bin_hdr-compiler-fixes.patch @@ -0,0 +1,31 @@ +diff --git a/tools/marvell/bin_hdr/base.mk b/tools/marvell/bin_hdr/base.mk +index 33ecf70..d1ee228 100755 +--- a/tools/marvell/bin_hdr/base.mk ++++ b/tools/marvell/bin_hdr/base.mk +@@ -208,7 +208,7 @@ CPUOPTS = -mthumb -mthumb-interwork -march=armv7 -mlittle-endian + BH_ROOT_DIR = $(TOPDIR)/tools/marvell/bin_hdr + INCLUDE = -I$(BH_ROOT_DIR)/src_ddr -I$(BH_ROOT_DIR)/src_phy/$(BOARD) -I$(BH_ROOT_DIR)/inc/common \ + -I$(BH_ROOT_DIR)/inc/ddr3_soc/$(INCNAME) -I$(BH_ROOT_DIR)/inc/ddr3_soc/$(BOARD) -I$(BH_ROOT_DIR)/platform/sysEnv/$(BOARD) -I$(TOPDIR)/include -I$(BH_ROOT_DIR)/src_init/$(BOARD) +-HOSTCFLAGS = -Wall $(INCLUDE) ++HOSTCFLAGS = -fno-stack-protector -Wall $(INCLUDE) + + ifeq ($(BIN_HDR_DEBUG),1) + DEBUG_FLAGS += -g -O0 +@@ -223,7 +223,7 @@ DEBUG_MODE_FLAG = no + endif + endif + +-CFLAGS += -Wall $(INCLUDE) $(DEBUG_FLAGS) $(CPUOPTS) -msoft-float -mabi=aapcs ++CFLAGS += -fno-stack-protector -Wall $(INCLUDE) $(DEBUG_FLAGS) $(CPUOPTS) -msoft-float -mabi=aapcs + + ifeq ($(BOARD),msys_bc2) + CFLAGS += -fPIE -fno-zero-initialized-in-bss -fno-unwind-tables +@@ -231,7 +231,7 @@ else + CFLAGS += -fdata-sections -ffunction-sections + endif + +-EXTRA_LD_FLAGS = -Wl,--gc-sections --entry=_start ++EXTRA_LD_FLAGS = -fno-stack-protector -Wl,--gc-sections --entry=_start + + ifeq ($(DDRTYPE),ddr4) + CFLAGS += -DCONFIG_DDR4