Merge branch 'develop-3.10' of ssh://10.10.10.29/rk/kernel into develop-3.10

This commit is contained in:
huang zhibao 2015-03-04 11:04:47 +08:00
commit 191bd45207
5 changed files with 141 additions and 59 deletions

View File

@ -302,15 +302,16 @@ phys_addr_t uboot_logo_offset=0;
void __init rockchip_uboot_mem_reserve(void)
{
if (uboot_logo_size) {
if (!memblock_is_region_reserved(uboot_logo_base, uboot_logo_size)
&& !memblock_reserve(uboot_logo_base, uboot_logo_size)){
pr_info("%s: reserve %zx@%zx for uboot logo\n", __func__,
uboot_logo_size, uboot_logo_base);
} else {
pr_err("%s: reserve of %zx@%zx failed\n", __func__,
uboot_logo_size, uboot_logo_base);
}
if (uboot_logo_size==0)
return;
if (!memblock_is_region_reserved(uboot_logo_base, uboot_logo_size)
&& !memblock_reserve(uboot_logo_base, uboot_logo_size)){
pr_info("%s: reserve %pa@%pa for uboot logo\n", __func__,
&uboot_logo_size, &uboot_logo_base);
} else {
pr_err("%s: reserve of %pa@%pa failed\n", __func__,
&uboot_logo_size, &uboot_logo_base);
}
}
@ -326,8 +327,8 @@ static int __init rockchip_uboot_logo_setup(char *p)
}
}
pr_info("%s: mem: %zx@%zx, offset:%zx\n", __func__,
uboot_logo_size, uboot_logo_base, uboot_logo_offset);
pr_info("%s: mem: %pa@%pa, offset:%pa\n", __func__,
&uboot_logo_size, &uboot_logo_base, &uboot_logo_offset);
return 0;
}
@ -342,8 +343,8 @@ static int __init rockchip_uboot_mem_late_init(void)
addr = PAGE_ALIGN(uboot_logo_base);
end = (uboot_logo_base+uboot_logo_size)&PAGE_MASK;
pr_info("%s: Freeing uboot logo memory: %zx@%zx\n", __func__,
uboot_logo_size, uboot_logo_base);
pr_info("%s: Freeing uboot logo memory: %pa@%pa\n", __func__,
&uboot_logo_size, &uboot_logo_base);
memblock_free(uboot_logo_base, uboot_logo_size);

View File

@ -10,11 +10,6 @@ obj-$(CONFIG_RTL8723AU) += rockchip_wlan/rtl8723au/
obj-$(CONFIG_RTL8723BU) += rockchip_wlan/rtl8723bu/
obj-$(CONFIG_RTL8812AU) += rockchip_wlan/rtl8812au/
obj-$(CONFIG_RKWIFI) += rockchip_wlan/rkwifi/
obj-$(CONFIG_RDA5990) += rockchip_wlan/rda5990/
obj-$(CONFIG_MT5931) += rockchip_wlan/mt5931/
obj-$(CONFIG_MT5931_MT6622) += rockchip_wlan/mt5931/
obj-$(CONFIG_RTL8723BS) += rockchip_wlan/rtl8723bs/
obj-$(CONFIG_RTL8723BS_VQ0) += rockchip_wlan/rtl8723bs-vq0/
obj-$(CONFIG_MTK_COMBO_WIFI) += rockchip_wlan/combo_mt66xx/
obj-$(CONFIG_MTK_MT5931) += rockchip_wlan/mt5931_kk/
obj-$(CONFIG_ESP8089) += rockchip_wlan/esp8089/

View File

