All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 0/4] Malta MIPS64 support
@ 2016-05-17 10:56 Paul Burton
  2016-05-17 10:56 ` [U-Boot] [PATCH 1/4] MIPS: Move CONFIG_SYS_TEXT_BASE to Kconfig Paul Burton
                   ` (4 more replies)
  0 siblings, 5 replies; 13+ messages in thread
From: Paul Burton @ 2016-05-17 10:56 UTC (permalink / raw)
  To: u-boot

This series allows MIPS64 builds for Malta boards, which can be used
either on real Malta boards with a MIPS64 CPU or in QEMU. It prepares by
moving CONFIG_SYS_TEXT_BASE to Kconfig and fixing some 64 bit build
issues that affect the ethernet driver, then allows the builds for the
Malta board.

This series applies atop u-boot-mips/next with my "Malta UART using
device model & device tree" series applied.

Paul Burton (4):
  MIPS: Move CONFIG_SYS_TEXT_BASE to Kconfig
  MIPS: Fix _ACAST32_ for pointers on MIPS64
  net: pcnet: Make 64 bit safe
  malta: Allow MIPS64 builds

 Kconfig                            |  2 +-
 arch/mips/Kconfig                  |  3 +++
 arch/mips/include/asm/addrspace.h  |  4 ++--
 board/dbau1x00/Kconfig             |  3 +++
 board/imgtec/malta/Kconfig         |  4 ++++
 board/imgtec/malta/lowlevel_init.S | 13 +++++++------
 board/microchip/pic32mzda/Kconfig  |  3 +++
 board/micronas/vct/Kconfig         |  3 +++
 board/pb1x00/Kconfig               |  3 +++
 board/qca/ap121/Kconfig            |  3 +++
 board/qca/ap143/Kconfig            |  3 +++
 board/qemu-mips/Kconfig            |  4 ++++
 board/tplink/wdr4300/Kconfig       |  3 +++
 drivers/net/pcnet.c                | 18 ++++++++++--------
 include/configs/ap121.h            |  2 --
 include/configs/ap143.h            |  2 --
 include/configs/dbau1x00.h         |  6 ------
 include/configs/malta.h            | 19 +++++++++++++------
 include/configs/pb1x00.h           |  6 ------
 include/configs/pic32mzdask.h      |  1 -
 include/configs/qemu-mips.h        |  1 -
 include/configs/qemu-mips64.h      |  1 -
 include/configs/tplink_wdr4300.h   |  2 --
 include/configs/vct.h              |  1 -
 24 files changed, 65 insertions(+), 45 deletions(-)

-- 
2.8.2

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [U-Boot] [PATCH 1/4] MIPS: Move CONFIG_SYS_TEXT_BASE to Kconfig
  2016-05-17 10:56 [U-Boot] [PATCH 0/4] Malta MIPS64 support Paul Burton
