1 /* linux/arch/arm/mach-s5pv310/setup-mipi.c
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd
5 * S5PV310 - Helper functions for MIPI CSIS/DSIM PHY control
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
12 #include <linux/kernel.h>
13 #include <linux/platform_device.h>
15 #include <linux/spinlock.h>
16 #include <mach/regs-pmu.h>
18 /* Global MIPI CSIS or DSIM PHY enable and reset control. */
19 static int s5p_mipi_phy_control(struct platform_device *pdev, bool on, u32 rst)
21 static DEFINE_SPINLOCK(lock);
31 if (pid != 0 && pid != 1)
34 addr = pid ? S5P_MIPI_PHY1_CONTROL : S5P_MIPI_PHY0_CONTROL;
36 spin_lock_irqsave(&lock, flags);
38 cfg = __raw_readl(addr) & ~rst;
41 __raw_writel(cfg, addr);
44 cfg |= S5P_MIPI_PHY_ENABLE;
45 else if (!(cfg & (S5P_MIPI_PHY_SRESETN | S5P_MIPI_PHY_MRESETN) & ~rst))
46 cfg &= ~S5P_MIPI_PHY_ENABLE;
48 __raw_writel(cfg, addr);
50 spin_unlock_irqrestore(&lock, flags);
54 int s5p_csis_phy_enable(struct platform_device *pdev, bool on)
56 return s5p_mipi_phy_control(pdev, on, S5P_MIPI_PHY_SRESETN);
59 int s5p_dsim_phy_enable(struct platform_device *pdev, bool on)
61 return s5p_mipi_phy_control(pdev, on, S5P_MIPI_PHY_MRESETN);