Re: [PATCH 2/2] misc: Add devicetree SRAM driver

Alexander Shiyan shc_work at mail.ru
Wed Jan 29 05:26:45 EST 2014


Среда, 29 января 2014, 10:30 +01:00 от Sascha Hauer <s.hauer at pengutronix.de>:
> Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
> ---
...
> +++ b/drivers/misc/sram.c
> @@ -0,0 +1,75 @@
> +/*
> + * drivers/misc/sram.c - generic memory mapped SRAM driver
...
> +static int sram_probe(struct device_d *dev)
> +{
> +	struct sram *sram;
> +	struct resource *res;
> +	void __iomem *base;
> +	int ret;
> +
> +	base = dev_request_mem_region(dev, 0);
> +	if (!base)
> +		return -EBUSY;
> +
> +	sram = xzalloc(sizeof(*sram));
> +
> +	sram->cdev.name = asprintf("sram%d",
> +			cdev_find_free_index("sram"));
> +
> +	res = dev_get_resource(dev, 0);
> +
> +	sram->cdev.size = (unsigned long)resource_size(res);
> +	sram->cdev.ops = &memops;
> +	sram->cdev.dev = dev;
> +
> +	ret = devfs_create(&sram->cdev);
> +	if (ret)
> +		return ret;
> +
> +	return 0;
> +}

Probably we should include clock handling in this driver to make it
compatible with kernel version of this driver.

---


More information about the barebox mailing list