[U-Boot] [PATCH 1/5] sh: Use -m2a-nofpu only

Based on reading over the GCC manual, passing both -m2a and -m2a-nofpu are redundant, as -m2a-nofpu will provide functional code for both. As -m2a-nofpu functions with more toolchains and does what is expected, switch.
Cc: Nobuhiro Iwamatsu iwamatsu@nigauri.org Signed-off-by: Tom Rini trini@konsulko.com --- arch/sh/cpu/sh2/config.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/sh/cpu/sh2/config.mk b/arch/sh/cpu/sh2/config.mk index 12e202d539a0..a063e8361c98 100644 --- a/arch/sh/cpu/sh2/config.mk +++ b/arch/sh/cpu/sh2/config.mk @@ -8,7 +8,7 @@ ENDIANNESS += -EB
ifdef CONFIG_CPU_SH2A -PLATFORM_CPPFLAGS += -m2a -m2a-nofpu -mb +PLATFORM_CPPFLAGS += -m2a-nofpu -mb else # SH2 PLATFORM_CPPFLAGS += -m3e -mb endif

With the switch to newer toolchains from kernel.org we can now fetch an sh2 toolchain that will build for sh2/3/4, so switch to that.
Signed-off-by: Tom Rini trini@konsulko.com --- .travis.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/.travis.yml b/.travis.yml index 7b53b3dddc1b..a67d3c3dbab6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -38,7 +38,7 @@ install: - echo -e "aarch64 = /tmp/gcc-linaro-6.3.1-2017.02-x86_64_aarch64-linux-gnu" >> ~/.buildman - echo -e "arm = /tmp/gcc-linaro-6.3.1-2017.02-x86_64_arm-linux-gnueabihf" >> ~/.buildman - echo -e "arc = /tmp/arc_gnu_2016.09_prebuilt_uclibc_le_archs_linux_install" >> ~/.buildman - - echo -e "\n[toolchain-alias]\nsh = sh4\nopenrisc = or32" >> ~/.buildman + - echo -e "\n[toolchain-alias]\nsh = sh2\nopenrisc = or32" >> ~/.buildman - cat ~/.buildman - virtualenv /tmp/venv - . /tmp/venv/bin/activate @@ -63,7 +63,7 @@ before_script: - if [[ "${TOOLCHAIN}" == *microblaze* ]]; then ./tools/buildman/buildman --fetch-arch microblaze ; fi - if [[ "${TOOLCHAIN}" == *mips* ]]; then ./tools/buildman/buildman --fetch-arch mips ; fi - if [[ "${TOOLCHAIN}" == *or32* ]]; then ./tools/buildman/buildman --fetch-arch or32 ; fi - - if [[ "${TOOLCHAIN}" == *sh4* ]]; then ./tools/buildman/buildman --fetch-arch sh4 ; fi + - if [[ "${TOOLCHAIN}" == *sh* ]]; then ./tools/buildman/buildman --fetch-arch sh2 ; fi - if [[ "${TOOLCHAIN}" == *x86_64* ]]; then ./tools/buildman/buildman --fetch-arch x86_64; echo -e "\n[toolchain-prefix]\nx86 = ${HOME}/.buildman-toolchains/gcc-4.9.0-nolibc/x86_64-linux/bin/x86_64-linux-" >> ~/.buildman; @@ -268,8 +268,8 @@ matrix: - env: - BUILDMAN="rockchip" - env: - - BUILDMAN="sh4" - TOOLCHAIN="sh4" + - BUILDMAN="sh" + TOOLCHAIN="sh" - env: - JOB="Xilinx (ARM)" BUILDMAN="xilinx -x microblaze"

