Re: [PATCH 8/9] bus: brcmstb_gisb: Honor the "big-endian" and "native-endian" DT properties

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 25/11/14 16:49, Kevin Cernekee wrote:
> On chips strapped for BE, we'll need to use ioread32be/iowrite32be instead of
> ioread32/iowrite32.

Has of_device_is_big_endian() been merged in a tree now, I am not seeing
it in Linus' tree, but have not look at Grant's tree yet. Thanks

> 
> Signed-off-by: Kevin Cernekee <cernekee@xxxxxxxxx>
> ---
>  drivers/bus/brcmstb_gisb.c | 13 +++++++++++--
>  1 file changed, 11 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/bus/brcmstb_gisb.c b/drivers/bus/brcmstb_gisb.c
> index 172908d..969b992 100644
> --- a/drivers/bus/brcmstb_gisb.c
> +++ b/drivers/bus/brcmstb_gisb.c
> @@ -90,6 +90,7 @@ static const int gisb_offsets_bcm7445[] = {
>  struct brcmstb_gisb_arb_device {
>  	void __iomem	*base;
>  	const int	*gisb_offsets;
> +	bool		big_endian;
>  	struct mutex	lock;
>  	struct list_head next;
>  	u32 valid_mask;
> @@ -106,7 +107,10 @@ static u32 gisb_read(struct brcmstb_gisb_arb_device *gdev, int reg)
>  	if (offset == -1)
>  		return 1;
>  
> -	return ioread32(gdev->base + offset);
> +	if (gdev->big_endian)
> +		return ioread32be(gdev->base + offset);
> +	else
> +		return ioread32(gdev->base + offset);
>  }
>  
>  static void gisb_write(struct brcmstb_gisb_arb_device *gdev, u32 val, int reg)
> @@ -115,7 +119,11 @@ static void gisb_write(struct brcmstb_gisb_arb_device *gdev, u32 val, int reg)
>  
>  	if (offset == -1)
>  		return;
> -	iowrite32(val, gdev->base + reg);
> +
> +	if (gdev->big_endian)
> +		iowrite32be(val, gdev->base + reg);
> +	else
> +		iowrite32(val, gdev->base + reg);
>  }
>  
>  static ssize_t gisb_arb_get_timeout(struct device *dev,
> @@ -300,6 +308,7 @@ static int brcmstb_gisb_arb_probe(struct platform_device *pdev)
>  		return -EINVAL;
>  	}
>  	gdev->gisb_offsets = of_id->data;
> +	gdev->big_endian = of_device_is_big_endian(dn);
>  
>  	err = devm_request_irq(&pdev->dev, timeout_irq,
>  				brcmstb_gisb_timeout_handler, 0, pdev->name,
> 


-- 
Florian
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]
  Powered by Linux