@ -265,8 +265,12 @@ static struct ion_buffer *ion_buffer_create(struct ion_heap *heap,
allocation via dma_map_sg. The implicit contract here is that
memory comming from the heaps is ready for dma, ie if it has a
cached mapping that mapping has been invalidated */
for_each_sg(buffer->sg_table->sgl, sg, buffer->sg_table->nents, i)
for_each_sg(buffer->sg_table->sgl, sg, buffer->sg_table->nents, i) {
sg_dma_address(sg) = sg_phys(sg);
#ifdef CONFIG_NEED_SG_DMA_LENGTH
sg_dma_len(sg) = sg->length;
#endif
}
mutex_lock(&dev->buffer_lock);
ion_buffer_add(dev, buffer);
mutex_unlock(&dev->buffer_lock);
@ -807,12 +811,6 @@ int ion_map_iommu(struct device *iommu_dev, struct ion_client *client,
mutex_lock(&buffer->lock);
if (ion_buffer_cached(buffer)) {
pr_err("%s: Cannot map iommu as cached.\n", __func__);
ret = -EINVAL;
goto out;
}
if (!handle->buffer->heap->ops->map_iommu) {
pr_err("%s: map_iommu is not implemented by this heap.\n",
__func__);
@ -1362,7 +1360,7 @@ static int ion_mmap(struct dma_buf *dmabuf, struct vm_area_struct *vma)
pr_err("%s: failure mapping buffer to userspace\n",
__func__);
trace_ion_buffer_mmap("", (unsigned int)buffer, buffer->size,
trace_ion_buffer_mmap("", (void*)buffer, buffer->size,
vma->vm_start, vma->vm_end);
return ret;
@ -1372,7 +1370,7 @@ int ion_munmap(struct dma_buf *dmabuf, struct vm_area_struct *vma)
{
struct ion_buffer *buffer = dmabuf->priv;
trace_ion_buffer_munmap("", (unsigned int)buffer, buffer->size,
trace_ion_buffer_munmap("", (void*)buffer, buffer->size,
vma->vm_start, vma->vm_end);
return 0;

View File

@ -31,7 +31,11 @@
#include <linux/of_fdt.h>
#endif
static struct ion_device *idev;
#include <linux/compat.h>
struct ion_device *rockchip_ion_dev;
EXPORT_SYMBOL(rockchip_ion_dev);
static int num_heaps;
static struct ion_heap **heaps;
@ -109,41 +113,123 @@ static int rockchip_ion_populate_heap(struct ion_platform_heap *heap)
struct ion_client *rockchip_ion_client_create(const char *name)
{
return ion_client_create(idev, name);
return ion_client_create(rockchip_ion_dev, name);
}
EXPORT_SYMBOL(rockchip_ion_client_create);
#ifdef CONFIG_COMPAT
struct compat_ion_phys_data {
compat_int_t handle;
compat_ulong_t phys;
compat_ulong_t size;
};
#define COMPAT_ION_IOC_GET_PHYS _IOWR(ION_IOC_ROCKCHIP_MAGIC, 0, \
struct compat_ion_phys_data)
static int compat_get_ion_phys_data(
struct compat_ion_phys_data __user *data32,
struct ion_phys_data __user *data)
{
compat_ulong_t l;
compat_int_t i;
int err;
err = get_user(i, &data32->handle);
err |= put_user(i, &data->handle);
err |= get_user(l, &data32->phys);
err |= put_user(l, &data->phys);
err |= get_user(l, &data32->size);
err |= put_user(l, &data->size);
return err;
};
static int compat_put_ion_phys_data(
struct compat_ion_phys_data __user *data32,
struct ion_phys_data __user *data)
{
compat_ulong_t l;
compat_int_t i;
int err;
err = get_user(i, &data->handle);
err |= put_user(i, &data32->handle);
err |= get_user(l, &data->phys);
err |= put_user(l, &data32->phys);
err |= get_user(l, &data->size);
err |= put_user(l, &data32->size);
return err;
};
#endif
static int rockchip_ion_get_phys(struct ion_client *client, unsigned long arg)
{
struct ion_phys_data data;
struct ion_handle *handle;
int ret;
if (copy_from_user(&data, (void __user *)arg,
sizeof(struct ion_phys_data)))
return -EFAULT;
handle = ion_handle_get_by_id(client, data.handle);
if (IS_ERR(handle))
return PTR_ERR(handle);
ret = ion_phys(client, handle, &data.phys, (size_t *)&data.size);
pr_debug("ret=%d, phys=0x%lX\n", ret, data.phys);
ion_handle_put(handle);
if (ret < 0)
return ret;
if (copy_to_user((void __user *)arg, &data,
sizeof(struct ion_phys_data)))
return -EFAULT;
return 0;
}
static long rockchip_custom_ioctl (struct ion_client *client, unsigned int cmd,
unsigned long arg)
{
pr_debug("[%s %d] cmd=%X\n", __func__, __LINE__, cmd);
pr_debug("%s(%d): cmd=%x\n", __func__, __LINE__, cmd);
switch (cmd) {
case ION_IOC_GET_PHYS:
{
struct ion_phys_data data;
struct ion_handle *handle;
int ret;
if (copy_from_user(&data, (void __user *)arg,
sizeof(struct ion_phys_data)))
return -EFAULT;
if (is_compat_task()) {
#ifdef CONFIG_COMPAT
long ret;
switch (cmd) {
case COMPAT_ION_IOC_GET_PHYS: {
struct compat_ion_phys_data __user *data32;
struct ion_phys_data __user *data;
int err;
handle = ion_handle_get_by_id(client, data.handle);
if (IS_ERR(handle))
return PTR_ERR(handle);
data32 = compat_ptr(arg);
data = compat_alloc_user_space(sizeof(*data));
if (data == NULL)
return -EFAULT;
ret = ion_phys(client, handle, &data.phys, (size_t *)&data.size);
pr_debug("ret=%d, phys=0x%lX\n", ret, data.phys);
ion_handle_put(handle);
if(ret < 0)
return ret;
if (copy_to_user((void __user *)arg, &data, sizeof(struct ion_phys_data)))
return -EFAULT;
break;
}
default:
return -ENOTTY;
err = compat_get_ion_phys_data(data32, data);
if (err)
return err;
ret = rockchip_ion_get_phys(client,
(unsigned long)data);
err = compat_put_ion_phys_data(data32, data);
return ret ? ret : err;
}
default:
return -ENOTTY;
}
#endif
} else {
switch (cmd) {
case ION_IOC_GET_PHYS:
return rockchip_ion_get_phys(client, arg);
default:
return -ENOTTY;
}
}
return 0;
@ -152,6 +238,7 @@ static long rockchip_custom_ioctl (struct ion_client *client, unsigned int cmd,
static int rockchip_ion_probe(struct platform_device *pdev)
{
struct ion_platform_data *pdata;
struct ion_device *idev;
int err;
int i;
@ -178,6 +265,7 @@ static int rockchip_ion_probe(struct platform_device *pdev)
kfree(heaps);
return PTR_ERR(idev);
}
rockchip_ion_dev = idev;
/* create the heaps as specified in the board file */
for (i = 0; i < num_heaps; i++) {
struct ion_platform_heap *heap_data = &pdata->heaps[i];

View File

@ -147,12 +147,12 @@ DEFINE_EVENT(ion_kmap_op, ion_kernel_map,
TP_ARGS(client, buffer, size, kaddr));
DECLARE_EVENT_CLASS(ion_mmap_op,
TP_PROTO(const char* client, unsigned int buf, unsigned int size,
TP_PROTO(const char* client, void* buf, unsigned int size,
unsigned long vm_start, unsigned long vm_end),
TP_ARGS(client, buf, size, vm_start, vm_end),
TP_STRUCT__entry(
__string(client, client)
__field(unsigned int, buf)
__field(void*, buf)
__field(unsigned int, size)
__field(unsigned long, vm_start)
__field(unsigned long, vm_end)
@ -164,18 +164,18 @@ DECLARE_EVENT_CLASS(ion_mmap_op,
__entry->vm_start = vm_start;
__entry->vm_end = vm_end;
),
TP_printk("client=%s,buffer=%08x:%d,vma[%08lx:%08lx]",
TP_printk("client=%s,buffer=%p:%d,vma[%08lx:%08lx]",
__get_str(client), __entry->buf, __entry->size,
__entry->vm_start, __entry->vm_end)
);
DEFINE_EVENT(ion_mmap_op, ion_buffer_mmap,
TP_PROTO(const char* client, unsigned int buf, unsigned int size,
TP_PROTO(const char* client, void* buf, unsigned int size,
unsigned long vm_start, unsigned long vm_end),
TP_ARGS(client, buf, size, vm_start, vm_end));
DEFINE_EVENT(ion_mmap_op, ion_buffer_munmap,
TP_PROTO(const char* client, unsigned int buf, unsigned int size,
TP_PROTO(const char* client, void* buf, unsigned int size,
unsigned long vm_start, unsigned long vm_end),
TP_ARGS(client, buf, size, vm_start, vm_end));