The MMP_SRAM code is no longer used by the tdma driver because the Kconfig symbol is not selected, so remove it along with its former callsite.
Unified · Split
| @@ -8,7 +8,6 @@ obj-y += common.o devices.o time.o · 7 unmodified lines | |||
| 8 | obj-$(CONFIG_CPU_PXA168) += pxa168.o | 8 | obj-$(CONFIG_CPU_PXA168) += pxa168.o |
| 9 | obj-$(CONFIG_CPU_PXA910) += pxa910.o | 9 | obj-$(CONFIG_CPU_PXA910) += pxa910.o |
| 10 | obj-$(CONFIG_CPU_MMP2) += mmp2.o | 10 | obj-$(CONFIG_CPU_MMP2) += mmp2.o |
| 11 | obj-$(CONFIG_MMP_SRAM) += sram.o | ||
| 12 | 11 | ||
| 13 | ifeq ($(CONFIG_PM),y) | 12 | ifeq ($(CONFIG_PM),y) |
| 14 | obj-$(CONFIG_CPU_PXA910) += pm-pxa910.o | 13 | obj-$(CONFIG_CPU_PXA910) += pm-pxa910.o |
| @@ -10,7 +10,6 @@ extern void mmp2_clear_pmic_int(void); · 9 unmodified lines | |||
| 10 | 10 | ||
| 11 | #include <linux/i2c.h> | 11 | #include <linux/i2c.h> |
| 12 | #include <linux/platform_data/i2c-pxa.h> | 12 | #include <linux/platform_data/i2c-pxa.h> |
| 13 | #include <linux/platform_data/dma-mmp_tdma.h> | ||
| 14 | #include <linux/irqchip/mmp.h> | 13 | #include <linux/irqchip/mmp.h> |
| 15 | 14 | ||
| 16 | #include "devices.h" | 15 | #include "devices.h" |
| @@ -29,8 +28,6 @@ extern struct mmp_device_desc mmp2_device_sdh0; · 12 unmodified lines | |||
| 29 | extern struct mmp_device_desc mmp2_device_sdh1; | 28 | extern struct mmp_device_desc mmp2_device_sdh1; |
| 30 | extern struct mmp_device_desc mmp2_device_sdh2; | 29 | extern struct mmp_device_desc mmp2_device_sdh2; |
| 31 | extern struct mmp_device_desc mmp2_device_sdh3; | 30 | extern struct mmp_device_desc mmp2_device_sdh3; |
| 32 | extern struct mmp_device_desc mmp2_device_asram; | ||
| 33 | extern struct mmp_device_desc mmp2_device_isram; | ||
| 34 | 31 | ||
| 35 | extern struct platform_device mmp2_device_gpio; | 32 | extern struct platform_device mmp2_device_gpio; |
| 36 | 33 | ||
| @@ -90,15 +87,5 @@ static inline int mmp2_add_sdhost(int id, struct sdhci_pxa_platdata *data) · 53 unmodified lines | |||
| 90 | return mmp_register_device(d, data, sizeof(*data)); | 87 | return mmp_register_device(d, data, sizeof(*data)); |
| 91 | } | 88 | } |
| 92 | 89 | ||
| 93 | static inline int mmp2_add_asram(struct sram_platdata *data) | ||
| 94 | { | ||
| 95 | return mmp_register_device(&mmp2_device_asram, data, sizeof(*data)); | ||
| 96 | } | ||
| 97 | |||
| 98 | static inline int mmp2_add_isram(struct sram_platdata *data) | ||
| 99 | { | ||
| 100 | return mmp_register_device(&mmp2_device_isram, data, sizeof(*data)); | ||
| 101 | } | ||
| 102 | |||
| 103 | #endif /* __ASM_MACH_MMP2_H */ | 90 | #endif /* __ASM_MACH_MMP2_H */ |
| 104 | 91 | ||
| @@ -1,167 +0,0 @@ | |||
| 1 | // SPDX-License-Identifier: GPL-2.0-only | ||
| 2 | /* | ||
| 3 | * linux/arch/arm/mach-mmp/sram.c | ||
| 4 | * | ||
| 5 | * based on mach-davinci/sram.c - DaVinci simple SRAM allocator | ||
| 6 | * | ||
| 7 | * Copyright (c) 2011 Marvell Semiconductors Inc. | ||
| 8 | * All Rights Reserved | ||
| 9 | * | ||
| 10 | * Add for mmp sram support - Leo Yan <leoy@marvell.com> | ||
| 11 | */ | ||
| 12 | |||
| 13 | #include <linux/module.h> | ||
| 14 | #include <linux/mod_devicetable.h> | ||
| 15 | #include <linux/init.h> | ||
| 16 | #include <linux/platform_device.h> | ||
| 17 | #include <linux/io.h> | ||
| 18 | #include <linux/err.h> | ||
| 19 | #include <linux/slab.h> | ||
| 20 | #include <linux/genalloc.h> | ||
| 21 | |||
| 22 | #include <linux/platform_data/dma-mmp_tdma.h> | ||
| 23 | |||
| 24 | struct sram_bank_info { | ||
| 25 | char *pool_name; | ||
| 26 | struct gen_pool *gpool; | ||
| 27 | int granularity; | ||
| 28 | |||
| 29 | phys_addr_t sram_phys; | ||
| 30 | void __iomem *sram_virt; | ||
| 31 | u32 sram_size; | ||
| 32 | |||
| 33 | struct list_head node; | ||
| 34 | }; | ||
| 35 | |||
| 36 | static DEFINE_MUTEX(sram_lock); | ||
| 37 | static LIST_HEAD(sram_bank_list); | ||
| 38 | |||
| 39 | struct gen_pool *sram_get_gpool(char *pool_name) | ||
| 40 | { | ||
| 41 | struct sram_bank_info *info = NULL; | ||
| 42 | |||
| 43 | if (!pool_name) | ||
| 44 | return NULL; | ||
| 45 | |||
| 46 | mutex_lock(&sram_lock); | ||
| 47 | |||
| 48 | list_for_each_entry(info, &sram_bank_list, node) | ||
| 49 | if (!strcmp(pool_name, info->pool_name)) | ||
| 50 | break; | ||
| 51 | |||
| 52 | mutex_unlock(&sram_lock); | ||
| 53 | |||
| 54 | if (&info->node == &sram_bank_list) | ||
| 55 | return NULL; | ||
| 56 | |||
| 57 | return info->gpool; | ||
| 58 | } | ||
| 59 | EXPORT_SYMBOL(sram_get_gpool); | ||
| 60 | |||
| 61 | static int sram_probe(struct platform_device *pdev) | ||
| 62 | { | ||
| 63 | struct sram_platdata *pdata = pdev->dev.platform_data; | ||
| 64 | struct sram_bank_info *info; | ||
| 65 | struct resource *res; | ||
| 66 | int ret = 0; | ||
| 67 | |||
| 68 | if (!pdata || !pdata->pool_name) | ||
| 69 | return -ENODEV; | ||
| 70 | |||
| 71 | info = kzalloc(sizeof(*info), GFP_KERNEL); | ||
| 72 | if (!info) | ||
| 73 | return -ENOMEM; | ||
| 74 | |||
| 75 | platform_set_drvdata(pdev, info); | ||
| 76 | |||
| 77 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
| 78 | if (res == NULL) { | ||
| 79 | dev_err(&pdev->dev, "no memory resource defined\n"); | ||
| 80 | ret = -ENODEV; | ||
| 81 | goto out; | ||
| 82 | } | ||
| 83 | |||
| 84 | if (!resource_size(res)) | ||
| 85 | return 0; | ||
| 86 | |||
| 87 | info->sram_phys = (phys_addr_t)res->start; | ||
| 88 | info->sram_size = resource_size(res); | ||
| 89 | info->sram_virt = ioremap(info->sram_phys, info->sram_size); | ||
| 90 | info->pool_name = kstrdup(pdata->pool_name, GFP_KERNEL); | ||
| 91 | info->granularity = pdata->granularity; | ||
| 92 | |||
| 93 | info->gpool = gen_pool_create(ilog2(info->granularity), -1); | ||
| 94 | if (!info->gpool) { | ||
| 95 | dev_err(&pdev->dev, "create pool failed\n"); | ||
| 96 | ret = -ENOMEM; | ||
| 97 | goto create_pool_err; | ||
| 98 | } | ||
| 99 | |||
| 100 | ret = gen_pool_add_virt(info->gpool, (unsigned long)info->sram_virt, | ||
| 101 | info->sram_phys, info->sram_size, -1); | ||
| 102 | if (ret < 0) { | ||
| 103 | dev_err(&pdev->dev, "add new chunk failed\n"); | ||
| 104 | ret = -ENOMEM; | ||
| 105 | goto add_chunk_err; | ||
| 106 | } | ||
| 107 | |||
| 108 | mutex_lock(&sram_lock); | ||
| 109 | list_add(&info->node, &sram_bank_list); | ||
| 110 | mutex_unlock(&sram_lock); | ||
| 111 | |||
| 112 | dev_info(&pdev->dev, "initialized\n"); | ||
| 113 | return 0; | ||
| 114 | |||
| 115 | add_chunk_err: | ||
| 116 | gen_pool_destroy(info->gpool); | ||
| 117 | create_pool_err: | ||
| 118 | iounmap(info->sram_virt); | ||
| 119 | kfree(info->pool_name); | ||
| 120 | out: | ||
| 121 | kfree(info); | ||
| 122 | return ret; | ||
| 123 | } | ||
| 124 | |||
| 125 | static int sram_remove(struct platform_device *pdev) | ||
| 126 | { | ||
| 127 | struct sram_bank_info *info; | ||
| 128 | |||
| 129 | info = platform_get_drvdata(pdev); | ||
| 130 | |||
| 131 | if (info->sram_size) { | ||
| 132 | mutex_lock(&sram_lock); | ||
| 133 | list_del(&info->node); | ||
| 134 | mutex_unlock(&sram_lock); | ||
| 135 | |||
| 136 | gen_pool_destroy(info->gpool); | ||
| 137 | iounmap(info->sram_virt); | ||
| 138 | kfree(info->pool_name); | ||
| 139 | } | ||
| 140 | |||
| 141 | kfree(info); | ||
| 142 | |||
| 143 | return 0; | ||
| 144 | } | ||
| 145 | |||
| 146 | static const struct platform_device_id sram_id_table[] = { | ||
| 147 | { "asram", MMP_ASRAM }, | ||
| 148 | { "isram", MMP_ISRAM }, | ||
| 149 | { } | ||
| 150 | }; | ||
| 151 | |||
| 152 | static struct platform_driver sram_driver = { | ||
| 153 | .probe = sram_probe, | ||
| 154 | .remove = sram_remove, | ||
| 155 | .driver = { | ||
| 156 | .name = "mmp-sram", | ||
| 157 | }, | ||
| 158 | .id_table = sram_id_table, | ||
| 159 | }; | ||
| 160 | |||
| 161 | static int __init sram_init(void) | ||
| 162 | { | ||
| 163 | return platform_driver_register(&sram_driver); | ||
| 164 | } | ||
| 165 | core_initcall(sram_init); | ||
| 166 | |||
| 167 | MODULE_LICENSE("GPL"); | ||
| @@ -15,7 +15,7 @@ · 14 unmodified lines | |||
| 15 | #include <linux/dmaengine.h> | 15 | #include <linux/dmaengine.h> |
| 16 | #include <linux/platform_device.h> | 16 | #include <linux/platform_device.h> |
| 17 | #include <linux/device.h> | 17 | #include <linux/device.h> |
| 18 | #include <linux/platform_data/dma-mmp_tdma.h> | 18 | #include <linux/genalloc.h> |
| 19 | #include <linux/of_device.h> | 19 | #include <linux/of_device.h> |
| 20 | #include <linux/of_dma.h> | 20 | #include <linux/of_dma.h> |
| 21 | 21 | ||
| @@ -670,10 +670,7 @@ static int mmp_tdma_probe(struct platform_device *pdev) · 648 unmodified lines | |||
| 670 | 670 | ||
| 671 | INIT_LIST_HEAD(&tdev->device.channels); | 671 | INIT_LIST_HEAD(&tdev->device.channels); |
| 672 | 672 | ||
| 673 | if (pdev->dev.of_node) | 673 | pool = of_gen_pool_get(pdev->dev.of_node, "asram", 0); |
| 674 | pool = of_gen_pool_get(pdev->dev.of_node, "asram", 0); | ||
| 675 | else | ||
| 676 | pool = sram_get_gpool("asram"); | ||
| 677 | if (!pool) { | 674 | if (!pool) { |
| 678 | dev_err(&pdev->dev, "asram pool not available\n"); | 675 | dev_err(&pdev->dev, "asram pool not available\n"); |
| 679 | return -ENOMEM; | 676 | return -ENOMEM; |
| @@ -1,36 +0,0 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0-only */ | ||
| 2 | /* | ||
| 3 | * SRAM Memory Management | ||
| 4 | * | ||
| 5 | * Copyright (c) 2011 Marvell Semiconductors Inc. | ||
| 6 | */ | ||
| 7 | |||
| 8 | #ifndef __DMA_MMP_TDMA_H | ||
| 9 | #define __DMA_MMP_TDMA_H | ||
| 10 | |||
| 11 | #include <linux/genalloc.h> | ||
| 12 | |||
| 13 | /* ARBITRARY: SRAM allocations are multiples of this 2^N size */ | ||
| 14 | #define SRAM_GRANULARITY 512 | ||
| 15 | |||
| 16 | enum sram_type { | ||
| 17 | MMP_SRAM_UNDEFINED = 0, | ||
| 18 | MMP_ASRAM, | ||
| 19 | MMP_ISRAM, | ||
| 20 | }; | ||
| 21 | |||
| 22 | struct sram_platdata { | ||
| 23 | char *pool_name; | ||
| 24 | int granularity; | ||
| 25 | }; | ||
| 26 | |||
| 27 | #ifdef CONFIG_MMP_SRAM | ||
| 28 | extern struct gen_pool *sram_get_gpool(char *pool_name); | ||
| 29 | #else | ||
| 30 | static inline struct gen_pool *sram_get_gpool(char *pool_name) | ||
| 31 | { | ||
| 32 | return NULL; | ||
| 33 | } | ||
| 34 | #endif | ||
| 35 | |||
| 36 | #endif /* __DMA_MMP_TDMA_H */ | ||