@ 2016-05-17 10:56 ` Paul Burton
  2016-05-25 23:01   ` Daniel Schwierzeck
  2016-05-17 10:56 ` [U-Boot] [PATCH 2/4] MIPS: Fix _ACAST32_ for pointers on MIPS64 Paul Burton
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 13+ messages in thread
From: Paul Burton @ 2016-05-17 10:56 UTC (permalink / raw)
  To: u-boot

Move CONFIG_SYS_TEXT_BASE to Kconfig, and add default values in board
Kconfig files matching what was present in their config headers. This
will make it cleaner to conditionalise the value for Malta based on 32
vs 64 bit builds.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
---

 Kconfig                           | 2 +-
 board/dbau1x00/Kconfig            | 3 +++
 board/imgtec/malta/Kconfig        | 3 +++
 board/microchip/pic32mzda/Kconfig | 3 +++
 board/micronas/vct/Kconfig        | 3 +++
 board/pb1x00/Kconfig              | 3 +++
 board/qca/ap121/Kconfig           | 3 +++
 board/qca/ap143/Kconfig           | 3 +++
 board/qemu-mips/Kconfig           | 4 ++++
 board/tplink/wdr4300/Kconfig      | 3 +++
 include/configs/ap121.h           | 2 --
 include/configs/ap143.h           | 2 --
 include/configs/dbau1x00.h        | 6 ------
 include/configs/malta.h           | 1 -
 include/configs/pb1x00.h          | 6 ------
 include/configs/pic32mzdask.h     | 1 -
 include/configs/qemu-mips.h       | 1 -
 include/configs/qemu-mips64.h     | 1 -
 include/configs/tplink_wdr4300.h  | 2 --
 include/configs/vct.h             | 1 -
 20 files changed, 29 insertions(+), 24 deletions(-)

diff --git a/Kconfig b/Kconfig
index f53759a..4b46216 100644
--- a/Kconfig
+++ b/Kconfig
@@ -268,7 +268,7 @@ config SYS_EXTRA_OPTIONS
 
 config SYS_TEXT_BASE
 	depends on SPARC || ARC || X86 || ARCH_UNIPHIER || ARCH_ZYNQMP || \
-		(M68K && !TARGET_ASTRO_MCF5373L) || MICROBLAZE
+		(M68K && !TARGET_ASTRO_MCF5373L) || MICROBLAZE || MIPS
 	depends on !EFI_APP
 	hex "Text Base"
 	help
diff --git a/board/dbau1x00/Kconfig b/board/dbau1x00/Kconfig
index b813adb..342ec59 100644
--- a/board/dbau1x00/Kconfig
+++ b/board/dbau1x00/Kconfig
@@ -9,6 +9,9 @@ config SYS_SOC
 config SYS_CONFIG_NAME
 	default "dbau1x00"
 
+config SYS_TEXT_BASE
+	default 0xbfc00000
+
 menu "dbau1x00 board options"
 
 choice
diff --git a/board/imgtec/malta/Kconfig b/board/imgtec/malta/Kconfig
index 4c06d0c..2bb8e8b 100644
--- a/board/imgtec/malta/Kconfig
+++ b/board/imgtec/malta/Kconfig
@@ -9,4 +9,7 @@ config SYS_VENDOR
 config SYS_CONFIG_NAME
 	default "malta"
 
+config SYS_TEXT_BASE
+	default 0xbe000000
+
 endif
diff --git a/board/microchip/pic32mzda/Kconfig b/board/microchip/pic32mzda/Kconfig
index 8acb393..4f08e98 100644
--- a/board/microchip/pic32mzda/Kconfig
+++ b/board/microchip/pic32mzda/Kconfig
@@ -10,4 +10,7 @@ config SYS_VENDOR
 config SYS_CONFIG_NAME
 	default "pic32mzdask"
 
+config SYS_TEXT_BASE
+	default 0x9d004000
+
 endif
diff --git a/board/micronas/vct/Kconfig b/board/micronas/vct/Kconfig
index c518079..535a77b 100644
--- a/board/micronas/vct/Kconfig
+++ b/board/micronas/vct/Kconfig
@@ -9,6 +9,9 @@ config SYS_VENDOR
 config SYS_CONFIG_NAME
 	default "vct"
 
+config SYS_TEXT_BASE
+	default 0x87000000
+
 menu "vct board options"
 
 choice
diff --git a/board/pb1x00/Kconfig b/board/pb1x00/Kconfig
index 251db6a..236a410 100644
--- a/board/pb1x00/Kconfig
+++ b/board/pb1x00/Kconfig
@@ -9,4 +9,7 @@ config SYS_SOC
 config SYS_CONFIG_NAME
 	default "pb1x00"
 
+config SYS_TEXT_BASE
+	default 0x83800000
+
 endif
diff --git a/board/qca/ap121/Kconfig b/board/qca/ap121/Kconfig
index f7e768a..c3ecc8f 100644
--- a/board/qca/ap121/Kconfig
+++ b/board/qca/ap121/Kconfig
@@ -9,4 +9,7 @@ config SYS_BOARD
 config SYS_CONFIG_NAME
 	default "ap121"
 
+config SYS_TEXT_BASE
+	default 0x9f000000
+
 endif
diff --git a/board/qca/ap143/Kconfig b/board/qca/ap143/Kconfig
index 4cdac0d..5ea5d6f 100644
--- a/board/qca/ap143/Kconfig
+++ b/board/qca/ap143/Kconfig
@@ -9,4 +9,7 @@ config SYS_BOARD
 config SYS_CONFIG_NAME
 	default "ap143"
 
+config SYS_TEXT_BASE
+	default 0x9f000000
+
 endif
diff --git a/board/qemu-mips/Kconfig b/board/qemu-mips/Kconfig
index 18d78b5..3de1f44 100644
--- a/board/qemu-mips/Kconfig
+++ b/board/qemu-mips/Kconfig
@@ -7,4 +7,8 @@ config SYS_CONFIG_NAME
 	default "qemu-mips" if 32BIT
 	default "qemu-mips64" if 64BIT
 
+config SYS_TEXT_BASE
+	default 0xbfc00000 if 32BIT
+	default 0xffffffffbfc00000 if 64BIT
+
 endif
diff --git a/board/tplink/wdr4300/Kconfig b/board/tplink/wdr4300/Kconfig
index 902abf5..65785bd 100644
--- a/board/tplink/wdr4300/Kconfig
+++ b/board/tplink/wdr4300/Kconfig
@@ -12,4 +12,7 @@ config SYS_BOARD
 config SYS_CONFIG_NAME
 	default "tplink_wdr4300"
 
+config SYS_TEXT_BASE
+	default 0xa1000000
+
 endif
diff --git a/include/configs/ap121.h b/include/configs/ap121.h
index 2beffa4..6f69f31 100644
--- a/include/configs/ap121.h
+++ b/include/configs/ap121.h
@@ -7,8 +7,6 @@
 #ifndef __CONFIG_H
 #define __CONFIG_H
 
-#define CONFIG_SYS_TEXT_BASE            0x9f000000
-
 #define CONFIG_DISPLAY_CPUINFO
 #define CONFIG_DISPLAY_BOARDINFO
 #define CONFIG_BOARD_EARLY_INIT_F
diff --git a/include/configs/ap143.h b/include/configs/ap143.h
index 7b69e10..f907c02 100644
--- a/include/configs/ap143.h
+++ b/include/configs/ap143.h
@@ -7,8 +7,6 @@
 #ifndef __CONFIG_H
 #define __CONFIG_H
 
-#define CONFIG_SYS_TEXT_BASE            0x9f000000
-
 #define CONFIG_DISPLAY_CPUINFO
 #define CONFIG_DISPLAY_BOARDINFO
 #define CONFIG_BOARD_EARLY_INIT_F
diff --git a/include/configs/dbau1x00.h b/include/configs/dbau1x00.h
index eb0a87c..68d9e36 100644
--- a/include/configs/dbau1x00.h
+++ b/include/configs/dbau1x00.h
@@ -139,12 +139,6 @@
 #define CONFIG_SYS_FLASH_CFI           1
 #define CONFIG_FLASH_CFI_DRIVER    1
 
-/* The following #defines are needed to get flash environment right */
-/* ROM version */
-#define CONFIG_SYS_TEXT_BASE		0xbfc00000
-/* RAM version */
-/* #define CONFIG_SYS_TEXT_BASE		0x80100000 */
-
 #define	CONFIG_SYS_MONITOR_BASE	CONFIG_SYS_TEXT_BASE
 #define	CONFIG_SYS_MONITOR_LEN		(192 << 10)
 
diff --git a/include/configs/malta.h b/include/configs/malta.h
index e03935b..a369678 100644
--- a/include/configs/malta.h
+++ b/include/configs/malta.h
@@ -37,7 +37,6 @@
 /*
  * Memory map
  */
-#define CONFIG_SYS_TEXT_BASE		0xbe000000 /* Rom version */
 #define CONFIG_SYS_MONITOR_BASE		CONFIG_SYS_TEXT_BASE
 
 #define CONFIG_SYS_SDRAM_BASE		0x80000000 /* Cached addr */
diff --git a/include/configs/pb1x00.h b/include/configs/pb1x00.h
index caf75a6..869768a 100644
--- a/include/configs/pb1x00.h
+++ b/include/configs/pb1x00.h
@@ -80,12 +80,6 @@
 #define PHYS_FLASH_1		0xbec00000 /* Flash Bank #1 */
 #define PHYS_FLASH_2		0xbfc00000 /* Flash Bank #2 */
 
-/* The following #defines are needed to get flash environment right */
-/* ROM version */
-/* #define CONFIG_SYS_TEXT_BASE		0xbfc00000 */
-/* SDRAM version */
-#define CONFIG_SYS_TEXT_BASE		0x83800000
-
 #define	CONFIG_SYS_MONITOR_BASE	CONFIG_SYS_TEXT_BASE
 #define	CONFIG_SYS_MONITOR_LEN		(192 << 10)
 
diff --git a/include/configs/pic32mzdask.h b/include/configs/pic32mzdask.h
index 108c6a2..fb2e41f 100644
--- a/include/configs/pic32mzdask.h
+++ b/include/configs/pic32mzdask.h
@@ -10,7 +10,6 @@
 #define __PIC32MZDASK_CONFIG_H
 
 /* System Configuration */
-#define CONFIG_SYS_TEXT_BASE		0x9d004000 /* .text */
 #define CONFIG_DISPLAY_BOARDINFO
 
 /*--------------------------------------------
diff --git a/include/configs/qemu-mips.h b/include/configs/qemu-mips.h
index 702967c..246ee01 100644
--- a/include/configs/qemu-mips.h
+++ b/include/configs/qemu-mips.h
@@ -107,7 +107,6 @@
  * FLASH and environment organization
  */
 /* The following #defines are needed to get flash environment right */
-#define CONFIG_SYS_TEXT_BASE		0xbfc00000 /* Rom version */
 #define CONFIG_SYS_MONITOR_BASE	CONFIG_SYS_TEXT_BASE
 #define CONFIG_SYS_MONITOR_LEN		(192 << 10)
 
diff --git a/include/configs/qemu-mips64.h b/include/configs/qemu-mips64.h
index 2394549..60a3a71 100644
--- a/include/configs/qemu-mips64.h
+++ b/include/configs/qemu-mips64.h
@@ -107,7 +107,6 @@
  * FLASH and environment organization
  */
 /* The following #defines are needed to get flash environment right */
-#define CONFIG_SYS_TEXT_BASE		0xffffffffbfc00000 /* Rom version */
 #define CONFIG_SYS_MONITOR_BASE	CONFIG_SYS_TEXT_BASE
 #define CONFIG_SYS_MONITOR_LEN		(192 << 10)
 
diff --git a/include/configs/tplink_wdr4300.h b/include/configs/tplink_wdr4300.h
index 2b9e92e..09a69fe 100644
--- a/include/configs/tplink_wdr4300.h
+++ b/include/configs/tplink_wdr4300.h
@@ -7,8 +7,6 @@
 #ifndef __CONFIG_H
 #define __CONFIG_H
 
-#define CONFIG_SYS_TEXT_BASE		0xa1000000
-
 #define CONFIG_DISPLAY_CPUINFO
 #define CONFIG_DISPLAY_BOARDINFO
 #define CONFIG_BOARD_EARLY_INIT_F
diff --git a/include/configs/vct.h b/include/configs/vct.h
index 6489e08..68eb089 100644
--- a/include/configs/vct.h
+++ b/include/configs/vct.h
@@ -32,7 +32,6 @@
 
 #define CONFIG_SKIP_LOWLEVEL_INIT	/* SDRAM is initialized by the bootstrap code */
 
-#define CONFIG_SYS_TEXT_BASE		0x87000000
 #define CONFIG_SYS_MONITOR_BASE		CONFIG_SYS_TEXT_BASE
 #define CONFIG_SYS_MONITOR_LEN		(256 << 10)
 #define CONFIG_SYS_MALLOC_LEN		(1 << 20)
-- 
2.8.2

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [U-Boot] [PATCH 2/4] MIPS: Fix _ACAST32_ for pointers on MIPS64
  2016-05-17 10:56 [U-Boot] [PATCH 0/4] Malta MIPS64 support Paul Burton
  2016-05-17 10:56 ` [U-Boot] [PATCH 1/4] MIPS: Move CONFIG_SYS_TEXT_BASE to Kconfig Paul Burton
