[U-Boot] [PATCH 01/13] ARM: tegra: Fix build failures and warnings on 64-bit

From: Thierry Reding treding@nvidia.com
This fixes some build errors and warnings caused by inline assembly and pointer to integer cast size mismatches. The inline assembly build error in config_cache() is easy to fix because the code isn't meaningful on 64 bit ARM. For the assembly-level reset_cpu() implementation, provide a version that uses ARMv8 register names, but is otherwise identical.
The remaining warnings about pointer to integer cast size mismatches can be fixed by simply using explicit casts where appropriate, or using long unsigned integers rather than 32-bit sized types where an actual address is stored.
Cc: Tom Warren twarren@nvidia.com Signed-off-by: Thierry Reding treding@nvidia.com --- arch/arm/mach-tegra/ap.c | 4 ++-- arch/arm/mach-tegra/cache.c | 2 ++ arch/arm/mach-tegra/lowlevel_init.S | 15 +++++++++++++++ arch/arm/mach-tegra/pinmux-common.c | 2 +- 4 files changed, 20 insertions(+), 3 deletions(-)
diff --git a/arch/arm/mach-tegra/ap.c b/arch/arm/mach-tegra/ap.c index cbe9be6f263a..01c15d829fc6 100644 --- a/arch/arm/mach-tegra/ap.c +++ b/arch/arm/mach-tegra/ap.c @@ -135,8 +135,8 @@ static u32 get_odmdata(void) * on BCTs for currently supported SoCs, which are locked down. * If this changes in new chips, we can revisit this algorithm. */ - - u32 bct_start, odmdata; + unsigned long bct_start; + u32 odmdata;
bct_start = readl(NV_PA_BASE_SRAM + NVBOOTINFOTABLE_BCTPTR); odmdata = readl(bct_start + BCT_ODMDATA_OFFSET); diff --git a/arch/arm/mach-tegra/cache.c b/arch/arm/mach-tegra/cache.c index 94f5bce90ec3..0e9cb97832dd 100644 --- a/arch/arm/mach-tegra/cache.c +++ b/arch/arm/mach-tegra/cache.c @@ -21,6 +21,7 @@ #include <asm/arch-tegra/ap.h> #include <asm/arch/gp_padctrl.h>
+#ifndef CONFIG_ARM64 void config_cache(void) { u32 reg = 0; @@ -44,3 +45,4 @@ void config_cache(void) reg |= 2; asm("mcr p15, 1, %0, c9, c0, 2" : : "r" (reg)); } +#endif diff --git a/arch/arm/mach-tegra/lowlevel_init.S b/arch/arm/mach-tegra/lowlevel_init.S index a211bb3b1a60..4fa834ba60e0 100644 --- a/arch/arm/mach-tegra/lowlevel_init.S +++ b/arch/arm/mach-tegra/lowlevel_init.S @@ -11,6 +11,20 @@ #include <version.h> #include <linux/linkage.h>
+#ifdef CONFIG_ARM64 + .align 5 +ENTRY(reset_cpu) + /* get address for global reset register */ + ldr x1, =PRM_RSTCTRL + ldr w3, [x1] + /* force reset */ + orr w3, w3, #0x10 + str w3, [x1] + mov w0, w0 +1: + b 1b +ENDPROC(reset_cpu) +#else .align 5 ENTRY(reset_cpu) ldr r1, rstctl @ get addr for global reset @@ -24,3 +38,4 @@ _loop_forever: rstctl: .word PRM_RSTCTRL ENDPROC(reset_cpu) +#endif diff --git a/arch/arm/mach-tegra/pinmux-common.c b/arch/arm/mach-tegra/pinmux-common.c index 912f65e98b06..c9dc58838803 100644 --- a/arch/arm/mach-tegra/pinmux-common.c +++ b/arch/arm/mach-tegra/pinmux-common.c @@ -78,7 +78,7 @@ (((hsm) >= PMUX_HSM_DISABLE) && ((hsm) <= PMUX_HSM_ENABLE)) #endif
-#define _R(offset) (u32 *)(NV_PA_APB_MISC_BASE + (offset)) +#define _R(offset) (u32 *)((unsigned long)NV_PA_APB_MISC_BASE + (offset))
#if defined(CONFIG_TEGRA20)

From: Thierry Reding treding@nvidia.com
Fix an pointer to integer cast size mismatch warning by casting to unsigned long instead of unsigned int and fix up the corresponding printf format string to use %lx instead of %x.
Also remove a pointless cast producing a size mismatch warning.
Cc: Simon Glass sjg@chromium.org Cc: Tom Rini trini@konsulko.com Signed-off-by: Thierry Reding treding@nvidia.com --- common/usb_storage.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/common/usb_storage.c b/common/usb_storage.c index 1411737bed89..cfa3cb124e15 100644 --- a/common/usb_storage.c +++ b/common/usb_storage.c @@ -336,8 +336,8 @@ static int us_one_transfer(struct us_data *us, int pipe, char *buf, int length) /* set up the transfer loop */ do { /* transfer the data */ - debug("Bulk xfer 0x%x(%d) try #%d\n", - (unsigned int)buf, this_xfer, 11 - maxtry); + debug("Bulk xfer 0x%lx(%d) try #%d\n", + (unsigned long)buf, this_xfer, 11 - maxtry); result = usb_bulk_msg(us->pusb_dev, pipe, buf, this_xfer, &partial, USB_CNTL_TIMEOUT * 5); @@ -603,7 +603,7 @@ static int usb_stor_CBI_get_status(ccb *srb, struct us_data *us) (void *) &us->ip_data, us->irqmaxp, us->irqinterval); timeout = 1000; while (timeout--) { - if ((volatile int *) us->ip_wanted == NULL) + if (us->ip_wanted == 0) break; mdelay(10); }

