11/*
22 * Driver for the NVIDIA Tegra pinmux
33 *
4- * Copyright (c) 2011, NVIDIA CORPORATION. All rights reserved.
4+ * Copyright (c) 2011-2012 , NVIDIA CORPORATION. All rights reserved.
55 *
66 * Derived from code:
77 * Copyright (C) 2010 Google, Inc.
2222#include <linux/init.h>
2323#include <linux/io.h>
2424#include <linux/module.h>
25- #include <linux/of_device.h>
25+ #include <linux/of.h>
26+ #include <linux/platform_device.h>
2627#include <linux/pinctrl/machine.h>
2728#include <linux/pinctrl/pinctrl.h>
2829#include <linux/pinctrl/pinmux.h>
3132
3233#include <mach/pinconf-tegra.h>
3334
35+ #include "core.h"
3436#include "pinctrl-tegra.h"
3537
36- #define DRIVER_NAME "tegra-pinmux"
37-
3838struct tegra_pmx {
3939 struct device * dev ;
4040 struct pinctrl_dev * pctl ;
@@ -87,7 +87,7 @@ static void tegra_pinctrl_pin_dbg_show(struct pinctrl_dev *pctldev,
8787 struct seq_file * s ,
8888 unsigned offset )
8989{
90- seq_printf (s , " " DRIVER_NAME );
90+ seq_printf (s , " %s" , dev_name ( pctldev -> dev ) );
9191}
9292
9393static int reserve_map (struct pinctrl_map * * map , unsigned * reserved_maps ,
@@ -589,60 +589,29 @@ static struct pinctrl_gpio_range tegra_pinctrl_gpio_range = {
589589};
590590
591591static struct pinctrl_desc tegra_pinctrl_desc = {
592- .name = DRIVER_NAME ,
593592 .pctlops = & tegra_pinctrl_ops ,
594593 .pmxops = & tegra_pinmux_ops ,
595594 .confops = & tegra_pinconf_ops ,
596595 .owner = THIS_MODULE ,
597596};
598597
599- static struct of_device_id tegra_pinctrl_of_match [] __devinitdata = {
600- #ifdef CONFIG_PINCTRL_TEGRA20
601- {
602- .compatible = "nvidia,tegra20-pinmux" ,
603- .data = tegra20_pinctrl_init ,
604- },
605- #endif
606- #ifdef CONFIG_PINCTRL_TEGRA30
607- {
608- .compatible = "nvidia,tegra30-pinmux" ,
609- .data = tegra30_pinctrl_init ,
610- },
611- #endif
612- {},
613- };
614-
615- static int __devinit tegra_pinctrl_probe (struct platform_device * pdev )
598+ int __devinit tegra_pinctrl_probe (struct platform_device * pdev ,
599+ const struct tegra_pinctrl_soc_data * soc_data )
616600{
617- const struct of_device_id * match ;
618- tegra_pinctrl_soc_initf initf = NULL ;
619601 struct tegra_pmx * pmx ;
620602 struct resource * res ;
621603 int i ;
622604
623- match = of_match_device (tegra_pinctrl_of_match , & pdev -> dev );
624- if (match )
625- initf = (tegra_pinctrl_soc_initf )match -> data ;
626- #ifdef CONFIG_PINCTRL_TEGRA20
627- if (!initf )
628- initf = tegra20_pinctrl_init ;
629- #endif
630- if (!initf ) {
631- dev_err (& pdev -> dev ,
632- "Could not determine SoC-specific init func\n" );
633- return - EINVAL ;
634- }
635-
636605 pmx = devm_kzalloc (& pdev -> dev , sizeof (* pmx ), GFP_KERNEL );
637606 if (!pmx ) {
638607 dev_err (& pdev -> dev , "Can't alloc tegra_pmx\n" );
639608 return - ENOMEM ;
640609 }
641610 pmx -> dev = & pdev -> dev ;
642-
643- (* initf )(& pmx -> soc );
611+ pmx -> soc = soc_data ;
644612
645613 tegra_pinctrl_gpio_range .npins = pmx -> soc -> ngpios ;
614+ tegra_pinctrl_desc .name = dev_name (& pdev -> dev );
646615 tegra_pinctrl_desc .pins = pmx -> soc -> pins ;
647616 tegra_pinctrl_desc .npins = pmx -> soc -> npins ;
648617
@@ -697,8 +666,9 @@ static int __devinit tegra_pinctrl_probe(struct platform_device *pdev)
697666
698667 return 0 ;
699668}
669+ EXPORT_SYMBOL_GPL (tegra_pinctrl_probe );
700670
701- static int __devexit tegra_pinctrl_remove (struct platform_device * pdev )
671+ int __devexit tegra_pinctrl_remove (struct platform_device * pdev )
702672{
703673 struct tegra_pmx * pmx = platform_get_drvdata (pdev );
704674
@@ -707,30 +677,4 @@ static int __devexit tegra_pinctrl_remove(struct platform_device *pdev)
707677
708678 return 0 ;
709679}
710-
711- static struct platform_driver tegra_pinctrl_driver = {
712- .driver = {
713- .name = DRIVER_NAME ,
714- .owner = THIS_MODULE ,
715- .of_match_table = tegra_pinctrl_of_match ,
716- },
717- .probe = tegra_pinctrl_probe ,
718- .remove = __devexit_p (tegra_pinctrl_remove ),
719- };
720-
721- static int __init tegra_pinctrl_init (void )
722- {
723- return platform_driver_register (& tegra_pinctrl_driver );
724- }
725- arch_initcall (tegra_pinctrl_init );
726-
727- static void __exit tegra_pinctrl_exit (void )
728- {
729- platform_driver_unregister (& tegra_pinctrl_driver );
730- }
731- module_exit (tegra_pinctrl_exit );
732-
733- MODULE_AUTHOR ("Stephen Warren <swarren@nvidia.com>" );
734- MODULE_DESCRIPTION ("NVIDIA Tegra pinctrl driver" );
735- MODULE_LICENSE ("GPL v2" );
736- MODULE_DEVICE_TABLE (of , tegra_pinctrl_of_match );
680+ EXPORT_SYMBOL_GPL (tegra_pinctrl_remove );
0 commit comments