diff options
author | Tushar Behera <tushar.behera@linaro.org> | 2013-05-29 13:21:57 +0530 |
---|---|---|
committer | Tushar Behera <tushar.behera@linaro.org> | 2013-05-29 13:50:09 +0530 |
commit | 87ca8699f35dba9791c6f693832bd4645d269182 (patch) | |
tree | c9881d5b5e630b7f26ec8cfea30abcd5454015aa | |
parent | fa40478a505193ff1d87d522b5faca47f16a8883 (diff) |
platform: arm: board_arndale: Add initial driver
Arndale board is based Samsung's EXYNOS5250 SoC. This board requires
the USB hub to be reset after the board boots up.
There is no legacy board file support for EXYNOS5250 based boards. Also
the reset sequence doesn't belong to USB-Host of USB-PHY driver code.
Hence the driver has been implemented here.
Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
-rw-r--r-- | drivers/platform/arm/Kconfig | 9 | ||||
-rw-r--r-- | drivers/platform/arm/Makefile | 1 | ||||
-rw-r--r-- | drivers/platform/arm/board_arndale.c | 89 |
3 files changed, 99 insertions, 0 deletions
diff --git a/drivers/platform/arm/Kconfig b/drivers/platform/arm/Kconfig index c131b89ca5e..1c997d58b89 100644 --- a/drivers/platform/arm/Kconfig +++ b/drivers/platform/arm/Kconfig @@ -9,4 +9,13 @@ menuconfig ARM_PLATFORM_DEVICES If you say N, all options in this submenu will be skipped and disabled. +if ARM_PLATFORM_DEVICES +config ARM_BOARD_ARNDALE + bool "Arndale specific customizations" + default y + depends on ARCH_EXYNOS5 + ---help--- + This is a virtual device to set Arndale specific customizations. + +endif # ARM_PLATFORM_DEVICES diff --git a/drivers/platform/arm/Makefile b/drivers/platform/arm/Makefile index 3f85eb22d98..ce548563f15 100644 --- a/drivers/platform/arm/Makefile +++ b/drivers/platform/arm/Makefile @@ -1,3 +1,4 @@ # # Makefile for ARM platform specific drivers # +obj-$(CONFIG_ARM_BOARD_ARNDALE) += board_arndale.o diff --git a/drivers/platform/arm/board_arndale.c b/drivers/platform/arm/board_arndale.c new file mode 100644 index 00000000000..5878e408254 --- /dev/null +++ b/drivers/platform/arm/board_arndale.c @@ -0,0 +1,89 @@ +/* + * Copyright (C) 2013 Samsung Electronics Co. Ltd. + * Copyright (C) 2013 Linaro Ltd. + * + * This software is licensed under the terms of the GNU General Public + * License version 2, as published by the Free Software Foundation, and + * may be copied, distributed, and modified under those terms. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#include <linux/module.h> +#include <linux/platform_device.h> +#include <linux/of_gpio.h> +#include <linux/delay.h> + +static void board_arndale_setup_hub_gpio(struct platform_device *pdev, + const char *propname, int level) +{ + int err; + int gpio; + + if (!pdev->dev.of_node) + return; + + gpio = of_get_named_gpio(pdev->dev.of_node, propname, 0); + if (!gpio_is_valid(gpio)) { + dev_err(&pdev->dev, "%s gpio not found", propname); + return; + } + + err = gpio_request_one(gpio, level, propname); + + if (err) + dev_err(&pdev->dev, "can't request %s gpio %d", propname, gpio); + else + gpio_free(gpio); +} + +static void board_arndale_hub_reset(struct platform_device *pdev) +{ + board_arndale_setup_hub_gpio(pdev, "hub-reset", GPIOF_OUT_INIT_LOW); + msleep(1); + board_arndale_setup_hub_gpio(pdev, "hub-reset", GPIOF_OUT_INIT_HIGH); + + board_arndale_setup_hub_gpio(pdev, "hub-connect", GPIOF_OUT_INIT_HIGH); +} + +static int board_arndale_probe(struct platform_device *pdev) +{ + board_arndale_hub_reset(pdev); + return 0; +} + +#ifdef CONFIG_OF +static const struct of_device_id board_arndale_match[] = { + { .compatible = "insignal,arndale-board-setup" }, + {}, +}; +MODULE_DEVICE_TABLE(of, exynos_ehci_match); +#endif + +static struct platform_driver board_arndale_driver = { + .probe = board_arndale_probe, + .driver = { + .name = "board-arndale-setup", + .owner = THIS_MODULE, + .of_match_table = of_match_ptr(board_arndale_match), + } +}; + +static int __init board_arndale_init(void) +{ + return platform_driver_register(&board_arndale_driver); +} +late_initcall(board_arndale_init); + +static void __exit board_arndale_exit(void) +{ + platform_driver_unregister(&board_arndale_driver); +} +module_exit(board_arndale_exit); + +MODULE_AUTHOR("Tushar Behera"); +MODULE_LICENSE("GPL v2"); |