mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-21 06:33:41 +00:00
c6c731fe31
Add support for NXP layerscape ls1043ardb 64b/32b Dev board. LS1043a is an SoC with 4x64-bit up to 1.6 GHz ARMv8 A53 cores. ls1043ardb support features as: 2GB DDR4, 128MB NOR/512MB NAND, USB3.0, eSDHC, I2C, GPIO, PCIe/Mini-PCIe, 6x1G/1x10G network port, etc. 64b/32b ls1043ardb target is using 4.4 kernel, and rcw/u-boot/fman images from NXP QorIQ SDK release. All of 4.4 kernel patches porting from SDK release or upstream. QorIQ SDK ISOs can be downloaded from this location: http://www.nxp.com/products/software-and-tools/run-time-software/linux-sdk/linux-sdk-for-qoriq-processors:SDKLINUX Signed-off-by: Yutang Jiang <yutang.jiang@nxp.com>
139 lines
3.9 KiB
Diff
139 lines
3.9 KiB
Diff
From f7792176d939e79b4f525114a95d0fd8266bef8e Mon Sep 17 00:00:00 2001
|
|
From: Madalin Bucur <madalin.bucur@freescale.com>
|
|
Date: Wed, 19 Nov 2014 13:06:54 +0200
|
|
Subject: [PATCH 18/70] devres: add devm_alloc_percpu()
|
|
|
|
Introduce managed counterparts for alloc_percpu() and free_percpu().
|
|
Add devm_alloc_percpu() and devm_free_percpu() into the managed
|
|
interfaces list.
|
|
|
|
Signed-off-by: Madalin Bucur <madalin.bucur@freescale.com>
|
|
|
|
Change-Id: I93546348e7b0e1974fda8b6c7a3b3710ce45b724
|
|
Reviewed-on: http://git.am.freescale.net:8181/24140
|
|
Reviewed-by: Madalin-Cristian Bucur <madalin.bucur@freescale.com>
|
|
Tested-by: Madalin-Cristian Bucur <madalin.bucur@freescale.com>
|
|
|
|
Conflicts:
|
|
Documentation/driver-model/devres.txt
|
|
drivers/base/devres.c
|
|
|
|
Conflicts:
|
|
drivers/base/devres.c
|
|
---
|
|
Documentation/driver-model/devres.txt | 4 +++
|
|
drivers/base/devres.c | 63 +++++++++++++++++++++++++++++++++
|
|
include/linux/device.h | 19 ++++++++++
|
|
3 files changed, 86 insertions(+)
|
|
|
|
--- a/Documentation/driver-model/devres.txt
|
|
+++ b/Documentation/driver-model/devres.txt
|
|
@@ -321,6 +321,10 @@ PHY
|
|
devm_usb_get_phy()
|
|
devm_usb_put_phy()
|
|
|
|
+PER-CPU MEM
|
|
+ devm_alloc_percpu()
|
|
+ devm_free_percpu()
|
|
+
|
|
PINCTRL
|
|
devm_pinctrl_get()
|
|
devm_pinctrl_put()
|
|
--- a/drivers/base/devres.c
|
|
+++ b/drivers/base/devres.c
|
|
@@ -985,3 +985,66 @@ void devm_free_pages(struct device *dev,
|
|
&devres));
|
|
}
|
|
EXPORT_SYMBOL_GPL(devm_free_pages);
|
|
+
|
|
+static void devm_percpu_release(struct device *dev, void *pdata)
|
|
+{
|
|
+ void __percpu *p;
|
|
+
|
|
+ p = *(void __percpu **)pdata;
|
|
+ free_percpu(p);
|
|
+}
|
|
+
|
|
+static int devm_percpu_match(struct device *dev, void *data, void *p)
|
|
+{
|
|
+ struct devres *devr = container_of(data, struct devres, data);
|
|
+
|
|
+ return *(void **)devr->data == p;
|
|
+}
|
|
+
|
|
+/**
|
|
+ * __devm_alloc_percpu - Resource-managed alloc_percpu
|
|
+ * @dev: Device to allocate per-cpu memory for
|
|
+ * @size: Size of per-cpu memory to allocate
|
|
+ * @align: Alignement of per-cpu memory to allocate
|
|
+ *
|
|
+ * Managed alloc_percpu. Per-cpu memory allocated with this function is
|
|
+ * automatically freed on driver detach.
|
|
+ *
|
|
+ * RETURNS:
|
|
+ * Pointer to allocated memory on success, NULL on failure.
|
|
+ */
|
|
+void __percpu *__devm_alloc_percpu(struct device *dev, size_t size,
|
|
+ size_t align)
|
|
+{
|
|
+ void *p;
|
|
+ void __percpu *pcpu;
|
|
+
|
|
+ pcpu = __alloc_percpu(size, align);
|
|
+ if (!pcpu)
|
|
+ return NULL;
|
|
+
|
|
+ p = devres_alloc(devm_percpu_release, sizeof(void *), GFP_KERNEL);
|
|
+ if (!p)
|
|
+ return NULL;
|
|
+
|
|
+ *(void __percpu **)p = pcpu;
|
|
+
|
|
+ devres_add(dev, p);
|
|
+
|
|
+ return pcpu;
|
|
+}
|
|
+EXPORT_SYMBOL_GPL(__devm_alloc_percpu);
|
|
+
|
|
+/**
|
|
+ * devm_free_percpu - Resource-managed free_percpu
|
|
+ * @dev: Device this memory belongs to
|
|
+ * @pdata: Per-cpu memory to free
|
|
+ *
|
|
+ * Free memory allocated with devm_alloc_percpu().
|
|
+ */
|
|
+void devm_free_percpu(struct device *dev, void __percpu *pdata)
|
|
+{
|
|
+ WARN_ON(devres_destroy(dev, devm_percpu_release, devm_percpu_match,
|
|
+ (void *)pdata));
|
|
+}
|
|
+EXPORT_SYMBOL_GPL(devm_free_percpu);
|
|
--- a/include/linux/device.h
|
|
+++ b/include/linux/device.h
|
|
@@ -681,6 +681,25 @@ void __iomem *devm_ioremap_resource(stru
|
|
int devm_add_action(struct device *dev, void (*action)(void *), void *data);
|
|
void devm_remove_action(struct device *dev, void (*action)(void *), void *data);
|
|
|
|
+/**
|
|
+ * devm_alloc_percpu - Resource-managed alloc_percpu
|
|
+ * @dev: Device to allocate per-cpu memory for
|
|
+ * @type: Type to allocate per-cpu memory for
|
|
+ *
|
|
+ * Managed alloc_percpu. Per-cpu memory allocated with this function is
|
|
+ * automatically freed on driver detach.
|
|
+ *
|
|
+ * RETURNS:
|
|
+ * Pointer to allocated memory on success, NULL on failure.
|
|
+ */
|
|
+#define devm_alloc_percpu(dev, type) \
|
|
+ (typeof(type) __percpu *)__devm_alloc_percpu(dev, sizeof(type), \
|
|
+ __alignof__(type))
|
|
+
|
|
+void __percpu *__devm_alloc_percpu(struct device *dev, size_t size,
|
|
+ size_t align);
|
|
+void devm_free_percpu(struct device *dev, void __percpu *pdata);
|
|
+
|
|
struct device_dma_parameters {
|
|
/*
|
|
* a low level driver may set these to teach IOMMU code about
|