@ 2016-05-17 10:56 ` Paul Burton
  2016-05-25 23:18   ` Daniel Schwierzeck
  2016-05-17 10:56 ` [U-Boot] [PATCH 3/4] net: pcnet: Make 64 bit safe Paul Burton
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 13+ messages in thread
From: Paul Burton @ 2016-05-17 10:56 UTC (permalink / raw)
  To: u-boot

When building for MIPS64 and providing a pointer to _ACAST32_,
optionally via CPHYSADDR or one of the CKSEGxADDR macros, the cast
directly to a 32 bit int leads to compilation warnings such as the
following:

  In file included from ./arch/mips/include/asm/io.h:17:0,
                   from drivers/net/pcnet.c:14:
  drivers/net/pcnet.c: In function ?pcnet_virt_to_mem?:
  ./arch/mips/include/asm/addrspace.h:39:29: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
   #define _ACAST32_  (_ATYPE_)(_ATYPE32_) /* widen if necessary */
                               ^
  ./arch/mips/include/asm/addrspace.h:51:25: note: in expansion of macro ?_ACAST32_?
   #define CPHYSADDR(a)  ((_ACAST32_(a)) & 0x1fffffff)
                           ^
  ./arch/mips/include/asm/addrspace.h:71:25: note: in expansion of macro ?CPHYSADDR?
   #define CKSEG0ADDR(a)  (CPHYSADDR(a) | CKSEG0)
                           ^
  drivers/net/pcnet.c:144:23: note: in expansion of macro ?CKSEG0ADDR?
     virt_addr = (void *)CKSEG0ADDR(addr);
                         ^

Fix this by first casting provided values to a pointer-width integer,
then truncating to a 32 bit int & widening back to pointer-width.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
---

 arch/mips/include/asm/addrspace.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/mips/include/asm/addrspace.h b/arch/mips/include/asm/addrspace.h
index 0994e96..fe497b5 100644
--- a/arch/mips/include/asm/addrspace.h
+++ b/arch/mips/include/asm/addrspace.h
@@ -36,8 +36,8 @@
 #define _ACAST32_
 #define _ACAST64_
 #else
-#define _ACAST32_		(_ATYPE_)(_ATYPE32_)	/* widen if necessary */
-#define _ACAST64_		(_ATYPE64_)		/* do _not_ narrow */
+#define _ACAST32_	(_ATYPE_)(_ATYPE32_)(_ATYPE_)	/* widen if necessary */
+#define _ACAST64_	(_ATYPE64_)		/* do _not_ narrow */
 #endif
 
 /*
-- 
2.8.2

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [U-Boot] [PATCH 3/4] net: pcnet: Make 64 bit safe
  2016-05-17 10:56 [U-Boot] [PATCH 0/4] Malta MIPS64 support Paul Burton
  2016-05-17 10:56 ` [U-Boot] [PATCH 1/4] MIPS: Move CONFIG_SYS_TEXT_BASE to Kconfig Paul Burton
  2016-05-17 10:56 ` [U-Boot] [PATCH 2/4] MIPS: Fix _ACAST32_ for pointers on MIPS64 Paul Burton
@ 2016-05-17 10:56 ` Paul Burton
  2016-05-24 15:25   ` Joe Hershberger
  2016-05-24 15:38   ` Joe Hershberger
  2016-05-17 10:56 ` [U-Boot] [PATCH 4/4] malta: Allow MIPS64 builds Paul Burton
  2016-05-17 11:30 ` [U-Boot] [PATCH 0/4] Malta MIPS64 support Daniel Schwierzeck
  4 siblings, 2 replies; 13+ messages in thread
From: Paul Burton @ 2016-05-17 10:56 UTC (permalink / raw)
  To: u-boot

