Re: [PATCH 1/3] clk: exynos5250: Add G2D gate clock
On 5 July 2013 14:12, Sachin Kamat sachin.ka...@linaro.org wrote: Adds gate clock for G2D IP for Exynos5250 SoC. Signed-off-by: Sachin Kamat sachin.ka...@linaro.org Cc: Mike Turquette mturque...@linaro.org --- This patch depends on the following patch: http://thread.gmane.org/gmane.linux.kernel.samsung-soc/20581 --- .../devicetree/bindings/clock/exynos5250-clock.txt |1 + drivers/clk/samsung/clk-exynos5250.c |5 - 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/clock/exynos5250-clock.txt b/Documentation/devicetree/bindings/clock/exynos5250-clock.txt index 1a05761..7e88242 100644 --- a/Documentation/devicetree/bindings/clock/exynos5250-clock.txt +++ b/Documentation/devicetree/bindings/clock/exynos5250-clock.txt @@ -155,6 +155,7 @@ clock which they consume. dp 342 mixer343 hdmi 344 + g2d 345 Example 1: An example of a clock controller node is listed below. diff --git a/drivers/clk/samsung/clk-exynos5250.c b/drivers/clk/samsung/clk-exynos5250.c index 6f767c5..3da0bdf 100644 --- a/drivers/clk/samsung/clk-exynos5250.c +++ b/drivers/clk/samsung/clk-exynos5250.c @@ -62,6 +62,7 @@ #define SRC_CDREX 0x20200 #define PLL_DIV2_SEL 0x20a24 #define GATE_IP_DISP1 0x10928 +#define GATE_IP_ACP0x1 /* * Let each supported clock get a unique id. This id is used to lookup the clock @@ -99,7 +100,7 @@ enum exynos5250_clks { spi2, i2s1, i2s2, pcm1, pcm2, pwm, spdif, ac97, hsi2c0, hsi2c1, hsi2c2, hsi2c3, chipid, sysreg, pmu, cmu_top, cmu_core, cmu_mem, tzpc0, tzpc1, tzpc2, tzpc3, tzpc4, tzpc5, tzpc6, tzpc7, tzpc8, tzpc9, hdmi_cec, mct, - wdt, rtc, tmu, fimd1, mie1, dsim0, dp, mixer, hdmi, + wdt, rtc, tmu, fimd1, mie1, dsim0, dp, mixer, hdmi, g2d, nr_clks, }; @@ -152,6 +153,7 @@ static __initdata unsigned long exynos5250_clk_regs[] = { SRC_CDREX, PLL_DIV2_SEL, GATE_IP_DISP1, + GATE_IP_ACP, }; /* list of all parent clock list */ @@ -463,6 +465,7 @@ struct samsung_gate_clock exynos5250_gate_clks[] __initdata = { GATE(dp, dp, aclk200, GATE_IP_DISP1, 4, 0, 0), GATE(mixer, mixer, aclk200, GATE_IP_DISP1, 5, 0, 0), GATE(hdmi, hdmi, aclk200, GATE_IP_DISP1, 6, 0, 0), + GATE(g2d, g2d, aclk200, GATE_IP_ACP, 3, 0, 0), }; static __initdata struct of_device_id ext_clk_match[] = { -- 1.7.9.5 Ping Mike. -- With warm regards, Sachin -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: XCLKOUT in exynos5250 clock driver
On 07/25/2013 08:21 PM, Mark Brown wrote: I appear to be missing something in the clock driver for the exynos5250. I'm looking at the Arndale schematic and I see that the audio master clock is connected to XCLKOUT on the SoC. However I can't see any reference to XCLKOUT or anything similar in the clock driver or any of the DTS files - where is this clock exposed by the clock driver? Unfortunately I haven't been able to get access to the datasheet for the part so I can't check this myself. Information as per Exynos5250 user manual: XCLKOUT is an output pin for debugging clocks. Exynos5250 has a CLKOUT logic which can select one of the clocks (within its clock domains) and output that through XCLKOUT pin. Not sure if XCLKOUT on Arndale schematics means the same. -- Tushar Behera -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH 2/2] iommu/exynos: Follow kernel coding style for __sysmmu_enable return type
-Original Message- From: Antonios Motakis [mailto:a.mota...@virtualopensystems.com] Sent: Friday, July 26, 2013 12:35 AM On success, the __sysmmu_enable returns 1 instead of 0, which does not respect the convention described in Chapter 16 of the Linux kernel coding style. In fact, this return value is propagated all the way up to iommu_attach_device() and iommu_attach_device() in drivers/iommu.c, which results into inconsistent behavior of the IOMMU API with Exynos systems, compared to other IOMMUs. This patch replaces the return value with 0, which makes the Exynos' IOMMU driver behavior consistent with that of other IOMMUs. Signed-off-by: Antonios Motakis a.mota...@virtualopensystems.com --- drivers/iommu/exynos-iommu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c index c7dd4b5..4ea3abb 100644 --- a/drivers/iommu/exynos-iommu.c +++ b/drivers/iommu/exynos-iommu.c @@ -504,7 +504,7 @@ static int __sysmmu_enable(struct sysmmu_drvdata *data, dev_dbg(data-sysmmu, Enabled\n); } else { - ret = (pgtable == data-pgtable) ? 1 : -EBUSY; + ret = (pgtable == data-pgtable) ? 0 : -EBUSY; Ok. __sysmmu_enable() must return 1 if it is called with the same page table. I have fixed it exynos_iommu_attach_device() to always return zero on success in the next patchset which I will post today. Thank you. dev_dbg(data-sysmmu, already enabled\n); } -- 1.8.1.2 -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/2] ARM: dts: exynos4210-origen: Add fixed voltage regulator to simple bus
This has been done for Arndale board vide commit aa3edb65 (ARM: dts: Put Arndale fixed voltage regulators on a simple-bus). Replicate here for consistency and correctness. Signed-off-by: Sachin Kamat sachin.ka...@linaro.org --- arch/arm/boot/dts/exynos4210-origen.dts | 20 +--- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/arch/arm/boot/dts/exynos4210-origen.dts b/arch/arm/boot/dts/exynos4210-origen.dts index 5537af8..ae2653e 100644 --- a/arch/arm/boot/dts/exynos4210-origen.dts +++ b/arch/arm/boot/dts/exynos4210-origen.dts @@ -32,13 +32,19 @@ bootargs =root=/dev/ram0 rw ramdisk=8192 initrd=0x4100,8M console=ttySAC2,115200 init=/linuxrc; }; - mmc_reg: voltage-regulator { - compatible = regulator-fixed; - regulator-name = VMEM_VDD_2.8V; - regulator-min-microvolt = 280; - regulator-max-microvolt = 280; - gpio = gpx1 1 0; - enable-active-high; + regulators { + compatible = simple-bus; + #address-cells = 1; + #size-cells = 0; + + mmc_reg: voltage-regulator { + compatible = regulator-fixed; + regulator-name = VMEM_VDD_2.8V; + regulator-min-microvolt = 280; + regulator-max-microvolt = 280; + gpio = gpx1 1 0; + enable-active-high; + }; }; tmu@100C { -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/2] ARM: dts: exynos4412-origen: Add fixed voltage regulator to simple bus
This has been done for Arndale board vide commit aa3edb65 (ARM: dts: Put Arndale fixed voltage regulators on a simple-bus). Replicate here for consistency and correctness. Signed-off-by: Sachin Kamat sachin.ka...@linaro.org --- arch/arm/boot/dts/exynos4412-origen.dts | 20 +--- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/arch/arm/boot/dts/exynos4412-origen.dts b/arch/arm/boot/dts/exynos4412-origen.dts index 829fd1fb..cf4cdf2 100644 --- a/arch/arm/boot/dts/exynos4412-origen.dts +++ b/arch/arm/boot/dts/exynos4412-origen.dts @@ -27,13 +27,19 @@ bootargs =console=ttySAC2,115200; }; - mmc_reg: voltage-regulator { - compatible = regulator-fixed; - regulator-name = VMEM_VDD_2.8V; - regulator-min-microvolt = 280; - regulator-max-microvolt = 280; - gpio = gpx1 1 0; - enable-active-high; + regulators { + compatible = simple-bus; + #address-cells = 1; + #size-cells = 0; + + mmc_reg: voltage-regulator { + compatible = regulator-fixed; + regulator-name = VMEM_VDD_2.8V; + regulator-min-microvolt = 280; + regulator-max-microvolt = 280; + gpio = gpx1 1 0; + enable-active-high; + }; }; pinctrl@1100 { -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v8 00/12] iommu/exynos: Fixes and Enhancements of System MMU driver with DT
The current exynos-iommu(System MMU) driver does not work autonomously since it is lack of support for power management of peripheral blocks. For example, MFC device driver must ensure that its System MMU is disabled before MFC block is power-down not to invalidate IOTLB in the System MMU when I/O memory mapping is changed. Because A System MMU is resides in the same H/W block, access to control registers of System MMU while the H/W block is turned off must be prohibited. This set of changes solves the above problem with setting each System MMUs as the parent of the device which owns the System MMU to recieve the information when the device is turned off or turned on. Another big change to the driver is the support for devicetree. The bindings for System MMU is described in Documentation/devicetree/bindings/arm/samsung/system-mmu.txt In addition, this patchset also includes several bug fixes and enhancements of the current driver. Change log: v8: - Reordered patch list: moved change rwloc to spinlock to the last. - Fixed remained bug in fix page table maintenance. - Always return 0 from exynos_iommu_attach_device(). - Removed prefetch buffer setting when System MMU is enabled due to the restriction of prefetch buffers: A prefetch buffer must not hit from more than one DMA. For instance with GScalers, if a single prefetch buffer is initialized with 0x0 ~ 0x and a GScaler works on source buffer at 0x1000 and target buffer @ 0x2000, the System MMU may be got deadlock. Clients must initialize prefetch buffers with custom function defined in exynos-iommu drivers whenever they need to enable prefetch buffers. - The clock of System MMU has no relationship with the clock of its master H/W. The clock of master H/W is always enabled when exynos-iommu driver needs to access MMIO area and disabled as soon as the access finishes. - Removed err_page variable used in exynos_iommu_unmap() in the previous patch fix page table maintenance. - Split a big patch add bus notifier for registering System MMU. Extracted the following 2 patches: 9/12 and 10/12. - And some additional fixes... v7: - Rebased on the stable 3.10 - Registered PM domains and gate clocks with DT - Changed connection method between a System MMU and its master H/W 'mmu-master' property in the node of System MMU -- 'iommu' property in the node of master H/W - Marking device descriptor of master H/W of a System MMU with bus notifier. - Power management (PM_RUNTIME, PM_SLEEP) of System MMUs with gpd_dev_ops of Generic IO Powerdomain. gpd_dev_ops are set to the master H/Ws before they are probed in the bus notifier. - Removed additional debugging features like debugfs entries and version names. - Removed support for advanced features of System MMU 3.2 and 3.3 the current IOMMU API cannot handle the feature (A kind of L2 TLB that fetches several consequence page table entries. It must be initialized by the driver of master H/W whenever it works.) v6: - Rebased on the branch, next/iommu-exynos of git.kernel.org/pub/scm/linux/kernel/git/kgene/linux-samsung.git v5: - new bugfix: patch 01 - Reordered patches * patch 01 ~ 05: Bugfix and enhancements of the existing driver * patch 06 ~ 10: Device Tree support and callbacks for power management * patch 11 : System MMU 3.2 and 3.3 support * patch 12 ~ 14: Debugging features - Additional code compaction v4: - Remove Change-Id from v3 patches - Change the order of the third and the first patch Thanks to Kukjin Kim. - Fix memory leak when allocating and assigning exynos_iommu_owner to client device if the client device has multiple System MMUs. Thanks to Rahul Sharma. v3: - Fix prefetch buffer flag definition for System MMU 3.3 (patch 10/12) - Fix incorrect setting for SET_RUNTIME_PM_OPS (patch 09/12) Thanks to Prathyush. v2: - Split the patch to iommu/exynos into 9 patches - Support for System MMU 3.3 - Some code compaction Patch summary: [PATCH v8 01/12] iommu/exynos: do not include removed header [PATCH v8 02/12] iommu/exynos: add missing cache flush for removed page table entries [PATCH v8 03/12] iommu/exynos: fix page table maintenance [PATCH v8 04/12] iommu/exynos: allocate lv2 page table from own slab [PATCH v8 05/12] clk: exynos5250: add gate clock descriptions of System MMU [PATCH v8 06/12] ARM: dts: Add description of System MMU of Exynos SoCs [PATCH v8 07/12] iommu/exynos: support for device tree [PATCH v8 08/12] iommu/exynos: remove prefetch buffer setting when enabling System MMU [PATCH v8 09/12] iommu/exynos: remove custom fault handler [PATCH v8 10/12] iommu/exynos: add bus notifier for registering System MMU [PATCH v8 11/12] iommu/exynos: change rwlock to spinlock [PATCH v8 12/12] iommu/exynos: return 0 if iommu_attach_device() successes Diffstats: .../devicetree/bindings/clock/exynos5250-clock.txt | 28 +- .../bindings/iommu/samsung,exynos4210-sysmmu.txt | 103 ++ arch/arm/boot/dts/exynos4.dtsi
[PATCH v8 01/12] iommu/exynos: do not include removed header
This commit remove mach/sysmmu.h which is removed. Signed-off-by: Cho KyongHo pullip@samsung.com --- drivers/iommu/exynos-iommu.c |3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c index 3f32d64..233f382 100644 --- a/drivers/iommu/exynos-iommu.c +++ b/drivers/iommu/exynos-iommu.c @@ -12,6 +12,7 @@ #define DEBUG #endif +#include linux/kernel.h #include linux/io.h #include linux/interrupt.h #include linux/platform_device.h @@ -29,8 +30,6 @@ #include asm/cacheflush.h #include asm/pgtable.h -#include mach/sysmmu.h - /* We does not consider super section mapping (16MB) */ #define SECT_ORDER 20 #define LPAGE_ORDER 16 -- 1.7.2.5 -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v8 02/12] iommu/exynos: add missing cache flush for removed page table entries
This commit adds cache flush for removed small and large page entries in exynos_iommu_unmap(). Missing cache flush of removed page table entries can cause missing page fault interrupt when a master IP accesses an unmapped area. Signed-off-by: Cho KyongHo pullip@samsung.com --- drivers/iommu/exynos-iommu.c |2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c index 233f382..e3be3e5 100644 --- a/drivers/iommu/exynos-iommu.c +++ b/drivers/iommu/exynos-iommu.c @@ -1002,6 +1002,7 @@ static size_t exynos_iommu_unmap(struct iommu_domain *domain, if (lv2ent_small(ent)) { *ent = 0; size = SPAGE_SIZE; + pgtable_flush(ent, ent +1); priv-lv2entcnt[lv1ent_offset(iova)] += 1; goto done; } @@ -1010,6 +1011,7 @@ static size_t exynos_iommu_unmap(struct iommu_domain *domain, BUG_ON(size LPAGE_SIZE); memset(ent, 0, sizeof(*ent) * SPAGES_PER_LPAGE); + pgtable_flush(ent, ent + SPAGES_PER_LPAGE); size = LPAGE_SIZE; priv-lv2entcnt[lv1ent_offset(iova)] += SPAGES_PER_LPAGE; -- 1.7.2.5 -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v8 03/12] iommu/exynos: fix page table maintenance
This prevents allocating lv2 page table for the lv1 page table entry that already has 1MB page mapping. In addition some BUG_ON() is changed to WARN_ON(). Signed-off-by: Cho KyongHo pullip@samsung.com --- drivers/iommu/exynos-iommu.c | 52 + 1 files changed, 37 insertions(+), 15 deletions(-) diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c index e3be3e5..6c4ecce 100644 --- a/drivers/iommu/exynos-iommu.c +++ b/drivers/iommu/exynos-iommu.c @@ -52,11 +52,11 @@ #define lv2ent_large(pent) ((*(pent) 3) == 1) #define section_phys(sent) (*(sent) SECT_MASK) -#define section_offs(iova) ((iova) 0xF) +#define section_offs(iova) ((iova) ~SECT_MASK) #define lpage_phys(pent) (*(pent) LPAGE_MASK) -#define lpage_offs(iova) ((iova) 0x) +#define lpage_offs(iova) ((iova) ~LPAGE_MASK) #define spage_phys(pent) (*(pent) SPAGE_MASK) -#define spage_offs(iova) ((iova) 0xFFF) +#define spage_offs(iova) ((iova) ~SPAGE_MASK) #define lv1ent_offset(iova) ((iova) SECT_ORDER) #define lv2ent_offset(iova) (((iova) 0xFF000) SPAGE_ORDER) @@ -862,12 +862,14 @@ static unsigned long *alloc_lv2entry(unsigned long *sent, unsigned long iova, pent = kzalloc(LV2TABLE_SIZE, GFP_ATOMIC); BUG_ON((unsigned long)pent (LV2TABLE_SIZE - 1)); if (!pent) - return NULL; + return ERR_PTR(-ENOMEM); *sent = mk_lv1ent_page(__pa(pent)); *pgcounter = NUM_LV2ENTRIES; pgtable_flush(pent, pent + NUM_LV2ENTRIES); pgtable_flush(sent, sent + 1); + } else if (lv1ent_section(sent)) { + return ERR_PTR(-EADDRINUSE); } return page_entry(sent, iova); @@ -894,6 +896,12 @@ static int lv1set_section(unsigned long *sent, phys_addr_t paddr, short *pgcnt) return 0; } +static void clear_page_table(unsigned long *ent, int n) +{ + if (n 0) + memset(ent, 0, sizeof(*ent) * n); +} + static int lv2set_page(unsigned long *pent, phys_addr_t paddr, size_t size, short *pgcnt) { @@ -908,7 +916,7 @@ static int lv2set_page(unsigned long *pent, phys_addr_t paddr, size_t size, int i; for (i = 0; i SPAGES_PER_LPAGE; i++, pent++) { if (!lv2ent_fault(pent)) { - memset(pent, 0, sizeof(*pent) * i); + clear_page_table(pent - i, i); return -EADDRINUSE; } @@ -944,17 +952,16 @@ static int exynos_iommu_map(struct iommu_domain *domain, unsigned long iova, pent = alloc_lv2entry(entry, iova, priv-lv2entcnt[lv1ent_offset(iova)]); - if (!pent) - ret = -ENOMEM; + if (IS_ERR(pent)) + ret = PTR_ERR(pent); else ret = lv2set_page(pent, paddr, size, priv-lv2entcnt[lv1ent_offset(iova)]); } - if (ret) { - pr_debug(%s: Failed to map iova 0x%lx/0x%x bytes\n, - __func__, iova, size); - } + if (ret) + pr_err(%s: Failed(%d) to map 0x%#x bytes @ %#lx\n, + __func__, ret, size, iova); spin_unlock_irqrestore(priv-pgtablelock, flags); @@ -968,6 +975,7 @@ static size_t exynos_iommu_unmap(struct iommu_domain *domain, struct sysmmu_drvdata *data; unsigned long flags; unsigned long *ent; + size_t err_pgsize; BUG_ON(priv-pgtable == NULL); @@ -976,7 +984,10 @@ static size_t exynos_iommu_unmap(struct iommu_domain *domain, ent = section_entry(priv-pgtable, iova); if (lv1ent_section(ent)) { - BUG_ON(size SECT_SIZE); + if (WARN_ON(size SECT_SIZE)) { + err_pgsize = SECT_SIZE; + goto err; + } *ent = 0; pgtable_flush(ent, ent + 1); @@ -1008,9 +1019,12 @@ static size_t exynos_iommu_unmap(struct iommu_domain *domain, } /* lv1ent_large(ent) == true here */ - BUG_ON(size LPAGE_SIZE); + if (WARN_ON(size LPAGE_SIZE)) { + err_pgsize = LPAGE_SIZE; + goto err; + } - memset(ent, 0, sizeof(*ent) * SPAGES_PER_LPAGE); + clear_page_table(ent, SPAGES_PER_LPAGE); pgtable_flush(ent, ent + SPAGES_PER_LPAGE); size = LPAGE_SIZE; @@ -1023,8 +1037,16 @@ done: sysmmu_tlb_invalidate_entry(data-dev, iova); spin_unlock_irqrestore(priv-lock, flags); - return size; +err: + spin_unlock_irqrestore(priv-pgtablelock, flags); + + pr_err(%s:
[PATCH v8 04/12] iommu/exynos: allocate lv2 page table from own slab
Since kmalloc() does not guarantee that the allignment of 1KiB when it allocates 1KiB, it is required to allocate lv2 page table from own slab that guarantees alignment of 1KiB Signed-off-by: Cho KyongHo pullip@samsung.com --- drivers/iommu/exynos-iommu.c | 24 1 files changed, 20 insertions(+), 4 deletions(-) diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c index 6c4ecce..093eea5 100644 --- a/drivers/iommu/exynos-iommu.c +++ b/drivers/iommu/exynos-iommu.c @@ -100,6 +100,8 @@ #define REG_PB1_SADDR 0x054 #define REG_PB1_EADDR 0x058 +static struct kmem_cache *lv2table_kmem_cache; + static unsigned long *section_entry(unsigned long *pgtable, unsigned long iova) { return pgtable + lv1ent_offset(iova); @@ -765,7 +767,8 @@ static void exynos_iommu_domain_destroy(struct iommu_domain *domain) for (i = 0; i NUM_LV1ENTRIES; i++) if (lv1ent_page(priv-pgtable + i)) - kfree(__va(lv2table_base(priv-pgtable + i))); + kmem_cache_free(lv2table_kmem_cache, + __va(lv2table_base(priv-pgtable + i))); free_pages((unsigned long)priv-pgtable, 2); free_pages((unsigned long)priv-lv2entcnt, 1); @@ -859,7 +862,7 @@ static unsigned long *alloc_lv2entry(unsigned long *sent, unsigned long iova, if (lv1ent_fault(sent)) { unsigned long *pent; - pent = kzalloc(LV2TABLE_SIZE, GFP_ATOMIC); + pent = kmem_cache_zalloc(lv2table_kmem_cache, GFP_ATOMIC); BUG_ON((unsigned long)pent (LV2TABLE_SIZE - 1)); if (!pent) return ERR_PTR(-ENOMEM); @@ -884,7 +887,7 @@ static int lv1set_section(unsigned long *sent, phys_addr_t paddr, short *pgcnt) if (*pgcnt != NUM_LV2ENTRIES) return -EADDRINUSE; - kfree(page_entry(sent, 0)); + kmem_cache_free(lv2table_kmem_cache, page_entry(sent, 0)); *pgcnt = 0; } @@ -1092,10 +1095,23 @@ static int __init exynos_iommu_init(void) { int ret; + lv2table_kmem_cache = kmem_cache_create(exynos-iommu-lv2table, + LV2TABLE_SIZE, LV2TABLE_SIZE, 0, NULL); + if (!lv2table_kmem_cache) { + pr_err(%s: Failed to create kmem cache\n, __func__); + return -ENOMEM; + } + ret = platform_driver_register(exynos_sysmmu_driver); if (ret == 0) - bus_set_iommu(platform_bus_type, exynos_iommu_ops); + ret = bus_set_iommu(platform_bus_type, exynos_iommu_ops); + + if (ret) { + pr_err(%s: Failed to register exynos-iommu driver.\n, + __func__); + kmem_cache_destroy(lv2table_kmem_cache); + } return ret; } -- 1.7.2.5 -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] [media] exynos-gsc: Register v4l2 device
Gscaler video device registration was happening without reference to a parent v4l2_dev causing probe to fail. The patch creates a parent v4l2 device and uses it for gsc m2m video device registration. Signed-off-by: Arun Kumar K arun...@samsung.com --- drivers/media/platform/exynos-gsc/gsc-core.c |9 - drivers/media/platform/exynos-gsc/gsc-core.h |1 + drivers/media/platform/exynos-gsc/gsc-m2m.c |1 + 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/exynos-gsc/gsc-core.c b/drivers/media/platform/exynos-gsc/gsc-core.c index 559fab2..1ec60264 100644 --- a/drivers/media/platform/exynos-gsc/gsc-core.c +++ b/drivers/media/platform/exynos-gsc/gsc-core.c @@ -1122,10 +1122,14 @@ static int gsc_probe(struct platform_device *pdev) goto err_clk; } - ret = gsc_register_m2m_device(gsc); + ret = v4l2_device_register(dev, gsc-v4l2_dev); if (ret) goto err_clk; + ret = gsc_register_m2m_device(gsc); + if (ret) + goto err_v4l2; + platform_set_drvdata(pdev, gsc); pm_runtime_enable(dev); ret = pm_runtime_get_sync(pdev-dev); @@ -1147,6 +1151,8 @@ err_pm: pm_runtime_put(dev); err_m2m: gsc_unregister_m2m_device(gsc); +err_v4l2: + v4l2_device_unregister(gsc-v4l2_dev); err_clk: gsc_clk_put(gsc); return ret; @@ -1157,6 +1163,7 @@ static int gsc_remove(struct platform_device *pdev) struct gsc_dev *gsc = platform_get_drvdata(pdev); gsc_unregister_m2m_device(gsc); + v4l2_device_unregister(gsc-v4l2_dev); vb2_dma_contig_cleanup_ctx(gsc-alloc_ctx); pm_runtime_disable(pdev-dev); diff --git a/drivers/media/platform/exynos-gsc/gsc-core.h b/drivers/media/platform/exynos-gsc/gsc-core.h index cc19bba..76435d3 100644 --- a/drivers/media/platform/exynos-gsc/gsc-core.h +++ b/drivers/media/platform/exynos-gsc/gsc-core.h @@ -343,6 +343,7 @@ struct gsc_dev { unsigned long state; struct vb2_alloc_ctx*alloc_ctx; struct video_device vdev; + struct v4l2_device v4l2_dev; }; /** diff --git a/drivers/media/platform/exynos-gsc/gsc-m2m.c b/drivers/media/platform/exynos-gsc/gsc-m2m.c index 40a73f7..e576ff2 100644 --- a/drivers/media/platform/exynos-gsc/gsc-m2m.c +++ b/drivers/media/platform/exynos-gsc/gsc-m2m.c @@ -751,6 +751,7 @@ int gsc_register_m2m_device(struct gsc_dev *gsc) gsc-vdev.release = video_device_release_empty; gsc-vdev.lock = gsc-lock; gsc-vdev.vfl_dir = VFL_DIR_M2M; + gsc-vdev.v4l2_dev = gsc-v4l2_dev; snprintf(gsc-vdev.name, sizeof(gsc-vdev.name), %s.%d:m2m, GSC_MODULE_NAME, gsc-id); -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v8 06/12] ARM: dts: Add description of System MMU of Exynos SoCs
Signed-off-by: Cho KyongHo pullip@samsung.com --- .../bindings/iommu/samsung,exynos4210-sysmmu.txt | 103 +++ arch/arm/boot/dts/exynos4.dtsi | 122 arch/arm/boot/dts/exynos4210.dtsi | 25 ++ arch/arm/boot/dts/exynos4x12.dtsi | 76 + arch/arm/boot/dts/exynos5250.dtsi | 291 5 files changed, 617 insertions(+), 0 deletions(-) create mode 100644 Documentation/devicetree/bindings/iommu/samsung,exynos4210-sysmmu.txt diff --git a/Documentation/devicetree/bindings/iommu/samsung,exynos4210-sysmmu.txt b/Documentation/devicetree/bindings/iommu/samsung,exynos4210-sysmmu.txt new file mode 100644 index 000..92f0a33 --- /dev/null +++ b/Documentation/devicetree/bindings/iommu/samsung,exynos4210-sysmmu.txt @@ -0,0 +1,103 @@ +Samsung Exynos4210 IOMMU H/W, System MMU (System Memory Management Unit) + +Samsung's Exynos architecture contains System MMU that enables scattered +physical memory chunks visible as a contiguous region to DMA-capable peripheral +devices like MFC, FIMC, FIMD, GScaler, FIMC-IS and so forth. + +System MMU is a sort of IOMMU and support identical translation table format to +ARMv7 translation tables with minimum set of page properties including access +permissions, shareability and security protection. In addition, System MMU has +another capabilities like L2 TLB or block-fetch buffers to minimize translation +latency. + +A System MMU is dedicated to a single master peripheral device. Thus, it is +important to specify the correct System MMU in the device node of its master +device. Whereas a System MMU is dedicated to a master device, the master device +may have more than one System MMU. + +Required properties: +- compatible: Should be samsung,exynos4210-sysmmu +- reg: A tuple of base address and size of System MMU registers. +- interrupt-parent: The phandle of the interrupt controller of System MMU +- interrupts: A tuple of numbers that indicates the interrupt source. +- clock-names: Should be sysmmu if the System MMU is needed to gate its clock. + Please refer to the following documents: + Documentation/devicetree/bindings/clock/clock-bindings.txt + Documentation/devicetree/bindings/clock/exynos4-clock.txt + Documentation/devicetree/bindings/clock/exynos5250-clock.txt + Optional master if the clock to the System MMU is gated by + another gate clock other than sysmmu. The System MMU driver + sets master the parent of sysmmu. + Exynos4 SoCs, there needs no master clocks. + Exynos5 SoCs, some System MMUs must have master clocks. +- clocks: Required if the System MMU is needed to gate its clock. + Please refer to the documents listed above. +- samsung,power-domain: Required if the System MMU is needed to gate its power. + Please refer to the following document: + Documentation/devicetree/bindings/arm/exynos/power_domain.txt + +Required properties for the master peripheral devices: +- iommu: phandles to the System MMUs of the device + +Examples: +A System MMU is dedicated to a single master device. + gsc_0: gsc@0x13e0 { + compatible = samsung,exynos5-gsc; + reg = 0x13e0 0x1000; + interrupts = 0 85 0; + samsung,power-domain = pd_gsc; + clocks = clock 256; + clock-names = gscl; + iommu = sysmmu_gsc1; + }; + + sysmmu_gsc0: sysmmu@13E8 { + compatible = samsung,exynos4210-sysmmu; + reg = 0x13E8 0x1000; + interrupt-parent = combiner; + interrupt-names = sysmmu-gsc0; + interrupts = 2 0; + clock-names = sysmmu, master; + clocks = clock 262, clock 256; + samsung,power-domain = pd_gsc; + status = ok; + }; + +MFC has 2 System MMUs for each port that MFC is attached. Thus it seems natural +to define 2 System MMUs for each port of the MFC: + + mfc: codec@1340 { + compatible = samsung,mfc-v5; + reg = 0x1340 0x1; + interrupts = 0 94 0; + samsung,power-domain = pd_mfc; + clocks = clock 170, clock 273; + clock-names = sclk_mfc, mfc; + status = ok; + iommu = sysmmu_mfc_l, sysmmu_mfc_r; + }; + + sysmmu_mfc_l: sysmmu@1362 { + compatible = samsung,exynos4210-sysmmu; + reg = 0x1362 0x1000; + interrupt-parent = combiner; + interrupt-names = sysmmu-mfc-l; + interrupts = 5 5; + clock-names = sysmmu; + clocks = clock 274; + samsung,power-domain = pd_mfc; + status = ok; + }; + + sysmmu_mfc_r: sysmmu@1363 { +
[PATCH v8 05/12] clk: exynos5250: add gate clock descriptions of System MMU
This adds gate clocks of all System MMUs and their master IPs that are not apeared in clk-exynos5250.c Signed-off-by: Cho KyongHo pullip@samsung.com --- .../devicetree/bindings/clock/exynos5250-clock.txt | 28 +- drivers/clk/samsung/clk-exynos5250.c | 57 --- 2 files changed, 75 insertions(+), 10 deletions(-) diff --git a/Documentation/devicetree/bindings/clock/exynos5250-clock.txt b/Documentation/devicetree/bindings/clock/exynos5250-clock.txt index 781a627..df49694 100644 --- a/Documentation/devicetree/bindings/clock/exynos5250-clock.txt +++ b/Documentation/devicetree/bindings/clock/exynos5250-clock.txt @@ -154,7 +154,33 @@ clock which they consume. dsim0341 dp 342 mixer343 - hdmi 345 + hdmi 344 + camif_top345 + smmu_fimc_lite0 346 + smmu_fimc_lite1 347 + smmu_fimc_lite2 348 + smmu_tv 349 + smmu_fimd1 350 + smmu_2d 351 + fimc_isp 352 + fimc_drc 353 + fimc_fd 354 + fimc_scc 355 + fimc_scp 356 + fimc_mcuctl 357 + fimc_odc 358 + fimc_dis 359 + fimc_3dnr360 + smmu_fimc_isp361 + smmu_fimc_drc362 + smmu_fimc_fd 363 + smmu_fimc_scc364 + smmu_fimc_scp365 + smmu_fimc_mcuctl 366 + smmu_fimc_odc367 + smmu_fimc_dis0 368 + smmu_fimc_dis1 369 + smmu_fimc_3dnr 370 Example 1: An example of a clock controller node is listed below. diff --git a/drivers/clk/samsung/clk-exynos5250.c b/drivers/clk/samsung/clk-exynos5250.c index 22d7699..e242bde 100644 --- a/drivers/clk/samsung/clk-exynos5250.c +++ b/drivers/clk/samsung/clk-exynos5250.c @@ -53,12 +53,15 @@ #define DIV_PERIC3 0x10564 #define DIV_PERIC4 0x10568 #define DIV_PERIC5 0x1056c +#define GATE_IP_ISP0 0x0C800 +#define GATE_IP_ISP1 0x0C800 #define GATE_IP_GSCL 0x10920 #define GATE_IP_MFC0x1092c #define GATE_IP_GEN0x10934 #define GATE_IP_FSYS 0x10944 #define GATE_IP_PERIC 0x10950 #define GATE_IP_PERIS 0x10960 +#define GATE_IP_ACP0x18800 #define SRC_CDREX 0x20200 #define PLL_DIV2_SEL 0x20a24 #define GATE_IP_DISP1 0x10928 @@ -100,6 +103,14 @@ enum exynos5250_clks { tzpc2, tzpc3, tzpc4, tzpc5, tzpc6, tzpc7, tzpc8, tzpc9, hdmi_cec, mct, wdt, rtc, tmu, fimd1, mie1, dsim0, dp, mixer, hdmi, + camif_top, smmu_fimc_lite0, smmu_fimc_lite1, smmu_fimc_lite2, + smmu_tv, smmu_fimd1, smmu_2d, + fimc_isp, fimc_drc, fimc_fd, fimc_scc, fimc_scp, fimc_mcuctl, fimc_odc, + fimc_dis, fimc_3dnr, + smmu_fimc_isp, smmu_fimc_drc, smmu_fimc_fd, smmu_fimc_scc, + smmu_fimc_scp, smmu_fimc_mcuctl, smmu_fimc_odc, smmu_fimc_dis0, + smmu_fimc_dis1, smmu_fimc_3dnr, + nr_clks, }; @@ -320,19 +331,26 @@ struct samsung_gate_clock exynos5250_gate_clks[] __initdata = { GATE(gscl3, gscl3, aclk266, GATE_IP_GSCL, 3, 0, 0), GATE(gscl_wa, gscl_wa, div_gscl_wa, GATE_IP_GSCL, 5, 0, 0), GATE(gscl_wb, gscl_wb, div_gscl_wb, GATE_IP_GSCL, 6, 0, 0), - GATE(smmu_gscl0, smmu_gscl0, aclk266, GATE_IP_GSCL, 7, 0, 0), - GATE(smmu_gscl1, smmu_gscl1, aclk266, GATE_IP_GSCL, 8, 0, 0), - GATE(smmu_gscl2, smmu_gscl2, aclk266, GATE_IP_GSCL, 9, 0, 0), - GATE(smmu_gscl3, smmu_gscl3, aclk266, GATE_IP_GSCL, 10, 0, 0), + GATE(smmu_gscl0, smmu_gscl0, none, GATE_IP_GSCL, 7, 0, 0), + GATE(smmu_gscl1, smmu_gscl1, none, GATE_IP_GSCL, 8, 0, 0), + GATE(smmu_gscl2, smmu_gscl2, none, GATE_IP_GSCL, 9, 0, 0), + GATE(smmu_gscl3, smmu_gscl3, none, GATE_IP_GSCL, 10, 0, 0), + GATE(camif_top, camif_top, aclk266, GATE_IP_GSCL, 4, 0, 0), + GATE(smmu_fimc_lite0, smmu_fimc_lite0, none, + GATE_IP_GSCL, 12, 0, 0), + GATE(smmu_fimc_lite1, smmu_fimc_lite1, none, + GATE_IP_GSCL, 13, 0, 0), + GATE(smmu_fimc_lite2, smmu_fimc_lite2, none, + GATE_IP_GSCL, 14, 0, 0), GATE(mfc, mfc, aclk333, GATE_IP_MFC, 0, 0, 0), - GATE(smmu_mfcl, smmu_mfcl, aclk333, GATE_IP_MFC, 1, 0, 0), - GATE(smmu_mfcr, smmu_mfcr, aclk333, GATE_IP_MFC, 2, 0, 0), + GATE(smmu_mfcr, smmu_mfcr, none, GATE_IP_MFC, 1, 0, 0), + GATE(smmu_mfcl, smmu_mfcl, none, GATE_IP_MFC, 2, 0, 0), GATE(rotator, rotator, aclk266, GATE_IP_GEN, 1, 0, 0), GATE(jpeg, jpeg, aclk166, GATE_IP_GEN, 2, 0, 0), GATE(mdma1, mdma1, aclk266, GATE_IP_GEN, 4, 0, 0), - GATE(smmu_rotator, smmu_rotator, aclk266, GATE_IP_GEN, 6, 0, 0), -
[PATCH v8 09/12] iommu/exynos: remove custom fault handler
This commit removes custom fault handler. The device drivers that need to register fault handler can register with iommu_set_fault_handler(). Signed-off-by: Cho KyongHo pullip@samsung.com --- drivers/iommu/exynos-iommu.c | 71 ++ 1 files changed, 17 insertions(+), 54 deletions(-) diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c index 87f6bb7..f9853fe 100644 --- a/drivers/iommu/exynos-iommu.c +++ b/drivers/iommu/exynos-iommu.c @@ -131,16 +131,6 @@ enum exynos_sysmmu_inttype { SYSMMU_FAULTS_NUM }; -/* - * @itype: type of fault. - * @pgtable_base: the physical address of page table base. This is 0 if @itype - *is SYSMMU_BUSERROR. - * @fault_addr: the device (virtual) address that the System MMU tried to - * translated. This is 0 if @itype is SYSMMU_BUSERROR. - */ -typedef int (*sysmmu_fault_handler_t)(enum exynos_sysmmu_inttype itype, - unsigned long pgtable_base, unsigned long fault_addr); - static unsigned short fault_reg_offset[SYSMMU_FAULTS_NUM] = { REG_PAGE_FAULT_ADDR, REG_AR_FAULT_ADDR, @@ -181,7 +171,6 @@ struct sysmmu_drvdata { int activations; rwlock_t lock; struct iommu_domain *domain; - sysmmu_fault_handler_t fault_handler; unsigned long pgtable; void __iomem *sfrbases[0]; }; @@ -313,34 +302,17 @@ finish: read_unlock_irqrestore(data-lock, flags); } -static void __set_fault_handler(struct sysmmu_drvdata *data, - sysmmu_fault_handler_t handler) -{ - unsigned long flags; - - write_lock_irqsave(data-lock, flags); - data-fault_handler = handler; - write_unlock_irqrestore(data-lock, flags); -} - -void exynos_sysmmu_set_fault_handler(struct device *dev, - sysmmu_fault_handler_t handler) -{ - struct sysmmu_drvdata *data = dev_get_drvdata(dev-archdata.iommu); - - __set_fault_handler(data, handler); -} - -static int default_fault_handler(enum exynos_sysmmu_inttype itype, -unsigned long pgtable_base, unsigned long fault_addr) +static void show_fault_information(const char *name, + enum exynos_sysmmu_inttype itype, + unsigned long pgtable_base, unsigned long fault_addr) { unsigned long *ent; if ((itype = SYSMMU_FAULTS_NUM) || (itype SYSMMU_PAGEFAULT)) itype = SYSMMU_FAULT_UNKNOWN; - pr_err(%s occurred at 0x%lx(Page table base: 0x%lx)\n, - sysmmu_fault_name[itype], fault_addr, pgtable_base); + pr_err(%s occurred at 0x%lx by %s(Page table base: 0x%lx)\n, + sysmmu_fault_name[itype], fault_addr, name, pgtable_base); ent = section_entry(__va(pgtable_base), fault_addr); pr_err(\tLv1 entry: 0x%lx\n, *ent); @@ -353,16 +325,12 @@ static int default_fault_handler(enum exynos_sysmmu_inttype itype, pr_err(Generating Kernel OOPS... because it is unrecoverable.\n); BUG(); - - return 0; } static irqreturn_t exynos_sysmmu_irq(int irq, void *dev_id) { /* SYSMMU is in blocked when interrupt occurred. */ struct sysmmu_drvdata *data = dev_id; - struct resource *irqres; - struct platform_device *pdev; enum exynos_sysmmu_inttype itype; unsigned long addr = -1; @@ -372,14 +340,15 @@ static irqreturn_t exynos_sysmmu_irq(int irq, void *dev_id) WARN_ON(!is_sysmmu_active(data)); - pdev = to_platform_device(data-sysmmu); - for (i = 0; i (pdev-num_resources / 2); i++) { - irqres = platform_get_resource(pdev, IORESOURCE_IRQ, i); + for (i = 0; i data-nsfrs; i++) { + struct resource *irqres; + irqres = platform_get_resource(to_platform_device(data-sysmmu), + IORESOURCE_IRQ, i); if (irqres ((int)irqres-start == irq)) break; } - if (i == pdev-num_resources) { + if (i == data-nsfrs) { itype = SYSMMU_FAULT_UNKNOWN; } else { itype = (enum exynos_sysmmu_inttype) @@ -395,19 +364,15 @@ static irqreturn_t exynos_sysmmu_irq(int irq, void *dev_id) ret = report_iommu_fault(data-domain, data-dev, addr, itype); - if ((ret == -ENOSYS) data-fault_handler) { - unsigned long base = data-pgtable; - if (itype != SYSMMU_FAULT_UNKNOWN) - base = __raw_readl( - data-sfrbases[i] + REG_PT_BASE_ADDR); - ret = data-fault_handler(itype, base, addr); - } - if (!ret (itype != SYSMMU_FAULT_UNKNOWN)) __raw_writel(1 itype, data-sfrbases[i] + REG_INT_CLEAR); - else - dev_dbg(data-sysmmu, %s is not handled.\n,
[PATCH v8 08/12] iommu/exynos: remove prefetch buffer setting when enabling System MMU
Prefetch buffer must be handled accurately, exact range of a buffer, frame by frame manually. Otherwise, it may causes page fault or deadlock in System MMU. Thus this patch removes prefetch buffer setting when System MMU is initialized(enabled). Signed-off-by: Cho KyongHo pullip@samsung.com --- drivers/iommu/exynos-iommu.c | 32 +++- 1 files changed, 27 insertions(+), 5 deletions(-) diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c index cfc02ed..87f6bb7 100644 --- a/drivers/iommu/exynos-iommu.c +++ b/drivers/iommu/exynos-iommu.c @@ -80,6 +80,8 @@ #define CTRL_BLOCK 0x7 #define CTRL_DISABLE 0x0 +#define CFG_FLPDCACHE (1 20) /* System MMU 3.2+ only */ + #define REG_MMU_CTRL 0x000 #define REG_MMU_CFG0x004 #define REG_MMU_STATUS 0x008 @@ -96,6 +98,9 @@ #define REG_MMU_VERSION0x034 +#define MMU_MAJ_VER(reg) (reg 28) +#define MMU_MIN_VER(reg) ((reg 21) 0x7F) + #define REG_PB0_SADDR 0x04C #define REG_PB0_EADDR 0x050 #define REG_PB1_SADDR 0x054 @@ -200,6 +205,22 @@ static bool is_sysmmu_active(struct sysmmu_drvdata *data) return data-activations 0; } +static unsigned int __sysmmu_version(struct sysmmu_drvdata *data, +int idx, unsigned int *minor) +{ + unsigned long major; + + major = readl(data-sfrbases[idx] + REG_MMU_VERSION); + + if (minor) + *minor = MMU_MIN_VER(major); + + if (MMU_MAJ_VER(major) 3) + return 1; + + return MMU_MAJ_VER(major); +} + static void sysmmu_unblock(void __iomem *sfrbase) { __raw_writel(CTRL_ENABLE, sfrbase + REG_MMU_CTRL); @@ -460,14 +481,15 @@ static int __exynos_sysmmu_enable(struct sysmmu_drvdata *data, data-pgtable = pgtable; for (i = 0; i data-nsfrs; i++) { + unsigned int min; + __sysmmu_set_ptbase(data-sfrbases[i], pgtable); - if ((readl(data-sfrbases[i] + REG_MMU_VERSION) 28) == 3) { - /* System MMU version is 3.x */ - __raw_writel((1 12) | (2 28), + if ((__sysmmu_version(data, i, min) == 3) (min 1)) { + unsigned long cfg; + cfg = __raw_readl(data-sfrbases[i] + REG_MMU_CFG); + __raw_writel(cfg | CFG_FLPDCACHE, data-sfrbases[i] + REG_MMU_CFG); - __sysmmu_set_prefbuf(data-sfrbases[i], 0, -1, 0); - __sysmmu_set_prefbuf(data-sfrbases[i], 0, -1, 1); } __raw_writel(CTRL_ENABLE, data-sfrbases[i] + REG_MMU_CTRL); -- 1.7.2.5 -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v8 07/12] iommu/exynos: support for device tree
This commit adds device tree support for System MMU. This also include the following changes and enhancements: * use managed device helper functions. Simplyfies System MMU device driver. * use only a single clock descriptor. System MMU device descriptor is seperate if it is imposible to make a single clock descriptor to make a device descriptor for a group of System MMUs. * removed dbgname member from sysmmu_drvdata structure. debugging kernel message for a System MMU is distinguisheable with the name of device descroptors. Signed-off-by: Cho KyongHo pullip@samsung.com --- drivers/iommu/Kconfig|5 +- drivers/iommu/exynos-iommu.c | 182 -- 2 files changed, 70 insertions(+), 117 deletions(-) diff --git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig index c332fb9..d45f3c9 100644 --- a/drivers/iommu/Kconfig +++ b/drivers/iommu/Kconfig @@ -168,16 +168,15 @@ config TEGRA_IOMMU_SMMU config EXYNOS_IOMMU bool Exynos IOMMU Support - depends on ARCH_EXYNOS EXYNOS_DEV_SYSMMU + depends on ARCH_EXYNOS select IOMMU_API + default n help Support for the IOMMU(System MMU) of Samsung Exynos application processor family. This enables H/W multimedia accellerators to see non-linear physical memory chunks as a linear memory in their address spaces - If unsure, say N here. - config EXYNOS_IOMMU_DEBUG bool Debugging log for Exynos IOMMU depends on EXYNOS_IOMMU diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c index 093eea5..cfc02ed 100644 --- a/drivers/iommu/exynos-iommu.c +++ b/drivers/iommu/exynos-iommu.c @@ -26,6 +26,7 @@ #include linux/list.h #include linux/memblock.h #include linux/export.h +#include linux/of.h #include asm/cacheflush.h #include asm/pgtable.h @@ -170,15 +171,14 @@ struct sysmmu_drvdata { struct list_head node; /* entry of exynos_iommu_domain.clients */ struct device *sysmmu; /* System MMU's device descriptor */ struct device *dev; /* Owner of system MMU */ - char *dbgname; int nsfrs; - void __iomem **sfrbases; - struct clk *clk[2]; + struct clk *clk; int activations; rwlock_t lock; struct iommu_domain *domain; sysmmu_fault_handler_t fault_handler; unsigned long pgtable; + void __iomem *sfrbases[0]; }; static bool set_sysmmu_active(struct sysmmu_drvdata *data) @@ -385,8 +385,8 @@ static irqreturn_t exynos_sysmmu_irq(int irq, void *dev_id) if (!ret (itype != SYSMMU_FAULT_UNKNOWN)) __raw_writel(1 itype, data-sfrbases[i] + REG_INT_CLEAR); else - dev_dbg(data-sysmmu, (%s) %s is not handled.\n, - data-dbgname, sysmmu_fault_name[itype]); + dev_dbg(data-sysmmu, %s is not handled.\n, + sysmmu_fault_name[itype]); if (itype != SYSMMU_FAULT_UNKNOWN) sysmmu_unblock(data-sfrbases[i]); @@ -410,10 +410,8 @@ static bool __exynos_sysmmu_disable(struct sysmmu_drvdata *data) for (i = 0; i data-nsfrs; i++) __raw_writel(CTRL_DISABLE, data-sfrbases[i] + REG_MMU_CTRL); - if (data-clk[1]) - clk_disable(data-clk[1]); - if (data-clk[0]) - clk_disable(data-clk[0]); + if (data-clk) + clk_disable(data-clk); disabled = true; data-pgtable = 0; @@ -422,10 +420,10 @@ finish: write_unlock_irqrestore(data-lock, flags); if (disabled) - dev_dbg(data-sysmmu, (%s) Disabled\n, data-dbgname); + dev_dbg(data-sysmmu, Disabled\n); else - dev_dbg(data-sysmmu, (%s) %d times left to be disabled\n, - data-dbgname, data-activations); + dev_dbg(data-sysmmu, %d times left to be disabled\n, + data-activations); return disabled; } @@ -452,14 +450,12 @@ static int __exynos_sysmmu_enable(struct sysmmu_drvdata *data, ret = 1; } - dev_dbg(data-sysmmu, (%s) Already enabled\n, data-dbgname); + dev_dbg(data-sysmmu, Already enabled\n); goto finish; } - if (data-clk[0]) - clk_enable(data-clk[0]); - if (data-clk[1]) - clk_enable(data-clk[1]); + if (data-clk) + clk_enable(data-clk); data-pgtable = pgtable; @@ -479,7 +475,7 @@ static int __exynos_sysmmu_enable(struct sysmmu_drvdata *data, data-domain = domain; - dev_dbg(data-sysmmu, (%s) Enabled\n, data-dbgname); + dev_dbg(data-sysmmu, Enabled\n); finish: write_unlock_irqrestore(data-lock, flags); @@ -495,7 +491,7 @@ int exynos_sysmmu_enable(struct device *dev, unsigned long pgtable)
[PATCH v8 10/12] iommu/exynos: add bus notifier for registering System MMU
When a device driver is registered, all constructs to handle System MMU is prepared by bus notifier call. Signed-off-by: Cho KyongHo pullip@samsung.com --- drivers/iommu/exynos-iommu.c | 708 - 1 files changed, 552 insertions(+), 156 deletions(-) diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c index f9853fe..c62c244 100644 --- a/drivers/iommu/exynos-iommu.c +++ b/drivers/iommu/exynos-iommu.c @@ -27,6 +27,9 @@ #include linux/memblock.h #include linux/export.h #include linux/of.h +#include linux/of_platform.h +#include linux/pm_domain.h +#include linux/notifier.h #include asm/cacheflush.h #include asm/pgtable.h @@ -80,7 +83,13 @@ #define CTRL_BLOCK 0x7 #define CTRL_DISABLE 0x0 +#define CFG_LRU0x1 +#define CFG_QOS(n) ((n 0xF) 7) +#define CFG_MASK 0x0150 /* Selecting bit 0-15, 20, 22 and 24 */ +#define CFG_ACGEN (1 24) /* System MMU 3.3 only */ +#define CFG_SYSSEL (1 22) /* System MMU 3.2 only */ #define CFG_FLPDCACHE (1 20) /* System MMU 3.2+ only */ +#define CFG_SHAREABLE (1 12) /* System MMU 3.x only */ #define REG_MMU_CTRL 0x000 #define REG_MMU_CFG0x004 @@ -154,6 +163,14 @@ static char *sysmmu_fault_name[SYSMMU_FAULTS_NUM] = { UNKNOWN FAULT }; +struct exynos_iommu_client { + struct list_head node; /* entry of exynos_iommu_domain.clients */ + struct device *dev; + spinlock_t lock; + int num_sysmmu; + struct device *sysmmu[0]; +}; + struct exynos_iommu_domain { struct list_head clients; /* list of sysmmu_drvdata.node */ unsigned long *pgtable; /* lv1 page table, 16KB */ @@ -165,12 +182,14 @@ struct exynos_iommu_domain { struct sysmmu_drvdata { struct list_head node; /* entry of exynos_iommu_domain.clients */ struct device *sysmmu; /* System MMU's device descriptor */ - struct device *dev; /* Owner of system MMU */ + struct device *master; /* Owner of system MMU */ int nsfrs; struct clk *clk; + struct clk *clk_master; int activations; rwlock_t lock; struct iommu_domain *domain; + bool runtime_active; unsigned long pgtable; void __iomem *sfrbases[0]; }; @@ -245,7 +264,6 @@ static void __sysmmu_tlb_invalidate_entry(void __iomem *sfrbase, static void __sysmmu_set_ptbase(void __iomem *sfrbase, unsigned long pgd) { - __raw_writel(0x1, sfrbase + REG_MMU_CFG); /* 16KB LV1, LRU */ __raw_writel(pgd, sfrbase + REG_PT_BASE_ADDR); __sysmmu_tlb_invalidate(sfrbase); @@ -273,6 +291,7 @@ void exynos_sysmmu_set_prefbuf(struct device *dev, if (!is_sysmmu_active(data)) goto finish; + clk_enable(data-clk_master); for (i = 0; i data-nsfrs; i++) { if ((readl(data-sfrbases[i] + REG_MMU_VERSION) 28) == 3) { if (!sysmmu_block(data-sfrbases[i])) @@ -298,6 +317,7 @@ void exynos_sysmmu_set_prefbuf(struct device *dev, sysmmu_unblock(data-sfrbases[i]); } } + clk_disable(data-clk_master); finish: read_unlock_irqrestore(data-lock, flags); } @@ -331,12 +351,13 @@ static irqreturn_t exynos_sysmmu_irq(int irq, void *dev_id) { /* SYSMMU is in blocked when interrupt occurred. */ struct sysmmu_drvdata *data = dev_id; + struct exynos_iommu_client *client = NULL; enum exynos_sysmmu_inttype itype; unsigned long addr = -1; - int i, ret = -ENOSYS; - read_lock(data-lock); + if (data-master) + client = data-master-archdata.iommu; WARN_ON(!is_sysmmu_active(data)); @@ -348,6 +369,10 @@ static irqreturn_t exynos_sysmmu_irq(int irq, void *dev_id) break; } + if (client) + spin_lock(client-lock); + read_lock(data-lock); + if (i == data-nsfrs) { itype = SYSMMU_FAULT_UNKNOWN; } else { @@ -361,7 +386,7 @@ static irqreturn_t exynos_sysmmu_irq(int irq, void *dev_id) } if (data-domain) - ret = report_iommu_fault(data-domain, data-dev, + ret = report_iommu_fault(data-domain, data-master, addr, itype); if (!ret (itype != SYSMMU_FAULT_UNKNOWN)) @@ -378,177 +403,251 @@ static irqreturn_t exynos_sysmmu_irq(int irq, void *dev_id) sysmmu_unblock(data-sfrbases[i]); read_unlock(data-lock); + if (client) + spin_unlock(client-lock); return IRQ_HANDLED; } -static bool __exynos_sysmmu_disable(struct sysmmu_drvdata *data) +static void __sysmmu_disable_nocount(struct sysmmu_drvdata *data) { - unsigned long flags; - bool disabled = false; int i; - write_lock_irqsave(data-lock, flags); +
[PATCH v8 11/12] iommu/exynos: change rwlock to spinlock
Since acquiring read_lock is not more frequent than write_lock, it is not beneficial to use rwlock, this commit changes rwlock to spinlock. Signed-off-by: Cho KyongHo pullip@samsung.com --- drivers/iommu/exynos-iommu.c | 36 ++-- 1 files changed, 18 insertions(+), 18 deletions(-) diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c index c62c244..51e5b35 100644 --- a/drivers/iommu/exynos-iommu.c +++ b/drivers/iommu/exynos-iommu.c @@ -187,7 +187,7 @@ struct sysmmu_drvdata { struct clk *clk; struct clk *clk_master; int activations; - rwlock_t lock; + spinlock_t lock; struct iommu_domain *domain; bool runtime_active; unsigned long pgtable; @@ -287,7 +287,7 @@ void exynos_sysmmu_set_prefbuf(struct device *dev, BUG_ON((base0 + size0) = base0); BUG_ON((size1 0) ((base1 + size1) = base1)); - read_lock_irqsave(data-lock, flags); + spin_lock_irqsave(data-lock, flags); if (!is_sysmmu_active(data)) goto finish; @@ -319,7 +319,7 @@ void exynos_sysmmu_set_prefbuf(struct device *dev, } clk_disable(data-clk_master); finish: - read_unlock_irqrestore(data-lock, flags); + spin_unlock_irqrestore(data-lock, flags); } static void show_fault_information(const char *name, @@ -371,7 +371,7 @@ static irqreturn_t exynos_sysmmu_irq(int irq, void *dev_id) if (client) spin_lock(client-lock); - read_lock(data-lock); + spin_lock(data-lock); if (i == data-nsfrs) { itype = SYSMMU_FAULT_UNKNOWN; @@ -402,7 +402,7 @@ static irqreturn_t exynos_sysmmu_irq(int irq, void *dev_id) if (itype != SYSMMU_FAULT_UNKNOWN) sysmmu_unblock(data-sfrbases[i]); - read_unlock(data-lock); + spin_unlock(data-lock); if (client) spin_unlock(client-lock); @@ -429,7 +429,7 @@ static bool __sysmmu_disable(struct sysmmu_drvdata *data) bool disabled; unsigned long flags; - write_lock_irqsave(data-lock, flags); + spin_lock_irqsave(data-lock, flags); disabled = set_sysmmu_inactive(data); @@ -446,7 +446,7 @@ static bool __sysmmu_disable(struct sysmmu_drvdata *data) data-activations); } - write_unlock_irqrestore(data-lock, flags); + spin_unlock_irqrestore(data-lock, flags); return disabled; } @@ -493,7 +493,7 @@ static int __sysmmu_enable(struct sysmmu_drvdata *data, int ret = 0; unsigned long flags; - write_lock_irqsave(data-lock, flags); + spin_lock_irqsave(data-lock, flags); if (set_sysmmu_active(data)) { data-pgtable = pgtable; data-domain = domain; @@ -511,7 +511,7 @@ static int __sysmmu_enable(struct sysmmu_drvdata *data, if (WARN_ON(ret 0)) set_sysmmu_inactive(data); /* decrement count */ - write_unlock_irqrestore(data-lock, flags); + spin_unlock_irqrestore(data-lock, flags); return ret; } @@ -602,7 +602,7 @@ static void sysmmu_tlb_invalidate_entry(struct device *dev, unsigned long iova) data = dev_get_drvdata(client-sysmmu[i]); - read_lock_irqsave(data-lock, flags); + spin_lock_irqsave(data-lock, flags); if (is_sysmmu_active(data) data-runtime_active) { int i; clk_enable(data-clk_master); @@ -615,7 +615,7 @@ static void sysmmu_tlb_invalidate_entry(struct device *dev, unsigned long iova) disabled. Skipping TLB invalidation @ %#lx\n, iova); } - read_unlock_irqrestore(data-lock, flags); + spin_unlock_irqrestore(data-lock, flags); } } @@ -630,7 +630,7 @@ void exynos_sysmmu_tlb_invalidate(struct device *dev) data = dev_get_drvdata(client-sysmmu[i]); - read_lock_irqsave(data-lock, flags); + spin_lock_irqsave(data-lock, flags); if (is_sysmmu_active(data) data-runtime_active) { int i; @@ -646,7 +646,7 @@ void exynos_sysmmu_tlb_invalidate(struct device *dev) } else { dev_dbg(dev, disabled. Skipping TLB invalidation\n); } - read_unlock_irqrestore(data-lock, flags); + spin_unlock_irqrestore(data-lock, flags); } } @@ -735,7 +735,7 @@ static int __init exynos_sysmmu_probe(struct platform_device *pdev) data-runtime_active = !pm_runtime_enabled(dev); - rwlock_init(data-lock); + spin_lock_init(data-lock); INIT_LIST_HEAD(data-node); platform_set_drvdata(pdev, data); @@ -749,11 +749,11 @@ static int sysmmu_suspend(struct device *dev)
[PATCH v8 12/12] iommu/exynos: return 0 if iommu_attach_device() successes
iommu_attach_device() against exynos-iommu positive integer on success if the caller calls iommu_attach_device() with the same iommu_domain multiple times without call to iommu_detach_device() to inform the caller how many calls to iommu_detach_device() to really detach iommu. However the convention of the return value of success of common API is zero, this patch makes iommu_attach_device() call against exynos-iommu always return zero if the given device is successfully attached to the given iommu_domain even though it is already attached to the same iommu_domain. Signed-off-by: Cho KyongHo pullip@samsung.com --- drivers/iommu/exynos-iommu.c | 13 +++-- 1 files changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c index 51e5b35..6eed6d6 100644 --- a/drivers/iommu/exynos-iommu.c +++ b/drivers/iommu/exynos-iommu.c @@ -882,15 +882,16 @@ static int exynos_iommu_attach_device(struct iommu_domain *domain, spin_unlock_irqrestore(priv-lock, flags); - if (ret 0) + if (ret 0) { dev_err(dev, %s: Failed to attach IOMMU with pgtable %#lx\n, __func__, __pa(priv-pgtable)); - else - dev_dbg(dev, %s: Attached IOMMU with pgtable 0x%lx%s\n, - __func__, __pa(priv-pgtable), - (ret == 0) ? : , again); + return ret; + } - return ret; + dev_dbg(dev, %s: Attached IOMMU with pgtable 0x%lx%s\n, + __func__, __pa(priv-pgtable), (ret == 0) ? : , again); + + return 0; } static void exynos_iommu_detach_device(struct iommu_domain *domain, -- 1.7.2.5 -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: XCLKOUT in exynos5250 clock driver
On 07/26/2013 11:56 AM, Tushar Behera wrote: On 07/25/2013 08:21 PM, Mark Brown wrote: I appear to be missing something in the clock driver for the exynos5250. I'm looking at the Arndale schematic and I see that the audio master clock is connected to XCLKOUT on the SoC. However I can't see any reference to XCLKOUT or anything similar in the clock driver or any of the DTS files - where is this clock exposed by the clock driver? This is something that's not yet supported in the mainline kernels I'm afraid. Unfortunately I haven't been able to get access to the datasheet for the part so I can't check this myself. Information as per Exynos5250 user manual: XCLKOUT is an output pin for debugging clocks. Exynos5250 has a CLKOUT logic which can select one of the clocks (within its clock domains) and output that through XCLKOUT pin. Not sure if XCLKOUT on Arndale schematics means the same. I suspect that the same, you can easily verify that by checking what ball identifier corresponds to XCLKOUT pin and how the routing looks like on the schematics. We have a bit hackish patch that adds support for the CLKOUT at the Exynos4 clocks driver to enable the audio codec. An issue here is that the CLKOUT mux and divider control bitfield is in the PMU registers (as opposed to CMU where the clock control registers normally are) and additionally single register contains the clock mux/divider bitfield as well as couple other unrelated control bits. Depending if those other bits are considered really important or not it it might another reason to expose (part of ?) PMU registers through syscon-like interface. There are registers in PMU that multiple drivers would be interested in, so instead of all of them to independently memory map and mess with single registers, probably a regmap interface could be used. Not sure if this solves the problem well, since each driver would need to have coded SoC specific register offsets. It can be seen in the Galaxy S3 kernel code how the Exynos5 CLKOUT handling might look like. See enum xclkout_select [1], exynos5_pmu_xclkout_set [2]. It would be good someone who has access to the datasheet come up with at with some patch so the audio works are not blocked. I'm not working right now on Exynos5 :P. [1] thttps://github.com/sgs3/GT-I9300_Kernel/blob/master/arch/arm/mach-exynos/include/mach/pmu.h [2] https://github.com/sgs3/GT-I9300_Kernel/blob/master/arch/arm/mach-exynos/pmu-exynos5.c -- Thanks, Sylwester -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v10 5/8] ARM: dts: omap: update usb_otg_hs data
Updated the usb_otg_hs dt data to include the *phy* and *phy-names* binding in order for the driver to use the new generic PHY framework. Also updated the Documentation to include the binding information. The PHY binding information can be found at Documentation/devicetree/bindings/phy/phy-bindings.txt Signed-off-by: Kishon Vijay Abraham I kis...@ti.com Acked-by: Felipe Balbi ba...@ti.com Reviewed-by: Sylwester Nawrocki s.nawro...@samsung.com --- Documentation/devicetree/bindings/usb/omap-usb.txt |5 + Documentation/devicetree/bindings/usb/usb-phy.txt |6 ++ arch/arm/boot/dts/omap3-beagle-xm.dts |2 ++ arch/arm/boot/dts/omap3-evm.dts|2 ++ arch/arm/boot/dts/omap3-overo.dtsi |2 ++ arch/arm/boot/dts/omap4.dtsi |3 +++ arch/arm/boot/dts/twl4030.dtsi |1 + 7 files changed, 21 insertions(+) diff --git a/Documentation/devicetree/bindings/usb/omap-usb.txt b/Documentation/devicetree/bindings/usb/omap-usb.txt index 57e71f6..825790d 100644 --- a/Documentation/devicetree/bindings/usb/omap-usb.txt +++ b/Documentation/devicetree/bindings/usb/omap-usb.txt @@ -19,6 +19,9 @@ OMAP MUSB GLUE - power : Should be 50. This signifies the controller can supply up to 100mA when operating in host mode. - usb-phy : the phandle for the PHY device + - phys : the phandle for the PHY device (used by generic PHY framework) + - phy-names : the names of the PHY corresponding to the PHYs present in the + *phy* phandle. Optional properties: - ctrl-module : phandle of the control module this glue uses to write to @@ -33,6 +36,8 @@ usb_otg_hs: usb_otg_hs@4a0ab000 { num-eps = 16; ram-bits = 12; ctrl-module = omap_control_usb; + phys = usb2_phy; + phy-names = usb2-phy; }; Board specific device node entry diff --git a/Documentation/devicetree/bindings/usb/usb-phy.txt b/Documentation/devicetree/bindings/usb/usb-phy.txt index 61496f5..c0245c8 100644 --- a/Documentation/devicetree/bindings/usb/usb-phy.txt +++ b/Documentation/devicetree/bindings/usb/usb-phy.txt @@ -5,6 +5,8 @@ OMAP USB2 PHY Required properties: - compatible: Should be ti,omap-usb2 - reg : Address and length of the register set for the device. + - #phy-cells: determine the number of cells that should be given in the + phandle while referencing this phy. Optional properties: - ctrl-module : phandle of the control module used by PHY driver to power on @@ -16,6 +18,7 @@ usb2phy@4a0ad080 { compatible = ti,omap-usb2; reg = 0x4a0ad080 0x58; ctrl-module = omap_control_usb; + #phy-cells = 0; }; OMAP USB3 PHY @@ -25,6 +28,8 @@ Required properties: - reg : Address and length of the register set for the device. - reg-names: The names of the register addresses corresponding to the registers filled in reg. + - #phy-cells: determine the number of cells that should be given in the + phandle while referencing this phy. Optional properties: - ctrl-module : phandle of the control module used by PHY driver to power on @@ -39,4 +44,5 @@ usb3phy@4a084400 { 0x4a084c00 0x40; reg-names = phy_rx, phy_tx, pll_ctrl; ctrl-module = omap_control_usb; + #phy-cells = 0; }; diff --git a/arch/arm/boot/dts/omap3-beagle-xm.dts b/arch/arm/boot/dts/omap3-beagle-xm.dts index afdb164..533b2da 100644 --- a/arch/arm/boot/dts/omap3-beagle-xm.dts +++ b/arch/arm/boot/dts/omap3-beagle-xm.dts @@ -144,6 +144,8 @@ usb_otg_hs { interface-type = 0; usb-phy = usb2_phy; + phys = usb2_phy; + phy-names = usb2-phy; mode = 3; power = 50; }; diff --git a/arch/arm/boot/dts/omap3-evm.dts b/arch/arm/boot/dts/omap3-evm.dts index 7d4329d..4134dd0 100644 --- a/arch/arm/boot/dts/omap3-evm.dts +++ b/arch/arm/boot/dts/omap3-evm.dts @@ -70,6 +70,8 @@ usb_otg_hs { interface-type = 0; usb-phy = usb2_phy; + phys = usb2_phy; + phy-names = usb2-phy; mode = 3; power = 50; }; diff --git a/arch/arm/boot/dts/omap3-overo.dtsi b/arch/arm/boot/dts/omap3-overo.dtsi index 8f1abec..a461d2f 100644 --- a/arch/arm/boot/dts/omap3-overo.dtsi +++ b/arch/arm/boot/dts/omap3-overo.dtsi @@ -76,6 +76,8 @@ usb_otg_hs { interface-type = 0; usb-phy = usb2_phy; + phys = usb2_phy; + phy-names = usb2-phy; mode = 3; power = 50; }; diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi index 22d9f2b..1e8e2fe 100644 --- a/arch/arm/boot/dts/omap4.dtsi +++ b/arch/arm/boot/dts/omap4.dtsi @@ -520,6 +520,7 @@ compatible = ti,omap-usb2; reg = 0x4a0ad080 0x58; ctrl-module = omap_control_usb; + #phy-cells = 0; }; }; @@ -658,6 +659,8 @@ interrupt-names = mc, dma;
[PATCH v10 6/8] usb: musb: omap2430: use the new generic PHY framework
Use the generic PHY framework API to get the PHY. The usb_phy_set_resume and usb_phy_set_suspend is replaced with power_on and power_off to align with the new PHY framework. musb-xceiv can't be removed as of now because musb core uses xceiv.state and xceiv.otg. Once there is a separate state machine to handle otg, these can be moved out of xceiv and then we can start using the generic PHY framework. Signed-off-by: Kishon Vijay Abraham I kis...@ti.com Reviewed-by: Sylwester Nawrocki s.nawro...@samsung.com Acked-by: Felipe Balbi ba...@ti.com --- drivers/usb/musb/Kconfig |1 + drivers/usb/musb/musb_core.h |2 ++ drivers/usb/musb/omap2430.c | 26 -- 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/drivers/usb/musb/Kconfig b/drivers/usb/musb/Kconfig index 797e3fd..25e2e57 100644 --- a/drivers/usb/musb/Kconfig +++ b/drivers/usb/musb/Kconfig @@ -76,6 +76,7 @@ config USB_MUSB_TUSB6010 config USB_MUSB_OMAP2PLUS tristate OMAP2430 and onwards depends on ARCH_OMAP2PLUS + select GENERIC_PHY config USB_MUSB_AM35X tristate AM35x diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h index 7d341c3..6e567bd 100644 --- a/drivers/usb/musb/musb_core.h +++ b/drivers/usb/musb/musb_core.h @@ -46,6 +46,7 @@ #include linux/usb.h #include linux/usb/otg.h #include linux/usb/musb.h +#include linux/phy/phy.h struct musb; struct musb_hw_ep; @@ -346,6 +347,7 @@ struct musb { u16 int_tx; struct usb_phy *xceiv; + struct phy *phy; int nIrq; unsignedirq_wake:1; diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c index 6708a3b..f7b33f4 100644 --- a/drivers/usb/musb/omap2430.c +++ b/drivers/usb/musb/omap2430.c @@ -348,11 +348,21 @@ static int omap2430_musb_init(struct musb *musb) * up through ULPI. TWL4030-family PMICs include one, * which needs a driver, drivers aren't always needed. */ - if (dev-parent-of_node) + if (dev-parent-of_node) { + musb-phy = devm_phy_get(dev-parent, usb2-phy); + + /* We can't totally remove musb-xceiv as of now because +* musb core uses xceiv.state and xceiv.otg. Once we have +* a separate state machine to handle otg, these can be moved +* out of xceiv and then we can start using the generic PHY +* framework +*/ musb-xceiv = devm_usb_get_phy_by_phandle(dev-parent, usb-phy, 0); - else + } else { musb-xceiv = devm_usb_get_phy_dev(dev, 0); + musb-phy = devm_phy_get(dev, usb); + } if (IS_ERR(musb-xceiv)) { status = PTR_ERR(musb-xceiv); @@ -364,6 +374,10 @@ static int omap2430_musb_init(struct musb *musb) return -EPROBE_DEFER; } + if (IS_ERR(musb-phy)) { + pr_err(HS USB OTG: no PHY configured\n); + return PTR_ERR(musb-phy); + } musb-isr = omap2430_musb_interrupt; status = pm_runtime_get_sync(dev); @@ -397,7 +411,7 @@ static int omap2430_musb_init(struct musb *musb) if (glue-status != OMAP_MUSB_UNKNOWN) omap_musb_set_mailbox(glue); - usb_phy_init(musb-xceiv); + phy_init(musb-phy); pm_runtime_put_noidle(musb-controller); return 0; @@ -460,6 +474,7 @@ static int omap2430_musb_exit(struct musb *musb) del_timer_sync(musb_idle_timer); omap2430_low_level_exit(musb); + phy_exit(musb-phy); return 0; } @@ -633,7 +648,7 @@ static int omap2430_runtime_suspend(struct device *dev) OTG_INTERFSEL); omap2430_low_level_exit(musb); - usb_phy_set_suspend(musb-xceiv, 1); + phy_power_off(musb-phy); } return 0; @@ -648,8 +663,7 @@ static int omap2430_runtime_resume(struct device *dev) omap2430_low_level_init(musb); musb_writel(musb-mregs, OTG_INTERFSEL, musb-context.otg_interfsel); - - usb_phy_set_suspend(musb-xceiv, 0); + phy_power_on(musb-phy); } return 0; -- 1.7.10.4 -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v10 8/8] usb: phy: twl4030-usb: remove *set_suspend* and *phy_init* ops
Now that twl4030-usb is adapted to the new generic PHY framework, *set_suspend* and *phy_init* ops can be removed from twl4030-usb driver. Signed-off-by: Kishon Vijay Abraham I kis...@ti.com Acked-by: Felipe Balbi ba...@ti.com Reviewed-by: Sylwester Nawrocki s.nawro...@samsung.com --- drivers/phy/phy-twl4030-usb.c | 57 ++--- 1 file changed, 13 insertions(+), 44 deletions(-) diff --git a/drivers/phy/phy-twl4030-usb.c b/drivers/phy/phy-twl4030-usb.c index 494f107..c437211 100644 --- a/drivers/phy/phy-twl4030-usb.c +++ b/drivers/phy/phy-twl4030-usb.c @@ -422,25 +422,20 @@ static void twl4030_phy_power(struct twl4030_usb *twl, int on) } } -static void twl4030_phy_suspend(struct twl4030_usb *twl, int controller_off) +static int twl4030_phy_power_off(struct phy *phy) { + struct twl4030_usb *twl = phy_get_drvdata(phy); + if (twl-asleep) - return; + return 0; twl4030_phy_power(twl, 0); twl-asleep = 1; dev_dbg(twl-dev, %s\n, __func__); -} - -static int twl4030_phy_power_off(struct phy *phy) -{ - struct twl4030_usb *twl = phy_get_drvdata(phy); - - twl4030_phy_suspend(twl, 0); return 0; } -static void __twl4030_phy_resume(struct twl4030_usb *twl) +static void __twl4030_phy_power_on(struct twl4030_usb *twl) { twl4030_phy_power(twl, 1); twl4030_i2c_access(twl, 1); @@ -449,11 +444,13 @@ static void __twl4030_phy_resume(struct twl4030_usb *twl) twl4030_i2c_access(twl, 0); } -static void twl4030_phy_resume(struct twl4030_usb *twl) +static int twl4030_phy_power_on(struct phy *phy) { + struct twl4030_usb *twl = phy_get_drvdata(phy); + if (!twl-asleep) - return; - __twl4030_phy_resume(twl); + return 0; + __twl4030_phy_power_on(twl); twl-asleep = 0; dev_dbg(twl-dev, %s\n, __func__); @@ -466,13 +463,6 @@ static void twl4030_phy_resume(struct twl4030_usb *twl) cancel_delayed_work(twl-id_workaround_work); schedule_delayed_work(twl-id_workaround_work, HZ); } -} - -static int twl4030_phy_power_on(struct phy *phy) -{ - struct twl4030_usb *twl = phy_get_drvdata(phy); - - twl4030_phy_resume(twl); return 0; } @@ -604,9 +594,9 @@ static void twl4030_id_workaround_work(struct work_struct *work) } } -static int twl4030_usb_phy_init(struct usb_phy *phy) +static int twl4030_phy_init(struct phy *phy) { - struct twl4030_usb *twl = phy_to_twl(phy); + struct twl4030_usb *twl = phy_get_drvdata(phy); enum omap_musb_vbus_id_status status; /* @@ -621,32 +611,13 @@ static int twl4030_usb_phy_init(struct usb_phy *phy) if (status == OMAP_MUSB_ID_GROUND || status == OMAP_MUSB_VBUS_VALID) { omap_musb_mailbox(twl-linkstat); - twl4030_phy_resume(twl); + twl4030_phy_power_on(phy); } sysfs_notify(twl-dev-kobj, NULL, vbus); return 0; } -static int twl4030_phy_init(struct phy *phy) -{ - struct twl4030_usb *twl = phy_get_drvdata(phy); - - return twl4030_usb_phy_init(twl-phy); -} - -static int twl4030_set_suspend(struct usb_phy *x, int suspend) -{ - struct twl4030_usb *twl = phy_to_twl(x); - - if (suspend) - twl4030_phy_suspend(twl, 1); - else - twl4030_phy_resume(twl); - - return 0; -} - static int twl4030_set_peripheral(struct usb_otg *otg, struct usb_gadget *gadget) { @@ -719,8 +690,6 @@ static int twl4030_usb_probe(struct platform_device *pdev) twl-phy.label = twl4030; twl-phy.otg= otg; twl-phy.type = USB_PHY_TYPE_USB2; - twl-phy.set_suspend= twl4030_set_suspend; - twl-phy.init = twl4030_usb_phy_init; otg-phy= twl-phy; otg-set_host = twl4030_set_host; -- 1.7.10.4 -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v10 7/8] usb: phy: omap-usb2: remove *set_suspend* callback from omap-usb2
Now that omap-usb2 is adapted to the new generic PHY framework, *set_suspend* ops can be removed from omap-usb2 driver. Signed-off-by: Kishon Vijay Abraham I kis...@ti.com Acked-by: Felipe Balbi ba...@ti.com Reviewed-by: Sylwester Nawrocki s.nawro...@samsung.com --- drivers/phy/phy-omap-usb2.c | 25 - 1 file changed, 25 deletions(-) diff --git a/drivers/phy/phy-omap-usb2.c b/drivers/phy/phy-omap-usb2.c index 25e0f3c..dec3fab 100644 --- a/drivers/phy/phy-omap-usb2.c +++ b/drivers/phy/phy-omap-usb2.c @@ -97,29 +97,6 @@ static int omap_usb_set_peripheral(struct usb_otg *otg, return 0; } -static int omap_usb2_suspend(struct usb_phy *x, int suspend) -{ - u32 ret; - struct omap_usb *phy = phy_to_omapusb(x); - - if (suspend !phy-is_suspended) { - omap_control_usb_phy_power(phy-control_dev, 0); - pm_runtime_put_sync(phy-dev); - phy-is_suspended = 1; - } else if (!suspend phy-is_suspended) { - ret = pm_runtime_get_sync(phy-dev); - if (ret 0) { - dev_err(phy-dev, get_sync failed with err %d\n, - ret); - return ret; - } - omap_control_usb_phy_power(phy-control_dev, 1); - phy-is_suspended = 0; - } - - return 0; -} - static int omap_usb_power_off(struct phy *x) { struct omap_usb *phy = phy_get_drvdata(x); @@ -167,7 +144,6 @@ static int omap_usb2_probe(struct platform_device *pdev) phy-phy.dev= phy-dev; phy-phy.label = omap-usb2; - phy-phy.set_suspend= omap_usb2_suspend; phy-phy.otg= otg; phy-phy.type = USB_PHY_TYPE_USB2; @@ -182,7 +158,6 @@ static int omap_usb2_probe(struct platform_device *pdev) return -ENODEV; } - phy-is_suspended = 1; omap_control_usb_phy_power(phy-control_dev, 0); otg-set_host = omap_usb_set_host; -- 1.7.10.4 -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v10 4/8] arm: omap3: twl: add phy consumer data in twl4030_usb_data
The PHY framework uses the phy consumer data populated in platform data in the case of non-dt boot to return the reference to the PHY when the controller (PHY consumer) requests for it. So populated the phy consumer data in the platform data of twl usb. Signed-off-by: Kishon Vijay Abraham I kis...@ti.com --- arch/arm/mach-omap2/twl-common.c | 11 +++ 1 file changed, 11 insertions(+) diff --git a/arch/arm/mach-omap2/twl-common.c b/arch/arm/mach-omap2/twl-common.c index c05898f..b0d54da 100644 --- a/arch/arm/mach-omap2/twl-common.c +++ b/arch/arm/mach-omap2/twl-common.c @@ -24,6 +24,7 @@ #include linux/i2c/twl.h #include linux/gpio.h #include linux/string.h +#include linux/phy/phy.h #include linux/regulator/machine.h #include linux/regulator/fixed.h @@ -90,8 +91,18 @@ void __init omap_pmic_late_init(void) } #if defined(CONFIG_ARCH_OMAP3) +struct phy_consumer consumers[] = { + PHY_CONSUMER(musb-hdrc.0, usb), +}; + +struct phy_init_data init_data = { + .consumers = consumers, + .num_consumers = ARRAY_SIZE(consumers), +}; + static struct twl4030_usb_data omap3_usb_pdata = { .usb_mode = T2_USB_MODE_ULPI, + .init_data = init_data, }; static int omap3_batt_table[] = { -- 1.7.10.4 -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v10 3/8] usb: phy: twl4030: use the new generic PHY framework
Used the generic PHY framework API to create the PHY. For powering on and powering off the PHY, power_on and power_off ops are used. Once the MUSB OMAP glue is adapted to the new framework, the suspend and resume ops of usb phy library will be removed. Also twl4030-usb driver is moved to drivers/phy/. However using the old usb phy library cannot be completely removed because otg is intertwined with phy and moving to the new framework completely will break otg. Once we have a separate otg state machine, we can get rid of the usb phy library. Signed-off-by: Kishon Vijay Abraham I kis...@ti.com Acked-by: Felipe Balbi ba...@ti.com Reviewed-by: Sylwester Nawrocki s.nawro...@samsung.com --- drivers/phy/Kconfig | 11 ++ drivers/phy/Makefile|1 + drivers/{usb = }/phy/phy-twl4030-usb.c | 56 +-- drivers/usb/phy/Kconfig |9 - drivers/usb/phy/Makefile|1 - include/linux/i2c/twl.h |2 ++ 6 files changed, 67 insertions(+), 13 deletions(-) rename drivers/{usb = }/phy/phy-twl4030-usb.c (95%) diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig index 38c3477..ac239ac 100644 --- a/drivers/phy/Kconfig +++ b/drivers/phy/Kconfig @@ -27,4 +27,15 @@ config OMAP_USB2 The USB OTG controller communicates with the comparator using this driver. +config TWL4030_USB + tristate TWL4030 USB Transceiver Driver + depends on TWL4030_CORE REGULATOR_TWL4030 USB_MUSB_OMAP2PLUS + select GENERIC_PHY + select USB_PHY + help + Enable this to support the USB OTG transceiver on TWL4030 + family chips (including the TWL5030 and TPS659x0 devices). + This transceiver supports high and full speed devices plus, + in host mode, low speed. + endmenu diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile index ed5b088..0dd8a98 100644 --- a/drivers/phy/Makefile +++ b/drivers/phy/Makefile @@ -4,3 +4,4 @@ obj-$(CONFIG_GENERIC_PHY) += phy-core.o obj-$(CONFIG_OMAP_USB2)+= phy-omap-usb2.o +obj-$(CONFIG_TWL4030_USB) += phy-twl4030-usb.o diff --git a/drivers/usb/phy/phy-twl4030-usb.c b/drivers/phy/phy-twl4030-usb.c similarity index 95% rename from drivers/usb/phy/phy-twl4030-usb.c rename to drivers/phy/phy-twl4030-usb.c index 8f78d2d..494f107 100644 --- a/drivers/usb/phy/phy-twl4030-usb.c +++ b/drivers/phy/phy-twl4030-usb.c @@ -33,6 +33,7 @@ #include linux/io.h #include linux/delay.h #include linux/usb/otg.h +#include linux/phy/phy.h #include linux/usb/musb-omap.h #include linux/usb/ulpi.h #include linux/i2c/twl.h @@ -431,6 +432,14 @@ static void twl4030_phy_suspend(struct twl4030_usb *twl, int controller_off) dev_dbg(twl-dev, %s\n, __func__); } +static int twl4030_phy_power_off(struct phy *phy) +{ + struct twl4030_usb *twl = phy_get_drvdata(phy); + + twl4030_phy_suspend(twl, 0); + return 0; +} + static void __twl4030_phy_resume(struct twl4030_usb *twl) { twl4030_phy_power(twl, 1); @@ -459,6 +468,14 @@ static void twl4030_phy_resume(struct twl4030_usb *twl) } } +static int twl4030_phy_power_on(struct phy *phy) +{ + struct twl4030_usb *twl = phy_get_drvdata(phy); + + twl4030_phy_resume(twl); + return 0; +} + static int twl4030_usb_ldo_init(struct twl4030_usb *twl) { /* Enable writing to power configuration registers */ @@ -602,13 +619,22 @@ static int twl4030_usb_phy_init(struct usb_phy *phy) status = twl4030_usb_linkstat(twl); twl-linkstat = status; - if (status == OMAP_MUSB_ID_GROUND || status == OMAP_MUSB_VBUS_VALID) + if (status == OMAP_MUSB_ID_GROUND || status == OMAP_MUSB_VBUS_VALID) { omap_musb_mailbox(twl-linkstat); + twl4030_phy_resume(twl); + } sysfs_notify(twl-dev-kobj, NULL, vbus); return 0; } +static int twl4030_phy_init(struct phy *phy) +{ + struct twl4030_usb *twl = phy_get_drvdata(phy); + + return twl4030_usb_phy_init(twl-phy); +} + static int twl4030_set_suspend(struct usb_phy *x, int suspend) { struct twl4030_usb *twl = phy_to_twl(x); @@ -646,13 +672,23 @@ static int twl4030_set_host(struct usb_otg *otg, struct usb_bus *host) return 0; } +static const struct phy_ops ops = { + .init = twl4030_phy_init, + .power_on = twl4030_phy_power_on, + .power_off = twl4030_phy_power_off, + .owner = THIS_MODULE, +}; + static int twl4030_usb_probe(struct platform_device *pdev) { struct twl4030_usb_data *pdata = pdev-dev.platform_data; struct twl4030_usb *twl; + struct phy *phy; int status, err; struct usb_otg *otg; struct device_node *np = pdev-dev.of_node; + struct phy_provider *phy_provider; + struct phy_init_data
[PATCH v10 0/8] PHY framework
Added a generic PHY framework that provides a set of APIs for the PHY drivers to create/destroy a PHY and APIs for the PHY users to obtain a reference to the PHY with or without using phandle. This framework will be of use only to devices that uses external PHY (PHY functionality is not embedded within the controller). The intention of creating this framework is to bring the phy drivers spread all over the Linux kernel to drivers/phy to increase code re-use and to increase code maintainability. Comments to make PHY as bus wasn't done because PHY devices can be part of other bus and making a same device attached to multiple bus leads to bad design. If the PHY driver has to send notification on connect/disconnect, the PHY driver should make use of the extcon framework. Using this susbsystem to use extcon framwork will have to be analysed. You can find this patch series @ git://git.kernel.org/pub/scm/linux/kernel/git/kishon/linux-phy.git testing I'll create a new branch *next* once this patch series is finalized. All the PHY driver development that depends on PHY framework can be based on this branch. Did USB enumeration testing in panda and beagle after applying [1] [1] - https://lkml.org/lkml/2013/7/26/88 Changes from v9: * Fixed Greg's concern on having *find PHY by string* and changed it to Tomasz pseudo code. * move omap-usb2 phy and twl4030-usb phy to drivers/phy * made all the dependent drivers select GENERIC_PHY instead of having depends on * Made PHY core to assign the id's (so changed the phy_create API). * Adapted twl4030-usb to the new design. Changes from v8: * Added phy_set_drvdata and phy_get_drvdata in phy.h. * Changed phy_create API not to take void *priv. private data should now be set using phy_set_drvdata now. Changes from v7: * Fixed Documentation * Added to_phy, of_phy_provider_register and devm_of_phy_provider_register * modified runtime_pm usage in phy_init, phy_exit, phy_power_on and phy_power_off. Now phy_power_on will enable the clocks and phy_power_off will disable the clocks. * pm_runtime_no_callbacks() is added so that pm_runtime_get_sync doesn't fail * modified other patches to adhere to the changes in the PHY framework * removed usb: phy: twl4030: twl4030 shouldn't be subsys_initcall as it will be merged separately. * reference counting has been added to protect phy ops when the PHY is shared by multiple consumers. Changes from v6 * corrected few typos in Documentation * Changed PHY Subsystem to *bool* in Kconfig (to avoid compilation errors when PHY Subsystem is kept as module and the dependent modules are built-in) * Added if pm_runtime_enabled check before runtime pm calls. Changes from v5: * removed the new sysfs entries as it dint have any new information other than what is already there in /sys/devices/... * removed a bunch of APIs added to get the PHY and now only phy_get and devm_phy_get are used. * Added new APIs to register/unregister the PHY provider. This is needed for dt boot case. * Enabled pm runtime and incorporated the comments given by Alan Stern in a different patch series by Gautam. * Removed the *phy_bind* API. Now the phy binding information should be passed using the platform data to the controller devices. * Fixed a few typos. Changes from v4: * removed of_phy_get_with_args/devm_of_phy_get_with_args. Now the *phy providers* should use their custom implementation of of_xlate or use of_phy_xlate to get *phy instance* from *phy providers*. * Added of_phy_xlate to be used by *phy providers* if it provides only one PHY. * changed phy_core from having subsys_initcall to module_init. * other minor fixes. Changes from v3: * Changed the return value of PHY APIs to ENOSYS * Added APIs of_phy_get_with_args/devm_of_phy_get_with_args to support getting PHYs if the same IP implements multiple PHYs. * modified phy_bind API so that the binding information can now be _updated_. In effect of this removed the binding information added in board files and added only in usb-musb.c. If a particular board uses a different phy binding, it can update it in board file after usb_musb_init(). * Added Documentation/devicetree/bindings/phy/phy-bindings.txt for dt binding information. Changes from v2: * removed phy_descriptor structure completely so changed the APIs which were taking phy_descriptor as parameters * Added 2 more APIs *of_phy_get_byname* and *devm_of_phy_get_byname* to be used by PHY user drivers which has *phy* and *phy-names* binding in the dt data * Fixed a few typos * Removed phy_list and we now use class_dev_iter_init, class_dev_iter_next and class_dev_iter_exit for traversing through the phy list. (Note we still need phy_bind list and phy_bind_mutex). * Changed the sysfs entry name from *bind* to *phy_bind*. Changes from v1: * Added Documentation for the PHY framework * Added few more APIs mostly w.r.t devres * Modified omap-usb2 and twl4030 to make use of the new framework Kishon Vijay Abraham I
[PATCH v10 2/8] usb: phy: omap-usb2: use the new generic PHY framework
Used the generic PHY framework API to create the PHY. Now the power off and power on are done in omap_usb_power_off and omap_usb_power_on respectively. The omap-usb2 driver is also moved to driver/phy. However using the old USB PHY library cannot be completely removed because OTG is intertwined with PHY and moving to the new framework will break OTG. Once we have a separate OTG state machine, we can get rid of the USB PHY library. Signed-off-by: Kishon Vijay Abraham I kis...@ti.com Reviewed-by: Sylwester Nawrocki s.nawro...@samsung.com Acked-by: Felipe Balbi ba...@ti.com --- drivers/phy/Kconfig | 12 + drivers/phy/Makefile |1 + drivers/{usb = }/phy/phy-omap-usb2.c | 45 ++--- drivers/usb/phy/Kconfig | 10 drivers/usb/phy/Makefile |1 - 5 files changed, 54 insertions(+), 15 deletions(-) rename drivers/{usb = }/phy/phy-omap-usb2.c (88%) diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig index 349bef2..38c3477 100644 --- a/drivers/phy/Kconfig +++ b/drivers/phy/Kconfig @@ -15,4 +15,16 @@ config GENERIC_PHY phy users can obtain reference to the PHY. All the users of this framework should select this config. +config OMAP_USB2 + tristate OMAP USB2 PHY Driver + depends on ARCH_OMAP2PLUS + select GENERIC_PHY + select USB_PHY + select OMAP_CONTROL_USB + help + Enable this to support the transceiver that is part of SOC. This + driver takes care of all the PHY functionality apart from comparator. + The USB OTG controller communicates with the comparator using this + driver. + endmenu diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile index 9e9560f..ed5b088 100644 --- a/drivers/phy/Makefile +++ b/drivers/phy/Makefile @@ -3,3 +3,4 @@ # obj-$(CONFIG_GENERIC_PHY) += phy-core.o +obj-$(CONFIG_OMAP_USB2)+= phy-omap-usb2.o diff --git a/drivers/usb/phy/phy-omap-usb2.c b/drivers/phy/phy-omap-usb2.c similarity index 88% rename from drivers/usb/phy/phy-omap-usb2.c rename to drivers/phy/phy-omap-usb2.c index 844ab68..25e0f3c 100644 --- a/drivers/usb/phy/phy-omap-usb2.c +++ b/drivers/phy/phy-omap-usb2.c @@ -28,6 +28,7 @@ #include linux/pm_runtime.h #include linux/delay.h #include linux/usb/omap_control_usb.h +#include linux/phy/phy.h /** * omap_usb2_set_comparator - links the comparator present in the sytem with @@ -119,10 +120,36 @@ static int omap_usb2_suspend(struct usb_phy *x, int suspend) return 0; } +static int omap_usb_power_off(struct phy *x) +{ + struct omap_usb *phy = phy_get_drvdata(x); + + omap_control_usb_phy_power(phy-control_dev, 0); + + return 0; +} + +static int omap_usb_power_on(struct phy *x) +{ + struct omap_usb *phy = phy_get_drvdata(x); + + omap_control_usb_phy_power(phy-control_dev, 1); + + return 0; +} + +static struct phy_ops ops = { + .power_on = omap_usb_power_on, + .power_off = omap_usb_power_off, + .owner = THIS_MODULE, +}; + static int omap_usb2_probe(struct platform_device *pdev) { struct omap_usb *phy; + struct phy *generic_phy; struct usb_otg *otg; + struct phy_provider *phy_provider; phy = devm_kzalloc(pdev-dev, sizeof(*phy), GFP_KERNEL); if (!phy) { @@ -144,6 +171,11 @@ static int omap_usb2_probe(struct platform_device *pdev) phy-phy.otg= otg; phy-phy.type = USB_PHY_TYPE_USB2; + phy_provider = devm_of_phy_provider_register(phy-dev, + of_phy_simple_xlate); + if (IS_ERR(phy_provider)) + return PTR_ERR(phy_provider); + phy-control_dev = omap_get_control_dev(); if (IS_ERR(phy-control_dev)) { dev_dbg(pdev-dev, Failed to get control device\n); @@ -159,6 +191,15 @@ static int omap_usb2_probe(struct platform_device *pdev) otg-start_srp = omap_usb_start_srp; otg-phy= phy-phy; + platform_set_drvdata(pdev, phy); + pm_runtime_enable(phy-dev); + + generic_phy = devm_phy_create(phy-dev, ops, NULL); + if (IS_ERR(generic_phy)) + return PTR_ERR(generic_phy); + + phy_set_drvdata(generic_phy, phy); + phy-wkupclk = devm_clk_get(phy-dev, usb_phy_cm_clk32k); if (IS_ERR(phy-wkupclk)) { dev_err(pdev-dev, unable to get usb_phy_cm_clk32k\n); @@ -174,10 +215,6 @@ static int omap_usb2_probe(struct platform_device *pdev) usb_add_phy_dev(phy-phy); - platform_set_drvdata(pdev, phy); - - pm_runtime_enable(phy-dev); - return 0; } diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig index 3622fff..7813238 100644 --- a/drivers/usb/phy/Kconfig +++ b/drivers/usb/phy/Kconfig @@ -72,16 +72,6 @@ config
[PATCH v10 1/8] drivers: phy: add generic PHY framework
The PHY framework provides a set of APIs for the PHY drivers to create/destroy a PHY and APIs for the PHY users to obtain a reference to the PHY with or without using phandle. For dt-boot, the PHY drivers should also register *PHY provider* with the framework. PHY drivers should create the PHY by passing id and ops like init, exit, power_on and power_off. This framework is also pm runtime enabled. The documentation for the generic PHY framework is added in Documentation/phy.txt and the documentation for dt binding can be found at Documentation/devicetree/bindings/phy/phy-bindings.txt Cc: Tomasz Figa t.f...@samsung.com Cc: Greg Kroah-Hartman gre...@linuxfoundation.org Signed-off-by: Kishon Vijay Abraham I kis...@ti.com Acked-by: Felipe Balbi ba...@ti.com Tested-by: Sylwester Nawrocki s.nawro...@samsung.com --- .../devicetree/bindings/phy/phy-bindings.txt | 66 ++ Documentation/phy.txt | 166 + MAINTAINERS|8 + drivers/Kconfig|2 + drivers/Makefile |2 + drivers/phy/Kconfig| 18 + drivers/phy/Makefile |5 + drivers/phy/phy-core.c | 714 include/linux/phy/phy.h| 270 9 files changed, 1251 insertions(+) create mode 100644 Documentation/devicetree/bindings/phy/phy-bindings.txt create mode 100644 Documentation/phy.txt create mode 100644 drivers/phy/Kconfig create mode 100644 drivers/phy/Makefile create mode 100644 drivers/phy/phy-core.c create mode 100644 include/linux/phy/phy.h diff --git a/Documentation/devicetree/bindings/phy/phy-bindings.txt b/Documentation/devicetree/bindings/phy/phy-bindings.txt new file mode 100644 index 000..8ae844f --- /dev/null +++ b/Documentation/devicetree/bindings/phy/phy-bindings.txt @@ -0,0 +1,66 @@ +This document explains only the device tree data binding. For general +information about PHY subsystem refer to Documentation/phy.txt + +PHY device node +=== + +Required Properties: +#phy-cells:Number of cells in a PHY specifier; The meaning of all those + cells is defined by the binding for the phy node. The PHY + provider can use the values in cells to find the appropriate + PHY. + +For example: + +phys: phy { +compatible = xxx; +reg = ...; +. +. +#phy-cells = 1; +. +. +}; + +That node describes an IP block (PHY provider) that implements 2 different PHYs. +In order to differentiate between these 2 PHYs, an additonal specifier should be +given while trying to get a reference to it. + +PHY user node += + +Required Properties: +phys : the phandle for the PHY device (used by the PHY subsystem) +phy-names : the names of the PHY corresponding to the PHYs present in the + *phys* phandle + +Example 1: +usb1: usb_otg_ss@xxx { +compatible = xxx; +reg = xxx; +. +. +phys = usb2_phy, usb3_phy; +phy-names = usb2phy, usb3phy; +. +. +}; + +This node represents a controller that uses two PHYs, one for usb2 and one for +usb3. + +Example 2: +usb2: usb_otg_ss@xxx { +compatible = xxx; +reg = xxx; +. +. +phys = phys 1; +phy-names = usbphy; +. +. +}; + +This node represents a controller that uses one of the PHYs of the PHY provider +device defined previously. Note that the phy handle has an additional specifier +1 to differentiate between the two PHYs. diff --git a/Documentation/phy.txt b/Documentation/phy.txt new file mode 100644 index 000..4e056c4 --- /dev/null +++ b/Documentation/phy.txt @@ -0,0 +1,166 @@ + PHY SUBSYSTEM + Kishon Vijay Abraham I kis...@ti.com + +This document explains the Generic PHY Framework along with the APIs provided, +and how-to-use. + +1. Introduction + +*PHY* is the abbreviation for physical layer. It is used to connect a device +to the physical medium e.g., the USB controller has a PHY to provide functions +such as serialization, de-serialization, encoding, decoding and is responsible +for obtaining the required data transmission rate. Note that some USB +controllers have PHY functionality embedded into it and others use an external +PHY. Other peripherals that use PHY include Wireless LAN, Ethernet, +SATA etc. + +The intention of creating this framework is to bring the PHY drivers spread +all over the Linux kernel to drivers/phy to increase code re-use and for +better code maintainability. + +This framework will be of use only to devices that use external PHY (PHY +functionality is not embedded within the controller). + +2. Registering/Unregistering the PHY provider + +PHY provider refers to an entity that implements one or more PHY instances. +For the simple case where the PHY provider implements only a single instance of +the
[RESEND PATCH v10 4/8] arm: omap3: twl: add phy consumer data in twl4030_usb_data
The PHY framework uses the phy consumer data populated in platform data in the case of non-dt boot to return the reference to the PHY when the controller (PHY consumer) requests for it. So populated the phy consumer data in the platform data of twl usb. Signed-off-by: Kishon Vijay Abraham I kis...@ti.com --- arch/arm/mach-omap2/twl-common.c | 11 +++ 1 file changed, 11 insertions(+) diff --git a/arch/arm/mach-omap2/twl-common.c b/arch/arm/mach-omap2/twl-common.c index c05898f..b0d54da 100644 --- a/arch/arm/mach-omap2/twl-common.c +++ b/arch/arm/mach-omap2/twl-common.c @@ -24,6 +24,7 @@ #include linux/i2c/twl.h #include linux/gpio.h #include linux/string.h +#include linux/phy/phy.h #include linux/regulator/machine.h #include linux/regulator/fixed.h @@ -90,8 +91,18 @@ void __init omap_pmic_late_init(void) } #if defined(CONFIG_ARCH_OMAP3) +struct phy_consumer consumers[] = { + PHY_CONSUMER(musb-hdrc.0, usb), +}; + +struct phy_init_data init_data = { + .consumers = consumers, + .num_consumers = ARRAY_SIZE(consumers), +}; + static struct twl4030_usb_data omap3_usb_pdata = { .usb_mode = T2_USB_MODE_ULPI, + .init_data = init_data, }; static int omap3_batt_table[] = { -- 1.7.10.4 -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[RESEND PATCH v10 6/8] usb: musb: omap2430: use the new generic PHY framework
Use the generic PHY framework API to get the PHY. The usb_phy_set_resume and usb_phy_set_suspend is replaced with power_on and power_off to align with the new PHY framework. musb-xceiv can't be removed as of now because musb core uses xceiv.state and xceiv.otg. Once there is a separate state machine to handle otg, these can be moved out of xceiv and then we can start using the generic PHY framework. Signed-off-by: Kishon Vijay Abraham I kis...@ti.com Reviewed-by: Sylwester Nawrocki s.nawro...@samsung.com Acked-by: Felipe Balbi ba...@ti.com --- drivers/usb/musb/Kconfig |1 + drivers/usb/musb/musb_core.h |2 ++ drivers/usb/musb/omap2430.c | 26 -- 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/drivers/usb/musb/Kconfig b/drivers/usb/musb/Kconfig index 797e3fd..25e2e57 100644 --- a/drivers/usb/musb/Kconfig +++ b/drivers/usb/musb/Kconfig @@ -76,6 +76,7 @@ config USB_MUSB_TUSB6010 config USB_MUSB_OMAP2PLUS tristate OMAP2430 and onwards depends on ARCH_OMAP2PLUS + select GENERIC_PHY config USB_MUSB_AM35X tristate AM35x diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h index 7d341c3..6e567bd 100644 --- a/drivers/usb/musb/musb_core.h +++ b/drivers/usb/musb/musb_core.h @@ -46,6 +46,7 @@ #include linux/usb.h #include linux/usb/otg.h #include linux/usb/musb.h +#include linux/phy/phy.h struct musb; struct musb_hw_ep; @@ -346,6 +347,7 @@ struct musb { u16 int_tx; struct usb_phy *xceiv; + struct phy *phy; int nIrq; unsignedirq_wake:1; diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c index 6708a3b..f7b33f4 100644 --- a/drivers/usb/musb/omap2430.c +++ b/drivers/usb/musb/omap2430.c @@ -348,11 +348,21 @@ static int omap2430_musb_init(struct musb *musb) * up through ULPI. TWL4030-family PMICs include one, * which needs a driver, drivers aren't always needed. */ - if (dev-parent-of_node) + if (dev-parent-of_node) { + musb-phy = devm_phy_get(dev-parent, usb2-phy); + + /* We can't totally remove musb-xceiv as of now because +* musb core uses xceiv.state and xceiv.otg. Once we have +* a separate state machine to handle otg, these can be moved +* out of xceiv and then we can start using the generic PHY +* framework +*/ musb-xceiv = devm_usb_get_phy_by_phandle(dev-parent, usb-phy, 0); - else + } else { musb-xceiv = devm_usb_get_phy_dev(dev, 0); + musb-phy = devm_phy_get(dev, usb); + } if (IS_ERR(musb-xceiv)) { status = PTR_ERR(musb-xceiv); @@ -364,6 +374,10 @@ static int omap2430_musb_init(struct musb *musb) return -EPROBE_DEFER; } + if (IS_ERR(musb-phy)) { + pr_err(HS USB OTG: no PHY configured\n); + return PTR_ERR(musb-phy); + } musb-isr = omap2430_musb_interrupt; status = pm_runtime_get_sync(dev); @@ -397,7 +411,7 @@ static int omap2430_musb_init(struct musb *musb) if (glue-status != OMAP_MUSB_UNKNOWN) omap_musb_set_mailbox(glue); - usb_phy_init(musb-xceiv); + phy_init(musb-phy); pm_runtime_put_noidle(musb-controller); return 0; @@ -460,6 +474,7 @@ static int omap2430_musb_exit(struct musb *musb) del_timer_sync(musb_idle_timer); omap2430_low_level_exit(musb); + phy_exit(musb-phy); return 0; } @@ -633,7 +648,7 @@ static int omap2430_runtime_suspend(struct device *dev) OTG_INTERFSEL); omap2430_low_level_exit(musb); - usb_phy_set_suspend(musb-xceiv, 1); + phy_power_off(musb-phy); } return 0; @@ -648,8 +663,7 @@ static int omap2430_runtime_resume(struct device *dev) omap2430_low_level_init(musb); musb_writel(musb-mregs, OTG_INTERFSEL, musb-context.otg_interfsel); - - usb_phy_set_suspend(musb-xceiv, 0); + phy_power_on(musb-phy); } return 0; -- 1.7.10.4 -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[RESEND PATCH v10 5/8] ARM: dts: omap: update usb_otg_hs data
Updated the usb_otg_hs dt data to include the *phy* and *phy-names* binding in order for the driver to use the new generic PHY framework. Also updated the Documentation to include the binding information. The PHY binding information can be found at Documentation/devicetree/bindings/phy/phy-bindings.txt Signed-off-by: Kishon Vijay Abraham I kis...@ti.com Acked-by: Felipe Balbi ba...@ti.com Reviewed-by: Sylwester Nawrocki s.nawro...@samsung.com --- Documentation/devicetree/bindings/usb/omap-usb.txt |5 + Documentation/devicetree/bindings/usb/usb-phy.txt |6 ++ arch/arm/boot/dts/omap3-beagle-xm.dts |2 ++ arch/arm/boot/dts/omap3-evm.dts|2 ++ arch/arm/boot/dts/omap3-overo.dtsi |2 ++ arch/arm/boot/dts/omap4.dtsi |3 +++ arch/arm/boot/dts/twl4030.dtsi |1 + 7 files changed, 21 insertions(+) diff --git a/Documentation/devicetree/bindings/usb/omap-usb.txt b/Documentation/devicetree/bindings/usb/omap-usb.txt index 57e71f6..825790d 100644 --- a/Documentation/devicetree/bindings/usb/omap-usb.txt +++ b/Documentation/devicetree/bindings/usb/omap-usb.txt @@ -19,6 +19,9 @@ OMAP MUSB GLUE - power : Should be 50. This signifies the controller can supply up to 100mA when operating in host mode. - usb-phy : the phandle for the PHY device + - phys : the phandle for the PHY device (used by generic PHY framework) + - phy-names : the names of the PHY corresponding to the PHYs present in the + *phy* phandle. Optional properties: - ctrl-module : phandle of the control module this glue uses to write to @@ -33,6 +36,8 @@ usb_otg_hs: usb_otg_hs@4a0ab000 { num-eps = 16; ram-bits = 12; ctrl-module = omap_control_usb; + phys = usb2_phy; + phy-names = usb2-phy; }; Board specific device node entry diff --git a/Documentation/devicetree/bindings/usb/usb-phy.txt b/Documentation/devicetree/bindings/usb/usb-phy.txt index 61496f5..c0245c8 100644 --- a/Documentation/devicetree/bindings/usb/usb-phy.txt +++ b/Documentation/devicetree/bindings/usb/usb-phy.txt @@ -5,6 +5,8 @@ OMAP USB2 PHY Required properties: - compatible: Should be ti,omap-usb2 - reg : Address and length of the register set for the device. + - #phy-cells: determine the number of cells that should be given in the + phandle while referencing this phy. Optional properties: - ctrl-module : phandle of the control module used by PHY driver to power on @@ -16,6 +18,7 @@ usb2phy@4a0ad080 { compatible = ti,omap-usb2; reg = 0x4a0ad080 0x58; ctrl-module = omap_control_usb; + #phy-cells = 0; }; OMAP USB3 PHY @@ -25,6 +28,8 @@ Required properties: - reg : Address and length of the register set for the device. - reg-names: The names of the register addresses corresponding to the registers filled in reg. + - #phy-cells: determine the number of cells that should be given in the + phandle while referencing this phy. Optional properties: - ctrl-module : phandle of the control module used by PHY driver to power on @@ -39,4 +44,5 @@ usb3phy@4a084400 { 0x4a084c00 0x40; reg-names = phy_rx, phy_tx, pll_ctrl; ctrl-module = omap_control_usb; + #phy-cells = 0; }; diff --git a/arch/arm/boot/dts/omap3-beagle-xm.dts b/arch/arm/boot/dts/omap3-beagle-xm.dts index afdb164..533b2da 100644 --- a/arch/arm/boot/dts/omap3-beagle-xm.dts +++ b/arch/arm/boot/dts/omap3-beagle-xm.dts @@ -144,6 +144,8 @@ usb_otg_hs { interface-type = 0; usb-phy = usb2_phy; + phys = usb2_phy; + phy-names = usb2-phy; mode = 3; power = 50; }; diff --git a/arch/arm/boot/dts/omap3-evm.dts b/arch/arm/boot/dts/omap3-evm.dts index 7d4329d..4134dd0 100644 --- a/arch/arm/boot/dts/omap3-evm.dts +++ b/arch/arm/boot/dts/omap3-evm.dts @@ -70,6 +70,8 @@ usb_otg_hs { interface-type = 0; usb-phy = usb2_phy; + phys = usb2_phy; + phy-names = usb2-phy; mode = 3; power = 50; }; diff --git a/arch/arm/boot/dts/omap3-overo.dtsi b/arch/arm/boot/dts/omap3-overo.dtsi index 8f1abec..a461d2f 100644 --- a/arch/arm/boot/dts/omap3-overo.dtsi +++ b/arch/arm/boot/dts/omap3-overo.dtsi @@ -76,6 +76,8 @@ usb_otg_hs { interface-type = 0; usb-phy = usb2_phy; + phys = usb2_phy; + phy-names = usb2-phy; mode = 3; power = 50; }; diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi index 22d9f2b..1e8e2fe 100644 --- a/arch/arm/boot/dts/omap4.dtsi +++ b/arch/arm/boot/dts/omap4.dtsi @@ -520,6 +520,7 @@ compatible = ti,omap-usb2; reg = 0x4a0ad080 0x58; ctrl-module = omap_control_usb; + #phy-cells = 0; }; }; @@ -658,6 +659,8 @@ interrupt-names = mc, dma;
[RESEND PATCH v10 8/8] usb: phy: twl4030-usb: remove *set_suspend* and *phy_init* ops
Now that twl4030-usb is adapted to the new generic PHY framework, *set_suspend* and *phy_init* ops can be removed from twl4030-usb driver. Signed-off-by: Kishon Vijay Abraham I kis...@ti.com Acked-by: Felipe Balbi ba...@ti.com Reviewed-by: Sylwester Nawrocki s.nawro...@samsung.com --- drivers/phy/phy-twl4030-usb.c | 57 ++--- 1 file changed, 13 insertions(+), 44 deletions(-) diff --git a/drivers/phy/phy-twl4030-usb.c b/drivers/phy/phy-twl4030-usb.c index 494f107..c437211 100644 --- a/drivers/phy/phy-twl4030-usb.c +++ b/drivers/phy/phy-twl4030-usb.c @@ -422,25 +422,20 @@ static void twl4030_phy_power(struct twl4030_usb *twl, int on) } } -static void twl4030_phy_suspend(struct twl4030_usb *twl, int controller_off) +static int twl4030_phy_power_off(struct phy *phy) { + struct twl4030_usb *twl = phy_get_drvdata(phy); + if (twl-asleep) - return; + return 0; twl4030_phy_power(twl, 0); twl-asleep = 1; dev_dbg(twl-dev, %s\n, __func__); -} - -static int twl4030_phy_power_off(struct phy *phy) -{ - struct twl4030_usb *twl = phy_get_drvdata(phy); - - twl4030_phy_suspend(twl, 0); return 0; } -static void __twl4030_phy_resume(struct twl4030_usb *twl) +static void __twl4030_phy_power_on(struct twl4030_usb *twl) { twl4030_phy_power(twl, 1); twl4030_i2c_access(twl, 1); @@ -449,11 +444,13 @@ static void __twl4030_phy_resume(struct twl4030_usb *twl) twl4030_i2c_access(twl, 0); } -static void twl4030_phy_resume(struct twl4030_usb *twl) +static int twl4030_phy_power_on(struct phy *phy) { + struct twl4030_usb *twl = phy_get_drvdata(phy); + if (!twl-asleep) - return; - __twl4030_phy_resume(twl); + return 0; + __twl4030_phy_power_on(twl); twl-asleep = 0; dev_dbg(twl-dev, %s\n, __func__); @@ -466,13 +463,6 @@ static void twl4030_phy_resume(struct twl4030_usb *twl) cancel_delayed_work(twl-id_workaround_work); schedule_delayed_work(twl-id_workaround_work, HZ); } -} - -static int twl4030_phy_power_on(struct phy *phy) -{ - struct twl4030_usb *twl = phy_get_drvdata(phy); - - twl4030_phy_resume(twl); return 0; } @@ -604,9 +594,9 @@ static void twl4030_id_workaround_work(struct work_struct *work) } } -static int twl4030_usb_phy_init(struct usb_phy *phy) +static int twl4030_phy_init(struct phy *phy) { - struct twl4030_usb *twl = phy_to_twl(phy); + struct twl4030_usb *twl = phy_get_drvdata(phy); enum omap_musb_vbus_id_status status; /* @@ -621,32 +611,13 @@ static int twl4030_usb_phy_init(struct usb_phy *phy) if (status == OMAP_MUSB_ID_GROUND || status == OMAP_MUSB_VBUS_VALID) { omap_musb_mailbox(twl-linkstat); - twl4030_phy_resume(twl); + twl4030_phy_power_on(phy); } sysfs_notify(twl-dev-kobj, NULL, vbus); return 0; } -static int twl4030_phy_init(struct phy *phy) -{ - struct twl4030_usb *twl = phy_get_drvdata(phy); - - return twl4030_usb_phy_init(twl-phy); -} - -static int twl4030_set_suspend(struct usb_phy *x, int suspend) -{ - struct twl4030_usb *twl = phy_to_twl(x); - - if (suspend) - twl4030_phy_suspend(twl, 1); - else - twl4030_phy_resume(twl); - - return 0; -} - static int twl4030_set_peripheral(struct usb_otg *otg, struct usb_gadget *gadget) { @@ -719,8 +690,6 @@ static int twl4030_usb_probe(struct platform_device *pdev) twl-phy.label = twl4030; twl-phy.otg= otg; twl-phy.type = USB_PHY_TYPE_USB2; - twl-phy.set_suspend= twl4030_set_suspend; - twl-phy.init = twl4030_usb_phy_init; otg-phy= twl-phy; otg-set_host = twl4030_set_host; -- 1.7.10.4 -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[RESEND PATCH v10 7/8] usb: phy: omap-usb2: remove *set_suspend* callback from omap-usb2
Now that omap-usb2 is adapted to the new generic PHY framework, *set_suspend* ops can be removed from omap-usb2 driver. Signed-off-by: Kishon Vijay Abraham I kis...@ti.com Acked-by: Felipe Balbi ba...@ti.com Reviewed-by: Sylwester Nawrocki s.nawro...@samsung.com --- drivers/phy/phy-omap-usb2.c | 25 - 1 file changed, 25 deletions(-) diff --git a/drivers/phy/phy-omap-usb2.c b/drivers/phy/phy-omap-usb2.c index 25e0f3c..dec3fab 100644 --- a/drivers/phy/phy-omap-usb2.c +++ b/drivers/phy/phy-omap-usb2.c @@ -97,29 +97,6 @@ static int omap_usb_set_peripheral(struct usb_otg *otg, return 0; } -static int omap_usb2_suspend(struct usb_phy *x, int suspend) -{ - u32 ret; - struct omap_usb *phy = phy_to_omapusb(x); - - if (suspend !phy-is_suspended) { - omap_control_usb_phy_power(phy-control_dev, 0); - pm_runtime_put_sync(phy-dev); - phy-is_suspended = 1; - } else if (!suspend phy-is_suspended) { - ret = pm_runtime_get_sync(phy-dev); - if (ret 0) { - dev_err(phy-dev, get_sync failed with err %d\n, - ret); - return ret; - } - omap_control_usb_phy_power(phy-control_dev, 1); - phy-is_suspended = 0; - } - - return 0; -} - static int omap_usb_power_off(struct phy *x) { struct omap_usb *phy = phy_get_drvdata(x); @@ -167,7 +144,6 @@ static int omap_usb2_probe(struct platform_device *pdev) phy-phy.dev= phy-dev; phy-phy.label = omap-usb2; - phy-phy.set_suspend= omap_usb2_suspend; phy-phy.otg= otg; phy-phy.type = USB_PHY_TYPE_USB2; @@ -182,7 +158,6 @@ static int omap_usb2_probe(struct platform_device *pdev) return -ENODEV; } - phy-is_suspended = 1; omap_control_usb_phy_power(phy-control_dev, 0); otg-set_host = omap_usb_set_host; -- 1.7.10.4 -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[RESEND PATCH v10 2/8] usb: phy: omap-usb2: use the new generic PHY framework
Used the generic PHY framework API to create the PHY. Now the power off and power on are done in omap_usb_power_off and omap_usb_power_on respectively. The omap-usb2 driver is also moved to driver/phy. However using the old USB PHY library cannot be completely removed because OTG is intertwined with PHY and moving to the new framework will break OTG. Once we have a separate OTG state machine, we can get rid of the USB PHY library. Signed-off-by: Kishon Vijay Abraham I kis...@ti.com Reviewed-by: Sylwester Nawrocki s.nawro...@samsung.com Acked-by: Felipe Balbi ba...@ti.com --- drivers/phy/Kconfig | 12 + drivers/phy/Makefile |1 + drivers/{usb = }/phy/phy-omap-usb2.c | 45 ++--- drivers/usb/phy/Kconfig | 10 drivers/usb/phy/Makefile |1 - 5 files changed, 54 insertions(+), 15 deletions(-) rename drivers/{usb = }/phy/phy-omap-usb2.c (88%) diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig index 349bef2..38c3477 100644 --- a/drivers/phy/Kconfig +++ b/drivers/phy/Kconfig @@ -15,4 +15,16 @@ config GENERIC_PHY phy users can obtain reference to the PHY. All the users of this framework should select this config. +config OMAP_USB2 + tristate OMAP USB2 PHY Driver + depends on ARCH_OMAP2PLUS + select GENERIC_PHY + select USB_PHY + select OMAP_CONTROL_USB + help + Enable this to support the transceiver that is part of SOC. This + driver takes care of all the PHY functionality apart from comparator. + The USB OTG controller communicates with the comparator using this + driver. + endmenu diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile index 9e9560f..ed5b088 100644 --- a/drivers/phy/Makefile +++ b/drivers/phy/Makefile @@ -3,3 +3,4 @@ # obj-$(CONFIG_GENERIC_PHY) += phy-core.o +obj-$(CONFIG_OMAP_USB2)+= phy-omap-usb2.o diff --git a/drivers/usb/phy/phy-omap-usb2.c b/drivers/phy/phy-omap-usb2.c similarity index 88% rename from drivers/usb/phy/phy-omap-usb2.c rename to drivers/phy/phy-omap-usb2.c index 844ab68..25e0f3c 100644 --- a/drivers/usb/phy/phy-omap-usb2.c +++ b/drivers/phy/phy-omap-usb2.c @@ -28,6 +28,7 @@ #include linux/pm_runtime.h #include linux/delay.h #include linux/usb/omap_control_usb.h +#include linux/phy/phy.h /** * omap_usb2_set_comparator - links the comparator present in the sytem with @@ -119,10 +120,36 @@ static int omap_usb2_suspend(struct usb_phy *x, int suspend) return 0; } +static int omap_usb_power_off(struct phy *x) +{ + struct omap_usb *phy = phy_get_drvdata(x); + + omap_control_usb_phy_power(phy-control_dev, 0); + + return 0; +} + +static int omap_usb_power_on(struct phy *x) +{ + struct omap_usb *phy = phy_get_drvdata(x); + + omap_control_usb_phy_power(phy-control_dev, 1); + + return 0; +} + +static struct phy_ops ops = { + .power_on = omap_usb_power_on, + .power_off = omap_usb_power_off, + .owner = THIS_MODULE, +}; + static int omap_usb2_probe(struct platform_device *pdev) { struct omap_usb *phy; + struct phy *generic_phy; struct usb_otg *otg; + struct phy_provider *phy_provider; phy = devm_kzalloc(pdev-dev, sizeof(*phy), GFP_KERNEL); if (!phy) { @@ -144,6 +171,11 @@ static int omap_usb2_probe(struct platform_device *pdev) phy-phy.otg= otg; phy-phy.type = USB_PHY_TYPE_USB2; + phy_provider = devm_of_phy_provider_register(phy-dev, + of_phy_simple_xlate); + if (IS_ERR(phy_provider)) + return PTR_ERR(phy_provider); + phy-control_dev = omap_get_control_dev(); if (IS_ERR(phy-control_dev)) { dev_dbg(pdev-dev, Failed to get control device\n); @@ -159,6 +191,15 @@ static int omap_usb2_probe(struct platform_device *pdev) otg-start_srp = omap_usb_start_srp; otg-phy= phy-phy; + platform_set_drvdata(pdev, phy); + pm_runtime_enable(phy-dev); + + generic_phy = devm_phy_create(phy-dev, ops, NULL); + if (IS_ERR(generic_phy)) + return PTR_ERR(generic_phy); + + phy_set_drvdata(generic_phy, phy); + phy-wkupclk = devm_clk_get(phy-dev, usb_phy_cm_clk32k); if (IS_ERR(phy-wkupclk)) { dev_err(pdev-dev, unable to get usb_phy_cm_clk32k\n); @@ -174,10 +215,6 @@ static int omap_usb2_probe(struct platform_device *pdev) usb_add_phy_dev(phy-phy); - platform_set_drvdata(pdev, phy); - - pm_runtime_enable(phy-dev); - return 0; } diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig index 3622fff..7813238 100644 --- a/drivers/usb/phy/Kconfig +++ b/drivers/usb/phy/Kconfig @@ -72,16 +72,6 @@ config
[RESEND PATCH v10 0/8] PHY framework
Resending with fixed device tree mailing address! Added a generic PHY framework that provides a set of APIs for the PHY drivers to create/destroy a PHY and APIs for the PHY users to obtain a reference to the PHY with or without using phandle. This framework will be of use only to devices that uses external PHY (PHY functionality is not embedded within the controller). The intention of creating this framework is to bring the phy drivers spread all over the Linux kernel to drivers/phy to increase code re-use and to increase code maintainability. Comments to make PHY as bus wasn't done because PHY devices can be part of other bus and making a same device attached to multiple bus leads to bad design. If the PHY driver has to send notification on connect/disconnect, the PHY driver should make use of the extcon framework. Using this susbsystem to use extcon framwork will have to be analysed. You can find this patch series @ git://git.kernel.org/pub/scm/linux/kernel/git/kishon/linux-phy.git testing I'll create a new branch *next* once this patch series is finalized. All the PHY driver development that depends on PHY framework can be based on this branch. Did USB enumeration testing in panda and beagle after applying [1] [1] - https://lkml.org/lkml/2013/7/26/88 Changes from v9: * Fixed Greg's concern on having *find PHY by string* and changed it to Tomasz pseudo code. * move omap-usb2 phy and twl4030-usb phy to drivers/phy * made all the dependent drivers select GENERIC_PHY instead of having depends on * Made PHY core to assign the id's (so changed the phy_create API). * Adapted twl4030-usb to the new design. Changes from v8: * Added phy_set_drvdata and phy_get_drvdata in phy.h. * Changed phy_create API not to take void *priv. private data should now be set using phy_set_drvdata now. Changes from v7: * Fixed Documentation * Added to_phy, of_phy_provider_register and devm_of_phy_provider_register * modified runtime_pm usage in phy_init, phy_exit, phy_power_on and phy_power_off. Now phy_power_on will enable the clocks and phy_power_off will disable the clocks. * pm_runtime_no_callbacks() is added so that pm_runtime_get_sync doesn't fail * modified other patches to adhere to the changes in the PHY framework * removed usb: phy: twl4030: twl4030 shouldn't be subsys_initcall as it will be merged separately. * reference counting has been added to protect phy ops when the PHY is shared by multiple consumers. Changes from v6 * corrected few typos in Documentation * Changed PHY Subsystem to *bool* in Kconfig (to avoid compilation errors when PHY Subsystem is kept as module and the dependent modules are built-in) * Added if pm_runtime_enabled check before runtime pm calls. Changes from v5: * removed the new sysfs entries as it dint have any new information other than what is already there in /sys/devices/... * removed a bunch of APIs added to get the PHY and now only phy_get and devm_phy_get are used. * Added new APIs to register/unregister the PHY provider. This is needed for dt boot case. * Enabled pm runtime and incorporated the comments given by Alan Stern in a different patch series by Gautam. * Removed the *phy_bind* API. Now the phy binding information should be passed using the platform data to the controller devices. * Fixed a few typos. Changes from v4: * removed of_phy_get_with_args/devm_of_phy_get_with_args. Now the *phy providers* should use their custom implementation of of_xlate or use of_phy_xlate to get *phy instance* from *phy providers*. * Added of_phy_xlate to be used by *phy providers* if it provides only one PHY. * changed phy_core from having subsys_initcall to module_init. * other minor fixes. Changes from v3: * Changed the return value of PHY APIs to ENOSYS * Added APIs of_phy_get_with_args/devm_of_phy_get_with_args to support getting PHYs if the same IP implements multiple PHYs. * modified phy_bind API so that the binding information can now be _updated_. In effect of this removed the binding information added in board files and added only in usb-musb.c. If a particular board uses a different phy binding, it can update it in board file after usb_musb_init(). * Added Documentation/devicetree/bindings/phy/phy-bindings.txt for dt binding information. Changes from v2: * removed phy_descriptor structure completely so changed the APIs which were taking phy_descriptor as parameters * Added 2 more APIs *of_phy_get_byname* and *devm_of_phy_get_byname* to be used by PHY user drivers which has *phy* and *phy-names* binding in the dt data * Fixed a few typos * Removed phy_list and we now use class_dev_iter_init, class_dev_iter_next and class_dev_iter_exit for traversing through the phy list. (Note we still need phy_bind list and phy_bind_mutex). * Changed the sysfs entry name from *bind* to *phy_bind*. Changes from v1: * Added Documentation for the PHY framework * Added few more APIs mostly w.r.t devres * Modified omap-usb2 and twl4030 to make
[RESEND PATCH v10 1/8] drivers: phy: add generic PHY framework
The PHY framework provides a set of APIs for the PHY drivers to create/destroy a PHY and APIs for the PHY users to obtain a reference to the PHY with or without using phandle. For dt-boot, the PHY drivers should also register *PHY provider* with the framework. PHY drivers should create the PHY by passing id and ops like init, exit, power_on and power_off. This framework is also pm runtime enabled. The documentation for the generic PHY framework is added in Documentation/phy.txt and the documentation for dt binding can be found at Documentation/devicetree/bindings/phy/phy-bindings.txt Cc: Tomasz Figa t.f...@samsung.com Cc: Greg Kroah-Hartman gre...@linuxfoundation.org Signed-off-by: Kishon Vijay Abraham I kis...@ti.com Acked-by: Felipe Balbi ba...@ti.com Tested-by: Sylwester Nawrocki s.nawro...@samsung.com --- .../devicetree/bindings/phy/phy-bindings.txt | 66 ++ Documentation/phy.txt | 166 + MAINTAINERS|8 + drivers/Kconfig|2 + drivers/Makefile |2 + drivers/phy/Kconfig| 18 + drivers/phy/Makefile |5 + drivers/phy/phy-core.c | 714 include/linux/phy/phy.h| 270 9 files changed, 1251 insertions(+) create mode 100644 Documentation/devicetree/bindings/phy/phy-bindings.txt create mode 100644 Documentation/phy.txt create mode 100644 drivers/phy/Kconfig create mode 100644 drivers/phy/Makefile create mode 100644 drivers/phy/phy-core.c create mode 100644 include/linux/phy/phy.h diff --git a/Documentation/devicetree/bindings/phy/phy-bindings.txt b/Documentation/devicetree/bindings/phy/phy-bindings.txt new file mode 100644 index 000..8ae844f --- /dev/null +++ b/Documentation/devicetree/bindings/phy/phy-bindings.txt @@ -0,0 +1,66 @@ +This document explains only the device tree data binding. For general +information about PHY subsystem refer to Documentation/phy.txt + +PHY device node +=== + +Required Properties: +#phy-cells:Number of cells in a PHY specifier; The meaning of all those + cells is defined by the binding for the phy node. The PHY + provider can use the values in cells to find the appropriate + PHY. + +For example: + +phys: phy { +compatible = xxx; +reg = ...; +. +. +#phy-cells = 1; +. +. +}; + +That node describes an IP block (PHY provider) that implements 2 different PHYs. +In order to differentiate between these 2 PHYs, an additonal specifier should be +given while trying to get a reference to it. + +PHY user node += + +Required Properties: +phys : the phandle for the PHY device (used by the PHY subsystem) +phy-names : the names of the PHY corresponding to the PHYs present in the + *phys* phandle + +Example 1: +usb1: usb_otg_ss@xxx { +compatible = xxx; +reg = xxx; +. +. +phys = usb2_phy, usb3_phy; +phy-names = usb2phy, usb3phy; +. +. +}; + +This node represents a controller that uses two PHYs, one for usb2 and one for +usb3. + +Example 2: +usb2: usb_otg_ss@xxx { +compatible = xxx; +reg = xxx; +. +. +phys = phys 1; +phy-names = usbphy; +. +. +}; + +This node represents a controller that uses one of the PHYs of the PHY provider +device defined previously. Note that the phy handle has an additional specifier +1 to differentiate between the two PHYs. diff --git a/Documentation/phy.txt b/Documentation/phy.txt new file mode 100644 index 000..4e056c4 --- /dev/null +++ b/Documentation/phy.txt @@ -0,0 +1,166 @@ + PHY SUBSYSTEM + Kishon Vijay Abraham I kis...@ti.com + +This document explains the Generic PHY Framework along with the APIs provided, +and how-to-use. + +1. Introduction + +*PHY* is the abbreviation for physical layer. It is used to connect a device +to the physical medium e.g., the USB controller has a PHY to provide functions +such as serialization, de-serialization, encoding, decoding and is responsible +for obtaining the required data transmission rate. Note that some USB +controllers have PHY functionality embedded into it and others use an external +PHY. Other peripherals that use PHY include Wireless LAN, Ethernet, +SATA etc. + +The intention of creating this framework is to bring the PHY drivers spread +all over the Linux kernel to drivers/phy to increase code re-use and for +better code maintainability. + +This framework will be of use only to devices that use external PHY (PHY +functionality is not embedded within the controller). + +2. Registering/Unregistering the PHY provider + +PHY provider refers to an entity that implements one or more PHY instances. +For the simple case where the PHY provider implements only a single instance of +the
[PATCH V2 1/8] platform: Increase platform name size
This patch increases the platform name size from 20 to 30. Signed-off-by: Padmavathi Venna padm...@samsung.com --- include/linux/mod_devicetable.h |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h index b62d4af..f67b5d5 100644 --- a/include/linux/mod_devicetable.h +++ b/include/linux/mod_devicetable.h @@ -478,7 +478,7 @@ struct dmi_system_id { #define DMI_MATCH(a, b){ .slot = a, .substr = b } #define DMI_EXACT_MATCH(a, b) { .slot = a, .substr = b, .exact_match = 1 } -#define PLATFORM_NAME_SIZE 20 +#define PLATFORM_NAME_SIZE 30 #define PLATFORM_MODULE_PREFIX platform: struct platform_device_id { -- 1.7.4.4 -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH V2 3/8] ARM: dts: Change i2s compatible string on exynos5250
This patch removes quirks from i2s node and change the i2s compatible names. Signed-off-by: Padmavathi Venna padm...@samsung.com --- arch/arm/boot/dts/exynos5250.dtsi |9 +++-- 1 files changed, 3 insertions(+), 6 deletions(-) diff --git a/arch/arm/boot/dts/exynos5250.dtsi b/arch/arm/boot/dts/exynos5250.dtsi index db2ca8b..f7fbedd 100644 --- a/arch/arm/boot/dts/exynos5250.dtsi +++ b/arch/arm/boot/dts/exynos5250.dtsi @@ -385,7 +385,7 @@ }; i2s0: i2s@0383 { - compatible = samsung,i2s-v5; + compatible = samsung,s5pv210-i2s; reg = 0x0383 0x100; dmas = pdma0 10 pdma0 9 @@ -395,16 +395,13 @@ clock_audss EXYNOS_I2S_BUS, clock_audss EXYNOS_SCLK_I2S; clock-names = iis, i2s_opclk0, i2s_opclk1; - samsung,supports-6ch; - samsung,supports-rstclr; - samsung,supports-secdai; samsung,idma-addr = 0x0300; pinctrl-names = default; pinctrl-0 = i2s0_bus; }; i2s1: i2s@12D6 { - compatible = samsung,i2s-v5; + compatible = samsung,s3c6410-i2s; reg = 0x12D6 0x100; dmas = pdma1 12 pdma1 11; @@ -416,7 +413,7 @@ }; i2s2: i2s@12D7 { - compatible = samsung,i2s-v5; + compatible = samsung,s3c6410-i2s; reg = 0x12D7 0x100; dmas = pdma0 12 pdma0 11; -- 1.7.4.4 -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH V2 5/8] ASoC: Samsung: I2S: Modify the I2S driver to support I2S on Exynos5420
Exynos5420 added support for I2S TDM mode. For this, there are some register changes in the I2S controller. This patch adds the relevant register changes to support I2S in normal mode. This patch adds a quirk for TDM mode and if TDM mode is present all the relevent changes will be applied. Signed-off-by: Padmavathi Venna padm...@samsung.com --- .../devicetree/bindings/sound/samsung-i2s.txt |4 + include/linux/platform_data/asoc-s3c.h |1 + sound/soc/samsung/i2s-regs.h | 15 sound/soc/samsung/i2s.c| 81 ++-- 4 files changed, 93 insertions(+), 8 deletions(-) diff --git a/Documentation/devicetree/bindings/sound/samsung-i2s.txt b/Documentation/devicetree/bindings/sound/samsung-i2s.txt index b3f6443..9b5c892 100644 --- a/Documentation/devicetree/bindings/sound/samsung-i2s.txt +++ b/Documentation/devicetree/bindings/sound/samsung-i2s.txt @@ -11,6 +11,10 @@ Required SoC Specific Properties: with secondary fifo and s/w reset control. - samsung,s5pv210-i2s: for 8/16/24bit multichannel(5.1) I2S with secondary fifo, s/w reset control and internal mux for root clk src. + - samsung,exynos5420-i2s: for 8/16/24bit multichannel(7.1) I2S with + secondary fifo, s/w reset control, internal mux for root clk src and + TDM support. TDM (Time division multiplexing) is to allow transfer of + multiple channel audio data on single data line. - reg: physical base address of the controller and length of memory mapped region. diff --git a/include/linux/platform_data/asoc-s3c.h b/include/linux/platform_data/asoc-s3c.h index 8827259..9efc04d 100644 --- a/include/linux/platform_data/asoc-s3c.h +++ b/include/linux/platform_data/asoc-s3c.h @@ -36,6 +36,7 @@ struct samsung_i2s { */ #define QUIRK_NO_MUXPSR(1 2) #define QUIRK_NEED_RSTCLR (1 3) +#define QUIRK_SUPPORTS_TDM (1 4) /* Quirks of the I2S controller */ u32 quirks; dma_addr_t idma_addr; diff --git a/sound/soc/samsung/i2s-regs.h b/sound/soc/samsung/i2s-regs.h index 30513b7..821a502 100644 --- a/sound/soc/samsung/i2s-regs.h +++ b/sound/soc/samsung/i2s-regs.h @@ -31,6 +31,10 @@ #define I2SLVL1ADDR0x34 #define I2SLVL2ADDR0x38 #define I2SLVL3ADDR0x3c +#define I2SSTR10x40 +#define I2SVER 0x44 +#define I2SFIC20x48 +#define I2STDM 0x4c #define CON_RSTCLR (1 31) #define CON_FRXOFSTATUS(1 26) @@ -117,6 +121,17 @@ #define MOD_BCLK_MASK 3 #define MOD_8BIT (1 0) +#define EXYNOS5420_MOD_LRP_SHIFT 15 +#define EXYNOS5420_MOD_SDF_SHIFT 6 +#define EXYNOS5420_MOD_RCLK_SHIFT 4 +#define EXYNOS5420_MOD_BCLK_SHIFT 0 +#define EXYNOS5420_MOD_BCLK_64FS 4 +#define EXYNOS5420_MOD_BCLK_96FS 5 +#define EXYNOS5420_MOD_BCLK_128FS 6 +#define EXYNOS5420_MOD_BCLK_192FS 7 +#define EXYNOS5420_MOD_BCLK_256FS 8 +#define EXYNOS5420_MOD_BCLK_MASK 0xf + #define MOD_CDCLKCON (1 12) #define PSR_PSREN (1 15) diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c index 0b36b0a..bdbb65d 100644 --- a/sound/soc/samsung/i2s.c +++ b/sound/soc/samsung/i2s.c @@ -199,7 +199,12 @@ static inline bool is_manager(struct i2s_dai *i2s) /* Read RCLK of I2S (in multiples of LRCLK) */ static inline unsigned get_rfs(struct i2s_dai *i2s) { - u32 rfs = (readl(i2s-addr + I2SMOD) MOD_RCLK_SHIFT); + u32 rfs; + + if (i2s-quirks QUIRK_SUPPORTS_TDM) + rfs = readl(i2s-addr + I2SMOD) EXYNOS5420_MOD_RCLK_SHIFT; + else + rfs = (readl(i2s-addr + I2SMOD) MOD_RCLK_SHIFT); rfs = MOD_RCLK_MASK; switch (rfs) { @@ -214,8 +219,12 @@ static inline unsigned get_rfs(struct i2s_dai *i2s) static inline void set_rfs(struct i2s_dai *i2s, unsigned rfs) { u32 mod = readl(i2s-addr + I2SMOD); - int rfs_shift = MOD_RCLK_SHIFT; + int rfs_shift; + if (i2s-quirks QUIRK_SUPPORTS_TDM) + rfs_shift = EXYNOS5420_MOD_RCLK_SHIFT; + else + rfs_shift = MOD_RCLK_SHIFT; mod = ~(MOD_RCLK_MASK rfs_shift); switch (rfs) { @@ -239,10 +248,22 @@ static inline void set_rfs(struct i2s_dai *i2s, unsigned rfs) /* Read Bit-Clock of I2S (in multiples of LRCLK) */ static inline unsigned get_bfs(struct i2s_dai *i2s) { - u32 bfs = readl(i2s-addr + I2SMOD) MOD_BCLK_SHIFT; - bfs = MOD_BCLK_MASK; + u32 bfs; + + if (i2s-quirks QUIRK_SUPPORTS_TDM) { + bfs = readl(i2s-addr + I2SMOD) EXYNOS5420_MOD_BCLK_SHIFT; + bfs = EXYNOS5420_MOD_BCLK_MASK; + } else { + bfs = readl(i2s-addr + I2SMOD) MOD_BCLK_SHIFT; + bfs = MOD_BCLK_MASK; + } switch (bfs) { + case 8: return 256; + case 7: return 192; + case 6: return 128; + case
[PATCH V2 4/8] ASoC: Samsung: I2S: Modify driver to give more flexibility
This patch modifies the i2s driver to give flexibility towards register handling. This is a pre requirement for enabling i2s support on Exynos5420. This patch modifies only the required registers as a pre-requirement to support on Exynos5420. Signed-off-by: Padmavathi Venna padm...@samsung.com --- sound/soc/samsung/i2s-regs.h | 36 ++--- sound/soc/samsung/i2s.c | 58 + 2 files changed, 55 insertions(+), 39 deletions(-) diff --git a/sound/soc/samsung/i2s-regs.h b/sound/soc/samsung/i2s-regs.h index c0e6d9a..30513b7 100644 --- a/sound/soc/samsung/i2s-regs.h +++ b/sound/soc/samsung/i2s-regs.h @@ -95,22 +95,26 @@ #define MOD_RXONLY (1 8) #define MOD_TXRX (2 8) #define MOD_MASK (3 8) -#define MOD_LR_LLOW(0 7) -#define MOD_LR_RLOW(1 7) -#define MOD_SDF_IIS(0 5) -#define MOD_SDF_MSB(1 5) -#define MOD_SDF_LSB(2 5) -#define MOD_SDF_MASK (3 5) -#define MOD_RCLK_256FS (0 3) -#define MOD_RCLK_512FS (1 3) -#define MOD_RCLK_384FS (2 3) -#define MOD_RCLK_768FS (3 3) -#define MOD_RCLK_MASK (3 3) -#define MOD_BCLK_32FS (0 1) -#define MOD_BCLK_48FS (1 1) -#define MOD_BCLK_16FS (2 1) -#define MOD_BCLK_24FS (3 1) -#define MOD_BCLK_MASK (3 1) +#define MOD_LRP_SHIFT 7 +#define MOD_LR_LLOW0 +#define MOD_LR_RLOW1 +#define MOD_SDF_SHIFT 5 +#define MOD_SDF_IIS0 +#define MOD_SDF_MSB1 +#define MOD_SDF_LSB2 +#define MOD_SDF_MASK 3 +#define MOD_RCLK_SHIFT 3 +#define MOD_RCLK_256FS 0 +#define MOD_RCLK_512FS 1 +#define MOD_RCLK_384FS 2 +#define MOD_RCLK_768FS 3 +#define MOD_RCLK_MASK 3 +#define MOD_BCLK_SHIFT 1 +#define MOD_BCLK_32FS 0 +#define MOD_BCLK_48FS 1 +#define MOD_BCLK_16FS 2 +#define MOD_BCLK_24FS 3 +#define MOD_BCLK_MASK 3 #define MOD_8BIT (1 0) #define MOD_CDCLKCON (1 12) diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c index f661a98..0b36b0a 100644 --- a/sound/soc/samsung/i2s.c +++ b/sound/soc/samsung/i2s.c @@ -199,7 +199,8 @@ static inline bool is_manager(struct i2s_dai *i2s) /* Read RCLK of I2S (in multiples of LRCLK) */ static inline unsigned get_rfs(struct i2s_dai *i2s) { - u32 rfs = (readl(i2s-addr + I2SMOD) 3) 0x3; + u32 rfs = (readl(i2s-addr + I2SMOD) MOD_RCLK_SHIFT); + rfs = MOD_RCLK_MASK; switch (rfs) { case 3: return 768; @@ -213,21 +214,22 @@ static inline unsigned get_rfs(struct i2s_dai *i2s) static inline void set_rfs(struct i2s_dai *i2s, unsigned rfs) { u32 mod = readl(i2s-addr + I2SMOD); + int rfs_shift = MOD_RCLK_SHIFT; - mod = ~MOD_RCLK_MASK; + mod = ~(MOD_RCLK_MASK rfs_shift); switch (rfs) { case 768: - mod |= MOD_RCLK_768FS; + mod |= (MOD_RCLK_768FS rfs_shift); break; case 512: - mod |= MOD_RCLK_512FS; + mod |= (MOD_RCLK_512FS rfs_shift); break; case 384: - mod |= MOD_RCLK_384FS; + mod |= (MOD_RCLK_384FS rfs_shift); break; default: - mod |= MOD_RCLK_256FS; + mod |= (MOD_RCLK_256FS rfs_shift); break; } @@ -237,7 +239,8 @@ static inline void set_rfs(struct i2s_dai *i2s, unsigned rfs) /* Read Bit-Clock of I2S (in multiples of LRCLK) */ static inline unsigned get_bfs(struct i2s_dai *i2s) { - u32 bfs = (readl(i2s-addr + I2SMOD) 1) 0x3; + u32 bfs = readl(i2s-addr + I2SMOD) MOD_BCLK_SHIFT; + bfs = MOD_BCLK_MASK; switch (bfs) { case 3: return 24; @@ -251,21 +254,22 @@ static inline unsigned get_bfs(struct i2s_dai *i2s) static inline void set_bfs(struct i2s_dai *i2s, unsigned bfs) { u32 mod = readl(i2s-addr + I2SMOD); + int bfs_shift = MOD_BCLK_SHIFT; - mod = ~MOD_BCLK_MASK; + mod = ~(MOD_BCLK_MASK bfs_shift); switch (bfs) { case 48: - mod |= MOD_BCLK_48FS; + mod |= (MOD_BCLK_48FS bfs_shift); break; case 32: - mod |= MOD_BCLK_32FS; + mod |= (MOD_BCLK_32FS bfs_shift); break; case 24: - mod |= MOD_BCLK_24FS; + mod |= (MOD_BCLK_24FS bfs_shift); break; case 16: - mod |= MOD_BCLK_16FS; + mod |= (MOD_BCLK_16FS bfs_shift); break; default: dev_err(i2s-pdev-dev, Wrong BCLK Divider!\n); @@ -492,20 +496,25 @@ static int i2s_set_fmt(struct snd_soc_dai *dai, { struct i2s_dai *i2s =
[PATCH V2 0/8] Add audio support on smdk5420
Samsung has different versions of I2S introduced in different platforms. Each version has some new support added for multichannel, secondary fifo, s/w reset control, internal mux for rclk src clk and tdm support. Each newly added change has a quirk. So this patch adds all the required quirks as driver data and based on compatible string from dtsi fetches the quirks. This also adds i2s support on exynos5420 and make relevent changes in the dtsi files. Changes since V1: - Pass quirks as driver data and fetch the quirks based on compatible string from dtsi file as suggested by Tomasz Figa and Mark Brown - Make the I2S driver more flexible with respect to register access as suggested by Tomasz Figa and Mark Brown - Add 5420 support in the driver. - Modify the dtsi files with the corresponding compatible strings and removed the i2s quirks from 5250 dtsi file. - Updated the i2s Documentation with relevent changes and i2s versioning info. - Add i2s nodes on exynos5420.dtsi - Enable sound support on smdk5420 This patch set is dependent on the following dma and audio subsystem clk controller patches. http://comments.gmane.org/gmane.linux.kernel.samsung-soc/20661 http://comments.gmane.org/gmane.linux.kernel.samsung-soc/20668 This patch set is made based on Kukjin Kim for-next branch. Andrew Bresticker (1): ARM: dts: exynos5420: add i2s controllers Padmavathi Venna (7): platform: Increase platform name size ASoC: Samsung: I2S: Add quirks as driver data in I2S ARM: dts: Change i2s compatible string on exynos5250 ASoC: Samsung: I2S: Modify driver to give more flexibility ASoC: Samsung: I2S: Modify the I2S driver to support I2S on Exynos5420 ARM: dts: wm8994: Add wm8994 support on smdk5420 ARM: dts: Enable sound support on smdk5420 .../devicetree/bindings/sound/samsung-i2s.txt | 25 ++- arch/arm/boot/dts/exynos5250.dtsi |9 +- arch/arm/boot/dts/exynos5420-smdk5420.dts | 60 ++ arch/arm/boot/dts/exynos5420.dtsi | 44 + include/linux/mod_devicetable.h|2 +- include/linux/platform_data/asoc-s3c.h |1 + sound/soc/samsung/i2s-regs.h | 51 -- sound/soc/samsung/i2s.c| 205 +++- 8 files changed, 312 insertions(+), 85 deletions(-) -- 1.7.4.4 -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH V2 2/8] ASoC: Samsung: I2S: Add quirks as driver data in I2S
Samsung has different versions of I2S introduced in different platforms. Each version has some new support added for multichannel, secondary fifo, s/w reset control and internal mux for rclk src clk. Each newly added change has a quirk. So this patch adds all the required quirks as driver data and based on compatible string from dtsi fetches the quirks. Signed-off-by: Padmavathi Venna padm...@samsung.com --- .../devicetree/bindings/sound/samsung-i2s.txt | 21 +++--- sound/soc/samsung/i2s.c| 82 +--- 2 files changed, 64 insertions(+), 39 deletions(-) diff --git a/Documentation/devicetree/bindings/sound/samsung-i2s.txt b/Documentation/devicetree/bindings/sound/samsung-i2s.txt index 025e66b..b3f6443 100644 --- a/Documentation/devicetree/bindings/sound/samsung-i2s.txt +++ b/Documentation/devicetree/bindings/sound/samsung-i2s.txt @@ -2,7 +2,16 @@ Required SoC Specific Properties: -- compatible : samsung,i2s-v5 +- compatible : should be one of the following. + - samsung,s3c6410-i2s: for 8/16/24bit stereo I2S. Previous versions + has only 8/16bit support. + - samsung,s3c6410-i2sv4: for 8/16/24bit multichannel(5.1 channel) I2S. + Introduced in s3c6410. This also applicable for s5p64x0 platforms. + - samsung,s5pc100-i2s: for 8/16/24bit multichannel(5.1 channel) I2S + with secondary fifo and s/w reset control. + - samsung,s5pv210-i2s: for 8/16/24bit multichannel(5.1) I2S with + secondary fifo, s/w reset control and internal mux for root clk src. + - reg: physical base address of the controller and length of memory mapped region. - dmas: list of DMA controller phandle and DMA request line ordered pairs. @@ -21,13 +30,6 @@ Required SoC Specific Properties: Optional SoC Specific Properties: -- samsung,supports-6ch: If the I2S Primary sound source has 5.1 Channel - support, this flag is enabled. -- samsung,supports-rstclr: This flag should be set if I2S software reset bit - control is required. When this flag is set I2S software reset bit will be - enabled or disabled based on need. -- samsung,supports-secdai:If I2S block has a secondary FIFO and internal DMA, - then this flag is enabled. - samsung,idma-addr: Internal DMA register base address of the audio sub system(used in secondary sound source). - pinctrl-0: Should specify pin control groups used for this controller. @@ -46,9 +48,6 @@ i2s0: i2s@0383 { clock_audss EXYNOS_I2S_BUS, clock_audss EXYNOS_SCLK_I2S; clock-names = iis, i2s_opclk0, i2s_opclk1; - samsung,supports-6ch; - samsung,supports-rstclr; - samsung,supports-secdai; samsung,idma-addr = 0x0300; pinctrl-names = default; pinctrl-0 = i2s0_bus; diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c index 959c702..f661a98 100644 --- a/sound/soc/samsung/i2s.c +++ b/sound/soc/samsung/i2s.c @@ -40,6 +40,7 @@ enum samsung_dai_type { struct samsung_i2s_dai_data { int dai_type; + u32 quirks; }; struct i2s_dai { @@ -1018,18 +1019,18 @@ static struct i2s_dai *i2s_alloc_dai(struct platform_device *pdev, bool sec) static const struct of_device_id exynos_i2s_match[]; -static inline int samsung_i2s_get_driver_data(struct platform_device *pdev) +static inline struct samsung_i2s_dai_data *samsung_i2s_get_driver_data( + struct platform_device *pdev) { #ifdef CONFIG_OF - struct samsung_i2s_dai_data *data; if (pdev-dev.of_node) { const struct of_device_id *match; match = of_match_node(exynos_i2s_match, pdev-dev.of_node); - data = (struct samsung_i2s_dai_data *) match-data; - return data-dai_type; + return (struct samsung_i2s_dai_data *) match-data; } else #endif - return platform_get_device_id(pdev)-driver_data; + return (struct samsung_i2s_dai_data *) + platform_get_device_id(pdev)-driver_data; } #ifdef CONFIG_PM_RUNTIME @@ -1060,13 +1061,13 @@ static int samsung_i2s_probe(struct platform_device *pdev) struct resource *res; u32 regs_base, quirks = 0, idma_addr = 0; struct device_node *np = pdev-dev.of_node; - enum samsung_dai_type samsung_dai_type; + struct samsung_i2s_dai_data *i2s_dai_data; int ret = 0; /* Call during Seconday interface registration */ - samsung_dai_type = samsung_i2s_get_driver_data(pdev); + i2s_dai_data = samsung_i2s_get_driver_data(pdev); - if (samsung_dai_type == TYPE_SEC) { + if (i2s_dai_data-dai_type == TYPE_SEC) { sec_dai = dev_get_drvdata(pdev-dev); if (!sec_dai) { dev_err(pdev-dev, Unable to get drvdata\n); @@ -1115,15 +1116,7 @@ static int samsung_i2s_probe(struct platform_device *pdev) idma_addr =
Re: [PATCH V2 2/8] ASoC: Samsung: I2S: Add quirks as driver data in I2S
On Fri, Jul 26, 2013 at 07:06:46PM +0530, Padmavathi Venna wrote: -- compatible : samsung,i2s-v5 +- compatible : should be one of the following. + - samsung,s3c6410-i2s: for 8/16/24bit stereo I2S. Previous versions + has only 8/16bit support. + - samsung,s3c6410-i2sv4: for 8/16/24bit multichannel(5.1 channel) I2S. + Introduced in s3c6410. This also applicable for s5p64x0 platforms. + - samsung,s5pc100-i2s: for 8/16/24bit multichannel(5.1 channel) I2S + with secondary fifo and s/w reset control. + - samsung,s5pv210-i2s: for 8/16/24bit multichannel(5.1) I2S with + secondary fifo, s/w reset control and internal mux for root clk src. + So what happens with your changes to everyone who is using a DT file with the samsung,i2s-v5 compatible string? -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH V2 0/8] Add audio support on smdk5420
Hi Padmavathi, On Friday 26 of July 2013 19:06:44 Padmavathi Venna wrote: Samsung has different versions of I2S introduced in different platforms. Each version has some new support added for multichannel, secondary fifo, s/w reset control, internal mux for rclk src clk and tdm support. Each newly added change has a quirk. So this patch adds all the required quirks as driver data and based on compatible string from dtsi fetches the quirks. This also adds i2s support on exynos5420 and make relevent changes in the dtsi files. Changes since V1: - Pass quirks as driver data and fetch the quirks based on compatible string from dtsi file as suggested by Tomasz Figa and Mark Brown - Make the I2S driver more flexible with respect to register access as suggested by Tomasz Figa and Mark Brown - Add 5420 support in the driver. - Modify the dtsi files with the corresponding compatible strings and removed the i2s quirks from 5250 dtsi file. - Updated the i2s Documentation with relevent changes and i2s versioning info. - Add i2s nodes on exynos5420.dtsi - Enable sound support on smdk5420 This patch set is dependent on the following dma and audio subsystem clk controller patches. http://comments.gmane.org/gmane.linux.kernel.samsung-soc/20661 http://comments.gmane.org/gmane.linux.kernel.samsung-soc/20668 This patch set is made based on Kukjin Kim for-next branch. Andrew Bresticker (1): ARM: dts: exynos5420: add i2s controllers Padmavathi Venna (7): platform: Increase platform name size ASoC: Samsung: I2S: Add quirks as driver data in I2S ARM: dts: Change i2s compatible string on exynos5250 ASoC: Samsung: I2S: Modify driver to give more flexibility ASoC: Samsung: I2S: Modify the I2S driver to support I2S on Exynos5420 ARM: dts: wm8994: Add wm8994 support on smdk5420 ARM: dts: Enable sound support on smdk5420 .../devicetree/bindings/sound/samsung-i2s.txt | 25 ++- arch/arm/boot/dts/exynos5250.dtsi |9 +- arch/arm/boot/dts/exynos5420-smdk5420.dts | 60 ++ arch/arm/boot/dts/exynos5420.dtsi | 44 + include/linux/mod_devicetable.h|2 +- include/linux/platform_data/asoc-s3c.h |1 + sound/soc/samsung/i2s-regs.h | 51 -- sound/soc/samsung/i2s.c| 205 +++- 8 files changed, 312 insertions(+), 85 deletions(-) Please resend the whole series again using correct devicetree mailing list, which is: devicet...@vger.kernel.org The old one (devicetree-disc...@lists.ozlabs.org) is no longer functioning. Best regards, Tomasz -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: XCLKOUT in exynos5250 clock driver
On Fri, Jul 26, 2013 at 02:19:39PM +0200, Sylwester Nawrocki wrote: On 07/26/2013 11:56 AM, Tushar Behera wrote: On 07/25/2013 08:21 PM, Mark Brown wrote: I appear to be missing something in the clock driver for the exynos5250. I'm looking at the Arndale schematic and I see that the audio master This is something that's not yet supported in the mainline kernels I'm afraid. I was trying to be polite :) I suspect that the same, you can easily verify that by checking what ball identifier corresponds to XCLKOUT pin and how the routing looks like on the schematics. Right, for what it's worth it's ball AJ27 marked as XCLKOUT/ETC6_1 We have a bit hackish patch that adds support for the CLKOUT at the Exynos4 clocks driver to enable the audio codec. An issue here is that the CLKOUT mux and divider control bitfield is in the PMU registers (as opposed to CMU where the clock control registers normally are) and additionally single register contains the clock mux/divider bitfield as well as couple other unrelated control bits. Depending if those other bits are considered really important or not it it might another reason to expose (part of ?) PMU registers through syscon-like interface. There are registers in PMU Sounds like it'd be a good idea to do that if only for the purpose of describing things clearly in the DT. It can be seen in the Galaxy S3 kernel code how the Exynos5 CLKOUT handling might look like. See enum xclkout_select [1], exynos5_pmu_xclkout_set [2]. It would be good someone who has access to the datasheet come up with at with some patch so the audio works are not blocked. I'm not working right now on Exynos5 :P. I suspect I can reverse engineer something from this, though it would be much easier for someone with the datasheet. signature.asc Description: Digital signature
Re: [PATCH V2 2/8] ASoC: Samsung: I2S: Add quirks as driver data in I2S
On Fri, Jul 26, 2013 at 04:21:16PM +0200, Tomasz Figa wrote: Hi Russell, On Friday 26 of July 2013 15:06:18 Russell King - ARM Linux wrote: On Fri, Jul 26, 2013 at 07:06:46PM +0530, Padmavathi Venna wrote: -- compatible : samsung,i2s-v5 +- compatible : should be one of the following. + - samsung,s3c6410-i2s: for 8/16/24bit stereo I2S. Previous versions + has only 8/16bit support. + - samsung,s3c6410-i2sv4: for 8/16/24bit multichannel(5.1 channel) I2S. + Introduced in s3c6410. This also applicable for s5p64x0 platforms. + - samsung,s5pc100-i2s: for 8/16/24bit multichannel(5.1 channel) I2S + with secondary fifo and s/w reset control. + - samsung,s5pv210-i2s: for 8/16/24bit multichannel(5.1) I2S with + secondary fifo, s/w reset control and internal mux for root clk src. + So what happens with your changes to everyone who is using a DT file with the samsung,i2s-v5 compatible string? AFAIK we decided that current bindings, if broken, can be redone correctly, without caring for compatibility with old DTBs and only then, after reviewing these new bindings by DT people, they can be stabilized. Other issue, though, is that this patch breaks things until they get fixed by patch 3. Support for new bindings should be added first, then users fixed and only then old bindings can be removed. So, these bindings were merged in the v3.9 merge window, using the samsung,i2s-v5 compatible string, and now for the v3.12 merge window, you're proposing to break the audio description in any DT file which has been used with v3.9..v3.11 inclusive? The way you should be doing this is to keep the existing stuff working and supplement it with the new method of describing the hardware. -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH V2 1/8] platform: Increase platform name size
Hi Padma, On 26 July 2013 19:06, Padmavathi Venna padm...@samsung.com wrote: This patch increases the platform name size from 20 to 30. Instead of describing what the patch does (which is quite obvious from the code), it would be useful to describe why this change is required. Signed-off-by: Padmavathi Venna padm...@samsung.com --- include/linux/mod_devicetable.h |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h index b62d4af..f67b5d5 100644 --- a/include/linux/mod_devicetable.h +++ b/include/linux/mod_devicetable.h @@ -478,7 +478,7 @@ struct dmi_system_id { #define DMI_MATCH(a, b){ .slot = a, .substr = b } #define DMI_EXACT_MATCH(a, b) { .slot = a, .substr = b, .exact_match = 1 } -#define PLATFORM_NAME_SIZE 20 +#define PLATFORM_NAME_SIZE 30 #define PLATFORM_MODULE_PREFIX platform: struct platform_device_id { -- 1.7.4.4 -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html -- With warm regards, Sachin -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH V2 2/8] ASoC: Samsung: I2S: Add quirks as driver data in I2S
On Friday 26 of July 2013 15:27:22 Russell King - ARM Linux wrote: On Fri, Jul 26, 2013 at 04:21:16PM +0200, Tomasz Figa wrote: Hi Russell, On Friday 26 of July 2013 15:06:18 Russell King - ARM Linux wrote: On Fri, Jul 26, 2013 at 07:06:46PM +0530, Padmavathi Venna wrote: -- compatible : samsung,i2s-v5 +- compatible : should be one of the following. + - samsung,s3c6410-i2s: for 8/16/24bit stereo I2S. Previous versions + has only 8/16bit support. + - samsung,s3c6410-i2sv4: for 8/16/24bit multichannel(5.1 channel) I2S. + Introduced in s3c6410. This also applicable for s5p64x0 platforms. + - samsung,s5pc100-i2s: for 8/16/24bit multichannel(5.1 channel) I2S + with secondary fifo and s/w reset control. + - samsung,s5pv210-i2s: for 8/16/24bit multichannel(5.1) I2S with + secondary fifo, s/w reset control and internal mux for root clk src. + So what happens with your changes to everyone who is using a DT file with the samsung,i2s-v5 compatible string? AFAIK we decided that current bindings, if broken, can be redone correctly, without caring for compatibility with old DTBs and only then, after reviewing these new bindings by DT people, they can be stabilized. Other issue, though, is that this patch breaks things until they get fixed by patch 3. Support for new bindings should be added first, then users fixed and only then old bindings can be removed. So, these bindings were merged in the v3.9 merge window, using the samsung,i2s-v5 compatible string, and now for the v3.12 merge window, you're proposing to break the audio description in any DT file which has been used with v3.9..v3.11 inclusive? It depends whether we want to keep all the broken stuff. At current state dts is still pretty much coupled with kernel version from which it comes from, so there is not yet too late to replace the broken bindings with something acceptable. The way you should be doing this is to keep the existing stuff working and supplement it with the new method of describing the hardware. Ideally yes and we are moving towards this with all the plans to separate stable and staging bindings. However we are currently half-drowning in a swamp of broken bindings, so we would rather try to clean the mess ASAP, before things stabilize. Best regards, Tomasz -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH V2 2/8] ASoC: Samsung: I2S: Add quirks as driver data in I2S
On Fri, Jul 26, 2013 at 07:06:46PM +0530, Padmavathi Venna wrote: Samsung has different versions of I2S introduced in different platforms. Each version has some new support added for multichannel, secondary fifo, s/w reset control and internal mux for rclk src clk. Each newly added change has a quirk. So this patch adds all the required quirks as driver data and based on compatible string from dtsi fetches the quirks. As Russell indicated you should really keep the old name around, though marking them as deprecated is OK. However I'm not sure anyone will have deployed this so I'm not sure how much it matters - every downstream kernel I've seen was still using board files anyway. The actual meat of the patch changing to a quirk scheme does look good, though. -- compatible : samsung,i2s-v5 +- compatible : should be one of the following. + - samsung,s3c6410-i2s: for 8/16/24bit stereo I2S. Previous versions + has only 8/16bit support. + - samsung,s3c6410-i2sv4: for 8/16/24bit multichannel(5.1 channel) I2S. + Introduced in s3c6410. This also applicable for s5p64x0 platforms. + - samsung,s5pc100-i2s: for 8/16/24bit multichannel(5.1 channel) I2S + with secondary fifo and s/w reset control. + - samsung,s5pv210-i2s: for 8/16/24bit multichannel(5.1) I2S with + secondary fifo, s/w reset control and internal mux for root clk src. + I think the -vN naming scheme was fine - I see where this came from but the main point was about having things identified by a string not switching the naming scheme. As you can see from the s3c6410 stuff the SoC isn't that helpful as a naming scheme as multiple IP versions appear on the same SoC. signature.asc Description: Digital signature
Re: [PATCH V2 4/8] ASoC: Samsung: I2S: Modify driver to give more flexibility
On Fri, Jul 26, 2013 at 07:06:48PM +0530, Padmavathi Venna wrote: This patch modifies the i2s driver to give flexibility towards register handling. This is a pre requirement for enabling i2s support on Exynos5420. This patch modifies only the required registers as a pre-requirement to support on Exynos5420. Applied, thanks. signature.asc Description: Digital signature
Re: [PATCH V2 7/8] ARM: dts: wm8994: Add wm8994 support on smdk5420
On Fri, Jul 26, 2013 at 07:06:51PM +0530, Padmavathi Venna wrote: This patch adds wm8994 codec node on i2c bus1 and the required regulator supplies and properties on smdk5420 board. This isn't a device tree patch for WM8994, it's a patch for the SMDK5420. + vdd: fixed-regulator@0 { + compatible = regulator-fixed; + regulator-name = vdd-supply; These names look wrong - they should reflect the names in the schematic as they're for human comprehensibility. This may just be a case of dropping the -supply. + wm8994: wm8994@1a { + compatible = wlf,wm8994; + reg = 0x1a; + + gpio-controller; + #gpio-cells = 2; + + AVDD2-supply = vdd; + CPVDD-supply = vdd; + DBVDD-supply = dbvdd; + SPKVDD1-supply = spkvdd; + SPKVDD2-supply = spkvdd; + }; It would be helpful to also add a clock binding (I posted a binding documentation update the other day, it's in my tree now) but it's not essential and I suspect it needs some work on the clock driver side still. signature.asc Description: Digital signature
Re: [PATCH V2 2/8] ASoC: Samsung: I2S: Add quirks as driver data in I2S
On Fri, Jul 26, 2013 at 05:02:46PM +0200, Tomasz Figa wrote: IMHO this SoC-based identification looks much better, especially considering the fact that IP version isn't something easily determinable, as even the documentation can sometimes be not really clear about that. Yeah, it's not terribly clever either way. We've been using the version numbers in audio for a long time partly because it is documented sometimes and partly because most of the SoCs tend to have one fully featured controller and a bunch of secondary controllers on older IP revisions. However the s3c6410-i2sv4 string looks a bit unfortunate. AFAIK there were two types of I2S IPs on S3C6410 - normal I2S and I2S multichannel. What about having a compatible like s3c6410-i2s-multi? It was explicitly identified as I2Sv4 in the S3C6410 datasheet so no real issue there. signature.asc Description: Digital signature
Re: [PATCH v8 02/12] iommu/exynos: add missing cache flush for removed page table entries
On Fri, Jul 26, 2013 at 4:26 AM, Cho KyongHo pullip@samsung.com wrote: This commit adds cache flush for removed small and large page entries in exynos_iommu_unmap(). Missing cache flush of removed page table entries can cause missing page fault interrupt when a master IP accesses an unmapped area. Signed-off-by: Cho KyongHo pullip@samsung.com Tested-by: Grant Grundler grund...@chromium.org I'm convinced this is a critical fix to apply. Any time we touch the IOMMU Page Table, we need to flush so the change is immediately visible to the IOMMU. thanks, grant --- drivers/iommu/exynos-iommu.c |2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c index 233f382..e3be3e5 100644 --- a/drivers/iommu/exynos-iommu.c +++ b/drivers/iommu/exynos-iommu.c @@ -1002,6 +1002,7 @@ static size_t exynos_iommu_unmap(struct iommu_domain *domain, if (lv2ent_small(ent)) { *ent = 0; size = SPAGE_SIZE; + pgtable_flush(ent, ent +1); priv-lv2entcnt[lv1ent_offset(iova)] += 1; goto done; } @@ -1010,6 +1011,7 @@ static size_t exynos_iommu_unmap(struct iommu_domain *domain, BUG_ON(size LPAGE_SIZE); memset(ent, 0, sizeof(*ent) * SPAGES_PER_LPAGE); + pgtable_flush(ent, ent + SPAGES_PER_LPAGE); size = LPAGE_SIZE; priv-lv2entcnt[lv1ent_offset(iova)] += SPAGES_PER_LPAGE; -- 1.7.2.5 -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v8 03/12] iommu/exynos: fix page table maintenance
On Fri, Jul 26, 2013 at 4:27 AM, Cho KyongHo pullip@samsung.com wrote: This prevents allocating lv2 page table for the lv1 page table entry that already has 1MB page mapping. In addition some BUG_ON() is changed to WARN_ON(). Signed-off-by: Cho KyongHo pullip@samsung.com Reviewed-by: Grant Grundler grund...@chromium.org In reviewing this, I noticed another issue that is related, but not caused by this patch. See below. --- drivers/iommu/exynos-iommu.c | 52 + 1 files changed, 37 insertions(+), 15 deletions(-) diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c index e3be3e5..6c4ecce 100644 --- a/drivers/iommu/exynos-iommu.c +++ b/drivers/iommu/exynos-iommu.c @@ -52,11 +52,11 @@ #define lv2ent_large(pent) ((*(pent) 3) == 1) #define section_phys(sent) (*(sent) SECT_MASK) -#define section_offs(iova) ((iova) 0xF) +#define section_offs(iova) ((iova) ~SECT_MASK) #define lpage_phys(pent) (*(pent) LPAGE_MASK) -#define lpage_offs(iova) ((iova) 0x) +#define lpage_offs(iova) ((iova) ~LPAGE_MASK) #define spage_phys(pent) (*(pent) SPAGE_MASK) -#define spage_offs(iova) ((iova) 0xFFF) +#define spage_offs(iova) ((iova) ~SPAGE_MASK) #define lv1ent_offset(iova) ((iova) SECT_ORDER) #define lv2ent_offset(iova) (((iova) 0xFF000) SPAGE_ORDER) @@ -862,12 +862,14 @@ static unsigned long *alloc_lv2entry(unsigned long *sent, unsigned long iova, pent = kzalloc(LV2TABLE_SIZE, GFP_ATOMIC); BUG_ON((unsigned long)pent (LV2TABLE_SIZE - 1)); if (!pent) - return NULL; + return ERR_PTR(-ENOMEM); *sent = mk_lv1ent_page(__pa(pent)); *pgcounter = NUM_LV2ENTRIES; pgtable_flush(pent, pent + NUM_LV2ENTRIES); pgtable_flush(sent, sent + 1); + } else if (lv1ent_section(sent)) { + return ERR_PTR(-EADDRINUSE); } return page_entry(sent, iova); @@ -894,6 +896,12 @@ static int lv1set_section(unsigned long *sent, phys_addr_t paddr, short *pgcnt) return 0; } +static void clear_page_table(unsigned long *ent, int n) +{ + if (n 0) + memset(ent, 0, sizeof(*ent) * n); +} + static int lv2set_page(unsigned long *pent, phys_addr_t paddr, size_t size, short *pgcnt) { @@ -908,7 +916,7 @@ static int lv2set_page(unsigned long *pent, phys_addr_t paddr, size_t size, int i; for (i = 0; i SPAGES_PER_LPAGE; i++, pent++) { if (!lv2ent_fault(pent)) { - memset(pent, 0, sizeof(*pent) * i); + clear_page_table(pent - i, i); return -EADDRINUSE; I am wondering about two issues with this error handling: 1) we don't call pgtable_flush() in this case - I think just for consistency we should - don't rush to add since my next comment is to change this error handling completely. 2) If -EADDRINUSE is correct, why does the code clear the IO Page table entries? I think this error path should either (a) BUG_ON (ie panic) since this is an inconsistency between generic IOMMU page allocation and chip specific IOMMU mapping code OR (b) WARN_ON, not clear the entries, and hope whoever was using it can finish using the system before crashing or gracefully shutting down. In any case, I'm pretty sure this code needs to change and it should be in a follow up to this series. thanks, grant } @@ -944,17 +952,16 @@ static int exynos_iommu_map(struct iommu_domain *domain, unsigned long iova, pent = alloc_lv2entry(entry, iova, priv-lv2entcnt[lv1ent_offset(iova)]); - if (!pent) - ret = -ENOMEM; + if (IS_ERR(pent)) + ret = PTR_ERR(pent); else ret = lv2set_page(pent, paddr, size, priv-lv2entcnt[lv1ent_offset(iova)]); } - if (ret) { - pr_debug(%s: Failed to map iova 0x%lx/0x%x bytes\n, - __func__, iova, size); - } + if (ret) + pr_err(%s: Failed(%d) to map 0x%#x bytes @ %#lx\n, + __func__, ret, size, iova); spin_unlock_irqrestore(priv-pgtablelock, flags); @@ -968,6 +975,7 @@ static size_t exynos_iommu_unmap(struct iommu_domain *domain, struct sysmmu_drvdata *data; unsigned long flags; unsigned long *ent; + size_t err_pgsize; BUG_ON(priv-pgtable == NULL); @@ -976,7 +984,10 @@ static size_t exynos_iommu_unmap(struct iommu_domain *domain, ent =
Re: [PATCH v8 11/12] iommu/exynos: change rwlock to spinlock
On Fri, Jul 26, 2013 at 4:30 AM, Cho KyongHo pullip@samsung.com wrote: Since acquiring read_lock is not more frequent than write_lock, it is not beneficial to use rwlock, this commit changes rwlock to spinlock. Signed-off-by: Cho KyongHo pullip@samsung.com Reviewed-by: Grant Grundler grund...@chromium.org cheers, grant --- drivers/iommu/exynos-iommu.c | 36 ++-- 1 files changed, 18 insertions(+), 18 deletions(-) diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c index c62c244..51e5b35 100644 --- a/drivers/iommu/exynos-iommu.c +++ b/drivers/iommu/exynos-iommu.c @@ -187,7 +187,7 @@ struct sysmmu_drvdata { struct clk *clk; struct clk *clk_master; int activations; - rwlock_t lock; + spinlock_t lock; struct iommu_domain *domain; bool runtime_active; unsigned long pgtable; @@ -287,7 +287,7 @@ void exynos_sysmmu_set_prefbuf(struct device *dev, BUG_ON((base0 + size0) = base0); BUG_ON((size1 0) ((base1 + size1) = base1)); - read_lock_irqsave(data-lock, flags); + spin_lock_irqsave(data-lock, flags); if (!is_sysmmu_active(data)) goto finish; @@ -319,7 +319,7 @@ void exynos_sysmmu_set_prefbuf(struct device *dev, } clk_disable(data-clk_master); finish: - read_unlock_irqrestore(data-lock, flags); + spin_unlock_irqrestore(data-lock, flags); } static void show_fault_information(const char *name, @@ -371,7 +371,7 @@ static irqreturn_t exynos_sysmmu_irq(int irq, void *dev_id) if (client) spin_lock(client-lock); - read_lock(data-lock); + spin_lock(data-lock); if (i == data-nsfrs) { itype = SYSMMU_FAULT_UNKNOWN; @@ -402,7 +402,7 @@ static irqreturn_t exynos_sysmmu_irq(int irq, void *dev_id) if (itype != SYSMMU_FAULT_UNKNOWN) sysmmu_unblock(data-sfrbases[i]); - read_unlock(data-lock); + spin_unlock(data-lock); if (client) spin_unlock(client-lock); @@ -429,7 +429,7 @@ static bool __sysmmu_disable(struct sysmmu_drvdata *data) bool disabled; unsigned long flags; - write_lock_irqsave(data-lock, flags); + spin_lock_irqsave(data-lock, flags); disabled = set_sysmmu_inactive(data); @@ -446,7 +446,7 @@ static bool __sysmmu_disable(struct sysmmu_drvdata *data) data-activations); } - write_unlock_irqrestore(data-lock, flags); + spin_unlock_irqrestore(data-lock, flags); return disabled; } @@ -493,7 +493,7 @@ static int __sysmmu_enable(struct sysmmu_drvdata *data, int ret = 0; unsigned long flags; - write_lock_irqsave(data-lock, flags); + spin_lock_irqsave(data-lock, flags); if (set_sysmmu_active(data)) { data-pgtable = pgtable; data-domain = domain; @@ -511,7 +511,7 @@ static int __sysmmu_enable(struct sysmmu_drvdata *data, if (WARN_ON(ret 0)) set_sysmmu_inactive(data); /* decrement count */ - write_unlock_irqrestore(data-lock, flags); + spin_unlock_irqrestore(data-lock, flags); return ret; } @@ -602,7 +602,7 @@ static void sysmmu_tlb_invalidate_entry(struct device *dev, unsigned long iova) data = dev_get_drvdata(client-sysmmu[i]); - read_lock_irqsave(data-lock, flags); + spin_lock_irqsave(data-lock, flags); if (is_sysmmu_active(data) data-runtime_active) { int i; clk_enable(data-clk_master); @@ -615,7 +615,7 @@ static void sysmmu_tlb_invalidate_entry(struct device *dev, unsigned long iova) disabled. Skipping TLB invalidation @ %#lx\n, iova); } - read_unlock_irqrestore(data-lock, flags); + spin_unlock_irqrestore(data-lock, flags); } } @@ -630,7 +630,7 @@ void exynos_sysmmu_tlb_invalidate(struct device *dev) data = dev_get_drvdata(client-sysmmu[i]); - read_lock_irqsave(data-lock, flags); + spin_lock_irqsave(data-lock, flags); if (is_sysmmu_active(data) data-runtime_active) { int i; @@ -646,7 +646,7 @@ void exynos_sysmmu_tlb_invalidate(struct device *dev) } else { dev_dbg(dev, disabled. Skipping TLB invalidation\n); } - read_unlock_irqrestore(data-lock, flags); + spin_unlock_irqrestore(data-lock, flags); } } @@ -735,7 +735,7 @@ static int __init exynos_sysmmu_probe(struct platform_device *pdev) data-runtime_active =
Re: [PATCH v8 09/12] iommu/exynos: remove custom fault handler
On Fri, Jul 26, 2013 at 4:29 AM, Cho KyongHo pullip@samsung.com wrote: This commit removes custom fault handler. The device drivers that need to register fault handler can register with iommu_set_fault_handler(). Signed-off-by: Cho KyongHo pullip@samsung.com Reviewed-by: Grant Grundler grund...@chromium.org cheers grant --- drivers/iommu/exynos-iommu.c | 71 ++ 1 files changed, 17 insertions(+), 54 deletions(-) diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c index 87f6bb7..f9853fe 100644 --- a/drivers/iommu/exynos-iommu.c +++ b/drivers/iommu/exynos-iommu.c @@ -131,16 +131,6 @@ enum exynos_sysmmu_inttype { SYSMMU_FAULTS_NUM }; -/* - * @itype: type of fault. - * @pgtable_base: the physical address of page table base. This is 0 if @itype - *is SYSMMU_BUSERROR. - * @fault_addr: the device (virtual) address that the System MMU tried to - * translated. This is 0 if @itype is SYSMMU_BUSERROR. - */ -typedef int (*sysmmu_fault_handler_t)(enum exynos_sysmmu_inttype itype, - unsigned long pgtable_base, unsigned long fault_addr); - static unsigned short fault_reg_offset[SYSMMU_FAULTS_NUM] = { REG_PAGE_FAULT_ADDR, REG_AR_FAULT_ADDR, @@ -181,7 +171,6 @@ struct sysmmu_drvdata { int activations; rwlock_t lock; struct iommu_domain *domain; - sysmmu_fault_handler_t fault_handler; unsigned long pgtable; void __iomem *sfrbases[0]; }; @@ -313,34 +302,17 @@ finish: read_unlock_irqrestore(data-lock, flags); } -static void __set_fault_handler(struct sysmmu_drvdata *data, - sysmmu_fault_handler_t handler) -{ - unsigned long flags; - - write_lock_irqsave(data-lock, flags); - data-fault_handler = handler; - write_unlock_irqrestore(data-lock, flags); -} - -void exynos_sysmmu_set_fault_handler(struct device *dev, - sysmmu_fault_handler_t handler) -{ - struct sysmmu_drvdata *data = dev_get_drvdata(dev-archdata.iommu); - - __set_fault_handler(data, handler); -} - -static int default_fault_handler(enum exynos_sysmmu_inttype itype, -unsigned long pgtable_base, unsigned long fault_addr) +static void show_fault_information(const char *name, + enum exynos_sysmmu_inttype itype, + unsigned long pgtable_base, unsigned long fault_addr) { unsigned long *ent; if ((itype = SYSMMU_FAULTS_NUM) || (itype SYSMMU_PAGEFAULT)) itype = SYSMMU_FAULT_UNKNOWN; - pr_err(%s occurred at 0x%lx(Page table base: 0x%lx)\n, - sysmmu_fault_name[itype], fault_addr, pgtable_base); + pr_err(%s occurred at 0x%lx by %s(Page table base: 0x%lx)\n, + sysmmu_fault_name[itype], fault_addr, name, pgtable_base); ent = section_entry(__va(pgtable_base), fault_addr); pr_err(\tLv1 entry: 0x%lx\n, *ent); @@ -353,16 +325,12 @@ static int default_fault_handler(enum exynos_sysmmu_inttype itype, pr_err(Generating Kernel OOPS... because it is unrecoverable.\n); BUG(); - - return 0; } static irqreturn_t exynos_sysmmu_irq(int irq, void *dev_id) { /* SYSMMU is in blocked when interrupt occurred. */ struct sysmmu_drvdata *data = dev_id; - struct resource *irqres; - struct platform_device *pdev; enum exynos_sysmmu_inttype itype; unsigned long addr = -1; @@ -372,14 +340,15 @@ static irqreturn_t exynos_sysmmu_irq(int irq, void *dev_id) WARN_ON(!is_sysmmu_active(data)); - pdev = to_platform_device(data-sysmmu); - for (i = 0; i (pdev-num_resources / 2); i++) { - irqres = platform_get_resource(pdev, IORESOURCE_IRQ, i); + for (i = 0; i data-nsfrs; i++) { + struct resource *irqres; + irqres = platform_get_resource(to_platform_device(data-sysmmu), + IORESOURCE_IRQ, i); if (irqres ((int)irqres-start == irq)) break; } - if (i == pdev-num_resources) { + if (i == data-nsfrs) { itype = SYSMMU_FAULT_UNKNOWN; } else { itype = (enum exynos_sysmmu_inttype) @@ -395,19 +364,15 @@ static irqreturn_t exynos_sysmmu_irq(int irq, void *dev_id) ret = report_iommu_fault(data-domain, data-dev, addr, itype); - if ((ret == -ENOSYS) data-fault_handler) { - unsigned long base = data-pgtable; - if (itype != SYSMMU_FAULT_UNKNOWN) - base = __raw_readl( - data-sfrbases[i] + REG_PT_BASE_ADDR); - ret
Re: [PATCH v8 12/12] iommu/exynos: return 0 if iommu_attach_device() successes
On Fri, Jul 26, 2013 at 4:31 AM, Cho KyongHo pullip@samsung.com wrote: iommu_attach_device() against exynos-iommu positive integer on success if the caller calls iommu_attach_device() with the same iommu_domain multiple times without call to iommu_detach_device() to inform the caller how many calls to iommu_detach_device() to really detach iommu. However the convention of the return value of success of common API is zero, this patch makes iommu_attach_device() call against exynos-iommu always return zero if the given device is successfully attached to the given iommu_domain even though it is already attached to the same iommu_domain. Signed-off-by: Cho KyongHo pullip@samsung.com Reviewed-by: Grant Grundler grund...@chromium.org cheers, grant --- drivers/iommu/exynos-iommu.c | 13 +++-- 1 files changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c index 51e5b35..6eed6d6 100644 --- a/drivers/iommu/exynos-iommu.c +++ b/drivers/iommu/exynos-iommu.c @@ -882,15 +882,16 @@ static int exynos_iommu_attach_device(struct iommu_domain *domain, spin_unlock_irqrestore(priv-lock, flags); - if (ret 0) + if (ret 0) { dev_err(dev, %s: Failed to attach IOMMU with pgtable %#lx\n, __func__, __pa(priv-pgtable)); - else - dev_dbg(dev, %s: Attached IOMMU with pgtable 0x%lx%s\n, - __func__, __pa(priv-pgtable), - (ret == 0) ? : , again); + return ret; + } - return ret; + dev_dbg(dev, %s: Attached IOMMU with pgtable 0x%lx%s\n, + __func__, __pa(priv-pgtable), (ret == 0) ? : , again); + + return 0; } static void exynos_iommu_detach_device(struct iommu_domain *domain, -- 1.7.2.5 -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v8 08/12] iommu/exynos: remove prefetch buffer setting when enabling System MMU
On Fri, Jul 26, 2013 at 4:28 AM, Cho KyongHo pullip@samsung.com wrote: Prefetch buffer must be handled accurately, exact range of a buffer, frame by frame manually. Otherwise, it may causes page fault or deadlock in System MMU. Thus this patch removes prefetch buffer setting when System MMU is initialized(enabled). Signed-off-by: Cho KyongHo pullip@samsung.com Reviewed-by: Grant Grundler grund...@chromium.org BTW, cscope doesn't find any callers of exynos_sysmmu_enable(). Want to submit another patch to remove it? (Note I'm talking about exynos_sysmmu_enable() without __ prefix). cheers, grant --- drivers/iommu/exynos-iommu.c | 32 +++- 1 files changed, 27 insertions(+), 5 deletions(-) diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c index cfc02ed..87f6bb7 100644 --- a/drivers/iommu/exynos-iommu.c +++ b/drivers/iommu/exynos-iommu.c @@ -80,6 +80,8 @@ #define CTRL_BLOCK 0x7 #define CTRL_DISABLE 0x0 +#define CFG_FLPDCACHE (1 20) /* System MMU 3.2+ only */ + #define REG_MMU_CTRL 0x000 #define REG_MMU_CFG0x004 #define REG_MMU_STATUS 0x008 @@ -96,6 +98,9 @@ #define REG_MMU_VERSION0x034 +#define MMU_MAJ_VER(reg) (reg 28) +#define MMU_MIN_VER(reg) ((reg 21) 0x7F) + #define REG_PB0_SADDR 0x04C #define REG_PB0_EADDR 0x050 #define REG_PB1_SADDR 0x054 @@ -200,6 +205,22 @@ static bool is_sysmmu_active(struct sysmmu_drvdata *data) return data-activations 0; } +static unsigned int __sysmmu_version(struct sysmmu_drvdata *data, +int idx, unsigned int *minor) +{ + unsigned long major; + + major = readl(data-sfrbases[idx] + REG_MMU_VERSION); + + if (minor) + *minor = MMU_MIN_VER(major); + + if (MMU_MAJ_VER(major) 3) + return 1; + + return MMU_MAJ_VER(major); +} + static void sysmmu_unblock(void __iomem *sfrbase) { __raw_writel(CTRL_ENABLE, sfrbase + REG_MMU_CTRL); @@ -460,14 +481,15 @@ static int __exynos_sysmmu_enable(struct sysmmu_drvdata *data, data-pgtable = pgtable; for (i = 0; i data-nsfrs; i++) { + unsigned int min; + __sysmmu_set_ptbase(data-sfrbases[i], pgtable); - if ((readl(data-sfrbases[i] + REG_MMU_VERSION) 28) == 3) { - /* System MMU version is 3.x */ - __raw_writel((1 12) | (2 28), + if ((__sysmmu_version(data, i, min) == 3) (min 1)) { + unsigned long cfg; + cfg = __raw_readl(data-sfrbases[i] + REG_MMU_CFG); + __raw_writel(cfg | CFG_FLPDCACHE, data-sfrbases[i] + REG_MMU_CFG); - __sysmmu_set_prefbuf(data-sfrbases[i], 0, -1, 0); - __sysmmu_set_prefbuf(data-sfrbases[i], 0, -1, 1); } __raw_writel(CTRL_ENABLE, data-sfrbases[i] + REG_MMU_CTRL); -- 1.7.2.5 -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v8 06/12] ARM: dts: Add description of System MMU of Exynos SoCs
On Fri, Jul 26, 2013 at 4:28 AM, Cho KyongHo pullip@samsung.com wrote: Signed-off-by: Cho KyongHo pullip@samsung.com --- .../bindings/iommu/samsung,exynos4210-sysmmu.txt | 103 +++ arch/arm/boot/dts/exynos4.dtsi | 122 arch/arm/boot/dts/exynos4210.dtsi | 25 ++ arch/arm/boot/dts/exynos4x12.dtsi | 76 + arch/arm/boot/dts/exynos5250.dtsi | 291 5 files changed, 617 insertions(+), 0 deletions(-) create mode 100644 Documentation/devicetree/bindings/iommu/samsung,exynos4210-sysmmu.txt diff --git a/Documentation/devicetree/bindings/iommu/samsung,exynos4210-sysmmu.txt b/Documentation/devicetree/bindings/iommu/samsung,exynos4210-sysmmu.txt new file mode 100644 index 000..92f0a33 --- /dev/null +++ b/Documentation/devicetree/bindings/iommu/samsung,exynos4210-sysmmu.txt @@ -0,0 +1,103 @@ +Samsung Exynos4210 IOMMU H/W, System MMU (System Memory Management Unit) + +Samsung's Exynos architecture contains System MMU that enables scattered Cho, MMU should be plural? MMUs? +physical memory chunks visible as a contiguous region to DMA-capable peripheral +devices like MFC, FIMC, FIMD, GScaler, FIMC-IS and so forth. + +System MMU is a sort of IOMMU and support identical translation table format to s/a sort of/an/ . Or perhaps is also an. For the purposes of documenting DMA support, we are talking about the IOMMU functionality this device provides. It might be better to mention the functionality the System MMU supports and refer to other subsystem documents (e,g, clocking and power control) for details. +ARMv7 translation tables with minimum set of page properties including access +permissions, shareability and security protection. In addition, System MMU has +another capabilities like L2 TLB or block-fetch buffers to minimize translation +latency. + +A System MMU is dedicated to a single master peripheral device. Thus, it is +important to specify the correct System MMU in the device node of its master +device. Whereas a System MMU is dedicated to a master device, the master device +may have more than one System MMU. Can I suggest rewriting the last two sentences to: The master device node must correctly specify at least one SystemMMU. A master device may have more than one System MMU. BTW, is there a difference between master device and master peripheral device that I'm not aware of? Perhaps use just one of those expressions in this document, not both if they are the same thing (which is what I assumed). cheers, grant + +Required properties: +- compatible: Should be samsung,exynos4210-sysmmu +- reg: A tuple of base address and size of System MMU registers. +- interrupt-parent: The phandle of the interrupt controller of System MMU +- interrupts: A tuple of numbers that indicates the interrupt source. +- clock-names: Should be sysmmu if the System MMU is needed to gate its clock. + Please refer to the following documents: + Documentation/devicetree/bindings/clock/clock-bindings.txt + Documentation/devicetree/bindings/clock/exynos4-clock.txt + Documentation/devicetree/bindings/clock/exynos5250-clock.txt + Optional master if the clock to the System MMU is gated by + another gate clock other than sysmmu. The System MMU driver + sets master the parent of sysmmu. + Exynos4 SoCs, there needs no master clocks. + Exynos5 SoCs, some System MMUs must have master clocks. +- clocks: Required if the System MMU is needed to gate its clock. + Please refer to the documents listed above. +- samsung,power-domain: Required if the System MMU is needed to gate its power. + Please refer to the following document: + Documentation/devicetree/bindings/arm/exynos/power_domain.txt + +Required properties for the master peripheral devices: +- iommu: phandles to the System MMUs of the device + +Examples: +A System MMU is dedicated to a single master device. + gsc_0: gsc@0x13e0 { + compatible = samsung,exynos5-gsc; + reg = 0x13e0 0x1000; + interrupts = 0 85 0; + samsung,power-domain = pd_gsc; + clocks = clock 256; + clock-names = gscl; + iommu = sysmmu_gsc1; + }; + + sysmmu_gsc0: sysmmu@13E8 { + compatible = samsung,exynos4210-sysmmu; + reg = 0x13E8 0x1000; + interrupt-parent = combiner; + interrupt-names = sysmmu-gsc0; + interrupts = 2 0; + clock-names = sysmmu, master; + clocks = clock 262, clock 256; + samsung,power-domain = pd_gsc; + status = ok; + }; + +MFC has 2 System MMUs for each port that MFC is
Re: [PATCH 1/3] clk: exynos5250: Add G2D gate clock
Quoting Sachin Kamat (2013-07-05 01:42:27) Adds gate clock for G2D IP for Exynos5250 SoC. Signed-off-by: Sachin Kamat sachin.ka...@linaro.org Cc: Mike Turquette mturque...@linaro.org I've taken patch #1 into clk-next. --- This patch depends on the following patch: http://thread.gmane.org/gmane.linux.kernel.samsung-soc/20581 I think I've gotten all three series you sent out, can you confirm? http://thread.gmane.org/gmane.linux.kernel.samsung-soc/20581 http://comments.gmane.org/gmane.linux.kernel.samsung-soc/20829 http://comments.gmane.org/gmane.linux.kernel.samsung-soc/20582 Regards, Mike --- .../devicetree/bindings/clock/exynos5250-clock.txt |1 + drivers/clk/samsung/clk-exynos5250.c |5 - 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/clock/exynos5250-clock.txt b/Documentation/devicetree/bindings/clock/exynos5250-clock.txt index 1a05761..7e88242 100644 --- a/Documentation/devicetree/bindings/clock/exynos5250-clock.txt +++ b/Documentation/devicetree/bindings/clock/exynos5250-clock.txt @@ -155,6 +155,7 @@ clock which they consume. dp 342 mixer343 hdmi 344 + g2d 345 Example 1: An example of a clock controller node is listed below. diff --git a/drivers/clk/samsung/clk-exynos5250.c b/drivers/clk/samsung/clk-exynos5250.c index 6f767c5..3da0bdf 100644 --- a/drivers/clk/samsung/clk-exynos5250.c +++ b/drivers/clk/samsung/clk-exynos5250.c @@ -62,6 +62,7 @@ #define SRC_CDREX 0x20200 #define PLL_DIV2_SEL 0x20a24 #define GATE_IP_DISP1 0x10928 +#define GATE_IP_ACP0x1 /* * Let each supported clock get a unique id. This id is used to lookup the clock @@ -99,7 +100,7 @@ enum exynos5250_clks { spi2, i2s1, i2s2, pcm1, pcm2, pwm, spdif, ac97, hsi2c0, hsi2c1, hsi2c2, hsi2c3, chipid, sysreg, pmu, cmu_top, cmu_core, cmu_mem, tzpc0, tzpc1, tzpc2, tzpc3, tzpc4, tzpc5, tzpc6, tzpc7, tzpc8, tzpc9, hdmi_cec, mct, - wdt, rtc, tmu, fimd1, mie1, dsim0, dp, mixer, hdmi, + wdt, rtc, tmu, fimd1, mie1, dsim0, dp, mixer, hdmi, g2d, nr_clks, }; @@ -152,6 +153,7 @@ static __initdata unsigned long exynos5250_clk_regs[] = { SRC_CDREX, PLL_DIV2_SEL, GATE_IP_DISP1, + GATE_IP_ACP, }; /* list of all parent clock list */ @@ -463,6 +465,7 @@ struct samsung_gate_clock exynos5250_gate_clks[] __initdata = { GATE(dp, dp, aclk200, GATE_IP_DISP1, 4, 0, 0), GATE(mixer, mixer, aclk200, GATE_IP_DISP1, 5, 0, 0), GATE(hdmi, hdmi, aclk200, GATE_IP_DISP1, 6, 0, 0), + GATE(g2d, g2d, aclk200, GATE_IP_ACP, 3, 0, 0), }; static __initdata struct of_device_id ext_clk_match[] = { -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH V2 0/8] Add audio support on smdk5420
On Fri, Jul 26, 2013 at 7:52 PM, Tomasz Figa t.f...@samsung.com wrote: Hi Padmavathi, On Friday 26 of July 2013 19:06:44 Padmavathi Venna wrote: Samsung has different versions of I2S introduced in different platforms. Each version has some new support added for multichannel, secondary fifo, s/w reset control, internal mux for rclk src clk and tdm support. Each newly added change has a quirk. So this patch adds all the required quirks as driver data and based on compatible string from dtsi fetches the quirks. This also adds i2s support on exynos5420 and make relevent changes in the dtsi files. Changes since V1: - Pass quirks as driver data and fetch the quirks based on compatible string from dtsi file as suggested by Tomasz Figa and Mark Brown - Make the I2S driver more flexible with respect to register access as suggested by Tomasz Figa and Mark Brown - Add 5420 support in the driver. - Modify the dtsi files with the corresponding compatible strings and removed the i2s quirks from 5250 dtsi file. - Updated the i2s Documentation with relevent changes and i2s versioning info. - Add i2s nodes on exynos5420.dtsi - Enable sound support on smdk5420 This patch set is dependent on the following dma and audio subsystem clk controller patches. http://comments.gmane.org/gmane.linux.kernel.samsung-soc/20661 http://comments.gmane.org/gmane.linux.kernel.samsung-soc/20668 This patch set is made based on Kukjin Kim for-next branch. Andrew Bresticker (1): ARM: dts: exynos5420: add i2s controllers Padmavathi Venna (7): platform: Increase platform name size ASoC: Samsung: I2S: Add quirks as driver data in I2S ARM: dts: Change i2s compatible string on exynos5250 ASoC: Samsung: I2S: Modify driver to give more flexibility ASoC: Samsung: I2S: Modify the I2S driver to support I2S on Exynos5420 ARM: dts: wm8994: Add wm8994 support on smdk5420 ARM: dts: Enable sound support on smdk5420 .../devicetree/bindings/sound/samsung-i2s.txt | 25 ++- arch/arm/boot/dts/exynos5250.dtsi |9 +- arch/arm/boot/dts/exynos5420-smdk5420.dts | 60 ++ arch/arm/boot/dts/exynos5420.dtsi | 44 + include/linux/mod_devicetable.h|2 +- include/linux/platform_data/asoc-s3c.h |1 + sound/soc/samsung/i2s-regs.h | 51 -- sound/soc/samsung/i2s.c| 205 +++- 8 files changed, 312 insertions(+), 85 deletions(-) Please resend the whole series again using correct devicetree mailing list, which is: devicet...@vger.kernel.org The old one (devicetree-disc...@lists.ozlabs.org) is no longer functioning. Best regards, Tomasz OK. I will post. Thanks Padma -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH V2 1/8] platform: Increase platform name size
Hi Sachin, On Fri, Jul 26, 2013 at 8:06 PM, Sachin Kamat sachin.ka...@linaro.org wrote: Hi Padma, On 26 July 2013 19:06, Padmavathi Venna padm...@samsung.com wrote: This patch increases the platform name size from 20 to 30. Instead of describing what the patch does (which is quite obvious from the code), it would be useful to describe why this change is required. OK. I will post in my next version. Signed-off-by: Padmavathi Venna padm...@samsung.com --- include/linux/mod_devicetable.h |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h index b62d4af..f67b5d5 100644 --- a/include/linux/mod_devicetable.h +++ b/include/linux/mod_devicetable.h @@ -478,7 +478,7 @@ struct dmi_system_id { #define DMI_MATCH(a, b){ .slot = a, .substr = b } #define DMI_EXACT_MATCH(a, b) { .slot = a, .substr = b, .exact_match = 1 } -#define PLATFORM_NAME_SIZE 20 +#define PLATFORM_NAME_SIZE 30 #define PLATFORM_MODULE_PREFIX platform: struct platform_device_id { -- 1.7.4.4 -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html -- With warm regards, Sachin Thanks Padma -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH V2 7/8] ARM: dts: wm8994: Add wm8994 support on smdk5420
Hi Mark, On Fri, Jul 26, 2013 at 8:49 PM, Mark Brown broo...@kernel.org wrote: On Fri, Jul 26, 2013 at 07:06:51PM +0530, Padmavathi Venna wrote: This patch adds wm8994 codec node on i2c bus1 and the required regulator supplies and properties on smdk5420 board. This isn't a device tree patch for WM8994, it's a patch for the SMDK5420. Yes. I will correct the subject. + vdd: fixed-regulator@0 { + compatible = regulator-fixed; + regulator-name = vdd-supply; These names look wrong - they should reflect the names in the schematic as they're for human comprehensibility. This may just be a case of dropping the -supply. OK. + wm8994: wm8994@1a { + compatible = wlf,wm8994; + reg = 0x1a; + + gpio-controller; + #gpio-cells = 2; + + AVDD2-supply = vdd; + CPVDD-supply = vdd; + DBVDD-supply = dbvdd; + SPKVDD1-supply = spkvdd; + SPKVDD2-supply = spkvdd; + }; It would be helpful to also add a clock binding (I posted a binding documentation update the other day, it's in my tree now) but it's not essential and I suspect it needs some work on the clock driver side still. OK. I will check this. Thanks Padma -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html