From: Thierry Reding treding@nvidia.com
Explicitly cast the result of a pointer arithmetic to unsigned int so that it matches the corresponding printf format string. While at it, use %p to print a buffer address rather than %x and an explicit cast (which causes a warning in this case because it's cast to unsigned int instead of unsigned long).
Cc: Łukasz Majewski l.majewski@samsung.com Signed-off-by: Thierry Reding treding@nvidia.com --- drivers/dfu/dfu.c | 2 +- drivers/dfu/dfu_mmc.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/dfu/dfu.c b/drivers/dfu/dfu.c index 0560afa9ffa5..5c137acfaa04 100644 --- a/drivers/dfu/dfu.c +++ b/drivers/dfu/dfu.c @@ -200,7 +200,7 @@ int dfu_write(struct dfu_entity *dfu, void *buf, int size, int blk_seq_num)
debug("%s: name: %s buf: 0x%p size: 0x%x p_num: 0x%x offset: 0x%llx bufoffset: 0x%x\n", __func__, dfu->name, buf, size, blk_seq_num, dfu->offset, - dfu->i_buf - dfu->i_buf_start); + (unsigned int)(dfu->i_buf - dfu->i_buf_start));
if (!dfu->inited) { /* initial state */ diff --git a/drivers/dfu/dfu_mmc.c b/drivers/dfu/dfu_mmc.c index fd865e11212e..2a780f7b5d31 100644 --- a/drivers/dfu/dfu_mmc.c +++ b/drivers/dfu/dfu_mmc.c @@ -156,7 +156,7 @@ static int mmc_file_op(enum dfu_op op, struct dfu_entity *dfu, dfu->data.mmc.dev, dfu->data.mmc.part);
if (op != DFU_OP_SIZE) - sprintf(cmd_buf + strlen(cmd_buf), " 0x%x", (unsigned int)buf); + sprintf(cmd_buf + strlen(cmd_buf), " %p", buf);
sprintf(cmd_buf + strlen(cmd_buf), " %s", dfu->name);

Hi Thierry,
From: Thierry Reding treding@nvidia.com
Explicitly cast the result of a pointer arithmetic to unsigned int so that it matches the corresponding printf format string. While at it, use %p to print a buffer address rather than %x and an explicit cast (which causes a warning in this case because it's cast to unsigned int instead of unsigned long).
Cc: Łukasz Majewski l.majewski@samsung.com Signed-off-by: Thierry Reding treding@nvidia.com
drivers/dfu/dfu.c | 2 +- drivers/dfu/dfu_mmc.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/dfu/dfu.c b/drivers/dfu/dfu.c index 0560afa9ffa5..5c137acfaa04 100644 --- a/drivers/dfu/dfu.c +++ b/drivers/dfu/dfu.c @@ -200,7 +200,7 @@ int dfu_write(struct dfu_entity *dfu, void *buf, int size, int blk_seq_num) debug("%s: name: %s buf: 0x%p size: 0x%x p_num: 0x%x offset: 0x%llx bufoffset: 0x%x\n", __func__, dfu->name, buf, size, blk_seq_num, dfu->offset,
dfu->i_buf - dfu->i_buf_start);
(unsigned int)(dfu->i_buf - dfu->i_buf_start));
if (!dfu->inited) { /* initial state */
diff --git a/drivers/dfu/dfu_mmc.c b/drivers/dfu/dfu_mmc.c index fd865e11212e..2a780f7b5d31 100644 --- a/drivers/dfu/dfu_mmc.c +++ b/drivers/dfu/dfu_mmc.c @@ -156,7 +156,7 @@ static int mmc_file_op(enum dfu_op op, struct dfu_entity *dfu, dfu->data.mmc.dev, dfu->data.mmc.part);
if (op != DFU_OP_SIZE)
sprintf(cmd_buf + strlen(cmd_buf), " 0x%x",
(unsigned int)buf);
sprintf(cmd_buf + strlen(cmd_buf), " %p", buf);
sprintf(cmd_buf + strlen(cmd_buf), " %s", dfu->name);
Acked-by: Lukasz Majewski l.majewski@samsung.com Tested-by: Lukasz Majewski l.majewski@samsung.com [test HW: trats - Exynos4210 board]

From: Thierry Reding treding@nvidia.com
Fix a couple of pointer to integer size mismatch warnings by casting pointers to unsigned long rather than unsigned int.
Cc: Heiko Schocher hs@denx.de Signed-off-by: Thierry Reding treding@nvidia.com --- drivers/i2c/tegra_i2c.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/i2c/tegra_i2c.c b/drivers/i2c/tegra_i2c.c index f4142870b304..78f125d88723 100644 --- a/drivers/i2c/tegra_i2c.c +++ b/drivers/i2c/tegra_i2c.c @@ -235,7 +235,7 @@ static int send_recv_packets(struct i2c_bus *i2c_bus, if ((words == 1) && last_bytes) { local = 0; memcpy(&local, dptr, last_bytes); - } else if ((unsigned)dptr & 3) { + } else if ((unsigned long)dptr & 3) { memcpy(&local, dptr, sizeof(u32)); } else { local = *wptr; @@ -258,7 +258,7 @@ static int send_recv_packets(struct i2c_bus *i2c_bus, local = readl(&control->rx_fifo); if ((words == 1) && last_bytes) memcpy(dptr, (char *)&local, last_bytes); - else if ((unsigned)dptr & 3) + else if ((unsigned long)dptr & 3) memcpy(dptr, &local, sizeof(u32)); else *wptr = local;

From: Thierry Reding treding@nvidia.com
Fix a couple of pointer to integer size mismatch warnings by casting pointers to unsigned long rather than unsigned int.
Cc: Pantelis Antoniou panto@antoniou-consulting.com Cc: Tom Warren twarren@nvidia.com Signed-off-by: Thierry Reding treding@nvidia.com --- drivers/mmc/tegra_mmc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/mmc/tegra_mmc.c b/drivers/mmc/tegra_mmc.c index 2cd8cf10aec5..b6387b357d7a 100644 --- a/drivers/mmc/tegra_mmc.c +++ b/drivers/mmc/tegra_mmc.c @@ -67,7 +67,7 @@ static void mmc_prepare_data(struct mmc_host *host, struct mmc_data *data, bbstate->bounce_buffer, bbstate->user_buffer, data->blocks, data->blocksize);
- writel((u32)bbstate->bounce_buffer, &host->reg->sysad); + writel((u32)(unsigned long)bbstate->bounce_buffer, &host->reg->sysad); /* * DMASEL[4:3] * 00 = Selects SDMA @@ -233,8 +233,8 @@ static int mmc_send_cmd_bounced(struct mmc *mmc, struct mmc_cmd *cmd, if (cmd->resp_type & MMC_RSP_136) { /* CRC is stripped so we need to do some shifting. */ for (i = 0; i < 4; i++) { - unsigned int offset = - (unsigned int)(&host->reg->rspreg3 - i); + unsigned long offset = + (unsigned long)(&host->reg->rspreg3 - i); cmd->response[i] = readl(offset) << 8;
if (i != 3) {

From: Thierry Reding treding@nvidia.com
Turn ioaddr into an unsigned long rather than a sized 32-bit variable. While at it, fix a couple of pointer to integer cast size mismatch warnings by casting through unsigned long going from pointers to integers and vice versa.
Cc: Joe Hershberger joe.hershberger@gmail.com Signed-off-by: Thierry Reding treding@nvidia.com --- drivers/net/rtl8169.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/net/rtl8169.c b/drivers/net/rtl8169.c index 6c16c1bb403f..5feeb9cb7cbc 100644 --- a/drivers/net/rtl8169.c +++ b/drivers/net/rtl8169.c @@ -55,7 +55,7 @@ #define drv_version "v1.5" #define drv_date "01-17-2004"
-static u32 ioaddr; +static unsigned long ioaddr;
/* Condensed operations for readability. */ #define currticks() get_timer(0) @@ -97,14 +97,14 @@ static int media[MAX_UNITS] = { -1, -1, -1, -1, -1, -1, -1, -1 }; #define RTL_W32(reg, val32) writel ((val32), ioaddr + (reg)) #define RTL_R8(reg) readb (ioaddr + (reg)) #define RTL_R16(reg) readw (ioaddr + (reg)) -#define RTL_R32(reg) ((unsigned long) readl (ioaddr + (reg))) +#define RTL_R32(reg) readl (ioaddr + (reg))
#define ETH_FRAME_LEN MAX_ETH_FRAME_SIZE #define ETH_ALEN MAC_ADDR_LEN #define ETH_ZLEN 60
-#define bus_to_phys(a) pci_mem_to_phys((pci_dev_t)dev->priv, (pci_addr_t)a) -#define phys_to_bus(a) pci_phys_to_mem((pci_dev_t)dev->priv, (phys_addr_t)a) +#define bus_to_phys(a) pci_mem_to_phys((pci_dev_t)(unsigned long)dev->priv, (pci_addr_t)(unsigned long)a) +#define phys_to_bus(a) pci_phys_to_mem((pci_dev_t)(unsigned long)dev->priv, (phys_addr_t)a)
enum RTL8169_registers { MAC0 = 0, /* Ethernet hardware address. */ @@ -852,7 +852,7 @@ static int rtl_init(struct eth_device *dev, bd_t *bis)
#ifdef DEBUG_RTL8169 /* Print out some hardware info */ - printf("%s: at ioaddr 0x%x\n", dev->name, ioaddr); + printf("%s: at ioaddr 0x%lx\n", dev->name, ioaddr); #endif
/* if TBI is not endbled */ @@ -1008,7 +1008,7 @@ int rtl8169_initialize(bd_t *bis) memset(dev, 0, sizeof(*dev)); sprintf (dev->name, "RTL8169#%d", card_number);
- dev->priv = (void *) devno; + dev->priv = (void *)(unsigned long)devno; dev->iobase = (int)pci_mem_to_phys(devno, iobase);
dev->init = rtl_reset;

Hi Thierry,
On Fri, Mar 20, 2015 at 6:41 AM, Thierry Reding thierry.reding@gmail.com wrote:
From: Thierry Reding treding@nvidia.com
Turn ioaddr into an unsigned long rather than a sized 32-bit variable. While at it, fix a couple of pointer to integer cast size mismatch warnings by casting through unsigned long going from pointers to integers and vice versa.
Cc: Joe Hershberger joe.hershberger@gmail.com Signed-off-by: Thierry Reding treding@nvidia.com
Fixed checkpatch failures and applied to next, thanks! -Joe

From: Thierry Reding treding@nvidia.com
Use the %pa specifier to print physical addresses rather than %x. The latter causes build warnings on 64-bit.
Cc: Tom Warren twarren@nvidia.com Cc: Tom Rini trini@konsulko.com Signed-off-by: Thierry Reding treding@nvidia.com --- drivers/pci/pci_tegra.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/pci/pci_tegra.c b/drivers/pci/pci_tegra.c index 1598dcd4433e..4799be065d9e 100644 --- a/drivers/pci/pci_tegra.c +++ b/drivers/pci/pci_tegra.c @@ -462,11 +462,11 @@ static int tegra_pcie_parse_dt_ranges(const void *fdt, int node, }
debug("PCI regions:\n"); - debug(" I/O: %#x-%#x\n", pcie->io.start, pcie->io.end); - debug(" non-prefetchable memory: %#x-%#x\n", pcie->mem.start, - pcie->mem.end); - debug(" prefetchable memory: %#x-%#x\n", pcie->prefetch.start, - pcie->prefetch.end); + debug(" I/O: %pa-%pa\n", &pcie->io.start, &pcie->io.end); + debug(" non-prefetchable memory: %pa-%pa\n", &pcie->mem.start, + &pcie->mem.end); + debug(" prefetchable memory: %pa-%pa\n", &pcie->prefetch.start, + &pcie->prefetch.end);
return 0; }

From: Thierry Reding treding@nvidia.com
Fix a type mismatch in a printf format string.
Cc: Marek Vasut marex@denx.de Signed-off-by: Thierry Reding treding@nvidia.com --- drivers/usb/eth/asix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/usb/eth/asix.c b/drivers/usb/eth/asix.c index 11811094ede8..1cd179baaea7 100644 --- a/drivers/usb/eth/asix.c +++ b/drivers/usb/eth/asix.c @@ -475,7 +475,7 @@ static int asix_send(struct eth_device *eth, void *packet, int length) length + sizeof(packet_len), &actual_len, USB_BULK_SEND_TIMEOUT); - debug("Tx: len = %u, actual = %u, err = %d\n", + debug("Tx: len = %zu, actual = %u, err = %d\n", length + sizeof(packet_len), actual_len, err);
return err;

On Friday, March 20, 2015 at 12:41:23 PM, Thierry Reding wrote:
From: Thierry Reding treding@nvidia.com
Fix a type mismatch in a printf format string.
Cc: Marek Vasut marex@denx.de Signed-off-by: Thierry Reding treding@nvidia.com
drivers/usb/eth/asix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/usb/eth/asix.c b/drivers/usb/eth/asix.c index 11811094ede8..1cd179baaea7 100644 --- a/drivers/usb/eth/asix.c +++ b/drivers/usb/eth/asix.c @@ -475,7 +475,7 @@ static int asix_send(struct eth_device *eth, void *packet, int length) length + sizeof(packet_len), &actual_len, USB_BULK_SEND_TIMEOUT);
- debug("Tx: len = %u, actual = %u, err = %d\n",
debug("Tx: len = %zu, actual = %u, err = %d\n", length + sizeof(packet_len), actual_len, err);
return err;
Applied, thanks!
Best regards, Marek Vasut

From: Thierry Reding treding@nvidia.com
Fix a slew of pointer to integer cast size mismatch warnings caused by this driver explicitly casting pointers to 32-bit integers. While it is true that the hardware can only deal with 32-bit addresses, truncating using a cast isn't the right solution because the pointer could still be outside of the space addressable using 32-bit addresses.
Cc: Łukasz Majewski l.majewski@samsung.com Cc: Marek Vasut marex@denx.de Signed-off-by: Thierry Reding treding@nvidia.com --- drivers/usb/gadget/ci_udc.c | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-)
diff --git a/drivers/usb/gadget/ci_udc.c b/drivers/usb/gadget/ci_udc.c index b0ef35e745a3..2338e2831d22 100644 --- a/drivers/usb/gadget/ci_udc.c +++ b/drivers/usb/gadget/ci_udc.c @@ -160,8 +160,8 @@ static struct ept_queue_item *ci_get_qtd(int ep_num, int dir_in) static void ci_flush_qh(int ep_num) { struct ept_queue_head *head = ci_get_qh(ep_num, 0); - const uint32_t start = (uint32_t)head; - const uint32_t end = start + 2 * sizeof(*head); + unsigned long start = (unsigned long)head; + unsigned long end = start + 2 * sizeof(*head);
flush_dcache_range(start, end); } @@ -175,8 +175,8 @@ static void ci_flush_qh(int ep_num) static void ci_invalidate_qh(int ep_num) { struct ept_queue_head *head = ci_get_qh(ep_num, 0); - uint32_t start = (uint32_t)head; - uint32_t end = start + 2 * sizeof(*head); + unsigned long start = (unsigned long)head; + unsigned long end = start + 2 * sizeof(*head);
invalidate_dcache_range(start, end); } @@ -190,8 +190,8 @@ static void ci_invalidate_qh(int ep_num) static void ci_flush_qtd(int ep_num) { struct ept_queue_item *item = ci_get_qtd(ep_num, 0); - const uint32_t start = (uint32_t)item; - const uint32_t end = start + 2 * ILIST_ENT_SZ; + unsigned long start = (unsigned long)item; + unsigned long end = start + 2 * ILIST_ENT_SZ;
flush_dcache_range(start, end); } @@ -205,8 +205,8 @@ static void ci_flush_qtd(int ep_num) static void ci_invalidate_qtd(int ep_num) { struct ept_queue_item *item = ci_get_qtd(ep_num, 0); - const uint32_t start = (uint32_t)item; - const uint32_t end = start + 2 * ILIST_ENT_SZ; + const unsigned long start = (unsigned long)item; + const unsigned long end = start + 2 * ILIST_ENT_SZ;
invalidate_dcache_range(start, end); } @@ -308,8 +308,8 @@ static int ci_ep_disable(struct usb_ep *ep) static int ci_bounce(struct ci_req *ci_req, int in) { struct usb_request *req = &ci_req->req; - uint32_t addr = (uint32_t)req->buf; - uint32_t hwaddr; + unsigned long addr = (unsigned long)req->buf; + unsigned long hwaddr; uint32_t aligned_used_len;
/* Input buffer address is not aligned. */ @@ -343,7 +343,7 @@ align: memcpy(ci_req->hw_buf, req->buf, req->length);
flush: - hwaddr = (uint32_t)ci_req->hw_buf; + hwaddr = (unsigned long)ci_req->hw_buf; aligned_used_len = roundup(req->length, ARCH_DMA_MINALIGN); flush_dcache_range(hwaddr, hwaddr + aligned_used_len);
@@ -353,8 +353,8 @@ flush: static void ci_debounce(struct ci_req *ci_req, int in) { struct usb_request *req = &ci_req->req; - uint32_t addr = (uint32_t)req->buf; - uint32_t hwaddr = (uint32_t)ci_req->hw_buf; + unsigned long addr = (unsigned long)req->buf; + unsigned long hwaddr = (unsigned long)ci_req->hw_buf; uint32_t aligned_used_len;
if (in) @@ -388,13 +388,13 @@ static void ci_ep_submit_next_request(struct ci_ep *ci_ep) len = ci_req->req.length;
item->info = INFO_BYTES(len) | INFO_ACTIVE; - item->page0 = (uint32_t)ci_req->hw_buf; - item->page1 = ((uint32_t)ci_req->hw_buf & 0xfffff000) + 0x1000; - item->page2 = ((uint32_t)ci_req->hw_buf & 0xfffff000) + 0x2000; - item->page3 = ((uint32_t)ci_req->hw_buf & 0xfffff000) + 0x3000; - item->page4 = ((uint32_t)ci_req->hw_buf & 0xfffff000) + 0x4000; + item->page0 = (unsigned long)ci_req->hw_buf; + item->page1 = ((unsigned long)ci_req->hw_buf & 0xfffff000) + 0x1000; + item->page2 = ((unsigned long)ci_req->hw_buf & 0xfffff000) + 0x2000; + item->page3 = ((unsigned long)ci_req->hw_buf & 0xfffff000) + 0x3000; + item->page4 = ((unsigned long)ci_req->hw_buf & 0xfffff000) + 0x4000;
- head->next = (unsigned) item; + head->next = (unsigned long)item; head->info = 0;
/* @@ -422,7 +422,7 @@ static void ci_ep_submit_next_request(struct ci_ep *ci_ep) * can use the other to transmit the extra zero-length packet. */ struct ept_queue_item *other_item = ci_get_qtd(num, 0); - item->next = (unsigned)other_item; + item->next = (unsigned long)other_item; item = other_item; item->info = INFO_ACTIVE; } @@ -772,7 +772,7 @@ static int ci_pullup(struct usb_gadget *gadget, int is_on) writel(USBCMD_ITC(MICRO_8FRAME) | USBCMD_RST, &udc->usbcmd); udelay(200);
- writel((unsigned)controller.epts, &udc->epinitaddr); + writel((unsigned long)controller.epts, &udc->epinitaddr);
/* select DEVICE mode */ writel(USBMODE_DEVICE, &udc->usbmode);

On 03/20/2015 05:41 AM, Thierry Reding wrote:
From: Thierry Reding treding@nvidia.com
Fix a slew of pointer to integer cast size mismatch warnings caused by this driver explicitly casting pointers to 32-bit integers. While it is true that the hardware can only deal with 32-bit addresses, truncating using a cast isn't the right solution because the pointer could still be outside of the space addressable using 32-bit addresses.
Seems reasonable at a quick glance, Acked-by: Stephen Warren swarren@nvidia.com

On Friday, March 20, 2015 at 12:41:24 PM, Thierry Reding wrote:
From: Thierry Reding treding@nvidia.com
Fix a slew of pointer to integer cast size mismatch warnings caused by this driver explicitly casting pointers to 32-bit integers. While it is true that the hardware can only deal with 32-bit addresses, truncating using a cast isn't the right solution because the pointer could still be outside of the space addressable using 32-bit addresses.
Cc: Łukasz Majewski l.majewski@samsung.com Cc: Marek Vasut marex@denx.de Signed-off-by: Thierry Reding treding@nvidia.com
I'll be picking the one from Rob here.
Best regards, Marek Vasut

From: Thierry Reding treding@nvidia.com
Fix a printf format mismatch warning seen on 64-bit builds.
Cc: Łukasz Majewski l.majewski@samsung.com Cc: Marek Vasut marex@denx.de Signed-off-by: Thierry Reding treding@nvidia.com --- drivers/usb/gadget/f_mass_storage.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/usb/gadget/f_mass_storage.c b/drivers/usb/gadget/f_mass_storage.c index e045957d0723..71fd49db7f24 100644 --- a/drivers/usb/gadget/f_mass_storage.c +++ b/drivers/usb/gadget/f_mass_storage.c @@ -973,7 +973,7 @@ static int do_write(struct fsg_common *common)
/* If an error occurred, report it and its position */ if (nwritten < amount) { - printf("nwritten:%d amount:%d\n", nwritten, + printf("nwritten:%zd amount:%u\n", nwritten, amount); curlun->sense_data = SS_WRITE_ERROR; curlun->info_valid = 1;

Hi Thierry,
From: Thierry Reding treding@nvidia.com
Fix a printf format mismatch warning seen on 64-bit builds.
Cc: Łukasz Majewski l.majewski@samsung.com Cc: Marek Vasut marex@denx.de Signed-off-by: Thierry Reding treding@nvidia.com
drivers/usb/gadget/f_mass_storage.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/usb/gadget/f_mass_storage.c b/drivers/usb/gadget/f_mass_storage.c index e045957d0723..71fd49db7f24 100644 --- a/drivers/usb/gadget/f_mass_storage.c +++ b/drivers/usb/gadget/f_mass_storage.c @@ -973,7 +973,7 @@ static int do_write(struct fsg_common *common) /* If an error occurred, report it and its position */ if (nwritten < amount) {
printf("nwritten:%d amount:%d\n",
nwritten,
printf("nwritten:%zd amount:%u\n",
nwritten, amount); curlun->sense_data = SS_WRITE_ERROR; curlun->info_valid = 1;
Acked-by: Lukasz Majewski l.majewski@samsung.com Tested-by: Lukasz Majewski l.majewski@samsung.com [test HW - Exynos4210 Trats board]

Hi Thierry,
From: Thierry Reding treding@nvidia.com
Fix a printf format mismatch warning seen on 64-bit builds.
Cc: Łukasz Majewski l.majewski@samsung.com Cc: Marek Vasut marex@denx.de Signed-off-by: Thierry Reding treding@nvidia.com
drivers/usb/gadget/f_mass_storage.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/usb/gadget/f_mass_storage.c b/drivers/usb/gadget/f_mass_storage.c index e045957d0723..71fd49db7f24 100644 --- a/drivers/usb/gadget/f_mass_storage.c +++ b/drivers/usb/gadget/f_mass_storage.c @@ -973,7 +973,7 @@ static int do_write(struct fsg_common *common) /* If an error occurred, report it and its position */ if (nwritten < amount) {
printf("nwritten:%d amount:%d\n",
nwritten,
printf("nwritten:%zd amount:%u\n",
nwritten, amount); curlun->sense_data = SS_WRITE_ERROR; curlun->info_valid = 1;
Reviewed-by: Lukasz Majewski l.majewski@samsung.com

On Friday, March 20, 2015 at 12:41:25 PM, Thierry Reding wrote:
From: Thierry Reding treding@nvidia.com
Fix a printf format mismatch warning seen on 64-bit builds.
Cc: Łukasz Majewski l.majewski@samsung.com Cc: Marek Vasut marex@denx.de Signed-off-by: Thierry Reding treding@nvidia.com
Applied, thanks!
Best regards, Marek Vasut

From: Thierry Reding treding@nvidia.com
Fix a slew of pointer to integer cast size mismatch warnings caused by this driver explicitly casting pointers to 32-bit integers. While it is true that the hardware can only deal with 32-bit addresses, truncating using a cast isn't the right solution because the pointer could still be outside of the space addressable using 32-bit addresses.
Cc: Marek Vasut marex@denx.de Signed-off-by: Thierry Reding treding@nvidia.com --- drivers/usb/host/ehci-hcd.c | 84 ++++++++++++++++++++++----------------------- 1 file changed, 42 insertions(+), 42 deletions(-)
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index f1fb19013281..c2277ddd5870 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c @@ -45,7 +45,7 @@ static struct ehci_ctrl ehcic[CONFIG_USB_MAX_CONTROLLER_COUNT];
#define ALIGN_END_ADDR(type, ptr, size) \ - ((uint32_t)(ptr) + roundup((size) * sizeof(type), USB_DMA_MINALIGN)) + ((unsigned long)(ptr) + roundup((size) * sizeof(type), USB_DMA_MINALIGN))
static struct descriptor { struct usb_hub_descriptor hub; @@ -223,7 +223,7 @@ static int ehci_shutdown(struct ehci_ctrl *ctrl) static int ehci_td_buffer(struct qTD *td, void *buf, size_t sz) { uint32_t delta, next; - uint32_t addr = (uint32_t)buf; + unsigned long addr = (unsigned long)buf; int idx;
if (addr != ALIGN(addr, ARCH_DMA_MINALIGN)) @@ -245,7 +245,7 @@ static int ehci_td_buffer(struct qTD *td, void *buf, size_t sz) }
if (idx == QT_BUFFER_CNT) { - printf("out of buffer pointers (%u bytes left)\n", sz); + printf("out of buffer pointers (%zu bytes left)\n", sz); return -1; }
@@ -354,7 +354,7 @@ ehci_submit_async(struct usb_device *dev, unsigned long pipe, void *buffer, * qTD transfer size will be one page shorter, and the first qTD * data buffer of each transfer will be page-unaligned. */ - if ((uint32_t)buffer & (PKT_ALIGN - 1)) + if ((unsigned long)buffer & (PKT_ALIGN - 1)) xfr_sz--; /* Convert the qTD transfer size to bytes. */ xfr_sz *= EHCI_PAGE_SIZE; @@ -394,7 +394,7 @@ ehci_submit_async(struct usb_device *dev, unsigned long pipe, void *buffer, * qh_overlay.qt_next ...... 13-10 H * - qh_overlay.qt_altnext */ - qh->qh_link = cpu_to_hc32((uint32_t)&ctrl->qh_list | QH_LINK_TYPE_QH); + qh->qh_link = cpu_to_hc32((unsigned long)&ctrl->qh_list | QH_LINK_TYPE_QH); c = (dev->speed != USB_SPEED_HIGH) && !usb_pipeendpoint(pipe); maxpacket = usb_maxpacket(dev, pipe); endpt = QH_ENDPT1_RL(8) | QH_ENDPT1_C(c) | @@ -434,7 +434,7 @@ ehci_submit_async(struct usb_device *dev, unsigned long pipe, void *buffer, goto fail; } /* Update previous qTD! */ - *tdp = cpu_to_hc32((uint32_t)&qtd[qtd_counter]); + *tdp = cpu_to_hc32((unsigned long)&qtd[qtd_counter]); tdp = &qtd[qtd_counter++].qt_next; toggle = 1; } @@ -454,7 +454,7 @@ ehci_submit_async(struct usb_device *dev, unsigned long pipe, void *buffer, * portion of the first page before the buffer start * offset within that page is unusable. */ - xfr_bytes -= (uint32_t)buf_ptr & (EHCI_PAGE_SIZE - 1); + xfr_bytes -= (unsigned long)buf_ptr & (EHCI_PAGE_SIZE - 1); /* * In order to keep each packet within a qTD transfer, * align the qTD transfer size to PKT_ALIGN. @@ -493,7 +493,7 @@ ehci_submit_async(struct usb_device *dev, unsigned long pipe, void *buffer, goto fail; } /* Update previous qTD! */ - *tdp = cpu_to_hc32((uint32_t)&qtd[qtd_counter]); + *tdp = cpu_to_hc32((unsigned long)&qtd[qtd_counter]); tdp = &qtd[qtd_counter++].qt_next; /* * Data toggle has to be adjusted since the qTD transfer @@ -524,21 +524,21 @@ ehci_submit_async(struct usb_device *dev, unsigned long pipe, void *buffer, QT_TOKEN_STATUS(QT_TOKEN_STATUS_ACTIVE); qtd[qtd_counter].qt_token = cpu_to_hc32(token); /* Update previous qTD! */ - *tdp = cpu_to_hc32((uint32_t)&qtd[qtd_counter]); + *tdp = cpu_to_hc32((unsigned long)&qtd[qtd_counter]); tdp = &qtd[qtd_counter++].qt_next; }
- ctrl->qh_list.qh_link = cpu_to_hc32((uint32_t)qh | QH_LINK_TYPE_QH); + ctrl->qh_list.qh_link = cpu_to_hc32((unsigned long)qh | QH_LINK_TYPE_QH);
/* Flush dcache */ - flush_dcache_range((uint32_t)&ctrl->qh_list, + flush_dcache_range((unsigned long)&ctrl->qh_list, ALIGN_END_ADDR(struct QH, &ctrl->qh_list, 1)); - flush_dcache_range((uint32_t)qh, ALIGN_END_ADDR(struct QH, qh, 1)); - flush_dcache_range((uint32_t)qtd, + flush_dcache_range((unsigned long)qh, ALIGN_END_ADDR(struct QH, qh, 1)); + flush_dcache_range((unsigned long)qtd, ALIGN_END_ADDR(struct qTD, qtd, qtd_count));
/* Set async. queue head pointer. */ - ehci_writel(&ctrl->hcor->or_asynclistaddr, (uint32_t)&ctrl->qh_list); + ehci_writel(&ctrl->hcor->or_asynclistaddr, (unsigned long)&ctrl->qh_list);
usbsts = ehci_readl(&ctrl->hcor->or_usbsts); ehci_writel(&ctrl->hcor->or_usbsts, (usbsts & 0x3f)); @@ -561,11 +561,11 @@ ehci_submit_async(struct usb_device *dev, unsigned long pipe, void *buffer, timeout = USB_TIMEOUT_MS(pipe); do { /* Invalidate dcache */ - invalidate_dcache_range((uint32_t)&ctrl->qh_list, + invalidate_dcache_range((unsigned long)&ctrl->qh_list, ALIGN_END_ADDR(struct QH, &ctrl->qh_list, 1)); - invalidate_dcache_range((uint32_t)qh, + invalidate_dcache_range((unsigned long)qh, ALIGN_END_ADDR(struct QH, qh, 1)); - invalidate_dcache_range((uint32_t)qtd, + invalidate_dcache_range((unsigned long)qtd, ALIGN_END_ADDR(struct qTD, qtd, qtd_count));
token = hc32_to_cpu(vtd->qt_token); @@ -583,8 +583,8 @@ ehci_submit_async(struct usb_device *dev, unsigned long pipe, void *buffer, * dangerous operation, it's responsibility of the calling * code to make sure enough space is reserved. */ - invalidate_dcache_range((uint32_t)buffer, - ALIGN((uint32_t)buffer + length, ARCH_DMA_MINALIGN)); + invalidate_dcache_range((unsigned long)buffer, + ALIGN((unsigned long)buffer + length, ARCH_DMA_MINALIGN));
/* Check that the TD processing happened */ if (QT_TOKEN_GET_STATUS(token) & QT_TOKEN_STATUS_ACTIVE) @@ -968,7 +968,7 @@ int usb_lowlevel_init(int index, enum usb_init_type init, void **controller)
/* Set head of reclaim list */ memset(qh_list, 0, sizeof(*qh_list)); - qh_list->qh_link = cpu_to_hc32((uint32_t)qh_list | QH_LINK_TYPE_QH); + qh_list->qh_link = cpu_to_hc32((unsigned long)qh_list | QH_LINK_TYPE_QH); qh_list->qh_endpt1 = cpu_to_hc32(QH_ENDPT1_H(1) | QH_ENDPT1_EPS(USB_SPEED_HIGH)); qh_list->qh_overlay.qt_next = cpu_to_hc32(QT_NEXT_TERMINATE); @@ -976,11 +976,11 @@ int usb_lowlevel_init(int index, enum usb_init_type init, void **controller) qh_list->qh_overlay.qt_token = cpu_to_hc32(QT_TOKEN_STATUS(QT_TOKEN_STATUS_HALTED));
- flush_dcache_range((uint32_t)qh_list, + flush_dcache_range((unsigned long)qh_list, ALIGN_END_ADDR(struct QH, qh_list, 1));
/* Set async. queue head pointer. */ - ehci_writel(&ehcic[index].hcor->or_asynclistaddr, (uint32_t)qh_list); + ehci_writel(&ehcic[index].hcor->or_asynclistaddr, (unsigned long)qh_list);
/* * Set up periodic list @@ -993,7 +993,7 @@ int usb_lowlevel_init(int index, enum usb_init_type init, void **controller) periodic->qh_overlay.qt_next = cpu_to_hc32(QT_NEXT_TERMINATE); periodic->qh_overlay.qt_altnext = cpu_to_hc32(QT_NEXT_TERMINATE);
- flush_dcache_range((uint32_t)periodic, + flush_dcache_range((unsigned long)periodic, ALIGN_END_ADDR(struct QH, periodic, 1));
/* @@ -1011,17 +1011,17 @@ int usb_lowlevel_init(int index, enum usb_init_type init, void **controller) if (!ehcic[index].periodic_list) return -ENOMEM; for (i = 0; i < 1024; i++) { - ehcic[index].periodic_list[i] = cpu_to_hc32((uint32_t)periodic - | QH_LINK_TYPE_QH); + ehcic[index].periodic_list[i] = + cpu_to_hc32((unsigned long)periodic | QH_LINK_TYPE_QH); }
- flush_dcache_range((uint32_t)ehcic[index].periodic_list, + flush_dcache_range((unsigned long)ehcic[index].periodic_list, ALIGN_END_ADDR(uint32_t, ehcic[index].periodic_list, 1024));
/* Set periodic list base address */ ehci_writel(&ehcic[index].hcor->or_periodiclistbase, - (uint32_t)ehcic[index].periodic_list); + (unsigned long)ehcic[index].periodic_list);
reg = ehci_readl(&ehcic[index].hccr->cr_hcsparams); descriptor.hub.bNbrPorts = HCS_N_PORTS(reg); @@ -1103,7 +1103,7 @@ struct int_queue { struct qTD *tds; };
-#define NEXT_QH(qh) (struct QH *)(hc32_to_cpu((qh)->qh_link) & ~0x1f) +#define NEXT_QH(qh) (struct QH *)(unsigned long)(hc32_to_cpu((qh)->qh_link) & ~0x1f)
static int enable_periodic(struct ehci_ctrl *ctrl) @@ -1214,11 +1214,11 @@ create_int_queue(struct usb_device *dev, unsigned long pipe, int queuesize, struct qTD *td = result->tds + i; void **buf = &qh->buffer;
- qh->qh_link = cpu_to_hc32((uint32_t)(qh+1) | QH_LINK_TYPE_QH); + qh->qh_link = cpu_to_hc32((unsigned long)(qh+1) | QH_LINK_TYPE_QH); if (i == queuesize - 1) qh->qh_link = cpu_to_hc32(QH_LINK_TERMINATE);
- qh->qh_overlay.qt_next = cpu_to_hc32((uint32_t)td); + qh->qh_overlay.qt_next = cpu_to_hc32((unsigned long)td); qh->qh_overlay.qt_altnext = cpu_to_hc32(QT_NEXT_TERMINATE); qh->qh_endpt1 = cpu_to_hc32((0 << 28) | /* No NAK reload (ehci 4.9) */ @@ -1244,7 +1244,7 @@ create_int_queue(struct usb_device *dev, unsigned long pipe, int queuesize, ((usb_pipein(pipe) ? 1 : 0) << 8) | /* IN/OUT token */ 0x80); /* active */ td->qt_buffer[0] = - cpu_to_hc32((uint32_t)buffer + i * elementsize); + cpu_to_hc32((unsigned long)buffer + i * elementsize); td->qt_buffer[1] = cpu_to_hc32((td->qt_buffer[0] + 0x1000) & ~0xfff); td->qt_buffer[2] = @@ -1257,13 +1257,13 @@ create_int_queue(struct usb_device *dev, unsigned long pipe, int queuesize, *buf = buffer + i * elementsize; }
- flush_dcache_range((uint32_t)buffer, + flush_dcache_range((unsigned long)buffer, ALIGN_END_ADDR(char, buffer, queuesize * elementsize)); - flush_dcache_range((uint32_t)result->first, + flush_dcache_range((unsigned long)result->first, ALIGN_END_ADDR(struct QH, result->first, queuesize)); - flush_dcache_range((uint32_t)result->tds, + flush_dcache_range((unsigned long)result->tds, ALIGN_END_ADDR(struct qTD, result->tds, queuesize));
@@ -1277,11 +1277,11 @@ create_int_queue(struct usb_device *dev, unsigned long pipe, int queuesize, /* hook up to periodic list */ struct QH *list = &ctrl->periodic_queue; result->last->qh_link = list->qh_link; - list->qh_link = cpu_to_hc32((uint32_t)result->first | QH_LINK_TYPE_QH); + list->qh_link = cpu_to_hc32((unsigned long)result->first | QH_LINK_TYPE_QH);
- flush_dcache_range((uint32_t)result->last, + flush_dcache_range((unsigned long)result->last, ALIGN_END_ADDR(struct QH, result->last, 1)); - flush_dcache_range((uint32_t)list, + flush_dcache_range((unsigned long)list, ALIGN_END_ADDR(struct QH, list, 1));
if (enable_periodic(ctrl) < 0) { @@ -1316,7 +1316,7 @@ void *poll_int_queue(struct usb_device *dev, struct int_queue *queue) } /* still active */ cur_td = &queue->tds[queue->current - queue->first]; - invalidate_dcache_range((uint32_t)cur_td, + invalidate_dcache_range((unsigned long)cur_td, ALIGN_END_ADDR(struct qTD, cur_td, 1)); if (QT_TOKEN_GET_STATUS(hc32_to_cpu(cur_td->qt_token)) & QT_TOKEN_STATUS_ACTIVE) { @@ -1329,7 +1329,7 @@ void *poll_int_queue(struct usb_device *dev, struct int_queue *queue) else queue->current = NULL;
- invalidate_dcache_range((uint32_t)cur->buffer, + invalidate_dcache_range((unsigned long)cur->buffer, ALIGN_END_ADDR(char, cur->buffer, queue->elementsize));
@@ -1359,7 +1359,7 @@ destroy_int_queue(struct usb_device *dev, struct int_queue *queue) if (NEXT_QH(cur) == queue->first) { debug("found candidate. removing from chain\n"); cur->qh_link = queue->last->qh_link; - flush_dcache_range((uint32_t)cur, + flush_dcache_range((unsigned long)cur, ALIGN_END_ADDR(struct QH, cur, 1)); result = 0; break; @@ -1411,8 +1411,8 @@ submit_int_msg(struct usb_device *dev, unsigned long pipe, void *buffer, }
if (backbuffer != buffer) { - debug("got wrong buffer back (%x instead of %x)\n", - (uint32_t)backbuffer, (uint32_t)buffer); + debug("got wrong buffer back (%p instead of %p)\n", + backbuffer, buffer); return -EINVAL; }

On Friday, March 20, 2015 at 12:41:26 PM, Thierry Reding wrote:
From: Thierry Reding treding@nvidia.com
Fix a slew of pointer to integer cast size mismatch warnings caused by this driver explicitly casting pointers to 32-bit integers. While it is true that the hardware can only deal with 32-bit addresses, truncating using a cast isn't the right solution because the pointer could still be outside of the space addressable using 32-bit addresses.
Cc: Marek Vasut marex@denx.de Signed-off-by: Thierry Reding treding@nvidia.com
I'll be picking the one from Rob here instead.
Best regards, Marek Vasut

From: Thierry Reding treding@nvidia.com
Cast pointers to unsigned long instead of a sized 32-bit type to avoid pointer to integer cast size mismatch warnings.
Cc: Tom Warren twarren@nvidia.com Cc: Marek Vasut marex@denx.de Signed-off-by: Thierry Reding treding@nvidia.com --- drivers/usb/host/ehci-tegra.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c index b5ad1e35e54c..c6bfbe399941 100644 --- a/drivers/usb/host/ehci-tegra.c +++ b/drivers/usb/host/ehci-tegra.c @@ -196,7 +196,7 @@ void ehci_powerup_fixup(uint32_t *status_reg, uint32_t *reg) if (controller->has_hostpc) *reg |= EHCI_PS_PE;
- if (((u32)status_reg & TEGRA_USB_ADDR_MASK) != port_addr_clear_csc) + if (((unsigned long)status_reg & TEGRA_USB_ADDR_MASK) != port_addr_clear_csc) return; /* For EHCI_PS_CSC to be cleared in ehci_hcd.c */ if (ehci_readl(status_reg) & EHCI_PS_CSC) @@ -434,7 +434,7 @@ static int init_utmi_usb_controller(struct fdt_usb *config, reset_set_enable(PERIPH_ID_USBD, 0); } usb1ctlr = (struct usb_ctlr *) - ((u32)config->reg & USB1_ADDR_MASK); + ((unsigned long)config->reg & USB1_ADDR_MASK); val = readl(&usb1ctlr->utmip_bias_cfg0); setbits_le32(&val, UTMIP_HSDISCON_LEVEL_MSB); clrsetbits_le32(&val, UTMIP_HSDISCON_LEVEL_MASK, @@ -537,7 +537,7 @@ static int init_utmi_usb_controller(struct fdt_usb *config, * controllers and can be controlled from USB1 only. */ usb1ctlr = (struct usb_ctlr *) - ((u32)config->reg & USB1_ADDR_MASK); + ((unsigned long)config->reg & USB1_ADDR_MASK); clrbits_le32(&usb1ctlr->utmip_bias_cfg0, UTMIP_BIASPD); udelay(25); clrbits_le32(&usb1ctlr->utmip_bias_cfg1, @@ -675,7 +675,7 @@ static int fdt_decode_usb(const void *blob, int node, struct fdt_usb *config) config->has_legacy_mode = fdtdec_get_bool(blob, node, "nvidia,has-legacy-mode"); if (config->has_legacy_mode) - port_addr_clear_csc = (u32) config->reg; + port_addr_clear_csc = (unsigned long)config->reg; config->periph_id = clock_decode_periph_id(blob, node); if (config->periph_id == PERIPH_ID_NONE) { debug("%s: Missing/invalid peripheral ID\n", __func__);

On Friday, March 20, 2015 at 12:41:27 PM, Thierry Reding wrote:
From: Thierry Reding treding@nvidia.com
Cast pointers to unsigned long instead of a sized 32-bit type to avoid pointer to integer cast size mismatch warnings.
Cc: Tom Warren twarren@nvidia.com Cc: Marek Vasut marex@denx.de Signed-off-by: Thierry Reding treding@nvidia.com
Applied, thanks!
Best regards, Marek Vasut

From: Thierry Reding treding@nvidia.com
Use the %lx printf specifier to print unsigned long variables to avoid a build warning on 64-bit.
Cc: Simon Glass sjg@chromium.org Signed-off-by: Thierry Reding treding@nvidia.com --- lib/fdtdec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/fdtdec.c b/lib/fdtdec.c index 1a0268a3f9f5..0776c3004cbd 100644 --- a/lib/fdtdec.c +++ b/lib/fdtdec.c @@ -103,8 +103,8 @@ fdt_addr_t fdtdec_get_addr_size(const void *blob, int node, size = (fdt_size_t *)((char *)cell + sizeof(fdt_addr_t)); *sizep = fdt_size_to_cpu(*size); - debug("addr=%08lx, size=%08x\n", - (ulong)addr, *sizep); + debug("addr=%08lx, size=%08lx\n", + (ulong)addr, (ulong)*sizep); } else { debug("%08lx\n", (ulong)addr); }
participants (5)
-
Joe Hershberger
-
Lukasz Majewski
-
Marek Vasut
-
Stephen Warren
-
Thierry Reding