Fix the pcnet driver to build safely on 64 bit platforms, in preparation
for allowing MIPS64 builds for Malta boards.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
---

 drivers/net/pcnet.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/drivers/net/pcnet.c b/drivers/net/pcnet.c
index 16a7512..7dff445 100644
--- a/drivers/net/pcnet.c
+++ b/drivers/net/pcnet.c
@@ -137,7 +137,7 @@ static int pcnet_probe (struct eth_device *dev, bd_t * bis, int dev_num);
 static inline pci_addr_t pcnet_virt_to_mem(const struct eth_device *dev,
 						void *addr, bool uncached)
 {
-	pci_dev_t devbusfn = (pci_dev_t)dev->priv;
+	pci_dev_t devbusfn = (pci_dev_t)(unsigned long)dev->priv;
 	void *virt_addr = addr;
 
 	if (uncached)
@@ -179,7 +179,7 @@ int pcnet_initialize(bd_t *bis)
 			break;
 		}
 		memset(dev, 0, sizeof(*dev));
-		dev->priv = (void *)devbusfn;
+		dev->priv = (void *)(unsigned long)devbusfn;
 		sprintf(dev->name, "pcnet#%d", dev_nr);
 
 		/*
@@ -190,8 +190,8 @@ int pcnet_initialize(bd_t *bis)
 		dev->iobase = pci_io_to_phys(devbusfn, dev->iobase);
 		dev->iobase &= ~0xf;
 
-		PCNET_DEBUG1("%s: devbusfn=0x%x iobase=0x%x: ",
-			     dev->name, devbusfn, dev->iobase);
+		PCNET_DEBUG1("%s: devbusfn=0x%x iobase=0x%lx: ",
+			     dev->name, devbusfn, (unsigned long)dev->iobase);
 
 		command = PCI_COMMAND_IO | PCI_COMMAND_MASTER;
 		pci_write_config_word(devbusfn, PCI_COMMAND, command);
@@ -298,7 +298,7 @@ static int pcnet_init(struct eth_device *dev, bd_t *bis)
 {
 	struct pcnet_uncached_priv *uc;
 	int i, val;
-	u32 addr;
+	unsigned long addr;
 
 	PCNET_DEBUG1("%s: pcnet_init...\n", dev->name);
 
@@ -336,16 +336,18 @@ static int pcnet_init(struct eth_device *dev, bd_t *bis)
 	 * must be aligned on 16-byte boundaries.
 	 */
 	if (lp == NULL) {
-		addr = (u32)malloc(sizeof(pcnet_priv_t) + 0x10);
+		addr = (unsigned long)malloc(sizeof(pcnet_priv_t) + 0x10);
 		addr = (addr + 0xf) & ~0xf;
 		lp = (pcnet_priv_t *)addr;
 
-		addr = (u32)memalign(ARCH_DMA_MINALIGN, sizeof(*lp->uc));
+		addr = (unsigned long)memalign(ARCH_DMA_MINALIGN,
+					       sizeof(*lp->uc));
 		flush_dcache_range(addr, addr + sizeof(*lp->uc));
 		addr = UNCACHED_SDRAM(addr);
 		lp->uc = (struct pcnet_uncached_priv *)addr;
 
-		addr = (u32)memalign(ARCH_DMA_MINALIGN, sizeof(*lp->rx_buf));
+		addr = (unsigned long)memalign(ARCH_DMA_MINALIGN,
+					       sizeof(*lp->rx_buf));
 		flush_dcache_range(addr, addr + sizeof(*lp->rx_buf));
 		lp->rx_buf = (void *)addr;
 	}
-- 
2.8.2

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [U-Boot] [PATCH 4/4] malta: Allow MIPS64 builds
  2016-05-17 10:56 [U-Boot] [PATCH 0/4] Malta MIPS64 support Paul Burton
                   ` (2 preceding siblings ...)
  2016-05-17 10:56 ` [U-Boot] [PATCH 3/4] net: pcnet: Make 64 bit safe Paul Burton
@ 2016-05-17 10:56 ` Paul Burton
  2016-05-17 11:30 ` [U-Boot] [PATCH 0/4] Malta MIPS64 support Daniel Schwierzeck
  4 siblings, 0 replies; 13+ messages in thread
From: Paul Burton @ 2016-05-17 10:56 UTC (permalink / raw)
  To: u-boot

Both real Malta boards & emulators that mimic Malta (eg. QEMU) can
support MIPS64 CPUs. Allow MIPS64 builds of U-Boot for such boards,
which enables the user to make use of the whole 64 bit address space.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
---

 arch/mips/Kconfig                  |  3 +++
 board/imgtec/malta/Kconfig         |  3 ++-
 board/imgtec/malta/lowlevel_init.S | 13 +++++++------
 include/configs/malta.h            | 18 +++++++++++++-----
 4 files changed, 25 insertions(+), 12 deletions(-)

diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 53363e3..abaeaf0 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -33,6 +33,9 @@ config TARGET_MALTA
 	select SUPPORTS_CPU_MIPS32_R1
 	select SUPPORTS_CPU_MIPS32_R2
 	select SUPPORTS_CPU_MIPS32_R6
+	select SUPPORTS_CPU_MIPS64_R1
+	select SUPPORTS_CPU_MIPS64_R2
+	select SUPPORTS_CPU_MIPS64_R6
 	select SWAP_IO_SPACE
 	select MIPS_L1_CACHE_SHIFT_6
 
diff --git a/board/imgtec/malta/Kconfig b/board/imgtec/malta/Kconfig
index 2bb8e8b..98eb4d1 100644
--- a/board/imgtec/malta/Kconfig
+++ b/board/imgtec/malta/Kconfig
@@ -10,6 +10,7 @@ config SYS_CONFIG_NAME
 	default "malta"
 
 config SYS_TEXT_BASE
-	default 0xbe000000
+	default 0xbe000000 if 32BIT
+	default 0xffffffffbe000000 if 64BIT
 
 endif
diff --git a/board/imgtec/malta/lowlevel_init.S b/board/imgtec/malta/lowlevel_init.S
index 534db1d..3d48cdc 100644
--- a/board/imgtec/malta/lowlevel_init.S
+++ b/board/imgtec/malta/lowlevel_init.S
@@ -10,6 +10,7 @@
 #include <pci.h>
 
 #include <asm/addrspace.h>
+#include <asm/asm.h>
 #include <asm/regdef.h>
 #include <asm/malta.h>
 #include <asm/mipsregs.h>
@@ -34,7 +35,7 @@ lowlevel_init:
 	mtc0	t0, CP0_CONFIG, 2
 
 	/* detect the core card */
