Skip to content

Commit 276e552

Browse files
parakalinusw
authored andcommitted
pinctrl: ralink: move ralink architecture pinmux header into the driver
Ralink architecture is making use of the header located in 'arch/mips/include/asm/mach-ralink/pinmux.h' to stablish the mechanisms to make derived SoCs to set its pin functions and groups. In order to move all architecture pinmux into a more accurate place which is 'drivers/pinctrl/ralink' we have to first of all move this file also there with a small modification which creates 'rt2880_pinmux_init' function to allow SoCs pinctrl drivers to pass its configuration to the common code located in 'pinctrl-rt2880.c' file. Signed-off-by: Sergio Paracuellos <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Linus Walleij <[email protected]>
1 parent 8c987eb commit 276e552

File tree

3 files changed

+7
-27
lines changed

3 files changed

+7
-27
lines changed

arch/mips/ralink/prom.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
#include "common.h"
1919

2020
struct ralink_soc_info soc_info;
21-
struct rt2880_pmx_group *rt2880_pinmux_data = NULL;
2221

2322
enum ralink_soc_type ralink_soc;
2423
EXPORT_SYMBOL_GPL(ralink_soc);

drivers/pinctrl/ralink/pinctrl-rt2880.c

Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
#include <linux/pinctrl/machine.h>
1818

1919
#include <asm/mach-ralink/ralink_regs.h>
20-
#include <asm/mach-ralink/pinmux.h>
2120
#include <asm/mach-ralink/mt7620.h>
2221

22+
#include "pinmux.h"
2323
#include "../core.h"
2424
#include "../pinctrl-utils.h"
2525

@@ -311,13 +311,14 @@ static int rt2880_pinmux_pins(struct rt2880_priv *p)
311311
return 0;
312312
}
313313

314-
static int rt2880_pinmux_probe(struct platform_device *pdev)
314+
int rt2880_pinmux_init(struct platform_device *pdev,
315+
struct rt2880_pmx_group *data)
315316
{
316317
struct rt2880_priv *p;
317318
struct pinctrl_dev *dev;
318319
int err;
319320

320-
if (!rt2880_pinmux_data)
321+
if (!data)
321322
return -ENOTSUPP;
322323

323324
/* setup the private data */
@@ -327,7 +328,7 @@ static int rt2880_pinmux_probe(struct platform_device *pdev)
327328

328329
p->dev = &pdev->dev;
329330
p->desc = &rt2880_pctrl_desc;
330-
p->groups = rt2880_pinmux_data;
331+
p->groups = data;
331332
platform_set_drvdata(pdev, p);
332333

333334
/* init the device */
@@ -346,24 +347,3 @@ static int rt2880_pinmux_probe(struct platform_device *pdev)
346347

347348
return PTR_ERR_OR_ZERO(dev);
348349
}
349-
350-
static const struct of_device_id rt2880_pinmux_match[] = {
351-
{ .compatible = "ralink,rt2880-pinmux" },
352-
{},
353-
};
354-
MODULE_DEVICE_TABLE(of, rt2880_pinmux_match);
355-
356-
static struct platform_driver rt2880_pinmux_driver = {
357-
.probe = rt2880_pinmux_probe,
358-
.driver = {
359-
.name = "rt2880-pinmux",
360-
.of_match_table = rt2880_pinmux_match,
361-
},
362-
};
363-
364-
static int __init rt2880_pinmux_init(void)
365-
{
366-
return platform_driver_register(&rt2880_pinmux_driver);
367-
}
368-
369-
core_initcall_sync(rt2880_pinmux_init);

arch/mips/include/asm/mach-ralink/pinmux.h renamed to drivers/pinctrl/ralink/pinmux.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ struct rt2880_pmx_group {
4747
int func_count;
4848
};
4949

50-
extern struct rt2880_pmx_group *rt2880_pinmux_data;
50+
int rt2880_pinmux_init(struct platform_device *pdev,
51+
struct rt2880_pmx_group *data);
5152

5253
#endif

0 commit comments

Comments
 (0)