- Assorted warning fixes, io read/write bugfix
This commit is contained in:
commit
11c41192ec
@ -44,15 +44,15 @@ static inline phys_addr_t map_to_sysmem(const void *ptr)
|
||||
* read/writes. We define __arch_*[bl] here, and leave __arch_*w
|
||||
* to the architecture specific code.
|
||||
*/
|
||||
#define __arch_getb(a) (*(unsigned char *)(a))
|
||||
#define __arch_getw(a) (*(unsigned short *)(a))
|
||||
#define __arch_getl(a) (*(unsigned int *)(a))
|
||||
#define __arch_getq(a) (*(unsigned long long *)(a))
|
||||
#define __arch_getb(a) (*(volatile unsigned char *)(a))
|
||||
#define __arch_getw(a) (*(volatile unsigned short *)(a))
|
||||
#define __arch_getl(a) (*(volatile unsigned int *)(a))
|
||||
#define __arch_getq(a) (*(volatile unsigned long long *)(a))
|
||||
|
||||
#define __arch_putb(v, a) (*(unsigned char *)(a) = (v))
|
||||
#define __arch_putw(v, a) (*(unsigned short *)(a) = (v))
|
||||
#define __arch_putl(v, a) (*(unsigned int *)(a) = (v))
|
||||
#define __arch_putq(v, a) (*(unsigned long long *)(a) = (v))
|
||||
#define __arch_putb(v, a) (*(volatile unsigned char *)(a) = (v))
|
||||
#define __arch_putw(v, a) (*(volatile unsigned short *)(a) = (v))
|
||||
#define __arch_putl(v, a) (*(volatile unsigned int *)(a) = (v))
|
||||
#define __arch_putq(v, a) (*(volatile unsigned long long *)(a) = (v))
|
||||
|
||||
#define __raw_writeb(v, a) __arch_putb(v, a)
|
||||
#define __raw_writew(v, a) __arch_putw(v, a)
|
||||
|
@ -118,10 +118,10 @@ void *board_fdt_blob_setup(void)
|
||||
{
|
||||
if (IS_ENABLED(CONFIG_OF_SEPARATE)) {
|
||||
if (gd->arch.firmware_fdt_addr)
|
||||
return (ulong *)gd->arch.firmware_fdt_addr;
|
||||
else
|
||||
return (ulong *)&_end;
|
||||
return (ulong *)(uintptr_t)gd->arch.firmware_fdt_addr;
|
||||
}
|
||||
|
||||
return (ulong *)&_end;
|
||||
}
|
||||
|
||||
int board_init(void)
|
||||
|
@ -15,10 +15,10 @@ void *board_fdt_blob_setup(void)
|
||||
{
|
||||
if (IS_ENABLED(CONFIG_OF_SEPARATE)) {
|
||||
if (gd->arch.firmware_fdt_addr)
|
||||
return (ulong *)gd->arch.firmware_fdt_addr;
|
||||
else
|
||||
return (ulong *)&_end;
|
||||
return (ulong *)(uintptr_t)gd->arch.firmware_fdt_addr;
|
||||
}
|
||||
|
||||
return (ulong *)&_end;
|
||||
}
|
||||
|
||||
int board_init(void)
|
||||
|
2
drivers/cache/cache-sifive-ccache.c
vendored
2
drivers/cache/cache-sifive-ccache.c
vendored
@ -38,7 +38,7 @@ static int sifive_ccache_get_info(struct udevice *dev, struct cache_info *info)
|
||||
{
|
||||
struct sifive_ccache *priv = dev_get_priv(dev);
|
||||
|
||||
info->base = (phys_addr_t)priv->base;
|
||||
info->base = (uintptr_t)priv->base;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -653,9 +653,9 @@ static int sifive_prci_probe(struct udevice *dev)
|
||||
struct prci_clk_desc *data =
|
||||
(struct prci_clk_desc *)dev_get_driver_data(dev);
|
||||
|
||||
pd->va = (void *)dev_read_addr(dev);
|
||||
if (IS_ERR(pd->va))
|
||||
return PTR_ERR(pd->va);
|
||||
pd->va = dev_read_addr_ptr(dev);
|
||||
if (!pd->va)
|
||||
return -EINVAL;
|
||||
|
||||
err = clk_get_by_index(dev, 0, &pd->parent_hfclk);
|
||||
if (err)
|
||||
|
@ -93,6 +93,13 @@ fdt_addr_t devfdt_get_addr_index(const struct udevice *dev, int index)
|
||||
#endif
|
||||
}
|
||||
|
||||
void *devfdt_get_addr_index_ptr(const struct udevice *dev, int index)
|
||||
{
|
||||
fdt_addr_t addr = devfdt_get_addr_index(dev, index);
|
||||
|
||||
return (addr == FDT_ADDR_T_NONE) ? NULL : (void *)(uintptr_t)addr;
|
||||
}
|
||||
|
||||
fdt_addr_t devfdt_get_addr_size_index(const struct udevice *dev, int index,
|
||||
fdt_size_t *size)
|
||||
{
|
||||
@ -155,9 +162,7 @@ fdt_addr_t devfdt_get_addr(const struct udevice *dev)
|
||||
|
||||
void *devfdt_get_addr_ptr(const struct udevice *dev)
|
||||
{
|
||||
fdt_addr_t addr = devfdt_get_addr_index(dev, 0);
|
||||
|
||||
return (addr == FDT_ADDR_T_NONE) ? NULL : (void *)(uintptr_t)addr;
|
||||
return devfdt_get_addr_index_ptr(dev, 0);
|
||||
}
|
||||
|
||||
void *devfdt_remap_addr_index(const struct udevice *dev, int index)
|
||||
|
@ -157,13 +157,11 @@ static const struct dm_gpio_ops sifive_gpio_ops = {
|
||||
static int sifive_gpio_of_to_plat(struct udevice *dev)
|
||||
{
|
||||
struct sifive_gpio_plat *plat = dev_get_plat(dev);
|
||||
fdt_addr_t addr;
|
||||
|
||||
addr = dev_read_addr(dev);
|
||||
if (addr == FDT_ADDR_T_NONE)
|
||||
plat->base = dev_read_addr_ptr(dev);
|
||||
if (!plat->base)
|
||||
return -EINVAL;
|
||||
|
||||
plat->base = (void *)addr;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -516,7 +516,7 @@ static int ocores_i2c_probe(struct udevice *dev)
|
||||
u32 clock_frequency_khz;
|
||||
int ret;
|
||||
|
||||
bus->base = (void __iomem *)devfdt_get_addr(dev);
|
||||
bus->base = dev_read_addr_ptr(dev);
|
||||
|
||||
if (dev_read_u32(dev, "reg-shift", &bus->reg_shift)) {
|
||||
/* no 'reg-shift', check for deprecated 'regstep' */
|
||||
|
@ -574,14 +574,9 @@ static int macb_phy_find(struct macb_device *macb, const char *name)
|
||||
#ifdef CONFIG_DM_ETH
|
||||
static int macb_sifive_clk_init(struct udevice *dev, ulong rate)
|
||||
{
|
||||
fdt_addr_t addr;
|
||||
void *gemgxl_regs;
|
||||
|
||||
addr = dev_read_addr_index(dev, 1);
|
||||
if (addr == FDT_ADDR_T_NONE)
|
||||
return -ENODEV;
|
||||
|
||||
gemgxl_regs = (void __iomem *)addr;
|
||||
gemgxl_regs = dev_read_addr_index_ptr(dev, 1);
|
||||
if (!gemgxl_regs)
|
||||
return -ENODEV;
|
||||
|
||||
@ -1383,7 +1378,7 @@ static int macb_eth_probe(struct udevice *dev)
|
||||
macb->phy_addr = ofnode_read_u32_default(phandle_args.node,
|
||||
"reg", -1);
|
||||
|
||||
macb->regs = (void *)pdata->iobase;
|
||||
macb->regs = (void *)(uintptr_t)pdata->iobase;
|
||||
|
||||
macb->is_big_endian = (cpu_to_be32(0x12345678) == 0x12345678);
|
||||
|
||||
@ -1444,7 +1439,7 @@ static int macb_eth_of_to_plat(struct udevice *dev)
|
||||
{
|
||||
struct eth_pdata *pdata = dev_get_plat(dev);
|
||||
|
||||
pdata->iobase = (phys_addr_t)dev_remap_addr(dev);
|
||||
pdata->iobase = (uintptr_t)dev_remap_addr(dev);
|
||||
if (!pdata->iobase)
|
||||
return -EINVAL;
|
||||
|
||||
|
@ -313,7 +313,7 @@ static int sifive_ddr_setup(struct udevice *dev)
|
||||
sifive_ddr_phy_fixup(denali_phy);
|
||||
|
||||
/* check size */
|
||||
priv->info.size = get_ram_size((long *)priv->info.base,
|
||||
priv->info.size = get_ram_size((long *)(uintptr_t)priv->info.base,
|
||||
ddr_size);
|
||||
|
||||
debug("%s : %lx\n", __func__, (uintptr_t)priv->info.size);
|
||||
@ -369,9 +369,9 @@ static int sifive_ddr_probe(struct udevice *dev)
|
||||
return ret;
|
||||
}
|
||||
|
||||
priv->ctl = (struct sifive_ddrctl *)dev_read_addr_index(dev, 0);
|
||||
priv->phy = (struct sifive_ddrphy *)dev_read_addr_index(dev, 1);
|
||||
priv->physical_filter_ctrl = (u32 *)dev_read_addr_index(dev, 2);
|
||||
priv->ctl = (struct sifive_ddrctl *)dev_read_addr_index_ptr(dev, 0);
|
||||
priv->phy = (struct sifive_ddrphy *)dev_read_addr_index_ptr(dev, 1);
|
||||
priv->physical_filter_ctrl = (u32 *)dev_read_addr_index_ptr(dev, 2);
|
||||
|
||||
return sifive_ddr_setup(dev);
|
||||
#endif
|
||||
|
@ -92,6 +92,18 @@ void *devfdt_map_physmem(const struct udevice *dev, unsigned long size);
|
||||
*/
|
||||
fdt_addr_t devfdt_get_addr_index(const struct udevice *dev, int index);
|
||||
|
||||
/**
|
||||
* devfdt_get_addr_index_ptr() - Return indexed pointer to the address of the
|
||||
* reg property of a device
|
||||
*
|
||||
* @dev: Pointer to a device
|
||||
* @index: the 'reg' property can hold a list of <addr, size> pairs
|
||||
* and @index is used to select which one is required
|
||||
*
|
||||
* @return Pointer to addr, or NULL if there is no such property
|
||||
*/
|
||||
void *devfdt_get_addr_index_ptr(const struct udevice *dev, int index);
|
||||
|
||||
/**
|
||||
* devfdt_get_addr_size_index() - Get the indexed reg property of a device
|
||||
*
|
||||
|
@ -180,6 +180,18 @@ int dev_read_size(const struct udevice *dev, const char *propname);
|
||||
*/
|
||||
fdt_addr_t dev_read_addr_index(const struct udevice *dev, int index);
|
||||
|
||||
/**
|
||||
* dev_read_addr_index_ptr() - Get the indexed reg property of a device
|
||||
* as a pointer
|
||||
*
|
||||
* @dev: Device to read from
|
||||
* @index: the 'reg' property can hold a list of <addr, size> pairs
|
||||
* and @index is used to select which one is required
|
||||
*
|
||||
* @return pointer or NULL if not found
|
||||
*/
|
||||
void *dev_read_addr_index_ptr(const struct udevice *dev, int index);
|
||||
|
||||
/**
|
||||
* dev_read_addr_size_index() - Get the indexed reg property of a device
|
||||
*
|
||||
@ -805,6 +817,12 @@ static inline fdt_addr_t dev_read_addr_index(const struct udevice *dev,
|
||||
return devfdt_get_addr_index(dev, index);
|
||||
}
|
||||
|
||||
static inline void *dev_read_addr_index_ptr(const struct udevice *dev,
|
||||
int index)
|
||||
{
|
||||
return devfdt_get_addr_index_ptr(dev, index);
|
||||
}
|
||||
|
||||
static inline fdt_addr_t dev_read_addr_size_index(const struct udevice *dev,
|
||||
int index,
|
||||
fdt_size_t *size)
|
||||
|
Loading…
Reference in New Issue
Block a user