On 02/17/2018 11:30 PM, Tom Rini wrote:
With the switch to newer toolchains from kernel.org we can now fetch an sh2 toolchain that will build for sh2/3/4, so switch to that.
Signed-off-by: Tom Rini trini@konsulko.com
.travis.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/.travis.yml b/.travis.yml index 7b53b3dddc1b..a67d3c3dbab6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -38,7 +38,7 @@ install:
- echo -e "aarch64 = /tmp/gcc-linaro-6.3.1-2017.02-x86_64_aarch64-linux-gnu" >> ~/.buildman
- echo -e "arm = /tmp/gcc-linaro-6.3.1-2017.02-x86_64_arm-linux-gnueabihf" >> ~/.buildman
- echo -e "arc = /tmp/arc_gnu_2016.09_prebuilt_uclibc_le_archs_linux_install" >> ~/.buildman
- echo -e "\n[toolchain-alias]\nsh = sh4\nopenrisc = or32" >> ~/.buildman
- echo -e "\n[toolchain-alias]\nsh = sh2\nopenrisc = or32" >> ~/.buildman
- cat ~/.buildman
- virtualenv /tmp/venv
- . /tmp/venv/bin/activate
@@ -63,7 +63,7 @@ before_script:
- if [[ "${TOOLCHAIN}" == *microblaze* ]]; then ./tools/buildman/buildman --fetch-arch microblaze ; fi
- if [[ "${TOOLCHAIN}" == *mips* ]]; then ./tools/buildman/buildman --fetch-arch mips ; fi
- if [[ "${TOOLCHAIN}" == *or32* ]]; then ./tools/buildman/buildman --fetch-arch or32 ; fi
- if [[ "${TOOLCHAIN}" == *sh4* ]]; then ./tools/buildman/buildman --fetch-arch sh4 ; fi
- if [[ "${TOOLCHAIN}" == *sh* ]]; then ./tools/buildman/buildman --fetch-arch sh2 ; fi
- if [[ "${TOOLCHAIN}" == *x86_64* ]]; then ./tools/buildman/buildman --fetch-arch x86_64; echo -e "\n[toolchain-prefix]\nx86 = ${HOME}/.buildman-toolchains/gcc-4.9.0-nolibc/x86_64-linux/bin/x86_64-linux-" >> ~/.buildman;
@@ -268,8 +268,8 @@ matrix: - env: - BUILDMAN="rockchip" - env:
- BUILDMAN="sh4"
TOOLCHAIN="sh4"
- BUILDMAN="sh"
TOOLCHAIN="sh"
- env:
- JOB="Xilinx (ARM)" BUILDMAN="xilinx -x microblaze"
Applied, thanks

On Mon, Feb 19, 2018 at 05:43:18AM +0100, Marek Vasut wrote:
On 02/17/2018 11:30 PM, Tom Rini wrote:
With the switch to newer toolchains from kernel.org we can now fetch an sh2 toolchain that will build for sh2/3/4, so switch to that.
Signed-off-by: Tom Rini trini@konsulko.com
.travis.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/.travis.yml b/.travis.yml index 7b53b3dddc1b..a67d3c3dbab6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -38,7 +38,7 @@ install:
- echo -e "aarch64 = /tmp/gcc-linaro-6.3.1-2017.02-x86_64_aarch64-linux-gnu" >> ~/.buildman
- echo -e "arm = /tmp/gcc-linaro-6.3.1-2017.02-x86_64_arm-linux-gnueabihf" >> ~/.buildman
- echo -e "arc = /tmp/arc_gnu_2016.09_prebuilt_uclibc_le_archs_linux_install" >> ~/.buildman
- echo -e "\n[toolchain-alias]\nsh = sh4\nopenrisc = or32" >> ~/.buildman
- echo -e "\n[toolchain-alias]\nsh = sh2\nopenrisc = or32" >> ~/.buildman
- cat ~/.buildman
- virtualenv /tmp/venv
- . /tmp/venv/bin/activate
@@ -63,7 +63,7 @@ before_script:
- if [[ "${TOOLCHAIN}" == *microblaze* ]]; then ./tools/buildman/buildman --fetch-arch microblaze ; fi
- if [[ "${TOOLCHAIN}" == *mips* ]]; then ./tools/buildman/buildman --fetch-arch mips ; fi
- if [[ "${TOOLCHAIN}" == *or32* ]]; then ./tools/buildman/buildman --fetch-arch or32 ; fi
- if [[ "${TOOLCHAIN}" == *sh4* ]]; then ./tools/buildman/buildman --fetch-arch sh4 ; fi
- if [[ "${TOOLCHAIN}" == *sh* ]]; then ./tools/buildman/buildman --fetch-arch sh2 ; fi
- if [[ "${TOOLCHAIN}" == *x86_64* ]]; then ./tools/buildman/buildman --fetch-arch x86_64; echo -e "\n[toolchain-prefix]\nx86 = ${HOME}/.buildman-toolchains/gcc-4.9.0-nolibc/x86_64-linux/bin/x86_64-linux-" >> ~/.buildman;
@@ -268,8 +268,8 @@ matrix: - env: - BUILDMAN="rockchip" - env:
- BUILDMAN="sh4"
TOOLCHAIN="sh4"
- BUILDMAN="sh"
TOOLCHAIN="sh"
- env:
- JOB="Xilinx (ARM)" BUILDMAN="xilinx -x microblaze"
Applied, thanks
Sorry, I should have put some comments below the commit on this one. It depends on Daniel's patches that fix some other issues so that we can use the newer toolchains first.