-	li	t0, KSEG1ADDR(MALTA_REVISION)
+	PTR_LI	t0, CKSEG1ADDR(MALTA_REVISION)
 	lw	t0, 0(t0)
 	srl	t0, t0, MALTA_REVISION_CORID_SHF
 	andi	t0, t0, (MALTA_REVISION_CORID_MSK >> \
@@ -68,12 +69,12 @@ lowlevel_init:
 	 */
 _gt64120:
 	/* move GT64120 registers from 0x14000000 to 0x1be00000 */
-	li	t1, KSEG1ADDR(GT_DEF_BASE)
+	PTR_LI	t1, CKSEG1ADDR(GT_DEF_BASE)
 	li	t0, CPU_TO_GT32(0xdf000000)
 	sw	t0, GT_ISD_OFS(t1)
 
 	/* setup MEM-to-PCI0 mapping */
-	li	t1, KSEG1ADDR(MALTA_GT_BASE)
+	PTR_LI	t1, CKSEG1ADDR(MALTA_GT_BASE)
 
 	/* setup PCI0 io window to 0x18000000-0x181fffff */
 	li	t0, CPU_TO_GT32(0xc0000000)
@@ -100,7 +101,7 @@ _gt64120:
 	 */
 _msc01:
 	/* setup peripheral bus controller clock divide */
-	li	t0, KSEG1ADDR(MALTA_MSC01_PBC_BASE)
+	PTR_LI	t0, CKSEG1ADDR(MALTA_MSC01_PBC_BASE)
 	li	t1, 0x1 << MSC01_PBC_CLKCFG_SHF
 	sw	t1, MSC01_PBC_CLKCFG_OFS(t0)
 
@@ -122,7 +123,7 @@ _msc01:
 	sw	t1, MSC01_PBC_CS0CFG_OFS(t0)
 
 	/* setup basic address decode */
-	li	t0, KSEG1ADDR(MALTA_MSC01_BIU_BASE)
+	PTR_LI	t0, CKSEG1ADDR(MALTA_MSC01_BIU_BASE)
 	li	t1, 0x0
 	li	t2, -CONFIG_SYS_MEM_SIZE
 	sw	t1, MSC01_BIU_MCBAS1L_OFS(t0)
@@ -157,7 +158,7 @@ _msc01:
 	sw	t2, MSC01_BIU_IP3MSK2L_OFS(t0)
 
 	/* setup PCI memory */
-	li	t0, KSEG1ADDR(MALTA_MSC01_PCI_BASE)
+	PTR_LI	t0, CKSEG1ADDR(MALTA_MSC01_PCI_BASE)
 	li	t1, MALTA_MSC01_PCIMEM_BASE
 	li	t2, (-MALTA_MSC01_PCIMEM_SIZE) & MSC01_PCI_SC2PMMSKL_MSK_MSK
 	li	t3, MALTA_MSC01_PCIMEM_MAP
diff --git a/include/configs/malta.h b/include/configs/malta.h
index a369678..fc4baba 100644
--- a/include/configs/malta.h
+++ b/include/configs/malta.h
@@ -39,14 +39,18 @@
  */
 #define CONFIG_SYS_MONITOR_BASE		CONFIG_SYS_TEXT_BASE
 
-#define CONFIG_SYS_SDRAM_BASE		0x80000000 /* Cached addr */
+#ifdef CONFIG_64BIT
+# define CONFIG_SYS_SDRAM_BASE		0xffffffff80000000
+#else
+# define CONFIG_SYS_SDRAM_BASE		0x80000000
+#endif
 #define CONFIG_SYS_MEM_SIZE		(256 * 1024 * 1024)
 
 #define CONFIG_SYS_INIT_SP_OFFSET	0x400000
 
-#define CONFIG_SYS_LOAD_ADDR		0x81000000
-#define CONFIG_SYS_MEMTEST_START	0x80100000
-#define CONFIG_SYS_MEMTEST_END		0x80800000
+#define CONFIG_SYS_LOAD_ADDR		(CONFIG_SYS_SDRAM_BASE + 0x01000000)
+#define CONFIG_SYS_MEMTEST_START	(CONFIG_SYS_SDRAM_BASE + 0x00100000)
+#define CONFIG_SYS_MEMTEST_END		(CONFIG_SYS_SDRAM_BASE + 0x00800000)
 
 #define CONFIG_SYS_MALLOC_LEN		(128 * 1024)
 #define CONFIG_SYS_BOOTPARAMS_LEN	(128 * 1024)
@@ -69,7 +73,11 @@
 /*
  * Flash configuration
  */
-#define CONFIG_SYS_FLASH_BASE		0xbe000000
+#ifdef CONFIG_64BIT
+# define CONFIG_SYS_FLASH_BASE		0xffffffffbe000000
+#else
+# define CONFIG_SYS_FLASH_BASE		0xbe000000
+#endif
 #define CONFIG_SYS_MAX_FLASH_BANKS	1
 #define CONFIG_SYS_MAX_FLASH_SECT	128
 #define CONFIG_SYS_FLASH_CFI
-- 
2.8.2

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [U-Boot] [PATCH 0/4] Malta MIPS64 support
  2016-05-17 10:56 [U-Boot] [PATCH 0/4] Malta MIPS64 support Paul Burton
                   ` (3 preceding siblings ...)
  2016-05-17 10:56 ` [U-Boot] [PATCH 4/4] malta: Allow MIPS64 builds Paul Burton
@ 2016-05-17 11:30 ` Daniel Schwierzeck
  4 siblings, 0 replies; 13+ messages in thread
From: Daniel Schwierzeck @ 2016-05-17 11:30 UTC (permalink / raw)
  To: u-boot

2016-05-17 12:56 GMT+02:00 Paul Burton <paul.burton@imgtec.com>:
> This series allows MIPS64 builds for Malta boards, which can be used
> either on real Malta boards with a MIPS64 CPU or in QEMU. It prepares by
> moving CONFIG_SYS_TEXT_BASE to Kconfig and fixing some 64 bit build
> issues that affect the ethernet driver, then allows the builds for the
> Malta board.
>
> This series applies atop u-boot-mips/next with my "Malta UART using
> device model & device tree" series applied.
>

thanks for doing this, this is very appreciated because I want to get
rid of the qemu_mips board configs whose don't have value anymore
without a bootable kernel.
I've also tried to do this some months ago and ended up with
refactoring the pcnet driver but couldn't finish it due to lack of
time ;)

> Paul Burton (4):
>   MIPS: Move CONFIG_SYS_TEXT_BASE to Kconfig
>   MIPS: Fix _ACAST32_ for pointers on MIPS64
>   net: pcnet: Make 64 bit safe
>   malta: Allow MIPS64 builds
>
>  Kconfig                            |  2 +-
>  arch/mips/Kconfig                  |  3 +++
>  arch/mips/include/asm/addrspace.h  |  4 ++--
>  board/dbau1x00/Kconfig             |  3 +++
>  board/imgtec/malta/Kconfig         |  4 ++++
>  board/imgtec/malta/lowlevel_init.S | 13 +++++++------
>  board/microchip/pic32mzda/Kconfig  |  3 +++
>  board/micronas/vct/Kconfig         |  3 +++
>  board/pb1x00/Kconfig               |  3 +++
>  board/qca/ap121/Kconfig            |  3 +++
>  board/qca/ap143/Kconfig            |  3 +++
>  board/qemu-mips/Kconfig            |  4 ++++
>  board/tplink/wdr4300/Kconfig       |  3 +++
>  drivers/net/pcnet.c                | 18 ++++++++++--------
>  include/configs/ap121.h            |  2 --
>  include/configs/ap143.h            |  2 --
>  include/configs/dbau1x00.h         |  6 ------
>  include/configs/malta.h            | 19 +++++++++++++------
>  include/configs/pb1x00.h           |  6 ------
>  include/configs/pic32mzdask.h      |  1 -
>  include/configs/qemu-mips.h        |  1 -
>  include/configs/qemu-mips64.h      |  1 -
>  include/configs/tplink_wdr4300.h   |  2 --
>  include/configs/vct.h              |  1 -
>  24 files changed, 65 insertions(+), 45 deletions(-)
>
> --
> 2.8.2
>



-- 
- Daniel

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [U-Boot] [PATCH 3/4] net: pcnet: Make 64 bit safe
  2016-05-17 10:56 ` [U-Boot] [PATCH 3/4] net: pcnet: Make 64 bit safe Paul Burton
@ 2016-05-24 15:25   ` Joe Hershberger
  2016-05-24 15:32     ` Paul Burton
  2016-05-24 15:38   ` Joe Hershberger
  1 sibling, 1 reply; 13+ messages in thread
From: Joe Hershberger @ 2016-05-24 15:25 UTC (permalink / raw)
  To: u-boot

Hi Paul,

On Tue, May 17, 2016 at 5:56 AM, Paul Burton <paul.burton@imgtec.com> wrote:
> Fix the pcnet driver to build safely on 64 bit platforms, in preparation
> for allowing MIPS64 builds for Malta boards.
>
> Signed-off-by: Paul Burton <paul.burton@imgtec.com>
> ---
>
>  drivers/net/pcnet.c | 18 ++++++++++--------
>  1 file changed, 10 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/net/pcnet.c b/drivers/net/pcnet.c
> index 16a7512..7dff445 100644
> --- a/drivers/net/pcnet.c
> +++ b/drivers/net/pcnet.c
> @@ -137,7 +137,7 @@ static int pcnet_probe (struct eth_device *dev, bd_t * bis, int dev_num);
>  static inline pci_addr_t pcnet_virt_to_mem(const struct eth_device *dev,
>                                                 void *addr, bool uncached)
>  {
> -       pci_dev_t devbusfn = (pci_dev_t)dev->priv;
> +       pci_dev_t devbusfn = (pci_dev_t)(unsigned long)dev->priv;

I thought this sort of double cast was frowned upon and warns in some
compilers. Is that not an issue here?

>         void *virt_addr = addr;
>
>         if (uncached)
> @@ -179,7 +179,7 @@ int pcnet_initialize(bd_t *bis)
>                         break;
>                 }
>                 memset(dev, 0, sizeof(*dev));
> -               dev->priv = (void *)devbusfn;
> +               dev->priv = (void *)(unsigned long)devbusfn;
>                 sprintf(dev->name, "pcnet#%d", dev_nr);
>
>                 /*
> @@ -190,8 +190,8 @@ int pcnet_initialize(bd_t *bis)
>                 dev->iobase = pci_io_to_phys(devbusfn, dev->iobase);
>                 dev->iobase &= ~0xf;
>
> -               PCNET_DEBUG1("%s: devbusfn=0x%x iobase=0x%x: ",
> -                            dev->name, devbusfn, dev->iobase);
> +               PCNET_DEBUG1("%s: devbusfn=0x%x iobase=0x%lx: ",
> +                            dev->name, devbusfn, (unsigned long)dev->iobase);
>
>                 command = PCI_COMMAND_IO | PCI_COMMAND_MASTER;
>                 pci_write_config_word(devbusfn, PCI_COMMAND, command);
> @@ -298,7 +298,7 @@ static int pcnet_init(struct eth_device *dev, bd_t *bis)
>  {
>         struct pcnet_uncached_priv *uc;
>         int i, val;
> -       u32 addr;
> +       unsigned long addr;
>
>         PCNET_DEBUG1("%s: pcnet_init...\n", dev->name);
>
> @@ -336,16 +336,18 @@ static int pcnet_init(struct eth_device *dev, bd_t *bis)
>          * must be aligned on 16-byte boundaries.
>          */
>         if (lp == NULL) {
> -               addr = (u32)malloc(sizeof(pcnet_priv_t) + 0x10);
> +               addr = (unsigned long)malloc(sizeof(pcnet_priv_t) + 0x10);
>                 addr = (addr + 0xf) & ~0xf;
>                 lp = (pcnet_priv_t *)addr;
>
> -               addr = (u32)memalign(ARCH_DMA_MINALIGN, sizeof(*lp->uc));
> +               addr = (unsigned long)memalign(ARCH_DMA_MINALIGN,
> +                                              sizeof(*lp->uc));
>                 flush_dcache_range(addr, addr + sizeof(*lp->uc));
>                 addr = UNCACHED_SDRAM(addr);
>                 lp->uc = (struct pcnet_uncached_priv *)addr;
>
> -               addr = (u32)memalign(ARCH_DMA_MINALIGN, sizeof(*lp->rx_buf));
> +               addr = (unsigned long)memalign(ARCH_DMA_MINALIGN,
> +                                              sizeof(*lp->rx_buf));
>                 flush_dcache_range(addr, addr + sizeof(*lp->rx_buf));
>                 lp->rx_buf = (void *)addr;
>         }
> --
> 2.8.2
>
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [U-Boot] [PATCH 3/4] net: pcnet: Make 64 bit safe
  2016-05-24 15:25   ` Joe Hershberger
@ 2016-05-24 15:32     ` Paul Burton
  0 siblings, 0 replies; 13+ messages in thread
From: Paul Burton @ 2016-05-24 15:32 UTC (permalink / raw)
  To: u-boot

On Tue, May 24, 2016 at 10:25:11AM -0500, Joe Hershberger wrote:
> Hi Paul,
> 
> On Tue, May 17, 2016 at 5:56 AM, Paul Burton <paul.burton@imgtec.com> wrote:
> > Fix the pcnet driver to build safely on 64 bit platforms, in preparation
> > for allowing MIPS64 builds for Malta boards.
> >
> > Signed-off-by: Paul Burton <paul.burton@imgtec.com>
> > ---
> >
> >  drivers/net/pcnet.c | 18 ++++++++++--------
> >  1 file changed, 10 insertions(+), 8 deletions(-)
> >
> > diff --git a/drivers/net/pcnet.c b/drivers/net/pcnet.c
> > index 16a7512..7dff445 100644
> > --- a/drivers/net/pcnet.c
> > +++ b/drivers/net/pcnet.c
> > @@ -137,7 +137,7 @@ static int pcnet_probe (struct eth_device *dev, bd_t * bis, int dev_num);
> >  static inline pci_addr_t pcnet_virt_to_mem(const struct eth_device *dev,
> >                                                 void *addr, bool uncached)
> >  {
> > -       pci_dev_t devbusfn = (pci_dev_t)dev->priv;
> > +       pci_dev_t devbusfn = (pci_dev_t)(unsigned long)dev->priv;
> 
> I thought this sort of double cast was frowned upon and warns in some
> compilers. Is that not an issue here?

Hi Joe,

It doesn't trigger any warnings with my gcc 4.9.2 based Codescape
2016.05 toolchain[1].

Thanks,
    Paul

[1] http://codescape-mips-sdk.imgtec.com/components/toolchain/2016.05-01/

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [U-Boot] [PATCH 3/4] net: pcnet: Make 64 bit safe
  2016-05-17 10:56 ` [U-Boot] [PATCH 3/4] net: pcnet: Make 64 bit safe Paul Burton
  2016-05-24 15:25   ` Joe Hershberger
@ 2016-05-24 15:38   ` Joe Hershberger
  1 sibling, 0 replies; 13+ messages in thread
From: Joe Hershberger @ 2016-05-24 15:38 UTC (permalink / raw)
  To: u-boot

On Tue, May 17, 2016 at 5:56 AM, Paul Burton <paul.burton@imgtec.com> wrote:
> Fix the pcnet driver to build safely on 64 bit platforms, in preparation
> for allowing MIPS64 builds for Malta boards.
>
> Signed-off-by: Paul Burton <paul.burton@imgtec.com>

Acked-by: Joe Hershberger <joe.hershberger@ni.com>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [U-Boot] [PATCH 1/4] MIPS: Move CONFIG_SYS_TEXT_BASE to Kconfig
  2016-05-17 10:56 ` [U-Boot] [PATCH 1/4] MIPS: Move CONFIG_SYS_TEXT_BASE to Kconfig Paul Burton
@ 2016-05-25 23:01   ` Daniel Schwierzeck
  0 siblings, 0 replies; 13+ messages in thread
From: Daniel Schwierzeck @ 2016-05-25 23:01 UTC (permalink / raw)
  To: u-boot



Am 17.05.2016 um 12:56 schrieb Paul Burton:
> Move CONFIG_SYS_TEXT_BASE to Kconfig, and add default values in board
> Kconfig files matching what was present in their config headers. This
> will make it cleaner to conditionalise the value for Malta based on 32
> vs 64 bit builds.
> 
> Signed-off-by: Paul Burton <paul.burton@imgtec.com>
> ---
> 
>  Kconfig                           | 2 +-
>  board/dbau1x00/Kconfig            | 3 +++
>  board/imgtec/malta/Kconfig        | 3 +++
>  board/microchip/pic32mzda/Kconfig | 3 +++
>  board/micronas/vct/Kconfig        | 3 +++
>  board/pb1x00/Kconfig              | 3 +++
>  board/qca/ap121/Kconfig           | 3 +++
>  board/qca/ap143/Kconfig           | 3 +++
>  board/qemu-mips/Kconfig           | 4 ++++
>  board/tplink/wdr4300/Kconfig      | 3 +++
>  include/configs/ap121.h           | 2 --
>  include/configs/ap143.h           | 2 --
>  include/configs/dbau1x00.h        | 6 ------
>  include/configs/malta.h           | 1 -
>  include/configs/pb1x00.h          | 6 ------
>  include/configs/pic32mzdask.h     | 1 -
>  include/configs/qemu-mips.h       | 1 -
>  include/configs/qemu-mips64.h     | 1 -
>  include/configs/tplink_wdr4300.h  | 2 --
>  include/configs/vct.h             | 1 -
>  20 files changed, 29 insertions(+), 24 deletions(-)
> 

applied to u-boot-mips, thanks.

-- 
- Daniel

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160526/261a57af/attachment.sig>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [U-Boot] [PATCH 2/4] MIPS: Fix _ACAST32_ for pointers on MIPS64
  2016-05-17 10:56 ` [U-Boot] [PATCH 2/4] MIPS: Fix _ACAST32_ for pointers on MIPS64 Paul Burton
@ 2016-05-25 23:18   ` Daniel Schwierzeck
  2016-05-26 13:51     ` Paul Burton
  0 siblings, 1 reply; 13+ messages in thread
From: Daniel Schwierzeck @ 2016-05-25 23:18 UTC (permalink / raw)
  To: u-boot



Am 17.05.2016 um 12:56 schrieb Paul Burton:
> When building for MIPS64 and providing a pointer to _ACAST32_,
> optionally via CPHYSADDR or one of the CKSEGxADDR macros, the cast
> directly to a 32 bit int leads to compilation warnings such as the
> following:
> 
>   In file included from ./arch/mips/include/asm/io.h:17:0,
>                    from drivers/net/pcnet.c:14:
>   drivers/net/pcnet.c: In function ?pcnet_virt_to_mem?:
>   ./arch/mips/include/asm/addrspace.h:39:29: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
>    #define _ACAST32_  (_ATYPE_)(_ATYPE32_) /* widen if necessary */
>                                ^
>   ./arch/mips/include/asm/addrspace.h:51:25: note: in expansion of macro ?_ACAST32_?
>    #define CPHYSADDR(a)  ((_ACAST32_(a)) & 0x1fffffff)
>                            ^
>   ./arch/mips/include/asm/addrspace.h:71:25: note: in expansion of macro ?CPHYSADDR?
>    #define CKSEG0ADDR(a)  (CPHYSADDR(a) | CKSEG0)
>                            ^
>   drivers/net/pcnet.c:144:23: note: in expansion of macro ?CKSEG0ADDR?
>      virt_addr = (void *)CKSEG0ADDR(addr);
>                          ^
> 
> Fix this by first casting provided values to a pointer-width integer,
> then truncating to a 32 bit int & widening back to pointer-width.
> 
> Signed-off-by: Paul Burton <paul.burton@imgtec.com>
> ---
> 
>  arch/mips/include/asm/addrspace.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/mips/include/asm/addrspace.h b/arch/mips/include/asm/addrspace.h
> index 0994e96..fe497b5 100644
> --- a/arch/mips/include/asm/addrspace.h
> +++ b/arch/mips/include/asm/addrspace.h
> @@ -36,8 +36,8 @@
>  #define _ACAST32_
>  #define _ACAST64_
>  #else
> -#define _ACAST32_		(_ATYPE_)(_ATYPE32_)	/* widen if necessary */
> -#define _ACAST64_		(_ATYPE64_)		/* do _not_ narrow */
> +#define _ACAST32_	(_ATYPE_)(_ATYPE32_)(_ATYPE_)	/* widen if necessary */
> +#define _ACAST64_	(_ATYPE64_)		/* do _not_ narrow */
>  #endif
>  
>  /*
> 

could you fix this in the pcnet driver? If possible I want to avoid
U-Boot specific changes on files imported from Linux.

-- 
- Daniel

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160526/21e6301d/attachment.sig>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [U-Boot] [PATCH 2/4] MIPS: Fix _ACAST32_ for pointers on MIPS64
  2016-05-25 23:18   ` Daniel Schwierzeck
@ 2016-05-26 13:51     ` Paul Burton
  2016-05-26 14:46       ` Daniel Schwierzeck
  0 siblings, 1 reply; 13+ messages in thread
From: Paul Burton @ 2016-05-26 13:51 UTC (permalink / raw)
  To: u-boot

On Thu, May 26, 2016 at 01:18:21AM +0200, Daniel Schwierzeck wrote:
> 
> 
> Am 17.05.2016 um 12:56 schrieb Paul Burton:
> > When building for MIPS64 and providing a pointer to _ACAST32_,
> > optionally via CPHYSADDR or one of the CKSEGxADDR macros, the cast
> > directly to a 32 bit int leads to compilation warnings such as the
> > following:
> > 
> >   In file included from ./arch/mips/include/asm/io.h:17:0,
> >                    from drivers/net/pcnet.c:14:
> >   drivers/net/pcnet.c: In function ?pcnet_virt_to_mem?:
> >   ./arch/mips/include/asm/addrspace.h:39:29: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
> >    #define _ACAST32_  (_ATYPE_)(_ATYPE32_) /* widen if necessary */
> >                                ^
> >   ./arch/mips/include/asm/addrspace.h:51:25: note: in expansion of macro ?_ACAST32_?
> >    #define CPHYSADDR(a)  ((_ACAST32_(a)) & 0x1fffffff)
> >                            ^
> >   ./arch/mips/include/asm/addrspace.h:71:25: note: in expansion of macro ?CPHYSADDR?
> >    #define CKSEG0ADDR(a)  (CPHYSADDR(a) | CKSEG0)
> >                            ^
> >   drivers/net/pcnet.c:144:23: note: in expansion of macro ?CKSEG0ADDR?
> >      virt_addr = (void *)CKSEG0ADDR(addr);
> >                          ^
> > 
> > Fix this by first casting provided values to a pointer-width integer,
> > then truncating to a 32 bit int & widening back to pointer-width.
> > 
> > Signed-off-by: Paul Burton <paul.burton@imgtec.com>
> > ---
> > 
> >  arch/mips/include/asm/addrspace.h | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/arch/mips/include/asm/addrspace.h b/arch/mips/include/asm/addrspace.h
> > index 0994e96..fe497b5 100644
> > --- a/arch/mips/include/asm/addrspace.h
> > +++ b/arch/mips/include/asm/addrspace.h
> > @@ -36,8 +36,8 @@
> >  #define _ACAST32_
> >  #define _ACAST64_
> >  #else
> > -#define _ACAST32_		(_ATYPE_)(_ATYPE32_)	/* widen if necessary */
> > -#define _ACAST64_		(_ATYPE64_)		/* do _not_ narrow */
> > +#define _ACAST32_	(_ATYPE_)(_ATYPE32_)(_ATYPE_)	/* widen if necessary */
> > +#define _ACAST64_	(_ATYPE64_)		/* do _not_ narrow */
> >  #endif
> >  
> >  /*
> > 
> 
> could you fix this in the pcnet driver? If possible I want to avoid
> U-Boot specific changes on files imported from Linux.
> 
> -- 
> - Daniel
> 

Hi Daniel,

I've submitted an alternate fix in v2 of the series just now. It still
requires a change to MIPS code but it mirrors one I have submitted to
Linux, and hopefully one you'll find acceptable. It makes MIPS32 &
MIPS64 more consistent & prevents drivers needing to care about which
segment of the virtual address space an address is in when calling
virt_to_phys.

Thanks,
    Paul

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [U-Boot] [PATCH 2/4] MIPS: Fix _ACAST32_ for pointers on MIPS64
  2016-05-26 13:51     ` Paul Burton
@ 2016-05-26 14:46       ` Daniel Schwierzeck
  0 siblings, 0 replies; 13+ messages in thread
From: Daniel Schwierzeck @ 2016-05-26 14:46 UTC (permalink / raw)
  To: u-boot



Am 26.05.2016 um 15:51 schrieb Paul Burton:
> 
> Hi Daniel,
> 
> I've submitted an alternate fix in v2 of the series just now. It still
> requires a change to MIPS code but it mirrors one I have submitted to
> Linux, and hopefully one you'll find acceptable. It makes MIPS32 &
> MIPS64 more consistent & prevents drivers needing to care about which
> segment of the virtual address space an address is in when calling
> virt_to_phys.
> 

yes that one looks good, thanks.

-- 
- Daniel

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160526/d82d37ca/attachment.sig>

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2016-05-26 14:46 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-17 10:56 [U-Boot] [PATCH 0/4] Malta MIPS64 support Paul Burton
2016-05-17 10:56 ` [U-Boot] [PATCH 1/4] MIPS: Move CONFIG_SYS_TEXT_BASE to Kconfig Paul Burton
2016-05-25 23:01   ` Daniel Schwierzeck
2016-05-17 10:56 ` [U-Boot] [PATCH 2/4] MIPS: Fix _ACAST32_ for pointers on MIPS64 Paul Burton
2016-05-25 23:18   ` Daniel Schwierzeck
2016-05-26 13:51     ` Paul Burton
2016-05-26 14:46       ` Daniel Schwierzeck
2016-05-17 10:56 ` [U-Boot] [PATCH 3/4] net: pcnet: Make 64 bit safe Paul Burton
2016-05-24 15:25   ` Joe Hershberger
2016-05-24 15:32     ` Paul Burton
2016-05-24 15:38   ` Joe Hershberger
2016-05-17 10:56 ` [U-Boot] [PATCH 4/4] malta: Allow MIPS64 builds Paul Burton
2016-05-17 11:30 ` [U-Boot] [PATCH 0/4] Malta MIPS64 support Daniel Schwierzeck

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.