Stephen Warren | 54862bf | 2011-12-16 15:12:31 -0700 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (c) 2011, NVIDIA CORPORATION. All rights reserved. |
| 3 | * |
| 4 | * This software is licensed under the terms of the GNU General Public |
| 5 | * License version 2, as published by the Free Software Foundation, and |
| 6 | * may be copied, distributed, and modified under those terms. |
| 7 | * |
| 8 | * This program is distributed in the hope that it will be useful, |
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 | * GNU General Public License for more details. |
| 12 | * |
| 13 | */ |
| 14 | |
| 15 | #include <linux/of.h> |
| 16 | |
| 17 | #include <mach/gpio-tegra.h> |
| 18 | #include <mach/pinmux.h> |
| 19 | |
| 20 | #include "board-pinmux.h" |
| 21 | #include "devices.h" |
| 22 | |
| 23 | static struct platform_device *devices[] = { |
| 24 | &tegra_gpio_device, |
| 25 | &tegra_pinmux_device, |
| 26 | }; |
| 27 | |
| 28 | void tegra_board_pinmux_init(struct tegra_board_pinmux_conf *conf_a, |
| 29 | struct tegra_board_pinmux_conf *conf_b) |
| 30 | { |
| 31 | struct tegra_board_pinmux_conf *confs[] = {conf_a, conf_b}; |
| 32 | int i; |
| 33 | |
| 34 | if (of_machine_is_compatible("nvidia,tegra20")) |
| 35 | platform_add_devices(devices, ARRAY_SIZE(devices)); |
| 36 | |
| 37 | for (i = 0; i < ARRAY_SIZE(confs); i++) { |
| 38 | if (!confs[i]) |
| 39 | continue; |
| 40 | |
| 41 | tegra_pinmux_config_table(confs[i]->pgs, confs[i]->pg_count); |
| 42 | |
| 43 | if (confs[i]->drives) |
| 44 | tegra_drive_pinmux_config_table(confs[i]->drives, |
| 45 | confs[i]->drive_count); |
| 46 | |
| 47 | tegra_gpio_config(confs[i]->gpios, confs[i]->gpio_count); |
| 48 | } |
| 49 | |
| 50 | if (!of_machine_is_compatible("nvidia,tegra20")) |
| 51 | platform_add_devices(devices, ARRAY_SIZE(devices)); |
| 52 | } |