Thread (26 messages) 26 messages, 4 authors, 2014-01-09

Re: [PATCH v5 3/9] phy: Add new Exynos USB 2.0 PHY driver

From: Kishon Vijay Abraham I <hidden>
Date: 2014-01-09 05:27:54
Also in: linux-samsung-soc, lkml

Hi,

On Wednesday 08 January 2014 11:26 PM, Kamil Debski wrote:
Hi,
quoted
From: Kishon Vijay Abraham I [mailto:kishon@ti.com]
Sent: Monday, January 06, 2014 11:12 AM

Hi,

On Friday 20 December 2013 06:54 PM, Kamil Debski wrote:
quoted
Add a new driver for the Exynos USB 2.0 PHY. The new driver uses the
generic PHY framework. The driver includes support for the Exynos
4x10
quoted
and 4x12 SoC families.

Signed-off-by: Kamil Debski <redacted>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
  .../devicetree/bindings/phy/samsung-phy.txt        |   55 ++++
  drivers/phy/Kconfig                                |   29 ++
  drivers/phy/Makefile                               |    3 +
  drivers/phy/phy-exynos4210-usb2.c                  |  257
++++++++++++++++
quoted
  drivers/phy/phy-exynos4212-usb2.c                  |  306
++++++++++++++++++++
quoted
  drivers/phy/phy-samsung-usb2.c                     |  226
+++++++++++++++
quoted
  drivers/phy/phy-samsung-usb2.h                     |   67 +++++
  7 files changed, 943 insertions(+)
  create mode 100644 drivers/phy/phy-exynos4210-usb2.c
  create mode 100644 drivers/phy/phy-exynos4212-usb2.c
  create mode 100644 drivers/phy/phy-samsung-usb2.c
  create mode 100644 drivers/phy/phy-samsung-usb2.h
.
.
<snip>
.
.
quoted
diff --git a/drivers/phy/phy-samsung-usb2.h
b/drivers/phy/phy-samsung-usb2.h new file mode 100644 index
0000000..ab89f91
--- /dev/null
+++ b/drivers/phy/phy-samsung-usb2.h
@@ -0,0 +1,67 @@
+/*
+ * Samsung SoC USB 1.1/2.0 PHY driver
+ *
+ * Copyright (C) 2013 Samsung Electronics Co., Ltd.
+ * Author: Kamil Debski <k.debski@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef _PHY_EXYNOS_USB2_H
+#define _PHY_EXYNOS_USB2_H
+
+#include <linux/clk.h>
+#include <linux/phy/phy.h>
+#include <linux/device.h>
+#include <linux/regmap.h>
+#include <linux/spinlock.h>
+
+#define KHZ 1000
+#define MHZ (KHZ * KHZ)
+
+struct samsung_usb2_phy_driver;
+struct samsung_usb2_phy_instance;
+struct samsung_usb2_phy_config;
+
+struct samsung_usb2_phy_instance {
+	const struct samsung_usb2_common_phy *cfg;
+	struct clk *clk;
+	struct phy *phy;
+	struct samsung_usb2_phy_driver *drv;
+	unsigned long rate;
+	u32 clk_reg_val;
+	bool enabled;
+};
+
+struct samsung_usb2_phy_driver {
+	const struct samsung_usb2_phy_config *cfg;
+	struct clk *clk;
+	struct device *dev;
+	void __iomem *reg_phy;
+	struct regmap *reg_pmu;
+	struct regmap *reg_sys;
+	spinlock_t lock;
+	struct samsung_usb2_phy_instance instances[0];
I think having instances as array here would allocate more space while
allocating 'samsung_usb2_phy_driver' in 'samsung_usb2_phy_probe'.
I am not sure if I understand you correctly here. Maybe I will explain
what I intended to write. An array with size 0 at the end of a structure
takes no space in the structure. The benefit of using it is that after
the structure one can allocate a number of the array elements and
address them easily. Another option would be placing pointer in the
samsung_usb2_phy_instance and allocate memory separately, but this would
involve two allocations and a pointer would be always present in the 
structure.
Al-right.. makes sense.

Thanks
Kishon
Best wishes,
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help