With a newer toolchain we can see that in both sh_eth_phy_config_legacy and sh_eth_recv_common the variable port is never referenced as eth->port is always used instead.
Cc: Joe Hershberger joe.hershberger@ni.com Signed-off-by: Tom Rini trini@konsulko.com --- drivers/net/sh_eth.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/sh_eth.c b/drivers/net/sh_eth.c index 850fe1587f59..6f48e93ab53d 100644 --- a/drivers/net/sh_eth.c +++ b/drivers/net/sh_eth.c @@ -517,7 +517,7 @@ static int sh_eth_start_common(struct sh_eth_dev *eth) #ifndef CONFIG_DM_ETH static int sh_eth_phy_config_legacy(struct sh_eth_dev *eth) { - int port = eth->port, ret = 0; + int ret = 0; struct sh_eth_info *port_info = ð->port_info[eth->port]; struct eth_device *dev = port_info->dev; struct phy_device *phydev; @@ -540,7 +540,7 @@ static int sh_eth_send_legacy(struct eth_device *dev, void *packet, int len)
static int sh_eth_recv_common(struct sh_eth_dev *eth) { - int port = eth->port, len = 0; + int len = 0; struct sh_eth_info *port_info = ð->port_info[eth->port]; uchar *packet = (uchar *)ADDR_TO_P2(port_info->rx_desc_cur->rd2);

On 02/17/2018 11:30 PM, Tom Rini wrote:
With a newer toolchain we can see that in both sh_eth_phy_config_legacy and sh_eth_recv_common the variable port is never referenced as eth->port is always used instead.
Cc: Joe Hershberger joe.hershberger@ni.com Signed-off-by: Tom Rini trini@konsulko.com
drivers/net/sh_eth.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/sh_eth.c b/drivers/net/sh_eth.c index 850fe1587f59..6f48e93ab53d 100644 --- a/drivers/net/sh_eth.c +++ b/drivers/net/sh_eth.c @@ -517,7 +517,7 @@ static int sh_eth_start_common(struct sh_eth_dev *eth) #ifndef CONFIG_DM_ETH static int sh_eth_phy_config_legacy(struct sh_eth_dev *eth) {
- int port = eth->port, ret = 0;
- int ret = 0; struct sh_eth_info *port_info = ð->port_info[eth->port]; struct eth_device *dev = port_info->dev; struct phy_device *phydev;
@@ -540,7 +540,7 @@ static int sh_eth_send_legacy(struct eth_device *dev, void *packet, int len)
static int sh_eth_recv_common(struct sh_eth_dev *eth) {
- int port = eth->port, len = 0;
- int len = 0; struct sh_eth_info *port_info = ð->port_info[eth->port]; uchar *packet = (uchar *)ADDR_TO_P2(port_info->rx_desc_cur->rd2);
This should be fixed in the PR I sent too.

On Sun, Feb 18, 2018 at 10:42 PM, Marek Vasut marek.vasut@gmail.com wrote:
On 02/17/2018 11:30 PM, Tom Rini wrote:
With a newer toolchain we can see that in both sh_eth_phy_config_legacy and sh_eth_recv_common the variable port is never referenced as eth->port is always used instead.
Cc: Joe Hershberger joe.hershberger@ni.com Signed-off-by: Tom Rini trini@konsulko.com
drivers/net/sh_eth.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/sh_eth.c b/drivers/net/sh_eth.c index 850fe1587f59..6f48e93ab53d 100644 --- a/drivers/net/sh_eth.c +++ b/drivers/net/sh_eth.c @@ -517,7 +517,7 @@ static int sh_eth_start_common(struct sh_eth_dev *eth) #ifndef CONFIG_DM_ETH static int sh_eth_phy_config_legacy(struct sh_eth_dev *eth) {
int port = eth->port, ret = 0;
int ret = 0; struct sh_eth_info *port_info = ð->port_info[eth->port]; struct eth_device *dev = port_info->dev; struct phy_device *phydev;
@@ -540,7 +540,7 @@ static int sh_eth_send_legacy(struct eth_device *dev, void *packet, int len)
static int sh_eth_recv_common(struct sh_eth_dev *eth) {
int port = eth->port, len = 0;
int len = 0; struct sh_eth_info *port_info = ð->port_info[eth->port]; uchar *packet = (uchar *)ADDR_TO_P2(port_info->rx_desc_cur->rd2);
This should be fixed in the PR I sent too.
PR or the series?
If you meant the series, then we should probably go with that instead of Tom's patch so that the series doesn't need to respin.
-Joe

On 02/19/2018 07:13 PM, Joe Hershberger wrote:
On Sun, Feb 18, 2018 at 10:42 PM, Marek Vasut marek.vasut@gmail.com wrote:
On 02/17/2018 11:30 PM, Tom Rini wrote:
With a newer toolchain we can see that in both sh_eth_phy_config_legacy and sh_eth_recv_common the variable port is never referenced as eth->port is always used instead.
Cc: Joe Hershberger joe.hershberger@ni.com Signed-off-by: Tom Rini trini@konsulko.com
drivers/net/sh_eth.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/sh_eth.c b/drivers/net/sh_eth.c index 850fe1587f59..6f48e93ab53d 100644 --- a/drivers/net/sh_eth.c +++ b/drivers/net/sh_eth.c @@ -517,7 +517,7 @@ static int sh_eth_start_common(struct sh_eth_dev *eth) #ifndef CONFIG_DM_ETH static int sh_eth_phy_config_legacy(struct sh_eth_dev *eth) {
int port = eth->port, ret = 0;
int ret = 0; struct sh_eth_info *port_info = ð->port_info[eth->port]; struct eth_device *dev = port_info->dev; struct phy_device *phydev;
@@ -540,7 +540,7 @@ static int sh_eth_send_legacy(struct eth_device *dev, void *packet, int len)
static int sh_eth_recv_common(struct sh_eth_dev *eth) {
int port = eth->port, len = 0;
int len = 0; struct sh_eth_info *port_info = ð->port_info[eth->port]; uchar *packet = (uchar *)ADDR_TO_P2(port_info->rx_desc_cur->rd2);
This should be fixed in the PR I sent too.
PR or the series?
PR, I wrapped this patch into mine.

With modern GCC, we get warnings such as: cmd/jffs2.c: In function 'mtdparts_init': arch/sh/include/asm/string.h:110:38: warning: array subscript is above array bounds [-Warray-bounds] : "0" (__cs), "1" (__ct), "r" (__cs+__n) ~~~~^~~~
This results in a small size reduction as well.
Cc: Nobuhiro Iwamatsu iwamatsu@nigauri.org Signed-off-by: Tom Rini trini@konsulko.com --- arch/sh/include/asm/string.h | 33 ++------------------------------- 1 file changed, 2 insertions(+), 31 deletions(-)
diff --git a/arch/sh/include/asm/string.h b/arch/sh/include/asm/string.h index 27d981b79af8..999febcb6b7d 100644 --- a/arch/sh/include/asm/string.h +++ b/arch/sh/include/asm/string.h @@ -81,37 +81,8 @@ static inline int strcmp(const char *__cs, const char *__ct) return __res; }
-#define __HAVE_ARCH_STRNCMP -static inline int strncmp(const char *__cs, const char *__ct, size_t __n) -{ - register int __res; - unsigned long __dummy; - - if (__n == 0) - return 0; - - __asm__ __volatile__( - "mov.b @%1+, %3\n" - "1:\n\t" - "mov.b @%0+, %2\n\t" - "cmp/eq %6, %0\n\t" - "bt/s 2f\n\t" - " cmp/eq #0, %3\n\t" - "bt/s 3f\n\t" - " cmp/eq %3, %2\n\t" - "bt/s 1b\n\t" - " mov.b @%1+, %3\n\t" - "add #-2, %1\n\t" - "mov.b @%1, %3\n" - "2:\n\t" - "sub %3, %2\n" - "3:" - :"=r" (__cs), "=r" (__ct), "=&r" (__res), "=&z" (__dummy) - : "0" (__cs), "1" (__ct), "r" (__cs+__n) - : "t"); - - return __res; -} +#undef __HAVE_ARCH_STRNCMP +extern int strncmp(const char *__cs, const char *__ct, size_t __n);
#undef __HAVE_ARCH_MEMSET extern void *memset(void *__s, int __c, size_t __count);

On 02/17/2018 11:30 PM, Tom Rini wrote:
With modern GCC, we get warnings such as: cmd/jffs2.c: In function 'mtdparts_init': arch/sh/include/asm/string.h:110:38: warning: array subscript is above array bounds [-Warray-bounds] : "0" (__cs), "1" (__ct), "r" (__cs+__n) ~~~~^~~~
This results in a small size reduction as well.
Cc: Nobuhiro Iwamatsu iwamatsu@nigauri.org Signed-off-by: Tom Rini trini@konsulko.com
arch/sh/include/asm/string.h | 33 ++------------------------------- 1 file changed, 2 insertions(+), 31 deletions(-)
diff --git a/arch/sh/include/asm/string.h b/arch/sh/include/asm/string.h index 27d981b79af8..999febcb6b7d 100644 --- a/arch/sh/include/asm/string.h +++ b/arch/sh/include/asm/string.h @@ -81,37 +81,8 @@ static inline int strcmp(const char *__cs, const char *__ct) return __res; }
-#define __HAVE_ARCH_STRNCMP -static inline int strncmp(const char *__cs, const char *__ct, size_t __n) -{
- register int __res;
- unsigned long __dummy;
- if (__n == 0)
return 0;
- __asm__ __volatile__(
"mov.b @%1+, %3\n"
"1:\n\t"
"mov.b @%0+, %2\n\t"
"cmp/eq %6, %0\n\t"
"bt/s 2f\n\t"
" cmp/eq #0, %3\n\t"
"bt/s 3f\n\t"
" cmp/eq %3, %2\n\t"
"bt/s 1b\n\t"
" mov.b @%1+, %3\n\t"
"add #-2, %1\n\t"
"mov.b @%1, %3\n"
"2:\n\t"
"sub %3, %2\n"
"3:"
:"=r" (__cs), "=r" (__ct), "=&r" (__res), "=&z" (__dummy)
: "0" (__cs), "1" (__ct), "r" (__cs+__n)
: "t");
- return __res;
-} +#undef __HAVE_ARCH_STRNCMP +extern int strncmp(const char *__cs, const char *__ct, size_t __n);
#undef __HAVE_ARCH_MEMSET extern void *memset(void *__s, int __c, size_t __count);
Applied, thanks

Based on v4.15, add MTDIDS / MTDPARTS that match the in-kernel defaults.
Cc: Nobuhiro Iwamatsu iwamatsu.nobuhiro@renesas.com Signed-off-by: Tom Rini trini@konsulko.com --- configs/sh7763rdp_defconfig | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/configs/sh7763rdp_defconfig b/configs/sh7763rdp_defconfig index 9683c7a6cabf..ff8011793016 100644 --- a/configs/sh7763rdp_defconfig +++ b/configs/sh7763rdp_defconfig @@ -24,6 +24,8 @@ CONFIG_CMD_MII=y CONFIG_CMD_PING=y # CONFIG_CMD_MISC is not set CONFIG_CMD_JFFS2=y +CONFIG_MTDIDS_DEFAULT="nor0=physmap-flash.0" +CONFIG_MTDPARTS_DEFAULT="mtdparts=physmap-flash.0:256k(U-Boot),2560k(Linux-Kernel),-(Root Filesystem)" CONFIG_ENV_IS_IN_FLASH=y CONFIG_MTD_NOR_FLASH=y CONFIG_NETDEVICES=y

On 02/17/2018 11:30 PM, Tom Rini wrote:
Based on reading over the GCC manual, passing both -m2a and -m2a-nofpu are redundant, as -m2a-nofpu will provide functional code for both. As -m2a-nofpu functions with more toolchains and does what is expected, switch.
Cc: Nobuhiro Iwamatsu iwamatsu@nigauri.org Signed-off-by: Tom Rini trini@konsulko.com
arch/sh/cpu/sh2/config.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/sh/cpu/sh2/config.mk b/arch/sh/cpu/sh2/config.mk index 12e202d539a0..a063e8361c98 100644 --- a/arch/sh/cpu/sh2/config.mk +++ b/arch/sh/cpu/sh2/config.mk @@ -8,7 +8,7 @@ ENDIANNESS += -EB
ifdef CONFIG_CPU_SH2A -PLATFORM_CPPFLAGS += -m2a -m2a-nofpu -mb +PLATFORM_CPPFLAGS += -m2a-nofpu -mb else # SH2 PLATFORM_CPPFLAGS += -m3e -mb endif
Applied, thanks.
participants (3)
-
Joe Hershberger
-
Marek Vasut
-
Tom Rini