History

ARM: mmp: remove custom sram code

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.

Arnd Bergmann committed 4 years ago

Commit 028908f1 parent 06f11df5 files · +2 −222Browse files

Unified · Split

5 files
  1. arch/arm/mach-mmp/Makefile +0 −1
  2. arch/arm/mach-mmp/mmp2.h +0 −13
  3. arch/arm/mach-mmp/sram.c +0 −167
  4. drivers/dma/mmp_tdma.c +2 −5
  5. include/linux/platform_data/dma-mmp_tdma.h +0 −36
arch/arm/mach-mmp/Makefile+0−1
@@ -8,7 +8,6 @@ obj-y += common.o devices.o time.o · 7 unmodified lines
88 obj-$(CONFIG_CPU_PXA168) += pxa168.o
99 obj-$(CONFIG_CPU_PXA910) += pxa910.o
1010 obj-$(CONFIG_CPU_MMP2) += mmp2.o
11−obj-$(CONFIG_MMP_SRAM) += sram.o
1211
1312 ifeq ($(CONFIG_PM),y)
1413 obj-$(CONFIG_CPU_PXA910) += pm-pxa910.o
arch/arm/mach-mmp/mmp2.h+0−13
@@ -10,7 +10,6 @@ extern void mmp2_clear_pmic_int(void); · 9 unmodified lines
1010
1111 #include <linux/i2c.h>
1212 #include <linux/platform_data/i2c-pxa.h>
13−#include <linux/platform_data/dma-mmp_tdma.h>
1413 #include <linux/irqchip/mmp.h>
1514
1615 #include "devices.h"
@@ -29,8 +28,6 @@ extern struct mmp_device_desc mmp2_device_sdh0; · 12 unmodified lines
2928 extern struct mmp_device_desc mmp2_device_sdh1;
3029 extern struct mmp_device_desc mmp2_device_sdh2;
3130 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;
3431
3532 extern struct platform_device mmp2_device_gpio;
3633
@@ -90,15 +87,5 @@ static inline int mmp2_add_sdhost(int id, struct sdhci_pxa_platdata *data) · 53 unmodified lines
9087 return mmp_register_device(d, data, sizeof(*data));
9188 }
9289
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−
10390 #endif /* __ASM_MACH_MMP2_H */
10491
arch/arm/mach-mmp/sram.c+0−167
@@ -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");
drivers/dma/mmp_tdma.c+2−5
@@ -15,7 +15,7 @@ · 14 unmodified lines
1515 #include <linux/dmaengine.h>
1616 #include <linux/platform_device.h>
1717 #include <linux/device.h>
18−#include <linux/platform_data/dma-mmp_tdma.h>
18+#include <linux/genalloc.h>
1919 #include <linux/of_device.h>
2020 #include <linux/of_dma.h>
2121
@@ -670,10 +670,7 @@ static int mmp_tdma_probe(struct platform_device *pdev) · 648 unmodified lines
670670
671671 INIT_LIST_HEAD(&tdev->device.channels);
672672
673− if (pdev->dev.of_node)
674− pool = of_gen_pool_get(pdev->dev.of_node, "asram", 0);
675− else
676− pool = sram_get_gpool("asram");
673+ pool = of_gen_pool_get(pdev->dev.of_node, "asram", 0);
677674 if (!pool) {
678675 dev_err(&pdev->dev, "asram pool not available\n");
679676 return -ENOMEM;
include/linux/platform_data/dma-mmp_tdma.h+0−36
@@ -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 */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t