1 /* linux/arch/arm/mach-s5pv210/setup-fimc0.c
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/
6 * Base FIMC 0 gpio configuration
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
13 #include <linux/kernel.h>
14 #include <linux/types.h>
15 #include <linux/gpio.h>
16 #include <linux/clk.h>
17 #include <linux/err.h>
18 #include <linux/platform_device.h>
20 #include <plat/clock.h>
21 #include <plat/gpio-cfg.h>
22 #include <mach/regs-gpio.h>
23 #include <plat/map-s5p.h>
26 struct platform_device; /* don't need the contents */
28 void s3c_fimc0_cfg_gpio(struct platform_device *pdev)
32 /* TODO FIXME: breaks qt602240 touch screen on Universal C210 */
33 /* CAM A port(b0010) : PCLK, VSYNC, HREF, DATA[0-4] */
34 for (i = 0; i < 8; i++) {
35 s3c_gpio_cfgpin(S5PV310_GPJ0(i), S3C_GPIO_SFN(2));
36 s3c_gpio_setpull(S5PV310_GPJ0(i), S3C_GPIO_PULL_NONE);
38 /* CAM A port(b0010) : DATA[5-7], CLKOUT(MIPI CAM also), FIELD */
39 for (i = 0; i < 5; i++) {
40 s3c_gpio_cfgpin(S5PV310_GPJ1(i), S3C_GPIO_SFN(2));
41 s3c_gpio_setpull(S5PV310_GPJ1(i), S3C_GPIO_PULL_NONE);
44 /* CAM B port(b0011) : DATA[0-7] */
45 for (i = 0; i < 8; i++) {
46 s3c_gpio_cfgpin(S5PV310_GPE1(i), S3C_GPIO_SFN(3));
47 s3c_gpio_setpull(S5PV310_GPE1(i), S3C_GPIO_PULL_NONE);
49 /* CAM B port(b0011) : PCLK, VSYNC, HREF, FIELD, CLCKOUT */
50 for (i = 0; i < 5; i++) {
51 s3c_gpio_cfgpin(S5PV310_GPE0(i), S3C_GPIO_SFN(3));
52 s3c_gpio_setpull(S5PV310_GPE0(i), S3C_GPIO_PULL_NONE);
55 /* note : driver strength to max is unnecessary */
58 int s3c_fimc_clk_on(struct platform_device *pdev, struct clk **clk)
60 struct clk *sclk_fimc_lclk = NULL;
61 struct clk *mout_mpll = NULL;
62 struct clk *mout_epll = NULL;
64 mout_mpll = clk_get(&pdev->dev, "mout_mpll");
65 if (IS_ERR(mout_mpll)) {
66 dev_err(&pdev->dev, "failed to get mout_mpll\n");
70 sclk_fimc_lclk = clk_get(&pdev->dev, "sclk_fimc");
71 if (IS_ERR(sclk_fimc_lclk)) {
72 dev_err(&pdev->dev, "failed to get sclk_fimc_lclk\n");
76 clk_set_parent(sclk_fimc_lclk, mout_mpll);
77 clk_set_rate(sclk_fimc_lclk, 166750000);
79 /* be able to handle clock on/off only with this clock */
80 *clk = clk_get(&pdev->dev, "fimc");
82 dev_err(&pdev->dev, "failed to get interface clock\n");
85 mout_epll = clk_get(&pdev->dev, "mout_epll");
88 clk_enable(sclk_fimc_lclk);
93 clk_put(sclk_fimc_lclk);
102 int s3c_fimc_clk_off(struct platform_device *pdev, struct clk **clk)