Re: [PATCH] drm/exynos: Fix (more) freeing issues in exynos_drm_drv.c

2014-03-18 Thread Daniel Kurtz
On Tue, Mar 18, 2014 at 2:08 PM, Inki Dae  wrote:
> 2014-03-18 14:45 GMT+09:00 Kukjin Kim :
>> Inki Dae wrote:
>>>
>>> Applied.
>>>
>>> Thanks,
>>> Inki Dae
>>>
>>> 2014-03-17 12:28 GMT+09:00 Daniel Kurtz :
>>> > The following commit [0] fixed a use-after-free, but left the subdrv
>>> open
>>> > in the error path.
>>> >
>>> > [0] commit 6ca605f7c70895a35737435f17ae9cc5e36f1466
>>> > drm/exynos: Fix freeing issues in exynos_drm_drv.c
>>> >
>>> > Change-Id: I452e944bf090fb11434d9e34213c890c41c15d73
>>
>> This should be removed when Inki apply this.
>>
>
> No, Daniel's patch just complements above previous one that is what I missed.
>

Inki,

Ah, sorry for the original double post.  The first one (with the
"Change-Id") went out too soon, and I forgot to ask for it to be
ignored.
Hopefully you picked up the second patch with the corrected commit message.

Thanks,
Daniel


> Thanks,
> Inki Dae
>
>> Thanks,
>> Kukjin
>>
>>> > Signed-off-by: Daniel Kurtz 
>>> > ---
>>> >  drivers/gpu/drm/exynos/exynos_drm_drv.c | 10 +++---
>>> >  1 file changed, 7 insertions(+), 3 deletions(-)
>>
>>
>> ___
>> linux-arm-kernel mailing list
>> linux-arm-ker...@lists.infradead.org
>> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
--
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: [RFC v3 0/5] cpufreq:LAB: Support for LAB governor.

2014-03-18 Thread Viresh Kumar
On 17 March 2014 21:08, Lukasz Majewski  wrote:
>> Despite this patch set is working and applicable on top of 3.14-rc5,
>> please regard it solely as a pure RFC.
>>
>> This patch provides support for LAB governor build on top of ondemand.
>> Previous version of LAB can be found here:
>> http://thread.gmane.org/gmane.linux.kernel/1484746/match=cpufreq
>>
>> LAB short reminder:
>>
>> LAB uses information about how many cores are in "idle" state (the
>> core idleness is represented as the value between 0 and 100) and the
>> overall load of the system (from 0 to 100) to decide about frequency
>> to be set. It is extremely useful with SoCs like Exynos4412, which
>> can set only one frequency for all cores.
>>
>> Important design decisions:
>>
>> - Reuse well established ondemand governor's internal code. To do this
>>   I had to expose some previously static internal ondemand code.
>>   This allowed smaller LAB code when compared to previous version.
>>
>> - LAB works on top of ondemand, which means that one via device tree
>>   attributes can specify if and when e.g. BOOST shall be enabled or
>> if any particular frequency shall be imposed. For situation NOT
>> important from the power consumption reduction viewpoint the ondemand
>> is used to set proper frequency.
>>
>> - It is only possible to either compile in or not the LAB into the
>> kernel. There is no "M" option for Kconfig. It is done on purpose,
>> since ondemand itself can be also compiled as a module and then it
>> would be possible to remove ondemand when LAB is working on top of it.
>>
>> - The LAB operation is specified (and thereof extendable) via device
>> tree lab-ctrl-freq attribute defined at /cpus/cpu0.
>>
>>
>> Problems:
>> - How the governor will work for big.LITTLE systems (especially
>> Global Task Scheduling).
>> - Will there be agreement to expose internal ondemand code to be
>> reused for more specialized governors.
>>
>> Test HW:
>>   Exynos4412 - Trats2 board.
>> Above patches were posted on top of Linux 3.14-rc5
>> (SHA1: 3f9590c281c66162bf8ae9b7b2d987f0a89043c6)
>>
>
> Any comments about those patches?

Sorry for being late on reviewing these..

I tried to go through the patches but didn't looked at the minutest
of the details. Its been a long time when you first sent this patchset.
And the memories have corrupted by now :) ..

To get context back, can we discuss again the fundamentals behind
this new governor you are proposing. And then we can discuss about
it again, its pros/cons, etc..

I tried to go to earlier threads but I think we better do it again..

People are reluctant in getting another governor in and want to give
existing governors a try if possible.

So, please explain the basics behind your governor again and then
we can put our arguments again..

--
viresh
--
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: [RFC v3 0/5] cpufreq:LAB: Support for LAB governor.

2014-03-18 Thread Lukasz Majewski
Hi Viresh,

> On 17 March 2014 21:08, Lukasz Majewski 
> wrote:
> >> Despite this patch set is working and applicable on top of
> >> 3.14-rc5, please regard it solely as a pure RFC.
> >>
> >> This patch provides support for LAB governor build on top of
> >> ondemand. Previous version of LAB can be found here:
> >> http://thread.gmane.org/gmane.linux.kernel/1484746/match=cpufreq
> >>
> >> LAB short reminder:
> >>
> >> LAB uses information about how many cores are in "idle" state (the
> >> core idleness is represented as the value between 0 and 100) and
> >> the overall load of the system (from 0 to 100) to decide about
> >> frequency to be set. It is extremely useful with SoCs like
> >> Exynos4412, which can set only one frequency for all cores.
> >>
> >> Important design decisions:
> >>
> >> - Reuse well established ondemand governor's internal code. To do
> >> this I had to expose some previously static internal ondemand code.
> >>   This allowed smaller LAB code when compared to previous version.
> >>
> >> - LAB works on top of ondemand, which means that one via device
> >> tree attributes can specify if and when e.g. BOOST shall be
> >> enabled or if any particular frequency shall be imposed. For
> >> situation NOT important from the power consumption reduction
> >> viewpoint the ondemand is used to set proper frequency.
> >>
> >> - It is only possible to either compile in or not the LAB into the
> >> kernel. There is no "M" option for Kconfig. It is done on purpose,
> >> since ondemand itself can be also compiled as a module and then it
> >> would be possible to remove ondemand when LAB is working on top of
> >> it.
> >>
> >> - The LAB operation is specified (and thereof extendable) via
> >> device tree lab-ctrl-freq attribute defined at /cpus/cpu0.
> >>
> >>
> >> Problems:
> >> - How the governor will work for big.LITTLE systems (especially
> >> Global Task Scheduling).
> >> - Will there be agreement to expose internal ondemand code to be
> >> reused for more specialized governors.
> >>
> >> Test HW:
> >>   Exynos4412 - Trats2 board.
> >> Above patches were posted on top of Linux 3.14-rc5
> >> (SHA1: 3f9590c281c66162bf8ae9b7b2d987f0a89043c6)
> >>
> >
> > Any comments about those patches?
> 
> Sorry for being late on reviewing these..
> 
> I tried to go through the patches but didn't looked at the minutest
> of the details. Its been a long time when you first sent this
> patchset. And the memories have corrupted by now :) ..

Unfortunately memory is volatile ... since LAB governor is a follow up
of BOOST, which review and inclusion took considerable time, some
details could be forgotten. 

> 
> To get context back, can we discuss again the fundamentals behind
> this new governor you are proposing. And then we can discuss about
> it again, its pros/cons, etc..

Please consider following links:

The original implementation - threads:
http://thread.gmane.org/gmane.linux.power-management.general/32523/match=lab
http://thread.gmane.org/gmane.linux.kernel/1484746/match=lab


LAB justification data:
http://article.gmane.org/gmane.linux.kernel/1472381


> People are reluctant in getting another governor in and want to give
> existing governors a try if possible.

As I've stated in the covering letter, this code is an extension of
Ondemand.

This is totally different from what have been posted previously (v1,
v2).
The first LAB proposal was written with some parts copied from Ondemand.
It was a separate, standalone governor.


The approach proposed in those patches is very different. It simply
reuses Ondemand code as much as possible (timers, default attributes
exported to sysfs, etc.).

On top of the Ondemand we have the LAB, which thereof is its optional
extension. The existing code is reused and can be easily extracted as a
common code.

> 
> So, please explain the basics behind your governor again and then
> we can put our arguments again..
> 

I hope that provided overview is sufficient. More in depth
information can be found in posted patches or provided LKML archives.

> --
> viresh

-- 
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
--
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 V4 1/8] sxgbe: Add device-tree binding support document

2014-03-18 Thread Mark Rutland
Hi,

As a general note it's helpful for devicetree to be Cc'd on the entire
series (though the binding document should be a separate patch) as it
provides useful context for reviewing the binding.

On Tue, Mar 18, 2014 at 06:47:13AM +, Byungho An wrote:
> From: Siva Reddy 
> 
> This patch adds binding document for SXGBE ethernet driver via device-tree.
> 
> Signed-off-by: Siva Reddy Kallam 
> Signed-off-by: Byungho An 
> ---
>  .../devicetree/bindings/net/samsung-sxgbe.txt  |   53
> 
>  1 file changed, 53 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/net/samsung-sxgbe.txt
> 
> diff --git a/Documentation/devicetree/bindings/net/samsung-sxgbe.txt
> b/Documentation/devicetree/bindings/net/samsung-sxgbe.txt
> new file mode 100644
> index 000..ca27947
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/net/samsung-sxgbe.txt
> @@ -0,0 +1,53 @@
> +* Samsung 10G Ethernet driver (SXGBE)
> +
> +Required properties:
> +- compatible: Should be "samsung,sxgbe-v2.0a"
> +- reg: Address and length of the register set for the device
> +- interrupt-parent: Should be the phandle for the interrupt controller
> +  that services interrupts for this device
> +- interrupts: Should contain the SXGBE interrupts
> +  These interrupts are ordered by fixed and follows variable
> +  trasmit DMA interrupts, receive DMA interrupts and lpi interrupt.
> +  index 0 - this is fixed common interrupt of SXGBE and it is always
> +  available.
> +  index 1 to 25 - 8 variable trasmit interrupts, variable 16 receive
> interrupts
> +  and 1 optional lpi interrupt.
> +- phy-mode: String, operation mode of the PHY interface.
> +  Supported values are: "xaui", "gmii".
> +- samsung,pbl: Integer, Programmable Burst Length.
> +  Supported values are 1, 2, 4, 8, 16, or 32.

There's no need to abbreviate to "pbl".

Is this a property of the hardware, or configuration that the kernel
will program in? If the latter, why can the kernel not choose?

> +- samsung,fixed-burst: Boolean, Program the DMA to use the fixed burst mode
> +- samsung,burst-map: Integer, Program the possible bursts supported by sxgbe
> +  This is an interger and represents allowable DMA bursts when fixed burst.
> +  Allowable range is 0x00-0x3F. This field is valid only when fixed burst is
> +  enabled, otherwise ignored.

If that's the case, why not have just this property and have it imply
the use of fixed burst mode?

When is it necessary to use fixed burst mode?

> +- samsung,adv-addr-mode: Boolean, Program the DMA to use Enhanced address
> mode.

When would this be selected, and why can the kernel not choose?

> +- samsung,force_thresh_dma_mode: Boolean, Force DMA to use the threshold mode
> +  for both tx and rx

s/_/-/ in property names.

Likewise, why can the kernel not choose.

> +- samsung,force_sf_dma_mode: Boolean, Force DMA to use the Store and Forward
> +  mode for both tx and rx. This flag is ignored if force_thresh_dma_mode is
> set.

Likewise for both points.

> +- samsung,phy-addr: Integer, Address of the PHY attached with SXGBE.

Some of these properties appear to be missing from the example. Are they
required or optional?

Thanks,
Mark.

> +
> +Optional properties:
> +- mac-address: 6 bytes, mac address
> +
> +Example:
> +
> + aliases {
> + ethernet0 = <&sxgbe0>;
> + };
> +
> + sxgbe0: ethernet@1a04 {
> + compatible = "samsung,sxgbe-v2.0a";
> + reg = <0 0x1a04 0 0x1>;
> + interrupt-parent = <&gic>;
> + interrupts = <0 209 4>, <0 185 4>, <0 186 4>, <0 187 4>,
> +  <0 188 4>, <0 189 4>, <0 190 4>, <0 191 4>,
> +  <0 192 4>, <0 193 4>, <0 194 4>, <0 195 4>,
> +  <0 196 4>, <0 197 4>, <0 198 4>, <0 199 4>,
> +  <0 200 4>, <0 201 4>, <0 202 4>, <0 203 4>,
> +  <0 204 4>, <0 205 4>, <0 206 4>, <0 207 4>,
> +  <0 208 4>, <0 210 4>;
> + mac-address = []; /* Filled in by U-Boot */
> + phy-mode = "xaui";
> + };
> -- 
> 1.7.10.4
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe devicetree" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
--
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 V4 0/8] add new Samsung SXGBE driver

2014-03-18 Thread Joe Perches
On Mon, 2014-03-17 at 23:47 -0700, Byungho An wrote:
> Hi all,

Hello all.

>  drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c| 2382
> 

The patches are wrapped again and can not be applied.

It really would be more convenient if you could use
git send-email for these.

Please resend.

--
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 v11 17/27] iommu/exynos: remove calls to Runtime PM API functions

2014-03-18 Thread Cho KyongHo
On Fri, 14 Mar 2014 13:59:00 +0100, Tomasz Figa wrote:
> Hi KyongHo,
> 
> On 14.03.2014 06:08, Cho KyongHo wrote:
> > Runtime power management by exynos-iommu driver independently from
> > master H/W's runtime pm is not useful for power saving since attaching
> > master H/W in probing time turns on its local power endlessly.
> > Thus this removes runtime pm API calls.
> > Runtime PM support is added in the following commits to exynos-iommu
> > driver.
> 
> The patch seems to be doing something completely different than the 
> commit description suggests. Please rewrite the description to describe 
> the patch correctly.
> 
I agree with your comment whatever the purpose of the change is.
The commit message will be updated.

> >
> > Signed-off-by: Cho KyongHo 
> > ---
> >   drivers/iommu/exynos-iommu.c |  369 
> > +++---
> >   1 file changed, 238 insertions(+), 131 deletions(-)
> >
> > diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c
> > index 3458349..6834556 100644
> > --- a/drivers/iommu/exynos-iommu.c
> > +++ b/drivers/iommu/exynos-iommu.c
> > @@ -27,6 +27,8 @@
> >   #include 
> >   #include 
> >   #include 
> > +#include 
> > +#include 
> >
> >   #include 
> >   #include 
> > @@ -111,6 +113,8 @@
> >   #define __master_clk_enable(data) __clk_gate_ctrl(data, clk_master, en)
> >   #define __master_clk_disable(data)__clk_gate_ctrl(data, 
> > clk_master, dis)
> >
> > +#define has_sysmmu(dev)(dev->archdata.iommu != NULL)
> > +
> >   static struct kmem_cache *lv2table_kmem_cache;
> >
> >   static unsigned long *section_entry(unsigned long *pgtable, unsigned long 
> > iova)
> > @@ -159,6 +163,16 @@ static char *sysmmu_fault_name[SYSMMU_FAULTS_NUM] = {
> > "UNKNOWN FAULT"
> >   };
> >
> > +/* attached to dev.archdata.iommu of the master device */
> > +struct exynos_iommu_owner {
> > +   struct list_head client; /* entry of exynos_iommu_domain.clients */
> > +   struct device *dev;
> > +   struct device *sysmmu;
> > +   struct iommu_domain *domain;
> > +   void *vmm_data; /* IO virtual memory manager's data */
> > +   spinlock_t lock;/* Lock to preserve consistency of System MMU */
> 
> Please don't use spaces for alignment.
> 
OK.

> > +};
> > +
> >   struct exynos_iommu_domain {
> > struct list_head clients; /* list of sysmmu_drvdata.node */
> > unsigned long *pgtable; /* lv1 page table, 16KB */
> > @@ -168,9 +182,8 @@ 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 */
> > void __iomem *sfrbase;
> > struct clk *clk;
> > struct clk *clk_master;
> > @@ -239,7 +252,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);
> > @@ -299,7 +311,7 @@ static irqreturn_t exynos_sysmmu_irq(int irq, void 
> > *dev_id)
> > itype, base, addr);
> > if (data->domain)
> > ret = report_iommu_fault(data->domain,
> > -   data->dev, addr, itype);
> > +   data->master, addr, itype);
> > }
> >
> > /* fault is not recovered by fault handler */
> > @@ -316,116 +328,148 @@ static irqreturn_t exynos_sysmmu_irq(int irq, void 
> > *dev_id)
> > return IRQ_HANDLED;
> >   }
> >
> > -static bool __exynos_sysmmu_disable(struct sysmmu_drvdata *data)
> > +static void __sysmmu_disable_nocount(struct sysmmu_drvdata *data)
> 
> If you are changing the names anyway, it would be probably a good idea 
> to reduce code obfuscation a bit and drop the underscores from 
> beginnings of function names. Also I'd suggest keeping the "exynos_" prefix.

Thanks for the suggestion.
__exynos_sysmmu_disable is splitted into 2 functions: __sysmmu_disable
and __sysmmu_disable_nocount.
I agree with you that it is good idea to reduce code obfuscation but
I don't think dropping beginning underscores of function names reduces
obfuscation.

> 
> >   {
> > -   unsigned long flags;
> > -   bool disabled = false;
> > -
> > -   write_lock_irqsave(&data->lock, flags);
> > -
> > -   if (!set_sysmmu_inactive(data))
> > -   goto finish;
> > -
> > -   __master_clk_enable(data);
> > +   clk_enable(data->clk_master);
> >
> > __raw_writel(CTRL_DISABLE, data->sfrbase + REG_MMU_CTRL);
> > +   __raw_writel(0, data->sfrbase + REG_MMU_CFG);
> >
> > __sysmmu_clk_disable(data);
> > __master_clk_disable(data);
> > +}
> >
> > -   

Re: [PATCH v6 05/10] V4L: s5c73m3: Add device tree support

2014-03-18 Thread Arnd Bergmann
On Thursday 06 March 2014, Sylwester Nawrocki wrote:
> This patch adds the V4L2 asynchronous subdev registration and
> device tree support. Common clock API is used to control the
> sensor master clock from within the subdev.
> 
> Signed-off-by: Andrzej Hajda 
> Signed-off-by: Sylwester Nawrocki 
> Acked-by: Kyungmin Park 

This driver is in linux-next now, but

> + node_ep = v4l2_of_get_next_endpoint(node, NULL);
> + if (!node_ep) {
> + dev_warn(dev, "no endpoint defined for node: %s\n",
> + node->full_name);
> + return 0;
>   }

This function is not defined here, leading to build errors.

Arnd
--
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 v11 08/27] iommu/exynos: always use a single clock descriptor

2014-03-18 Thread Cho KyongHo
On Fri, 14 Mar 2014 14:07:32 +0100, Tomasz Figa wrote:
> Hi KyongHo,
> 
> On 14.03.2014 06:05, Cho KyongHo wrote:
> > System MMU driver is changed to control only a single instance of
> > System MMU at a time. Since a single instance of System MMU has only
> > a single clock descriptor for its clock gating, there is no need to
> > obtain two or more clock descriptors.
> >
> 
> This patch does much more than just making the driver use a single clock 
> descriptor. Please update the subject and description accordingly.
> 
Ok.

> > Signed-off-by: Cho KyongHo 
> > ---
> >   drivers/iommu/exynos-iommu.c |  223 
> > ++
> >   1 file changed, 72 insertions(+), 151 deletions(-)
> >
> > diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c
> > index 8dc7031..a4499b2 100644
> > --- a/drivers/iommu/exynos-iommu.c
> > +++ b/drivers/iommu/exynos-iommu.c
> > @@ -171,9 +171,8 @@ struct sysmmu_drvdata {
> > 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];
> > +   void __iomem *sfrbase;
> > +   struct clk *clk;
> > int activations;
> > rwlock_t lock;
> > struct iommu_domain *domain;
> > @@ -294,56 +293,39 @@ 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;
> > -
> > -   int i, ret = -ENOSYS;
> > +   int ret = -ENOSYS;
> >
> > read_lock(&data->lock);
> >
> > 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);
> > -   if (irqres && ((int)irqres->start == irq))
> > -   break;
> > -   }
> > -
> > -   if (i == pdev->num_resources) {
> > +   itype = (enum exynos_sysmmu_inttype)
> > +   __ffs(__raw_readl(data->sfrbase + REG_INT_STATUS));
> > +   if (WARN_ON(!((itype >= 0) && (itype < SYSMMU_FAULT_UNKNOWN
> > itype = SYSMMU_FAULT_UNKNOWN;
> > -   } else {
> > -   itype = (enum exynos_sysmmu_inttype)
> > -   __ffs(__raw_readl(data->sfrbases[i] + REG_INT_STATUS));
> > -   if (WARN_ON(!((itype >= 0) && (itype < SYSMMU_FAULT_UNKNOWN
> > -   itype = SYSMMU_FAULT_UNKNOWN;
> > -   else
> > -   addr = __raw_readl(
> > -   data->sfrbases[i] + fault_reg_offset[itype]);
> > -   }
> > +   else
> > +   addr = __raw_readl(data->sfrbase + fault_reg_offset[itype]);
> >
> > if (data->domain)
> > -   ret = report_iommu_fault(data->domain, data->dev,
> > -   addr, itype);
> > +   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);
> > +   base = __raw_readl(data->sfrbase + 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);
> > +   __raw_writel(1 << itype, data->sfrbase + REG_INT_CLEAR);
> > else
> > dev_dbg(data->sysmmu, "(%s) %s is not handled.\n",
> > data->dbgname, sysmmu_fault_name[itype]);
> >
> > if (itype != SYSMMU_FAULT_UNKNOWN)
> > -   sysmmu_unblock(data->sfrbases[i]);
> > +   sysmmu_unblock(data->sfrbase);
> >
> > read_unlock(&data->lock);
> >
> > @@ -354,20 +336,16 @@ static bool __exynos_sysmmu_disable(struct 
> > sysmmu_drvdata *data)
> >   {
> > unsigned long flags;
> > bool disabled = false;
> > -   int i;
> >
> > write_lock_irqsave(&data->lock, flags);
> >
> > if (!set_sysmmu_inactive(data))
> > goto finish;
> >
> > -   for (i = 0; i < data->nsfrs; i++)
> > -   __raw_writel(CTRL_DISABLE, data->sfrbases[i] + REG_MMU_CTRL);
> > +   __raw_writel(CTRL_DISABLE, data->sfrbase + REG_MMU_CTRL);
> >
> > -   if (data->clk[1])
> > -   clk_disable(data->clk[1]);
> > -   if (data->clk[0])
> > -   clk_disable(data->clk[0]);
> > +   if (data->clk)
> 
> I know this is already in the driver, but checking (struct clk *) for 
> NULL is incorrect. NULL is a valid pointer for dummy clocks on platforms 
> which do not provide particular clocks, to make this transparent to

Re: [PATCH v11 10/27] iommu/exynos: use managed device helper functions

2014-03-18 Thread Cho KyongHo
On Fri, 14 Mar 2014 14:28:36 +0100, Tomasz Figa wrote:
> Hi KyongHo,
> 
> On 14.03.2014 06:05, Cho KyongHo wrote:
> > This patch uses managed device helper functions in the probe().
> >
> > Signed-off-by: Cho KyongHo 
> > ---
> >   drivers/iommu/exynos-iommu.c |   64 
> > +-
> >   1 file changed, 26 insertions(+), 38 deletions(-)
> >
> > diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c
> > index 36e6b73..33b424d 100644
> > --- a/drivers/iommu/exynos-iommu.c
> > +++ b/drivers/iommu/exynos-iommu.c
> > @@ -499,51 +499,48 @@ void exynos_sysmmu_tlb_invalidate(struct device *dev)
> >
> >   static int exynos_sysmmu_probe(struct platform_device *pdev)
> >   {
> > -   int ret;
> > +   int irq, ret;
> > struct device *dev = &pdev->dev;
> > struct sysmmu_drvdata *data;
> > struct resource *res;
> >
> > -   data = kzalloc(sizeof(*data), GFP_KERNEL);
> > -   if (!data) {
> > -   dev_dbg(dev, "Not enough memory\n");
> > -   ret = -ENOMEM;
> > -   goto err_alloc;
> > -   }
> > +   data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
> > +   if (!data)
> > +   return -ENOMEM;
> >
> > res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> > if (!res) {
> > -   dev_dbg(dev, "Unable to find IOMEM region\n");
> > -   ret = -ENOENT;
> > -   goto err_init;
> > +   dev_err(dev, "Unable to find IOMEM region\n");
> > +   return -ENOENT;
> > }
> 
> No need to check for error and print message, because 
> devm_ioremap_resource() already checks the passed resource and handles 
> error cases.
> 

Yes but devm_ioremap_resource() just tells that the given 'res' is not
correct. I think the message in the driver is more informative.

Thanks.

KyongHo
--
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 v11 13/27] iommu/exynos: support for device tree

2014-03-18 Thread Cho KyongHo
On Fri, 14 Mar 2014 14:39:33 +0100, Tomasz Figa wrote:
> Hi KyongHo,
> 
> On 14.03.2014 06:09, Cho KyongHo wrote:
> > This commit adds device tree support for System MMU.
> >
> > Signed-off-by: Cho KyongHo 
> > ---
> >   drivers/iommu/Kconfig|5 ++---
> >   drivers/iommu/exynos-iommu.c |   21 +
> >   2 files changed, 19 insertions(+), 7 deletions(-)
> >
> > diff --git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig
> > index df56e4c..22af807 100644
> > --- a/drivers/iommu/Kconfig
> > +++ b/drivers/iommu/Kconfig
> > @@ -178,16 +178,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
> 
> nit: There should be a white space before the opening parenthesis.
> 
Ok. :)

> >   processor family. This enables H/W multimedia accellerators to see
> 
> typo: s/accellerators/accelerators/
> 

Ok.

> >   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 33b424d..34feb04 100644
> > --- a/drivers/iommu/exynos-iommu.c
> > +++ b/drivers/iommu/exynos-iommu.c
> > @@ -26,6 +26,7 @@
> >   #include 
> >   #include 
> >   #include 
> > +#include 
> >
> >   #include 
> >   #include 
> > @@ -497,7 +498,7 @@ void exynos_sysmmu_tlb_invalidate(struct device *dev)
> > read_unlock_irqrestore(&data->lock, flags);
> >   }
> >
> > -static int exynos_sysmmu_probe(struct platform_device *pdev)
> > +static int __init exynos_sysmmu_probe(struct platform_device *pdev)
> >   {
> > int irq, ret;
> > struct device *dev = &pdev->dev;
> > @@ -557,11 +558,23 @@ static int exynos_sysmmu_probe(struct platform_device 
> > *pdev)
> > return 0;
> >   }
> >
> > -static struct platform_driver exynos_sysmmu_driver = {
> > -   .probe  = exynos_sysmmu_probe,
> > -   .driver = {
> > +#ifdef CONFIG_OF
> > +static struct of_device_id sysmmu_of_match[] __initconst = {
> > +   { .compatible   = "samsung,sysmmu-v1", },
> > +   { .compatible   = "samsung,sysmmu-v2", },
> > +   { .compatible   = "samsung,sysmmu-v3.1", },
> > +   { .compatible   = "samsung,sysmmu-v3.2", },
> > +   { .compatible   = "samsung,sysmmu-v3.3", },
> 
> Do you need all these compatible strings? I mean, are there any 
> implementation differences that can't be identified by reading IP 
> registers, such as REG_MMU_VERSION?
> 

Unfortunately, there is a SoC which overrides REG_MMU_VERSION with
a value for RTL designers and it is not related to System MMU
versions.

Thank you.

KyongHo
--
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 v11 15/27] iommu/exynos: use convenient macro to handle gate clocks

2014-03-18 Thread Cho KyongHo
On Fri, 14 Mar 2014 22:27:59 +0530, Sachin Kamat wrote:
>  Hi KyongHo,
> 
> On 14 March 2014 19:13, Tomasz Figa  wrote:
> > Hi KyongHo,
> >
> >
> > On 14.03.2014 06:09, Cho KyongHo wrote:
> >>
> >> exynos-iommu driver must care about master H/W's gate clock as well as
> >> System MMU's gate clock. To enhance readability of the source code,
> >> macros to gate/ungate those clocks are defined.
> >>
> >> Signed-off-by: Cho KyongHo 
> >> ---
> >>   drivers/iommu/exynos-iommu.c |   34 ++
> >>   1 file changed, 22 insertions(+), 12 deletions(-)
> >>
> >> diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c
> >> index 71e77f1..cef62d0 100644
> >> --- a/drivers/iommu/exynos-iommu.c
> >> +++ b/drivers/iommu/exynos-iommu.c
> >> @@ -101,6 +101,16 @@
> >>   #define REG_PB1_SADDR 0x054
> >>   #define REG_PB1_EADDR 0x058
> >>
> >> +#define __clk_gate_ctrl(data, clk, en) do {\
> >> +   if (data->clk)  \
> >> +   clk_##en##able(data->clk);  \
> >> +   } while (0)
> >> +
> >> +#define __sysmmu_clk_enable(data)  __clk_gate_ctrl(data, clk, en)
> >> +#define __sysmmu_clk_disable(data) __clk_gate_ctrl(data, clk, dis)
> >> +#define __master_clk_enable(data)  __clk_gate_ctrl(data, clk_master,
> >> en)
> >> +#define __master_clk_disable(data) __clk_gate_ctrl(data, clk_master,
> >> dis)
> >> +
> >
> >
> > I'd say that such macros only obfuscate code, without any gains, as you can
> > see in diffstat - this patch adds more lines than it removes.
> >
> > Please drop this change.
> 
>  I agree with Tomasz here.
> 

Are you concerning about using macros or more insertions than deletions?

The deletions in this patch are only clk_enable() and clk_disable()
but they must be
"if (!IS_ERR(clk)) clk_enable(clk)" and "if (!IS_ERR(clk)) clk_disable(clk)".

I think use of macro is fancier in that case.

Thank you.

KyongHo.
--
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 v6 05/10] V4L: s5c73m3: Add device tree support

2014-03-18 Thread Sylwester Nawrocki
On 18/03/14 11:05, Arnd Bergmann wrote:
> On Thursday 06 March 2014, Sylwester Nawrocki wrote:
>> This patch adds the V4L2 asynchronous subdev registration and
>> device tree support. Common clock API is used to control the
>> sensor master clock from within the subdev.
>>
>> Signed-off-by: Andrzej Hajda 
>> Signed-off-by: Sylwester Nawrocki 
>> Acked-by: Kyungmin Park 
> 
> This driver is in linux-next now, but
> 
>> +node_ep = v4l2_of_get_next_endpoint(node, NULL);
>> +if (!node_ep) {
>> +dev_warn(dev, "no endpoint defined for node: %s\n",
>> +node->full_name);
>> +return 0;
>>  }
> 
> This function is not defined here, leading to build errors.

*sigh* it seems this [1] patch series ended up somehow in -next,
but it shouldn't. Mauro, could you please remove the 'exynos'
branch from media-next tree ? This should fix the problem.
Even though I have been trying to merge this patch to mainline
for ages, I'm ready to resign from it for now, not to add to
the mess we are already seeing [2].


[1] https://lkml.org/lkml/2014/3/6/352
[2] https://lkml.org/lkml/2014/3/17/547

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


Re: [PATCH v11 10/27] iommu/exynos: use managed device helper functions

2014-03-18 Thread Cho KyongHo
On Fri, 14 Mar 2014 20:52:43 +0530, Sachin Kamat wrote:
> Hi KyongHo,
> 
> On 14 March 2014 10:35, Cho KyongHo  wrote:
> > This patch uses managed device helper functions in the probe().
> >
> > Signed-off-by: Cho KyongHo 
> > ---
> [snip]
> 
> > +   data->clk = devm_clk_get(dev, "sysmmu");
> > +   if (IS_ERR(data->clk)) {
> > +   dev_info(dev, "No gate clock found!\n");
> > +   data->clk = NULL;
> > +   }
> 
> Why aren't you returning from here upon error?

It is for the case of a System MMU which does not need clock gating.

> > +
> > +   ret = clk_prepare(data->clk);
> > +   if (ret) {
> > +   dev_err(dev, "Failed to prepare clk\n");
> > +   return ret;
> > }
> >
> > data->sysmmu = dev;
> > @@ -556,17 +553,8 @@ static int exynos_sysmmu_probe(struct platform_device 
> > *pdev)
> >
> > pm_runtime_enable(dev);
> >
> > -   dev_dbg(dev, "Initialized\n");
> > +   dev_dbg(dev, "Probed and initialized\n");
> 
> This message looks redundant.

Ok.

Do you mean that checking sysfs does the same?

Thank you.

KyongHo.
--
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 v11 13/27] iommu/exynos: support for device tree

2014-03-18 Thread Cho KyongHo
On Fri, 14 Mar 2014 20:57:42 +0530, Sachin Kamat wrote:
> Hi KyongHo,
> 
> On 14 March 2014 10:39, Cho KyongHo  wrote:
> > This commit adds device tree support for System MMU.
> >
> > Signed-off-by: Cho KyongHo 
> > ---
> >  drivers/iommu/Kconfig|5 ++---
> >  drivers/iommu/exynos-iommu.c |   21 +
> >  2 files changed, 19 insertions(+), 7 deletions(-)
> >
> > diff --git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig
> > index df56e4c..22af807 100644
> > --- a/drivers/iommu/Kconfig
> > +++ b/drivers/iommu/Kconfig
> > @@ -178,16 +178,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
> 
> This is not needed as it is the default choice.
> 

OK.

> > 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 33b424d..34feb04 100644
> > --- a/drivers/iommu/exynos-iommu.c
> > +++ b/drivers/iommu/exynos-iommu.c
> > @@ -26,6 +26,7 @@
> >  #include 
> >  #include 
> >  #include 
> > +#include 
> >
> >  #include 
> >  #include 
> > @@ -497,7 +498,7 @@ void exynos_sysmmu_tlb_invalidate(struct device *dev)
> > read_unlock_irqrestore(&data->lock, flags);
> >  }
> >
> > -static int exynos_sysmmu_probe(struct platform_device *pdev)
> > +static int __init exynos_sysmmu_probe(struct platform_device *pdev)
> >  {
> > int irq, ret;
> > struct device *dev = &pdev->dev;
> > @@ -557,11 +558,23 @@ static int exynos_sysmmu_probe(struct platform_device 
> > *pdev)
> > return 0;
> >  }
> >
> > -static struct platform_driver exynos_sysmmu_driver = {
> > -   .probe  = exynos_sysmmu_probe,
> > -   .driver = {
> > +#ifdef CONFIG_OF
> 
> This is not needed as Exynos is DT only platform.
> 
Yes, but I hesitate to remove that.

> > +static struct of_device_id sysmmu_of_match[] __initconst = {
> > +   { .compatible   = "samsung,sysmmu-v1", },
> > +   { .compatible   = "samsung,sysmmu-v2", },
> > +   { .compatible   = "samsung,sysmmu-v3.1", },
> > +   { .compatible   = "samsung,sysmmu-v3.2", },
> > +   { .compatible   = "samsung,sysmmu-v3.3", },
> > +   { },
> > +};
> > +#endif
> > +
> > +static struct platform_driver exynos_sysmmu_driver __refdata = {
> > +   .probe  = exynos_sysmmu_probe,
> > +   .driver = {
> > .owner  = THIS_MODULE,
> > .name   = "exynos-sysmmu",
> > +   .of_match_table = of_match_ptr(sysmmu_of_match),
> 
> of_match_ptr is not needed for the same reason as above.
> 
Ditto.

Thanks.

KyongHo
--
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: [PATCHv2 3/8] devfreq: exynos4: Add ppmu's clock control and code clean about regulator control

2014-03-18 Thread Tomasz Figa

Hi Chanwoo,

On 17.03.2014 06:59, Chanwoo Choi wrote:

Hi Tomasz,

On 03/17/2014 11:51 AM, Chanwoo Choi wrote:

Hi Tomasz,

On 03/15/2014 02:42 AM, Tomasz Figa wrote:

Hi Chanwoo,

On 13.03.2014 09:17, Chanwoo Choi wrote:

There are not the clock controller of ppmudmc0/1. This patch control the clock
of ppmudmc0/1 which is used for monitoring memory bus utilization.

Also, this patch code clean about regulator control and free resource
when calling exit/remove function.

For example,
busfreq@106A {
 compatible = "samsung,exynos4x12-busfreq";

 /* Clock for PPMUDMC0/1 */
 clocks = <&clock CLK_PPMUDMC0>, <&clock CLK_PPMUDMC1>;
 clock-names = "ppmudmc0", "ppmudmc1";

 /* Regulator for MIF/INT block */
 vdd_mif-supply = <&buck1_reg>;
 vdd_int-supply = <&buck3_reg>;
};

Signed-off-by: Chanwoo Choi 


I modify this patch according your comment as following:

Best Regards,
Chanwoo Choi


From c8f2fbc4c1166ec02fb2ad46164bc7ed9118721b Mon Sep 17 00:00:00 2001

From: Chanwoo Choi 
Date: Fri, 14 Mar 2014 12:05:54 +0900
Subject: [PATCH] devfreq: exynos4: Add ppmu's clock control and code clean
  about regulator control

There are not the clock controller of ppmudmc0/1. This patch control the clock
of ppmudmc0/1 which is used for monitoring memory bus utilization.

Also, this patch code clean about regulator control and free resource
when calling exit/remove function.

For example,
busfreq@106A {
compatible = "samsung,exynos4x12-busfreq";

/* Clock for PPMUDMC0/1 */
clocks = <&clock CLK_PPMUDMC0>, <&clock CLK_PPMUDMC1>;
clock-names = "ppmudmc0", "ppmudmc1";

/* Regulator for MIF/INT block */
vdd_mif-supply = <&buck1_reg>;
vdd_int-supply = <&buck3_reg>;
};

Signed-off-by: Chanwoo Choi 
---
  drivers/devfreq/exynos/exynos4_bus.c | 97 +++-
  1 file changed, 84 insertions(+), 13 deletions(-)

diff --git a/drivers/devfreq/exynos/exynos4_bus.c 
b/drivers/devfreq/exynos/exynos4_bus.c
index 4c630fb..3956bcc 100644
--- a/drivers/devfreq/exynos/exynos4_bus.c
+++ b/drivers/devfreq/exynos/exynos4_bus.c
@@ -62,6 +62,11 @@ enum exynos_ppmu_idx {
PPMU_END,
  };

+static const char *exynos_ppmu_clk_name[] = {
+   [PPMU_DMC0] = "ppmudmc0",
+   [PPMU_DMC1] = "ppmudmc1",
+};
+
  #define EX4210_LV_MAX LV_2
  #define EX4x12_LV_MAX LV_4
  #define EX4210_LV_NUM (LV_2 + 1)
@@ -86,6 +91,7 @@ struct busfreq_data {
struct regulator *vdd_mif; /* Exynos4412/4212 only */
struct busfreq_opp_info curr_oppinfo;
struct exynos_ppmu ppmu[PPMU_END];
+   struct clk *clk_ppmu[PPMU_END];

struct notifier_block pm_notifier;
struct mutex lock;
@@ -724,6 +730,17 @@ static void exynos4_bus_exit(struct device *dev)
struct busfreq_data *data = dev_get_drvdata(dev);
int i;

+   /*
+* Un-map memory map and disable regulator/clocks
+* to prevent power leakage.
+*/
+   regulator_disable(data->vdd_int);
+   if (data->type == TYPE_BUSF_EXYNOS4x12)
+   regulator_disable(data->vdd_mif);
+
+   for (i = 0; i < PPMU_END; i++)
+   clk_disable_unprepare(data->clk_ppmu[i]);
+
for (i = 0; i < PPMU_END; i++)
iounmap(data->ppmu[i].hw_base);
  }
@@ -989,6 +1006,7 @@ static int exynos4_busfreq_parse_dt(struct busfreq_data 
*data)
  {
struct device *dev = data->dev;
struct device_node *np = dev->of_node;
+   const char **clk_name = exynos_ppmu_clk_name;
int i, ret = 0;

if (!np) {
@@ -1006,8 +1024,67 @@ static int exynos4_busfreq_parse_dt(struct busfreq_data 
*data)
}
}

+   for (i = 0; i < PPMU_END; i++) {
+   data->clk_ppmu[i] = devm_clk_get(dev, clk_name[i]);
+   if (IS_ERR(data->clk_ppmu[i])) {
+   dev_warn(dev, "Failed to get %s clock\n", clk_name[i]);


dev_err() since this is an error.


+   goto err_clocks;
+   }
+
+   ret = clk_prepare_enable(data->clk_ppmu[i]);
+   if (ret < 0) {
+   dev_warn(dev, "Failed to enable %s clock\n", 
clk_name[i]);


Ditto.


+   data->clk_ppmu[i] = NULL;
+   goto err_clocks;
+   }
+   }
+
+   /* Get regulator to control voltage of int block */
+   data->vdd_int = devm_regulator_get(dev, "vdd_int");
+   if (IS_ERR(data->vdd_int)) {
+   dev_err(dev, "Failed to get the regulator of vdd_int\n");
+   ret = PTR_ERR(data->vdd_int);
+   goto err_clocks;
+   }
+   ret = regulator_enable(data->vdd_int);
+   if (ret < 0) {
+   dev_err(dev, "Failed to enable regulator of vdd_int\n");
+   goto err_clocks;
+   }
+
+   switch (data->type) {
+   case TYPE_BUSF_EXYNOS4210:
+   break;


Do you need to use switch here? Wouldn't a s

Re: [PATCH v11 13/27] iommu/exynos: support for device tree

2014-03-18 Thread Sachin Kamat
On 18 March 2014 16:44, Cho KyongHo  wrote:
> On Fri, 14 Mar 2014 20:57:42 +0530, Sachin Kamat wrote:
>> Hi KyongHo,
>>
>> On 14 March 2014 10:39, Cho KyongHo  wrote:
>> >
>> > -static struct platform_driver exynos_sysmmu_driver = {
>> > -   .probe  = exynos_sysmmu_probe,
>> > -   .driver = {
>> > +#ifdef CONFIG_OF
>>
>> This is not needed as Exynos is DT only platform.
>>
> Yes, but I hesitate to remove that.

What is the reason for your hesitation? :)


-- 
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 v11 15/27] iommu/exynos: use convenient macro to handle gate clocks

2014-03-18 Thread Sachin Kamat
On 18 March 2014 16:33, Cho KyongHo  wrote:
> On Fri, 14 Mar 2014 22:27:59 +0530, Sachin Kamat wrote:
>>  Hi KyongHo,
>>
>> On 14 March 2014 19:13, Tomasz Figa  wrote:
>> > Hi KyongHo,
>> >
>> >
>> > On 14.03.2014 06:09, Cho KyongHo wrote:
>> >>
>> >> exynos-iommu driver must care about master H/W's gate clock as well as
>> >> System MMU's gate clock. To enhance readability of the source code,
>> >> macros to gate/ungate those clocks are defined.
>> >>
>> >> Signed-off-by: Cho KyongHo 
>> >> ---
>> >>   drivers/iommu/exynos-iommu.c |   34 ++
>> >>   1 file changed, 22 insertions(+), 12 deletions(-)
>> >>
>> >> diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c
>> >> index 71e77f1..cef62d0 100644
>> >> --- a/drivers/iommu/exynos-iommu.c
>> >> +++ b/drivers/iommu/exynos-iommu.c
>> >> @@ -101,6 +101,16 @@
>> >>   #define REG_PB1_SADDR 0x054
>> >>   #define REG_PB1_EADDR 0x058
>> >>
>> >> +#define __clk_gate_ctrl(data, clk, en) do {\
>> >> +   if (data->clk)  \
>> >> +   clk_##en##able(data->clk);  \
>> >> +   } while (0)
>> >> +
>> >> +#define __sysmmu_clk_enable(data)  __clk_gate_ctrl(data, clk, en)
>> >> +#define __sysmmu_clk_disable(data) __clk_gate_ctrl(data, clk, dis)
>> >> +#define __master_clk_enable(data)  __clk_gate_ctrl(data, clk_master,
>> >> en)
>> >> +#define __master_clk_disable(data) __clk_gate_ctrl(data, clk_master,
>> >> dis)
>> >> +
>> >
>> >
>> > I'd say that such macros only obfuscate code, without any gains, as you can
>> > see in diffstat - this patch adds more lines than it removes.
>> >
>> > Please drop this change.
>>
>>  I agree with Tomasz here.
>>
>
> Are you concerning about using macros or more insertions than deletions?

It is just making the code more difficult to read and understand.

-- 
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 v11 19/27] iommu/exynos: add support for power management subsystems.

2014-03-18 Thread Cho KyongHo
On Fri, 14 Mar 2014 17:07:53 +0100, Tomasz Figa wrote:
> Hi KyongHo,
> 
> On 14.03.2014 06:10, Cho KyongHo wrote:
> > This adds support for Suspend to RAM and Runtime Power Management.
> >
> > Since System MMU is located in the same local power domain of its
> > master H/W, System MMU must be initialized before it is working if
> > its power domain was ever turned off. TLB invalidation according to
> > unmapping on page tables must also be performed while power domain is
> > turned on.
> >
> > This patch ensures that resume and runtime_resume(restore_state)
> > functions in this driver is called before the calls to resume and
> > runtime_resume callback functions in the drivers of master H/Ws.
> > Likewise, suspend and runtime_suspend(save_state) functions in this
> > driver is called after the calls to suspend and runtime_suspend in the
> > drivers of master H/Ws.
> >
> > In order to get benefit of this support, the master H/W and its System
> > MMU must resides in the same power domain in terms of Linux kernel. If
> > a master H/W does not use generic I/O power domain, its driver must
> > call iommu_attach_device() after its local power domain is turned on,
> > iommu_detach_device before turned off.
> >
> > Signed-off-by: Cho KyongHo 
> > ---
> >   drivers/iommu/exynos-iommu.c |  220 
> > ++
> >   1 file changed, 201 insertions(+), 19 deletions(-)
> >
> > diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c
> > index 9037da0..84ba29a 100644
> > --- a/drivers/iommu/exynos-iommu.c
> > +++ b/drivers/iommu/exynos-iommu.c
> > @@ -28,6 +28,7 @@
> >   #include 
> >   #include 
> >   #include 
> > +#include 
> >   #include 
> >
> >   #include 
> > @@ -203,6 +204,7 @@ struct sysmmu_drvdata {
> > int activations;
> > rwlock_t lock;
> > struct iommu_domain *domain;
> > +   bool runtime_active;
> > unsigned long pgtable;
> >   };
> >
> > @@ -388,7 +390,8 @@ static bool __sysmmu_disable(struct sysmmu_drvdata 
> > *data)
> > data->pgtable = 0;
> > data->domain = NULL;
> >
> > -   __sysmmu_disable_nocount(data);
> > +   if (data->runtime_active)
> > +   __sysmmu_disable_nocount(data);
> >
> > dev_dbg(data->sysmmu, "Disabled\n");
> > } else  {
> > @@ -449,7 +452,8 @@ static int __sysmmu_enable(struct sysmmu_drvdata *data,
> > data->pgtable = pgtable;
> > data->domain = domain;
> >
> > -   __sysmmu_enable_nocount(data);
> > +   if (data->runtime_active)
> > +   __sysmmu_enable_nocount(data);
> >
> > dev_dbg(data->sysmmu, "Enabled\n");
> > } else {
> > @@ -534,13 +538,11 @@ static void sysmmu_tlb_invalidate_entry(struct device 
> > *dev, unsigned long iova,
> > data = dev_get_drvdata(owner->sysmmu);
> >
> > read_lock_irqsave(&data->lock, flags);
> > -   if (is_sysmmu_active(data)) {
> > -   unsigned int maj;
> > +   if (is_sysmmu_active(data) && data->runtime_active) {
> > unsigned int num_inv = 1;
> >
> > __master_clk_enable(data);
> >
> > -   maj = __raw_readl(data->sfrbase + REG_MMU_VERSION);
> > /*
> >  * L2TLB invalidation required
> >  * 4KB page: 1 invalidation
> > @@ -551,7 +553,7 @@ static void sysmmu_tlb_invalidate_entry(struct device 
> > *dev, unsigned long iova,
> >  * 1MB page can be cached in one of all sets.
> >  * 64KB page can be one of 16 consecutive sets.
> >  */
> > -   if ((maj >> 28) == 2) /* major version number */
> > +   if (__sysmmu_version(data, NULL) == 2) /* major version number 
> > */
> > num_inv = min_t(unsigned int, size / PAGE_SIZE, 64);
> >
> > if (sysmmu_block(data->sfrbase)) {
> > @@ -576,7 +578,7 @@ void exynos_sysmmu_tlb_invalidate(struct device *dev)
> > data = dev_get_drvdata(owner->sysmmu);
> >
> > read_lock_irqsave(&data->lock, flags);
> > -   if (is_sysmmu_active(data)) {
> > +   if (is_sysmmu_active(data) && data->runtime_active) {
> > __master_clk_enable(data);
> > if (sysmmu_block(data->sfrbase)) {
> > __sysmmu_tlb_invalidate(data->sfrbase);
> > @@ -677,11 +679,40 @@ static int __init exynos_sysmmu_probe(struct 
> > platform_device *pdev)
> > platform_set_drvdata(pdev, data);
> >
> > pm_runtime_enable(dev);
> > +   data->runtime_active = !pm_runtime_enabled(dev);
> 
> Hmm, this seems to be a bit misleading. The field is named 
> runtime_active, but the assignment makes it true if PM runtime is _not_ 
> enabled (i.e. inactive). Is this correct?
> 

I agree that it may lead misunderstood.
data->runtime_active actually indicates if electric power is asserted
to the System MMU. pm_runtime_enable() call must enable runtime pm
for the given device. If runtime pm is not enabled although pm_runtime_enable()
is called, CONFIG_PM_RUNTIME is not 

[PATCH 1/2] serial: s3c: Fix build of header without serial_core.h preinclusion

2014-03-18 Thread Mark Brown
From: Mark Brown 

serial_s3c.h uses upf_t which is defined in serial_core.h but does not
include that itself meaning that users which include serial_s3c.h by
itself don't build.

Signed-off-by: Mark Brown 
---

This is needed together with patch 2 to fix build failures in -next, I
didn't have the time/enthusiasm to isolate the issue.

 include/linux/serial_s3c.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/linux/serial_s3c.h b/include/linux/serial_s3c.h
index 907d9d1d56cf..44e4a6b92ddb 100644
--- a/include/linux/serial_s3c.h
+++ b/include/linux/serial_s3c.h
@@ -29,6 +29,8 @@
 #ifndef __ASM_ARM_REGS_SERIAL_H
 #define __ASM_ARM_REGS_SERIAL_H
 
+#include 
+
 #define S3C2410_URXH (0x24)
 #define S3C2410_UTXH (0x20)
 #define S3C2410_ULCON(0x00)
-- 
1.9.0

--
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: s3c64xx: Fix build for implicit serial_s3c.h inclusion

2014-03-18 Thread Mark Brown
From: Mark Brown 

Some very recent change appears to have removed an implicit inclusion of
serial_s3c.h causing build failures due to references to UART registers
in the serial port restore code in next-20140318.  Include it explicitly
to fix the build.

Signed-off-by: Mark Brown 
---
 arch/arm/mach-s3c64xx/include/mach/pm-core.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm/mach-s3c64xx/include/mach/pm-core.h 
b/arch/arm/mach-s3c64xx/include/mach/pm-core.h
index c0537f40a3d8..a30a1e3ffc6a 100644
--- a/arch/arm/mach-s3c64xx/include/mach/pm-core.h
+++ b/arch/arm/mach-s3c64xx/include/mach/pm-core.h
@@ -15,6 +15,8 @@
 #ifndef __MACH_S3C64XX_PM_CORE_H
 #define __MACH_S3C64XX_PM_CORE_H __FILE__
 
+#include 
+
 #include 
 
 static inline void s3c_pm_debug_init_uart(void)
-- 
1.9.0

--
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: [PATCHv2 4/8] devfreq: exynos4: Fix bug of resource leak and code clean on probe()

2014-03-18 Thread Tomasz Figa

On 17.03.2014 06:05, Chanwoo Choi wrote:

Hi Tomasz,

On 03/15/2014 02:49 AM, Tomasz Figa wrote:

Hi Chanwoo,

On 13.03.2014 09:17, Chanwoo Choi wrote:

This patch fix bug about resource leak when happening probe fail and code clean
to add debug message.

Signed-off-by: Chanwoo Choi 
---
   drivers/devfreq/exynos/exynos4_bus.c | 32 ++--
   1 file changed, 26 insertions(+), 6 deletions(-)

diff --git a/drivers/devfreq/exynos/exynos4_bus.c 
b/drivers/devfreq/exynos/exynos4_bus.c
index a2a3a47..152a3e9 100644
--- a/drivers/devfreq/exynos/exynos4_bus.c
+++ b/drivers/devfreq/exynos/exynos4_bus.c
@@ -1152,8 +1152,11 @@ static int exynos4_busfreq_probe(struct platform_device 
*pdev)
   dev_err(dev, "Cannot determine the device id %d\n", data->type);
   err = -EINVAL;
   }
-if (err)
+if (err) {
+dev_err(dev, "Cannot initialize busfreq table %d\n",
+ data->type);
   return err;
+}

   rcu_read_lock();
   opp = dev_pm_opp_find_freq_floor(dev,
@@ -1176,7 +1179,7 @@ static int exynos4_busfreq_probe(struct platform_device 
*pdev)
   if (IS_ERR(data->devfreq)) {
   dev_err(dev, "Failed to add devfreq device\n");
   err = PTR_ERR(data->devfreq);
-goto err_opp;
+goto err_devfreq;
   }

   /*
@@ -1185,18 +1188,35 @@ static int exynos4_busfreq_probe(struct platform_device 
*pdev)
*/
   busfreq_mon_reset(data);

-devfreq_register_opp_notifier(dev, data->devfreq);
+/* Register opp_notifier for Exynos4 busfreq */
+err = devfreq_register_opp_notifier(dev, data->devfreq);
+if (err < 0) {
+dev_err(dev, "Failed to register opp notifier\n");
+goto err_notifier_opp;
+}

+/* Register pm_notifier for Exynos4 busfreq */
   err = register_pm_notifier(&data->pm_notifier);
   if (err) {
   dev_err(dev, "Failed to setup pm notifier\n");
-devfreq_remove_device(data->devfreq);
-return err;
+goto err_notifier_pm;
   }

   return 0;

-err_opp:
+err_notifier_pm:
+devfreq_unregister_opp_notifier(dev, data->devfreq);
+err_notifier_opp:
+/*
+ * The devfreq_remove_device() would execute finally devfreq->profile
+ * ->exit(). To avoid duplicate resource free operation, return directly
+ * before executing resource free below 'err_devfreq' goto statement.
+ */


I'm not quite sure about this. I believe that in this case 
devfreq->profile->exit() would be exynos4_bus_exit() and all it does is 
devfreq_unregister_opp_notifier(dev, data->devfreq), so all remaining resources 
(regulators, clocks, etc.) would get leaked.


This patch execute following sequence to probe exynos4_busfreq.c:

1. Parse dt node to get resource(regulator/clock/memory address).
2. Enable regulator/clock and map memory.
3. Add devfreq device using devfreq_add_device().
The devfreq_add_device() return devfreq instance(data->devfreq).
4. Register opp_notifier using devfreq instance(data->devfreq) which is created 
in sequence #3.

Case 1,
If an error happens in sequence #3 for registering devfreq_add_device(),

this case can't execute devfreq->profile->exit() to free resource
because this case has failed to register devfreq->profile to devfreq_list.

So, must goto 'err_devfreq' statement to free resource(regulator/clock/memory).


Case 2,
If an error happens in sequence #4 for registering opp_notifier,

In contrast
this case can execute devfreq->profile->exit() to free resource.
But, After executed devfreq->profile->exit(),
should not execute 'err_devfreq' statement to free resource.
In case, will operate twice of resource.

If my explanation is wrong, please reply your comment.



OK, it will work indeed, however the code is barely readable with this.

For consistency (and readability), resources acquired in platform 
driver's .probe() should be freed in .remove() and error path of 
.probe() should not rely on external code to do the clean-up.


So, as I proposed in my previous reply:



I believe the correct thing to do would be to remove the .exit() callback from 
exynos4_devfreq_profile struct and handle all the clean-up here in error path.



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 v11 20/27] iommu/exynos: allow having multiple System MMUs for a master H/W

2014-03-18 Thread Cho KyongHo
On Fri, 14 Mar 2014 17:12:03 +0100, Tomasz Figa wrote:
> Hi KyongHo,
> 
> On 14.03.2014 06:10, Cho KyongHo wrote:
> > Some master device descriptor like fimc-is which is an abstraction
> > of very complex H/W may have multiple System MMUs. For those devices,
> > the design of the link between System MMU and its master H/W is needed
> > to be reconsidered.
> >
> > A link structure, sysmmu_list_data is introduced that provides a link
> > to master H/W and that has a pointer to the device descriptor of a
> > System MMU. Given a device descriptor of a master H/W, it is possible
> > to traverse all System MMUs that must be controlled along with the
> > master H/W.
> 
> NAK.
> 
> A device driver should handle particular hardware instances separately, 
> without abstracting a virtual hardware instance consisting of multiple 
> physical ones.
> 
> If such abstraction is needed, it should be done above the exynos-iommu 
> driver, e.g. by something like iommu-composite driver that would 
> aggregate several IOMMUs. Keep in mind that such IOMMUs in a group could 
> be different, e.g. different Exynos SysMMU versions or even completely 
> different IPs handled by different drivers.
> 
> Still, I don't think there is a real need for such abstraction. Instead, 
> related drivers shall be fixed to properly handle multiple memory 
> masters and their IOMMUs.
> 

G2D, Scalers and FIMD of Exynos5420 has 2 System MMUs while aother SoC like
Exynos5250 does not.

I don't understand why you are negative to this approach.
This is the simplest than the others.

Let me show you an example.
FIMC-IS driver just controls MCU in FIMC-IS subsystem and the firmware of
the MCU controls all other peripherals in the subsystem. Each peripherals
have their own System MMU. Moreover, the configuration of the peripherals
varies according to the SoCs.

If System MMU driver accepts multiple masters, everything is done in DT.
But I worry that it is not easy if System MMU driver does not support
multiple masters. 

Thank you.

KyongHo
--
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 0/9] Restore parallel display support for Exynos based boards

2014-03-18 Thread Tomasz Figa

Hi Andrzej,

On 17.03.2014 11:27, Andrzej Hajda wrote:

Hi,

This patch set restores parallel display support removed during exynos
refactorization. It is rebased on the latest exynos-drm-next branch plus patch
adding polarization flags to drm_display_mode [1].

[1]: http://permalink.gmane.org/gmane.linux.drivers.driver-project.devel/47216

Regards
Andrzej


Andrzej Hajda (9):
   drm/exynos: delay fbdev initialization until an output is connected
   drm/exynos: init kms poll after creation of connectors
   drm/exynos: correct timing porch conversion
   exynos/fimd: add parallel output related bindings
   drm/exynos: restore parallel output interface support
   ARM: dts: exynos4210-universal: add exynos/fimd node
   drm/modes: add polarization handling to mode conversion
   drm/exynos/fimd: use polarization flags provided by drm_display_mode
   drm/exynos/fimd: remove unused variable

  .../devicetree/bindings/video/samsung-fimd.txt |  15 +
  arch/arm/boot/dts/exynos4210-universal_c210.dts|  25 ++
  drivers/gpu/drm/drm_modes.c|  11 +
  drivers/gpu/drm/exynos/Kconfig |   8 +
  drivers/gpu/drm/exynos/Makefile|   1 +
  drivers/gpu/drm/exynos/exynos_drm_dpi.c| 339 +
  drivers/gpu/drm/exynos/exynos_drm_drv.c|  22 +-
  drivers/gpu/drm/exynos/exynos_drm_drv.h|   8 +
  drivers/gpu/drm/exynos/exynos_drm_fb.c |   3 +
  drivers/gpu/drm/exynos/exynos_drm_fimd.c   |  32 +-
  10 files changed, 432 insertions(+), 32 deletions(-)
  create mode 100644 drivers/gpu/drm/exynos/exynos_drm_dpi.c



Including the V2 fixups sent for particular patches:

Reviewed-by: Tomasz Figa 

Will try to test on one of my boards with parallel displays soon.

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 v11 15/27] iommu/exynos: use convenient macro to handle gate clocks

2014-03-18 Thread Tomasz Figa

On 18.03.2014 12:18, Sachin Kamat wrote:

On 18 March 2014 16:33, Cho KyongHo  wrote:

On Fri, 14 Mar 2014 22:27:59 +0530, Sachin Kamat wrote:

  Hi KyongHo,

On 14 March 2014 19:13, Tomasz Figa  wrote:

Hi KyongHo,


On 14.03.2014 06:09, Cho KyongHo wrote:


exynos-iommu driver must care about master H/W's gate clock as well as
System MMU's gate clock. To enhance readability of the source code,
macros to gate/ungate those clocks are defined.

Signed-off-by: Cho KyongHo 
---
   drivers/iommu/exynos-iommu.c |   34 ++
   1 file changed, 22 insertions(+), 12 deletions(-)

diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c
index 71e77f1..cef62d0 100644
--- a/drivers/iommu/exynos-iommu.c
+++ b/drivers/iommu/exynos-iommu.c
@@ -101,6 +101,16 @@
   #define REG_PB1_SADDR 0x054
   #define REG_PB1_EADDR 0x058

+#define __clk_gate_ctrl(data, clk, en) do {\
+   if (data->clk)  \
+   clk_##en##able(data->clk);  \
+   } while (0)
+
+#define __sysmmu_clk_enable(data)  __clk_gate_ctrl(data, clk, en)
+#define __sysmmu_clk_disable(data) __clk_gate_ctrl(data, clk, dis)
+#define __master_clk_enable(data)  __clk_gate_ctrl(data, clk_master,
en)
+#define __master_clk_disable(data) __clk_gate_ctrl(data, clk_master,
dis)
+



I'd say that such macros only obfuscate code, without any gains, as you can
see in diffstat - this patch adds more lines than it removes.

Please drop this change.


  I agree with Tomasz here.



Are you concerning about using macros or more insertions than deletions?


It is just making the code more difficult to read and understand.


Especially when hiding accesses to struct fields inside and doing fancy 
stuff like concatenations.


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


[GIT PULL 1/2] Samsung 2nd cleanup for v3.15

2014-03-18 Thread Kukjin Kim

The following changes since commit d9671ca923445aa870ecc34df3db01dd602d87fc:

  ARM: EXYNOS: Remove uncompress.h (2014-02-24 09:39:18 +0900)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/kgene/linux-samsung.git 
tags/samsung-cleanup-2


for you to fetch changes up to 19a964644f1e655c3f67d539c1e99a9fbcc4588c:

  ARM: SAMSUNG: remove all custom uncompress.h (2014-03-11 22:05:18 +0900)


Samsung cleanup-2 for v3.15
- use generic uncompress.h and remove all custom
  uncompress.h in mach-s3c24xx, s3c64xx, s5p64x0,
  s5pc100, s5pv210 and plat-samsung directories.

Note that based on previous tags/samsung-cleanup


Heiko Stuebner (2):
  ARM: SAMSUNG: use generic uncompress.h
  ARM: SAMSUNG: remove all custom uncompress.h

 arch/arm/Kconfig.debug  |   4 +-
 arch/arm/mach-s3c24xx/include/mach/uncompress.h |  57 
 arch/arm/mach-s3c64xx/include/mach/uncompress.h |  31 -
 arch/arm/mach-s5p64x0/include/mach/uncompress.h |  34 -
 arch/arm/mach-s5pc100/include/mach/uncompress.h |  30 
 arch/arm/mach-s5pv210/include/mach/uncompress.h |  28 
 arch/arm/plat-samsung/include/plat/uncompress.h | 175 


 7 files changed, 2 insertions(+), 357 deletions(-)
 delete mode 100644 arch/arm/mach-s3c24xx/include/mach/uncompress.h
 delete mode 100644 arch/arm/mach-s3c64xx/include/mach/uncompress.h
 delete mode 100644 arch/arm/mach-s5p64x0/include/mach/uncompress.h
 delete mode 100644 arch/arm/mach-s5pc100/include/mach/uncompress.h
 delete mode 100644 arch/arm/mach-s5pv210/include/mach/uncompress.h
 delete mode 100644 arch/arm/plat-samsung/include/plat/uncompress.h
--
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


[GIT PULL 2/2] Samsung 2nd DT updates for v3.15

2014-03-18 Thread Kukjin Kim

The following changes since commit 86feafebbec2b510daf36ffbdbe10228ed890b00:

  ARM: dts: use macros in clock bindings for exynos5440 (2014-02-26 
09:53:31 +0900)


are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/kgene/linux-samsung.git 
tags/samsung-dt-2


for you to fetch changes up to ba0d7ed391b7b3fb5ca98d9cf4d067b7f5ed956b:

  ARM: dts: enable ahci sata and sata phy for exynos5250 (2014-03-18 
07:49:14 +0900)



Samsung 2nd DT updates for v3.15
- add DT entry for AHCI SATA and SATA PHY with using generic
  PHY framework for exynos5250 and arndale, smdk5250 boards.
- add SSS DT node for exynos5420 and exynos5250
- remove leftover spi0 node for smdk5250 board
- add ADC and thermistor nodes for exynos4412-trats2 board
- move common irq-combiner node for exynos4x12 from exynos4212
  and exynos4412
- add ADC, PMU and GPS_ALIVE power domain nodes for exynos4x12

Note that based on previous tags/samsung-dt and tags/exynos-clk


Chanwoo Choi (5):
  ARM: dts: Add ADC's dt data to read raw data for exynos4x12
  ARM: dts: Add PMU dt data to support PMU for exynos4x12
  ARM: dts: Add GPS_ALIVE power domain for exynos4x12
  ARM: dts: Move common dt data for interrupt combiner controller 
for exynos4x12

  ARM: dts: Add ADC and themistor nodes for exynos4412-trats2

Mark Brown (1):
  ARM: dts: Remove leftover spi0 node for smdk5250

Naveen Krishna Chatradhi (1):
  ARM: dts: add dt node for sss module for exynos5250/5420

Yuvaraj Kumar C D (1):
  ARM: dts: enable ahci sata and sata phy for exynos5250

 .../devicetree/bindings/ata/exynos-sata-phy.txt| 14 -
 .../devicetree/bindings/ata/exynos-sata.txt| 25 +--
 .../devicetree/bindings/phy/samsung-phy.txt| 36 
++

 arch/arm/boot/dts/exynos4.dtsi |  5 +++
 arch/arm/boot/dts/exynos4212.dtsi  | 13 +++-
 arch/arm/boot/dts/exynos4412-trats2.dts| 21 +
 arch/arm/boot/dts/exynos4412.dtsi  | 14 +++--
 arch/arm/boot/dts/exynos4x12.dtsi  | 26 
 arch/arm/boot/dts/exynos5250-arndale.dts   | 21 +
 arch/arm/boot/dts/exynos5250-smdk5250.dts  | 21 +++--
 arch/arm/boot/dts/exynos5250.dtsi  | 26 +---
 arch/arm/boot/dts/exynos5420.dtsi  |  9 ++
 12 files changed, 175 insertions(+), 56 deletions(-)
 delete mode 100644 
Documentation/devicetree/bindings/ata/exynos-sata-phy.txt

--
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 v3 2/3] mfd: sec-core: Add of_compatible strings for clock MFD cells

2014-03-18 Thread Tomasz Figa

Hi Krzysztof,

On 17.03.2014 10:19, Krzysztof Kozlowski wrote:

Add of_compatible strings for S5M8767 and S2MPS14 clock MFD cells.

Signed-off-by: Krzysztof Kozlowski 
---
  drivers/mfd/sec-core.c |3 +++
  1 file changed, 3 insertions(+)


Reviewed-by: Tomasz Figa 

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 2/2] dt-bindings: clock: Move exynos-audss-clk.h to dt-bindings/clock

2014-03-18 Thread Tomasz Figa

On 17.03.2014 23:20, Kukjin Kim wrote:

On 03/10/14 09:20, Tomasz Figa wrote:

On 06.03.2014 07:04, Tushar Behera wrote:

Most of the clock related dt-binding header files are located in
dt-bindings/clock folder. It would be good to keep all the similar
header files at a single location.

Signed-off-by: Tushar Behera 
CC: Kukjin Kim 


Acked-by: Kukjin Kim 

Or shall I take this into samsung tree?


I guess so.

Or should this whole series go through DT tree?

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 v11 20/27] iommu/exynos: allow having multiple System MMUs for a master H/W

2014-03-18 Thread Tomasz Figa



On 18.03.2014 14:01, Cho KyongHo wrote:

On Fri, 14 Mar 2014 17:12:03 +0100, Tomasz Figa wrote:

Hi KyongHo,

On 14.03.2014 06:10, Cho KyongHo wrote:

Some master device descriptor like fimc-is which is an abstraction
of very complex H/W may have multiple System MMUs. For those devices,
the design of the link between System MMU and its master H/W is needed
to be reconsidered.

A link structure, sysmmu_list_data is introduced that provides a link
to master H/W and that has a pointer to the device descriptor of a
System MMU. Given a device descriptor of a master H/W, it is possible
to traverse all System MMUs that must be controlled along with the
master H/W.


NAK.

A device driver should handle particular hardware instances separately,
without abstracting a virtual hardware instance consisting of multiple
physical ones.

If such abstraction is needed, it should be done above the exynos-iommu
driver, e.g. by something like iommu-composite driver that would
aggregate several IOMMUs. Keep in mind that such IOMMUs in a group could
be different, e.g. different Exynos SysMMU versions or even completely
different IPs handled by different drivers.

Still, I don't think there is a real need for such abstraction. Instead,
related drivers shall be fixed to properly handle multiple memory
masters and their IOMMUs.



G2D, Scalers and FIMD of Exynos5420 has 2 System MMUs while aother SoC like
Exynos5250 does not.

I don't understand why you are negative to this approach.
This is the simplest than the others.

Let me show you an example.
FIMC-IS driver just controls MCU in FIMC-IS subsystem and the firmware of
the MCU controls all other peripherals in the subsystem. Each peripherals
have their own System MMU. Moreover, the configuration of the peripherals
varies according to the SoCs.

If System MMU driver accepts multiple masters, everything is done in DT.
But I worry that it is not easy if System MMU driver does not support
multiple masters.


I believe I have stated enough reasons why this kind of implementation 
is bad. I'm not going to waste time repeating myself.


Your concerns presented above are valid, however they are not related to 
what is wrong with this patch. I have given you two proper ways to 
handle this, none should be forced upon particular IOMMU master drivers 
- their authors should have the chance to select the method that works 
best for them.


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: [GIT PULL] Samsung non-critical fixes for v3.15

2014-03-18 Thread Arnd Bergmann
On Tuesday 18 March 2014, Kukjin Kim wrote:
> The following changes since commit 38dbfb59d1175ef458d006556061adeaa8751b72:
> 
>Linus 3.14-rc1 (2014-02-02 16:42:13 -0800)
> 
> are available in the git repository at:
> 
>git://git.kernel.org/pub/scm/linux/kernel/git/kgene/linux-samsung.git 
> tags/samsung-fixes
> 
> for you to fetch changes up to baf64abc468c7583592f67197ae23fa31414b4db:
> 
>ARM: S3C64XX: mach-crag6410-module.c is not modular (2014-02-16 
> 02:05:44 +0900)
> 
> 
> Samsung non-critical fixes for v3.15
> - fix typo CONFIG_CPU_S3C2443 in Kconfig
> - fix G3D regulator on because of entering low power mode
>for exynos5250-arndale
> - fix CONFIG_USB_EHCI_EXYNOS for exynos_defconfig
> - fix initcall of mach-crag6410-module.c

Pulled into next/fixes-non-critical, thanks!

Arnd
--
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 v11 17/27] iommu/exynos: remove calls to Runtime PM API functions

2014-03-18 Thread Tomasz Figa

On 18.03.2014 10:56, Cho KyongHo wrote:

On Fri, 14 Mar 2014 13:59:00 +0100, Tomasz Figa wrote:

Hi KyongHo,

On 14.03.2014 06:08, Cho KyongHo wrote:


[snip]


-static bool __exynos_sysmmu_disable(struct sysmmu_drvdata *data)
+static void __sysmmu_disable_nocount(struct sysmmu_drvdata *data)


If you are changing the names anyway, it would be probably a good idea
to reduce code obfuscation a bit and drop the underscores from
beginnings of function names. Also I'd suggest keeping the "exynos_" prefix.


Thanks for the suggestion.
__exynos_sysmmu_disable is splitted into 2 functions: __sysmmu_disable
and __sysmmu_disable_nocount.
I agree with you that it is good idea to reduce code obfuscation but
I don't think dropping beginning underscores of function names reduces
obfuscation.



Well, if you are ending up with a function like 
__sysmmu_enable_nocount() below with every line starting with two 
underscores, do you think this improves code readability?


Of course this is a minor issue, but let's keep some code quality level 
in Linux kernel.





   {
-   unsigned long flags;
-   bool disabled = false;
-
-   write_lock_irqsave(&data->lock, flags);


[snip]

Here's the function mentioned above:


+
+static void __sysmmu_enable_nocount(struct sysmmu_drvdata *data)
+{
+   __master_clk_enable(data);
+   __sysmmu_clk_enable(data);
+
+   __raw_writel(CTRL_BLOCK, data->sfrbase + REG_MMU_CTRL);
+
+   __sysmmu_init_config(data);
+
+   __sysmmu_set_ptbase(data->sfrbase, data->pgtable);
+
+   __raw_writel(CTRL_ENABLE, data->sfrbase + REG_MMU_CTRL);
+
+   __master_clk_disable(data);
+}
+


[snip]



@@ -629,7 +700,7 @@ err_pgtable:
   static void exynos_iommu_domain_destroy(struct iommu_domain *domain)
   {
struct exynos_iommu_domain *priv = domain->priv;
-   struct sysmmu_drvdata *data;
+   struct exynos_iommu_owner *owner;
unsigned long flags;
int i;

@@ -637,11 +708,14 @@ static void exynos_iommu_domain_destroy(struct 
iommu_domain *domain)

spin_lock_irqsave(&priv->lock, flags);

-   list_for_each_entry(data, &priv->clients, node) {
-   while (!exynos_sysmmu_disable(data->dev))
+   list_for_each_entry(owner, &priv->clients, client) {
+   while (!exynos_sysmmu_disable(owner->dev))
; /* until System MMU is actually disabled */


What about using list_for_each_entry_safe() and calling list_del_init()
here directly?



That require another variable to be defined.


Is it a problem?


I just wanted to avoid that because I think it is prettier.
Moreover, list_del_init() below the empty while() clause may make
the source code readers misunderstood..


This raises another question, why the loop above is even needed. 
exynos_sysmmu_disable() should make sure that SYSMMU is actually 
disabled, without any need for looping like this.



}

+   while (!list_empty(&priv->clients))
+   list_del_init(priv->clients.next);
+
spin_unlock_irqrestore(&priv->lock, flags);

for (i = 0; i < NUM_LV1ENTRIES; i++)


[snip]


+static int sysmmu_hook_driver_register(struct notifier_block *nb,
+   unsigned long val,
+   void *p)
+{
+   struct device *dev = p;
+
+   switch (val) {
+   case BUS_NOTIFY_BIND_DRIVER:
+   {
+   struct exynos_iommu_owner *owner;


Please move this variable to the top of the function and drop the braces
around case blocks.


I don't think it is required because this function is modified
by the following patches.


OK, if so, and similar issue is not present after further patches.






+
+   /* No System MMU assigned. See exynos_sysmmu_probe(). */
+   if (dev->archdata.iommu == NULL)
+   break;


This looks strange... (see below)

Also this looks racy. There are no guarantees about device probing
order, so you may end up with master devices being probed before the
IOMMUs. Deferred probing should be used to handle this correctly.


System MMU driver must be probed earlier than the drivers of master devices
because the drivers may want to use System MMU for their initial task.


As I said, there are no guarantees about platform device probe order in 
Linux kernel. Code must be designed to check whether required 
dependencies are met and if not, deferred probing must be used.





+
+   owner = devm_kzalloc(dev, sizeof(*owner), GFP_KERNEL);
+   if (!owner) {
+   dev_err(dev, "No Memory for exynos_iommu_owner\n");
+   return -ENOMEM;
+   }
+
+   owner->dev = dev;
+   INIT_LIST_HEAD(&owner->client);
+   owner->sysmmu = dev->archdata.iommu;
+
+   dev->archdata.iommu = owner;


I don't understand what is happening here in this case statement. There
is already something assigned to dev->

Re: [PATCH v11 10/27] iommu/exynos: use managed device helper functions

2014-03-18 Thread Tomasz Figa

On 18.03.2014 12:09, Cho KyongHo wrote:

On Fri, 14 Mar 2014 20:52:43 +0530, Sachin Kamat wrote:

Hi KyongHo,

On 14 March 2014 10:35, Cho KyongHo  wrote:

This patch uses managed device helper functions in the probe().

Signed-off-by: Cho KyongHo 
---

[snip]


+   data->clk = devm_clk_get(dev, "sysmmu");
+   if (IS_ERR(data->clk)) {
+   dev_info(dev, "No gate clock found!\n");
+   data->clk = NULL;
+   }


Why aren't you returning from here upon error?


It is for the case of a System MMU which does not need clock gating.



Are there really such cases?

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 v11 10/27] iommu/exynos: use managed device helper functions

2014-03-18 Thread Tomasz Figa

On 18.03.2014 11:38, Cho KyongHo wrote:

On Fri, 14 Mar 2014 14:28:36 +0100, Tomasz Figa wrote:

Hi KyongHo,

On 14.03.2014 06:05, Cho KyongHo wrote:

This patch uses managed device helper functions in the probe().

Signed-off-by: Cho KyongHo 
---
   drivers/iommu/exynos-iommu.c |   64 
+-
   1 file changed, 26 insertions(+), 38 deletions(-)

diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c
index 36e6b73..33b424d 100644
--- a/drivers/iommu/exynos-iommu.c
+++ b/drivers/iommu/exynos-iommu.c
@@ -499,51 +499,48 @@ void exynos_sysmmu_tlb_invalidate(struct device *dev)

   static int exynos_sysmmu_probe(struct platform_device *pdev)
   {
-   int ret;
+   int irq, ret;
struct device *dev = &pdev->dev;
struct sysmmu_drvdata *data;
struct resource *res;

-   data = kzalloc(sizeof(*data), GFP_KERNEL);
-   if (!data) {
-   dev_dbg(dev, "Not enough memory\n");
-   ret = -ENOMEM;
-   goto err_alloc;
-   }
+   data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
+   if (!data)
+   return -ENOMEM;

res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res) {
-   dev_dbg(dev, "Unable to find IOMEM region\n");
-   ret = -ENOENT;
-   goto err_init;
+   dev_err(dev, "Unable to find IOMEM region\n");
+   return -ENOENT;
}


No need to check for error and print message, because
devm_ioremap_resource() already checks the passed resource and handles
error cases.



Yes but devm_ioremap_resource() just tells that the given 'res' is not
correct. I think the message in the driver is more informative.


The common practice used in Linux kernel is to not duplicate such 
messages. It is obvious that devm_ioremap_resource() printing such 
message is related to an IOMEM resource anyway, as you can't used it 
with other types of resources.


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 v11 13/27] iommu/exynos: support for device tree

2014-03-18 Thread Tomasz Figa

On 18.03.2014 11:52, Cho KyongHo wrote:

On Fri, 14 Mar 2014 14:39:33 +0100, Tomasz Figa wrote:

@@ -557,11 +558,23 @@ static int exynos_sysmmu_probe(struct platform_device 
*pdev)
return 0;
   }

-static struct platform_driver exynos_sysmmu_driver = {
-   .probe  = exynos_sysmmu_probe,
-   .driver = {
+#ifdef CONFIG_OF
+static struct of_device_id sysmmu_of_match[] __initconst = {
+   { .compatible   = "samsung,sysmmu-v1", },
+   { .compatible   = "samsung,sysmmu-v2", },
+   { .compatible   = "samsung,sysmmu-v3.1", },
+   { .compatible   = "samsung,sysmmu-v3.2", },
+   { .compatible   = "samsung,sysmmu-v3.3", },


Do you need all these compatible strings? I mean, are there any
implementation differences that can't be identified by reading IP
registers, such as REG_MMU_VERSION?



Unfortunately, there is a SoC which overrides REG_MMU_VERSION with
a value for RTL designers and it is not related to System MMU
versions.


OK.

What about having a generic compatible string for Samsung SysMMU then, 
but an additional property that can override the version to account for 
such brokenness? If not provided, the version would be read from 
REG_MMU_VERSION.


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 v11 19/27] iommu/exynos: add support for power management subsystems.

2014-03-18 Thread Tomasz Figa

On 18.03.2014 12:23, Cho KyongHo wrote:

On Fri, 14 Mar 2014 17:07:53 +0100, Tomasz Figa wrote:

Hi KyongHo,

On 14.03.2014 06:10, Cho KyongHo wrote:


[snip]


@@ -677,11 +679,40 @@ static int __init exynos_sysmmu_probe(struct 
platform_device *pdev)
platform_set_drvdata(pdev, data);

pm_runtime_enable(dev);
+   data->runtime_active = !pm_runtime_enabled(dev);


Hmm, this seems to be a bit misleading. The field is named
runtime_active, but the assignment makes it true if PM runtime is _not_
enabled (i.e. inactive). Is this correct?



I agree that it may lead misunderstood.
data->runtime_active actually indicates if electric power is asserted
to the System MMU. pm_runtime_enable() call must enable runtime pm
for the given device. If runtime pm is not enabled although pm_runtime_enable()
is called, CONFIG_PM_RUNTIME is not configured.

Actually, it is replacible with
if (IS_ENABLED(CONFIG_PM_RUNTIME))
 data->runtime_active = true;


I would keep it as !pm_runtime_enabled(dev), but rename the field to 
something more meaningful, like data->is_powered_on.


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: [PATCHv2 8/8] devfreq: exynos4: Add busfreq driver for exynos4210/exynos4x12

2014-03-18 Thread Tomasz Figa

On 17.03.2014 06:19, Chanwoo Choi wrote:

Hi Tomasz,

On 03/15/2014 02:35 AM, Tomasz Figa wrote:

Hi Chanwoo, Mark,

On 14.03.2014 11:56, Chanwoo Choi wrote:

Hi Mark,

On 03/14/2014 07:35 PM, Mark Rutland wrote:

On Fri, Mar 14, 2014 at 07:14:37AM +, Chanwoo Choi wrote:

Hi Mark,

On 03/14/2014 02:53 AM, Mark Rutland wrote:

On Thu, Mar 13, 2014 at 08:17:29AM +, Chanwoo Choi wrote:

This patch add busfreq driver for Exynos4210/Exynos4x12 memory interface
and bus to support DVFS(Dynamic Voltage Frequency Scaling) according to PPMU
counters. PPMU (Performance Profiling Monitorings Units) of Exynos4 SoC provides
PPMU counters for DMC(Dynamic Memory Controller) to check memory bus utilization
and then busfreq driver adjusts dynamically the operating frequency/voltage
by using DEVFREQ Subsystem.

Signed-off-by: Chanwoo Choi 
---
   .../devicetree/bindings/devfreq/exynos4_bus.txt| 49 
++
   1 file changed, 49 insertions(+)
   create mode 100644 Documentation/devicetree/bindings/devfreq/exynos4_bus.txt

diff --git a/Documentation/devicetree/bindings/devfreq/exynos4_bus.txt 
b/Documentation/devicetree/bindings/devfreq/exynos4_bus.txt
new file mode 100644
index 000..2a83fcc
--- /dev/null
+++ b/Documentation/devicetree/bindings/devfreq/exynos4_bus.txt
@@ -0,0 +1,49 @@
+
+Exynos4210/4x12 busfreq driver
+-
+
+Exynos4210/4x12 Soc busfreq driver with devfreq for Memory bus 
frequency/voltage
+scaling according to PPMU counters of memory controllers
+
+Required properties:
+- compatible: should contain Exynos4 SoC type as follwoing:
+  - "samsung,exynos4x12-busfreq" for Exynos4x12
+  - "samsung,exynos4210-busfreq" for Exynos4210


Is there a device called "busfreq"? What device does this binding
describe?


I'll add detailed description of busfreq as following:

"busfreq(bus frequendcy)" driver means that busfreq driver control dynamically
memory bus frequency/voltage by checking memory bus utilization to optimize
power-consumption. When checking memeory bus utilization, exynos4_busfreq driver
would use PPMU(Performance Profiling Monitoring Units).


This still sounds like a description of the _driver_, not the _device_.
The binding should describe the hardware, now the high level abstraction
that software is going to build atop of it.

It sounds like this is a binding for the DMC PPMU?

Is the PPMU a component of the DMC, or is it bolted on the side?


PPMU(Performance Profiling Monitoring Unit) is to profile performance event of
various IP on Exynos4. Each PPMU provide perforamnce event for each IP.
We can check various PPMU as following:

PPMU_3D
PPMU_ACP
PPMU_CAMIF
PPMU_CPU
PPMU_DMC0
PPMU_DMC1
PPMU_FSYS
PPMU_IMAGE
PPMU_LCD0
PPMU_LCD1
PPMU_MFC_L
PPMU_MFC_R
PPMU_TV
PPMU_LEFT_BUS
PPMU_RIGHT_BUS

DMC (Dynamic Memory Controller) control the operation of DRAM in Exynos4 SoC.
If we need to get memory bust utilization of DMC, we can get memory bus 
utilization
from PPMU_DMC0/PPMU_DMC1.

So, Exynos4's busfreq used two(PPMU_DMC0/PPMU_DMC1) among upper various PPMU 
list.


Well, PPMUs and DMCs are separate hardware blocks found inside Exynos SoCs. 
Busfreq/devfreq is just a Linux-specific abstraction responsible for collecting 
data using PPMUs and controlling frequencies and voltages of appropriate power 
planes, vdd_int responsible for powering DMC0 and DMC1 blocks in this case.



I knew already.


I'm afraid that the binding you're proposing is unfortunately incorrect, 
because it represents the software abstraction, not the real hardware.


What is exactly incorrect part of this patch?



Device tree contains information about hardware, not about OS-specific 
drivers or subsystems. Busfreq/devfreq is not a hardware block, but a 
Linux-specific driver, so it's not suitable to be described by DT 
directly, especially considering the fact that in future it might be 
replaced by or merged with another subsystem.


Only PPMUs are real hardware blocks present in the SoC. In addition, a 
SoC-level aspect of hardware description may be added, such as a list of 
power planes. See below for explanation.




Instead, this should be separated into several independent bindings:

  - PPMU bindings to list all the PPMU instances present in the SoC and 
resources they need,

  - power plane bindings, which define a power plane in which multiple IP 
blocks might reside, can be monitored by one or more PPMU units and frequency 
and voltage of which can be configured according to determined performance 
level. Needed resources will be clocks and regulators to scale and probably 
also operating points.

Then, exynos-busfreq driver should bind to such power planes, parse necessary 
data from DT (list of PPMUs and IP blocks, clocks, regulators and operating 
points) and register a devfreq entity.


What is 'power plane'? I don't know 'power plane'.


Power plane is a part of the SoC (set of IP blocks and buses) that is 
powered by the same power source. For e

Re: [PATCHv2 0/8] devfreq: exynos4: Support dt and use common ppmu driver

2014-03-18 Thread Tomasz Figa



On 17.03.2014 02:58, Chanwoo Choi wrote:

Hi Tomasz,

On 03/15/2014 02:58 AM, Tomasz Figa wrote:

Hi Chanwoo,

On 13.03.2014 09:17, Chanwoo Choi wrote:

This patchset support devicetree and use common ppmu driver instead of
individual code of exynos4_bus.c to remove duplicate code. Also this patchset
get the resources for busfreq from dt data by using DT helper function.
- PPMU register address
- PPMU clock
- Regulator for INT/MIF block

This patchset use SET_SYSTEM_SLEEP_PM_OPS macro intead of legacy method.
To remove power-leakage in suspend state, before entering suspend state,
disable ppmu clocks.

Changes from v1:
- Add exynos4_bus.txt documentation for devicetree guide
- Fix probe failure if CONFIG_PM_OPP is disabled
- Fix typo and resource leak(regulator/clock/memory) when happening probe 
failure
- Add additionally comment for PPMU usage instead of previous PPC
- Split separate patch to remove ambiguous of patch

Chanwoo Choi (8):
devfreq: exynos4: Support devicetree to get device id of Exynos4 SoC
devfreq: exynos4: Use common ppmu driver and get ppmu address from dt data
devfreq: exynos4: Add ppmu's clock control and code clean about regulator 
control
devfreq: exynos4: Fix bug of resource leak and code clean on probe()
devfreq: exynos4: Use SET_SYSTEM_SLEEP_PM_OPS macro
devfreq: exynos4: Fix power-leakage of clock on suspend state
devfreq: exynos4: Add CONFIG_PM_OPP dependency to fix probe fail
devfreq: exynos4: Add busfreq driver for exynos4210/exynos4x12

   .../devicetree/bindings/devfreq/exynos4_bus.txt|  49 +++
   drivers/devfreq/Kconfig|   1 +
   drivers/devfreq/exynos/Makefile|   2 +-
   drivers/devfreq/exynos/exynos4_bus.c   | 415 
++---
   4 files changed, 341 insertions(+), 126 deletions(-)
   create mode 100644 Documentation/devicetree/bindings/devfreq/exynos4_bus.txt



I have reviewed this series and there are several comments that I'd like to ask 
you to address. Please see my replies to particular patches.


OK, I'll fix it about your comment.



However, this driver, even after applying your series, is still far from a 
state that would allow it to be enabled. The most important issue is direct 
access to CMU registers, based on static mapping, which is not allowed on 
multiplatform kernels and multiplatform-awareness for drivers is currently a 
must.

To allow this driver to be enabled, it needs to be converted to use common 
clock framework functions to configure all clocks, e.g. clk_set_rate(), 
clk_set_parent(), etc., without accessing CMU registers directly.

Of course as long as the driver is effectively unusable, to keep development, 
we can proceed with refactoring it step-by-step and your series would be 
basically the first step, after addressing the review comments.



I agree your opinion. When setting frequency of memory bus, this driver access
directly to CMU registers. I know it should be modified by using common clk
framework as your comment.

I'll send patch set about using common clk framework instead of CMU register
based on static mapping after finished the review and apply of this patch set 
as next step.


OK. I'm looking forward for patches sorting this out.

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 V4 1/8] sxgbe: Add device-tree binding support document

2014-03-18 Thread Byungho An
Mark Rutland  :
> Hi,
> 
> As a general note it's helpful for devicetree to be Cc'd on the entire
series
> (though the binding document should be a separate patch) as it provides
useful
> context for reviewing the binding.
OK.

> 
> On Tue, Mar 18, 2014 at 06:47:13AM +, Byungho An wrote:
> > From: Siva Reddy 
> >
> > This patch adds binding document for SXGBE ethernet driver via
device-tree.
> >
> > Signed-off-by: Siva Reddy Kallam 
> > Signed-off-by: Byungho An 
> > ---
> >  .../devicetree/bindings/net/samsung-sxgbe.txt  |   53
> > 
> >  1 file changed, 53 insertions(+)
> >  create mode 100644
> > Documentation/devicetree/bindings/net/samsung-sxgbe.txt
> >
> > diff --git a/Documentation/devicetree/bindings/net/samsung-sxgbe.txt
> > b/Documentation/devicetree/bindings/net/samsung-sxgbe.txt
> > new file mode 100644
> > index 000..ca27947
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/net/samsung-sxgbe.txt
> > @@ -0,0 +1,53 @@
> > +* Samsung 10G Ethernet driver (SXGBE)
> > +
> > +Required properties:
> > +- compatible: Should be "samsung,sxgbe-v2.0a"
> > +- reg: Address and length of the register set for the device
> > +- interrupt-parent: Should be the phandle for the interrupt
> > +controller
> > +  that services interrupts for this device
> > +- interrupts: Should contain the SXGBE interrupts
> > +  These interrupts are ordered by fixed and follows variable
> > +  trasmit DMA interrupts, receive DMA interrupts and lpi interrupt.
> > +  index 0 - this is fixed common interrupt of SXGBE and it is always
> > +  available.
> > +  index 1 to 25 - 8 variable trasmit interrupts, variable 16 receive
> > interrupts
> > +  and 1 optional lpi interrupt.
> > +- phy-mode: String, operation mode of the PHY interface.
> > +  Supported values are: "xaui", "gmii".
> > +- samsung,pbl: Integer, Programmable Burst Length.
> > +  Supported values are 1, 2, 4, 8, 16, or 32.
> 
> There's no need to abbreviate to "pbl".
> 
> Is this a property of the hardware, or configuration that the kernel will
program
> in? If the latter, why can the kernel not choose?
Yes, this is hardware property

> 
> > +- samsung,fixed-burst: Boolean, Program the DMA to use the fixed
> > +burst mode
> > +- samsung,burst-map: Integer, Program the possible bursts supported
> > +by sxgbe
> > +  This is an interger and represents allowable DMA bursts when fixed
burst.
> > +  Allowable range is 0x00-0x3F. This field is valid only when fixed
> > +burst is
> > +  enabled, otherwise ignored.
> 
> If that's the case, why not have just this property and have it imply the
use of
> fixed burst mode?
OK. It will be implemented in next patch set.

> 
> When is it necessary to use fixed burst mode?
This is the configurable mode of DMA an used internally by hardware to fetch
data from platform bus

> 
> > +- samsung,adv-addr-mode: Boolean, Program the DMA to use Enhanced
> > +address
> > mode.
> 
> When would this be selected, and why can the kernel not choose?
Kernel doesn't have the provision to find out a way to select this. So, need
to pass from DT

> 
> > +- samsung,force_thresh_dma_mode: Boolean, Force DMA to use the
> > +threshold mode
> > +  for both tx and rx
> 
> s/_/-/ in property names.
OK.

> 
> Likewise, why can the kernel not choose.
SXGBE h/w registers can't provide information to select this. So, need to pass
from DT depend on Platform

> 
> > +- samsung,force_sf_dma_mode: Boolean, Force DMA to use the Store and
> > +Forward
> > +  mode for both tx and rx. This flag is ignored if
> > +force_thresh_dma_mode is
> > set.
> 
> Likewise for both points.
Same above.

> 
> > +- samsung,phy-addr: Integer, Address of the PHY attached with SXGBE.
> 
> Some of these properties appear to be missing from the example. Are they
> required or optional?
Those are optional depend on platform configuration.

> 
> Thanks,
> Mark.
> 
> > +
> > +Optional properties:
> > +- mac-address: 6 bytes, mac address
> > +
> > +Example:
> > +
> > +   aliases {
> > +   ethernet0 = <&sxgbe0>;
> > +   };
> > +
> > +   sxgbe0: ethernet@1a04 {
> > +   compatible = "samsung,sxgbe-v2.0a";
> > +   reg = <0 0x1a04 0 0x1>;
> > +   interrupt-parent = <&gic>;
> > +   interrupts = <0 209 4>, <0 185 4>, <0 186 4>, <0 187 4>,
> > +<0 188 4>, <0 189 4>, <0 190 4>, <0 191 4>,
> > +<0 192 4>, <0 193 4>, <0 194 4>, <0 195 4>,
> > +<0 196 4>, <0 197 4>, <0 198 4>, <0 199 4>,
> > +<0 200 4>, <0 201 4>, <0 202 4>, <0 203 4>,
> > +<0 204 4>, <0 205 4>, <0 206 4>, <0 207 4>,
> > +<0 208 4>, <0 210 4>;
> > +   mac-address = []; /* Filled in by U-Boot */
> > +   phy-mode = "xaui";
> > +   };
> > --
> > 1.7.10.4
> >
> >
> > --
> > To unsubscribe from this list: send the line "unsubscribe devicetree"
> > in the body of a message to majord...@vger

[PATCH v2 4/6] ARM: SAMSUNG: Fix rebase error in pm-debug.c

2014-03-18 Thread Tomasz Figa
Recent Samsung header clean-up series did heavy reorganization of
various Samsung-specific headers, unfortunately causing a conflict with
Samsung PM consolidation series part 2 - multiplatform) and resulting
with a merge error that caused a build failure, due to a missing header
being included.

This patch fixes this by removing incorrect header inclusion.

Signed-off-by: Tomasz Figa 
---
 arch/arm/plat-samsung/pm-debug.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/arm/plat-samsung/pm-debug.c b/arch/arm/plat-samsung/pm-debug.c
index 602998b..88bb4cf 100644
--- a/arch/arm/plat-samsung/pm-debug.c
+++ b/arch/arm/plat-samsung/pm-debug.c
@@ -20,7 +20,6 @@
 
 #include 
 #include 
-#include 
 
 #ifdef CONFIG_SAMSUNG_ATAGS
 #include 
-- 
1.9.0

--
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/6] ARM: s3c64xx: Fix build for implicit serial_s3c.h inclusion

2014-03-18 Thread Tomasz Figa
From: Mark Brown 

Some very recent change appears to have removed an implicit inclusion of
serial_s3c.h causing build failures due to references to UART registers
in the serial port restore code in next-20140318.  Include it explicitly
to fix the build.

Signed-off-by: Mark Brown 
---
 arch/arm/mach-s3c64xx/include/mach/pm-core.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm/mach-s3c64xx/include/mach/pm-core.h 
b/arch/arm/mach-s3c64xx/include/mach/pm-core.h
index c0537f4..a30a1e3 100644
--- a/arch/arm/mach-s3c64xx/include/mach/pm-core.h
+++ b/arch/arm/mach-s3c64xx/include/mach/pm-core.h
@@ -15,6 +15,8 @@
 #ifndef __MACH_S3C64XX_PM_CORE_H
 #define __MACH_S3C64XX_PM_CORE_H __FILE__
 
+#include 
+
 #include 
 
 static inline void s3c_pm_debug_init_uart(void)
-- 
1.9.0

--
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 1/6] serial: s3c: Fix build of header without serial_core.h preinclusion

2014-03-18 Thread Tomasz Figa
From: Mark Brown 

serial_s3c.h uses upf_t which is defined in serial_core.h but does not
include that itself meaning that users which include serial_s3c.h by
itself don't build.

Signed-off-by: Mark Brown 
[t.figa: Moved inclusion under #ifndef __ASSEMBLY__ to fix mach-exynos.]
Signed-off-by: Tomasz Figa 
---
 include/linux/serial_s3c.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/linux/serial_s3c.h b/include/linux/serial_s3c.h
index 907d9d1..e6fc956 100644
--- a/include/linux/serial_s3c.h
+++ b/include/linux/serial_s3c.h
@@ -233,6 +233,8 @@
 
 #ifndef __ASSEMBLY__
 
+#include 
+
 /* configuration structure for per-machine configurations for the
  * serial port
  *
-- 
1.9.0

--
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/6] ARM: s3c64xx: Fix incorrect selection of PM-related symbols

2014-03-18 Thread Tomasz Figa
This patch modifies ARCH_S3C64XX Kconfig entry to select
SAMSUNG_WAKEMASK and PM_GENERIC_DOMAINS conditionally if PM_SLEEP and
PM_RUNTIME are enabled respectively to avoid introducing unmet
dependenies such as

warning: (ARCH_S3C64XX && S3C2412_PM && CPU_S5P6440 && CPU_S5P6450)
selects SAMSUNG_WAKEMASK which has unmet direct dependencies
(PLAT_SAMSUNG && PM)

warning: (ARCH_S3C64XX && ARCH_EXYNOS4 && SOC_EXYNOS5250 &&
SOC_EXYNOS5420) selects PM_GENERIC_DOMAINS which has unmet direct
dependencies (PM)

and related compilation errors, when PM_SLEEP or PM_RUNTIME is not
enabled.

Signed-off-by: Tomasz Figa 
---
 arch/arm/Kconfig | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index afc751f..0608177 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -757,11 +757,11 @@ config ARCH_S3C64XX
select HAVE_TCM
select NO_IOPORT_MAP
select PLAT_SAMSUNG
-   select PM_GENERIC_DOMAINS
+   select PM_GENERIC_DOMAINS if PM_RUNTIME
select S3C_DEV_NAND
select S3C_GPIO_TRACK
select SAMSUNG_ATAGS
-   select SAMSUNG_WAKEMASK
+   select SAMSUNG_WAKEMASK if PM_SLEEP
select SAMSUNG_WDT_RESET
help
  Samsung S3C64XX series based systems
-- 
1.9.0

--
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/6] ARM: EXYNOS: Fix compilation error in cpuidle.c

2014-03-18 Thread Tomasz Figa
The big series refactoring Exynos suspend to RAM handling missed the
cpuidle driver that is disabled in exynos_defconfig, leaving it
including old mach/pm_core.h header and using old s3c_cpu_resume symbol
instead of new exynos_cpu_resume, resulting in compilation failures with
CONFIG_ARCH_EXYNOS and CONFIG_CPU_IDLE enabled.

This patch fixes that silly mistake and performs necessary modification
to arhc/arm/exynos/cpuidle.c to make it compile again.

Signed-off-by: Tomasz Figa 
---
 arch/arm/mach-exynos/cpuidle.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/arm/mach-exynos/cpuidle.c b/arch/arm/mach-exynos/cpuidle.c
index f57cb91..b530231 100644
--- a/arch/arm/mach-exynos/cpuidle.c
+++ b/arch/arm/mach-exynos/cpuidle.c
@@ -26,7 +26,6 @@
 #include 
 #include 
 
-#include 
 #include 
 
 #include "common.h"
@@ -127,7 +126,7 @@ static int exynos4_enter_core0_aftr(struct cpuidle_device 
*dev,
/* Set value of power down register for aftr mode */
exynos_sys_powerdown_conf(SYS_AFTR);
 
-   __raw_writel(virt_to_phys(s3c_cpu_resume), REG_DIRECTGO_ADDR);
+   __raw_writel(virt_to_phys(exynos_cpu_resume), REG_DIRECTGO_ADDR);
__raw_writel(S5P_CHECK_AFTR, REG_DIRECTGO_FLAG);
 
save_cpu_arch_register();
-- 
1.9.0

--
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 6/6] ARM: s5p64x0: Explicitly include linux/serial_s3c.h in mach/pm-core.h

2014-03-18 Thread Tomasz Figa
This patch fixes compilation failure due to missing explicit inclusion
of linux/serial_s3c.h in mach/pm-core.h, which contains definitions
required for further code in this header.

Signed-off-by: Tomasz Figa 
---
 arch/arm/mach-s5p64x0/include/mach/pm-core.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm/mach-s5p64x0/include/mach/pm-core.h 
b/arch/arm/mach-s5p64x0/include/mach/pm-core.h
index e52f754..1e0eb65 100644
--- a/arch/arm/mach-s5p64x0/include/mach/pm-core.h
+++ b/arch/arm/mach-s5p64x0/include/mach/pm-core.h
@@ -12,6 +12,8 @@
  * published by the Free Software Foundation.
  */
 
+#include 
+
 #include 
 
 static inline void s3c_pm_debug_init_uart(void)
-- 
1.9.0

--
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 1/2] serial: s3c: Fix build of header without serial_core.h preinclusion

2014-03-18 Thread Tomasz Figa

Hi Mark,

On 18.03.2014 12:56, Mark Brown wrote:

From: Mark Brown 

serial_s3c.h uses upf_t which is defined in serial_core.h but does not
include that itself meaning that users which include serial_s3c.h by
itself don't build.

Signed-off-by: Mark Brown 
---

This is needed together with patch 2 to fix build failures in -next, I
didn't have the time/enthusiasm to isolate the issue.

  include/linux/serial_s3c.h | 2 ++
  1 file changed, 2 insertions(+)

diff --git a/include/linux/serial_s3c.h b/include/linux/serial_s3c.h
index 907d9d1d56cf..44e4a6b92ddb 100644
--- a/include/linux/serial_s3c.h
+++ b/include/linux/serial_s3c.h
@@ -29,6 +29,8 @@
  #ifndef __ASM_ARM_REGS_SERIAL_H
  #define __ASM_ARM_REGS_SERIAL_H

+#include 
+
  #define S3C2410_URXH(0x24)
  #define S3C2410_UTXH(0x20)
  #define S3C2410_ULCON   (0x00)



Thanks for fixing this up. However due to this header ending up being 
included by arch/arm/kernel/debug.S, this breaks mach-exynos. I have 
fixed this up by moving the inclusion down the file, under #ifndef 
__ASSEMBLY__ and posted next version along with other fixups.


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 0/3] regulator: s2mps11: Add support for S2MPS14 regulators

2014-03-18 Thread Krzysztof Kozlowski
Hi Mark,

Lee Jones in his pull request [1] put also my changes for S2MPS14
support in MFD sec-core driver. They are needed by this patchset for adding
suppt for regulators on S2MPS14.

Do you have time to look at these patches and apply them if they're OK (or ACK 
them)?

Best regards,
Krzysztof

[1] mfd: regulator: S2MPA01 device support IB for Mark Brown



On Fri, 2014-03-07 at 11:10 +0100, Krzysztof Kozlowski wrote:
> Hi,
> 
> This patchset adds support for the S2MPS14 device to the s2mps11 regulator
> driver. It's a subset of previously sent patches for S2MPS14 device:
> http://thread.gmane.org/gmane.linux.kernel.samsung-soc/27194/focus=1649217
> along with one new patch:
>  - PATCH 2/3: regulator: s2mps11: Add set_suspend_disable for S2MPS14
> which replaces previous "opmode" idea.
> 
> 
> These patches are rebased against linux-next tree (next-20140305) because
> they depend on changes in main MFD sec-core and s2mps11 regulator driver.
> 
> 
> Changes since v1
> 
> 1. Patch 2/3: Store information that regulator was suspended.
> 
> 
> Best regards,
> Krzysztof
> 
> 
> Krzysztof Kozlowski (3):
>   regulator: s2mps11: Add support for S2MPS14 regulators
>   regulator: s2mps11: Add set_suspend_disable for S2MPS14
>   Documentation: mfd: s2mps11: Document support for S2MPS14
> 
>  Documentation/devicetree/bindings/mfd/s2mps11.txt |   12 +-
>  drivers/regulator/Kconfig |9 +-
>  drivers/regulator/s2mps11.c   |  301 
> -
>  include/linux/mfd/samsung/s2mps14.h   |2 +
>  4 files changed, 255 insertions(+), 69 deletions(-)
> 


--
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 00/12] Samsung PM consolidation part 2 (multiplatform)

2014-03-18 Thread Tomasz Figa

Hi Kukjin,

On 18.03.2014 01:58, Kukjin Kim wrote:

Tomasz Figa wrote:


On 21.02.2014 14:15, Tomasz Figa wrote:

Hi Kukjin,

On 06.02.2014 20:12, Tomasz Figa wrote:

Current Samsung PM code is heavily unprepared for multiplatform

systems.

The design implies accessing functions and global variables defined in
particular mach- subdirectory from common code in plat-, which is not
allowed when building ARCH_MULTIPLATFORM. In addition there is a lot of
forced code unification, which makes common function handle any

possible

quirks of all supported SoCs. In the end this design turned out to not
work too well, ending with a lot of empty functions exported from

mach-,

just because code in common pm.c calls them. Moreover, recent trend of
moving lower level suspend/resume code to proper drivers, like pinctrl
or clk, made a lot of code there redundant, especially on DT-only
platforms
like Exynos.

This patch series attempts to untie Exynos PM support from the legacy
Samsung PM core and make it multiplatform-aware, by isolating truly
generic parts of the latter, making them multiplatform-friendly and

then

reimplementing Exynos PM support in a multiplatform-capable way by

using

those generic parts. The result is that now PM initialization is

started

from mach-exynos*-dt, which calls Exynos-specific initialization code
that
registers platform_suspend_ops, so control flow is basically reversed
ending with mach- code calling more generic plat- code if needed.

This is limited to Exynos right now, but remaining SoCs could follow
in further series.

Depends on Samsung PM consolidation part 1 (clocks) series:
   - http://thread.gmane.org/gmane.linux.kernel.samsung-soc/26816

On Exynos4210-based Trats, Exynos4412-based Trats2 and Exynos5250-based
Arndale boards (except suspend/resume, which is broken because of
unrelated reasons):

Tested-by: Tomasz Figa 

Changes since v1 (RFC):
   - fixed l2x0 resume,
   - fixed checkpatch complaints (about issues in existing code being
moved),
   - rebased on top of current linux-next,
   - slightly reordered patches to make the order more logical.

Tomasz Figa (12):
ARM: EXYNOS: Do not resume l2x0 if not enabled before suspend
ARM: SAMSUNG: Add soc_is_s3c2410() helper
ARM: SAMSUNG: pm: Save UART DIVSLOT register based on SoC type
ARM: SAMSUNG: pm: Use debug_ll_addr() to get UART base address
ARM: SAMSUNG: pm: Consolidate PM debug functions
ARM: SAMSUNG: pm: Move Samsung PM debug code into separate file
ARM: SAMSUNG: Move common save/restore helpers to separate file
ARM: SAMSUNG: pm: Move s3c_pm_check_* prototypes to plat/pm-common.h
ARM: EXYNOS: Kconfig: Fix abuse of CONFIG_PM
ARM: EXYNOS: Remove PM initcalls and useless indirection
ARM: EXYNOS: Stop using legacy Samsung PM code
ARM: exynos: Allow wake-up using GIC interrupts

   arch/arm/mach-exynos/Kconfig   |  16 +--
   arch/arm/mach-exynos/Makefile  |   2 +-
   arch/arm/mach-exynos/common.c  |   1 +
   arch/arm/mach-exynos/common.h  |  14 ++
   arch/arm/mach-exynos/include/mach/pm-core.h|  75 ---
   arch/arm/mach-exynos/pm.c  | 172
+++--
   arch/arm/mach-exynos/regs-pmu.h|   2 +
   arch/arm/mach-exynos/sleep.S   |  85 
   arch/arm/mach-s3c64xx/pm.c |   1 -
   arch/arm/mach-s5p64x0/pm.c |   1 -
   arch/arm/plat-samsung/Makefile |   2 +
   arch/arm/plat-samsung/include/plat/cpu.h   |   6 +
   arch/arm/plat-samsung/include/plat/pm-common.h | 110 
   arch/arm/plat-samsung/include/plat/pm.h|  80 +---
   arch/arm/plat-samsung/pm-check.c   |   2 +-
   arch/arm/plat-samsung/pm-common.c  |  75 +++
   arch/arm/plat-samsung/pm-debug.c   |  98 ++
   arch/arm/plat-samsung/pm.c | 146
-
   arch/arm/plat-samsung/s5p-sleep.S  |  43 ---
   19 files changed, 531 insertions(+), 400 deletions(-)
   delete mode 100644 arch/arm/mach-exynos/include/mach/pm-core.h
   create mode 100644 arch/arm/mach-exynos/sleep.S
   create mode 100644 arch/arm/plat-samsung/include/plat/pm-common.h
   create mode 100644 arch/arm/plat-samsung/pm-common.c
   create mode 100644 arch/arm/plat-samsung/pm-debug.c



Hi Tomasz,

Build error happens with s3c6400_defconfig:

In file included from arch/arm/plat-samsung/pm.c:38:0:
arch/arm/mach-s3c64xx/include/mach/pm-core.h: In function
's3c_pm_arch_update_uart':
arch/arm/mach-s3c64xx/include/mach/pm-core.h:64:32: error: 'S3C2410_UCON'
undeclared (first use in this function)
arch/arm/mach-s3c64xx/include/mach/pm-core.h:64:32: note: each undeclared
identifier is reported only once for each function it appears in
arch/arm/mach-s3c64xx/include/mach/pm-core.h:65:24: error:
'S3C6400_UCON_CLKMASK' undeclared (first use in 

Re: [PATCH v2 1/3] arm64: dts: add initial dts for Samsung GH7 SoC and SSDK-GH7 board

2014-03-18 Thread Mark Rutland
On Fri, Mar 14, 2014 at 01:26:31AM +, Kukjin Kim wrote:
> > > > > + cpu@000 {
> > > > > + device_type = "cpu";
> > > > > + compatible = "arm,armv8";
> > > >
> > > > The "arm,armv8" should be a fallback rather than the only entry. The
> > > > precise core should be first (see arch/arm64/boot/dts/apm-storm.dtsi for
> > > > an example).
> > > >
> > > Well, do I really need another name if GH7 has just 'ARMv8 core' exactly?
> > 
> > Yes please. You presumably don't have "just 'ARMv8 core'", but rather a
> > specific ARMv8 implementation.
> > 
> OK, so in my understanding if it is really _just_ 'ARMv8 core' from S/W point
> of view, "arm,armv8" should be fine. I will make sure.

It will work, sure. But the compatible list should also list the
specific CPU. From the S/W point of view there are likely
implementation-defined registers which mean that no real CPU will be
"just" an ARMv8 core.

We have enough trouble with DTBs for 32-bit SoCs not listing things they
should. I see no reason to be lax here.

> > > > > + gic: interrupt-controller@1C00 {
> > > > > + compatible = "arm,cortex-a15-gic";
> > > >
> > > > We should have a more specific compatible string early in the list here
> > > > too.
> > > >
> > > Well, I think more specific compatible string is not required for gic, 
> > > there
> > > were discussion about using another compatible string for gic-v2. And
> > > cortex-a15-gic should be fine at this moment and if another name is 
> > > required
> > > as per previous discussion, we will then.
> > 
> > While it's probably ok to have "arm,cortex-a15-gic" in the compatible
> > list, it would be good to also have a more specific string, so we can
> > identify the GIC implementation precisely in future (in case we need to
> > perform any workarounds, or there's some kind of optimisation we could
> > perform for some implementations).
> > 
> Hmm... let's use just it for now then add another specific string later ;-)

Why not do this from the start? Then we can actually rely on the DTB
rather than it being useless.

> > > > > + pmu {
> > > > > + compatible = "arm,armv8-pmuv3";
> > > >
> > > > This is missing a specific compatible string.
> > > >
> > > I don't know why I need another specific compatible string here because I
> > > thought the 'armv8-pmuv3' is enough.
> > 
> > Each CPU microarchitecture has different PMU events and quirks. While
> > the CPU PMU might be compatible with ARMv8's PMUv3, it will also have
> > implementation-specific events, and may have quirks we need to work
> > around in future.
> > 
> > As with 32-bit, we'd expect these to be of the form
> > "${implementor},${cpu}-pmu".
> > 
> OK.
> 
> + compatible = "samsung,gh7-pmu", "armv8-pmuv3";

Is GH7 an SoC or a CPU?

> > > > > + serial@12c2 {
> > > > > + compatible = "arm,pl011", "arm,primecell";
> > > > > + reg = <0 0x12c2 0 0x1>;
> > > > > + interrupts = <0 420 0>;
> > > > > + };
> > > >
> > > > These are both missing required clocks.
> > > >
> > > Yes right.
> > 
> > So you'll add these?
> > 
> To be honest, still I'm not sure how it should be handled because regarding
> clocks do not need to handle in the kernel for GH7. And for it, I needed to
> use some HACKs to change clock handling in the kernel. I will provide proper
> solution soon.

Are the clocks always-on, fixed-rate clocks, or does some firmware
manage them dynamically? We have bindings for the former.

There's not much point having a DTS upstream that relies on hacks which
are not.

Cheers,
Mark.
--
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 V5 3/8] net: sxgbe: add TSO support for Samsung sxgbe

2014-03-18 Thread Byungho An
From: Vipul Pandya 

Enable TSO during initialization for each DMA channels

Signed-off-by: Vipul Pandya 
Neatening-by: Joe Perches 
Signed-off-by: Byungho An 
---
 drivers/net/ethernet/samsung/sxgbe/sxgbe_desc.h |   17 +++--
 drivers/net/ethernet/samsung/sxgbe/sxgbe_dma.c  |   10 +++
 drivers/net/ethernet/samsung/sxgbe/sxgbe_dma.h  |2 +
 drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c |   75 ---
 4 files changed, 91 insertions(+), 13 deletions(-)

diff --git a/drivers/net/ethernet/samsung/sxgbe/sxgbe_desc.h 
b/drivers/net/ethernet/samsung/sxgbe/sxgbe_desc.h
index 41844d4..547edf3 100644
--- a/drivers/net/ethernet/samsung/sxgbe/sxgbe_desc.h
+++ b/drivers/net/ethernet/samsung/sxgbe/sxgbe_desc.h
@@ -167,8 +167,9 @@ struct sxgbe_desc_ops {
void (*init_tx_desc)(struct sxgbe_tx_norm_desc *p);
 
/* Invoked by the xmit function to prepare the tx descriptor */
-   void (*tx_enable_tse)(struct sxgbe_tx_norm_desc *p, u8 is_tse,
-   u32 hdr_len, u32 payload_len);
+   void (*tx_desc_enable_tse)(struct sxgbe_tx_norm_desc *p, u8 is_tse,
+  u32 total_hdr_len, u32 tcp_hdr_len,
+  u32 tcp_payload_len);
 
/* Assign buffer lengths for descriptor */
void (*prepare_tx_desc)(struct sxgbe_tx_norm_desc *p, u8 is_fd,
@@ -207,20 +208,26 @@ struct sxgbe_desc_ops {
int (*get_tx_timestamp_status)(struct sxgbe_tx_norm_desc *p);
 
/* TX Context Descripto Specific */
-   void (*init_tx_ctxt_desc)(struct sxgbe_tx_ctxt_desc *p);
+   void (*tx_ctxt_desc_set_ctxt)(struct sxgbe_tx_ctxt_desc *p);
 
/* Set the owner of the TX context descriptor */
-   void (*set_tx_ctxt_owner)(struct sxgbe_tx_ctxt_desc *p);
+   void (*tx_ctxt_desc_set_owner)(struct sxgbe_tx_ctxt_desc *p);
 
/* Get the owner of the TX context descriptor */
int (*get_tx_ctxt_owner)(struct sxgbe_tx_ctxt_desc *p);
 
/* Set TX mss */
-   void (*tx_ctxt_desc_setmss)(struct sxgbe_tx_ctxt_desc *p, int mss);
+   void (*tx_ctxt_desc_set_mss)(struct sxgbe_tx_ctxt_desc *p, u16 mss);
 
/* Set TX mss */
int (*tx_ctxt_desc_get_mss)(struct sxgbe_tx_ctxt_desc *p);
 
+   /* Set TX tcmssv */
+   void (*tx_ctxt_desc_set_tcmssv)(struct sxgbe_tx_ctxt_desc *p);
+
+   /* Reset TX ostc */
+   void (*tx_ctxt_desc_reset_ostc)(struct sxgbe_tx_ctxt_desc *p);
+
/* Set IVLAN information */
void (*tx_ctxt_desc_set_ivlantag)(struct sxgbe_tx_ctxt_desc *p,
  int is_ivlanvalid, int ivlan_tag,
diff --git a/drivers/net/ethernet/samsung/sxgbe/sxgbe_dma.c 
b/drivers/net/ethernet/samsung/sxgbe/sxgbe_dma.c
index 1e68ef3..1edc451 100644
--- a/drivers/net/ethernet/samsung/sxgbe/sxgbe_dma.c
+++ b/drivers/net/ethernet/samsung/sxgbe/sxgbe_dma.c
@@ -354,6 +354,15 @@ static void sxgbe_dma_rx_watchdog(void __iomem *ioaddr, 
u32 riwt)
}
 }
 
+static void sxgbe_enable_tso(void __iomem *ioaddr, u8 chan_num)
+{
+   u32 ctrl;
+
+   ctrl = readl(ioaddr + SXGBE_DMA_CHA_TXCTL_REG(chan_num));
+   ctrl |= SXGBE_DMA_CHA_TXCTL_TSE_ENABLE;
+   writel(ctrl, ioaddr + SXGBE_DMA_CHA_TXCTL_REG(chan_num));
+}
+
 static const struct sxgbe_dma_ops sxgbe_dma_ops = {
.init = sxgbe_dma_init,
.cha_init = sxgbe_dma_channel_init,
@@ -369,6 +378,7 @@ static const struct sxgbe_dma_ops sxgbe_dma_ops = {
.tx_dma_int_status = sxgbe_tx_dma_int_status,
.rx_dma_int_status = sxgbe_rx_dma_int_status,
.rx_watchdog = sxgbe_dma_rx_watchdog,
+   .enable_tso = sxgbe_enable_tso,
 };
 
 const struct sxgbe_dma_ops *sxgbe_get_dma_ops(void)
diff --git a/drivers/net/ethernet/samsung/sxgbe/sxgbe_dma.h 
b/drivers/net/ethernet/samsung/sxgbe/sxgbe_dma.h
index 50c8054..6c070ac 100644
--- a/drivers/net/ethernet/samsung/sxgbe/sxgbe_dma.h
+++ b/drivers/net/ethernet/samsung/sxgbe/sxgbe_dma.h
@@ -42,6 +42,8 @@ struct sxgbe_dma_ops {
 struct sxgbe_extra_stats *x);
/* Program the HW RX Watchdog */
void (*rx_watchdog)(void __iomem *ioaddr, u32 riwt);
+   /* Enable TSO for each DMA channel */
+   void (*enable_tso)(void __iomem *ioaddr, u8 chan_num);
 };
 
 const struct sxgbe_dma_ops *sxgbe_get_dma_ops(void);
diff --git a/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c 
b/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c
index 8e4e78f..a8ba1a5 100644
--- a/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c
+++ b/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c
@@ -1101,6 +1101,28 @@ static int sxgbe_release(struct net_device *dev)
return 0;
 }
 
+/* Prepare first Tx descriptor for doing TSO operation */
+void sxgbe_tso_prepare(struct sxgbe_priv_data *priv,
+  struct sxgbe_tx_norm_desc *first_desc,
+  struct sk_buff *skb)
+{
+   unsigned int total_hdr_len, tcp_hdr_len;
+
+   /* Write first Tx descriptor with

[PATCH V5 1/8] sxgbe: Add device-tree binding support document

2014-03-18 Thread Byungho An
From: Siva Reddy 

This patch adds binding document for SXGBE ethernet driver via device-tree.

Signed-off-by: Siva Reddy Kallam 
Signed-off-by: Byungho An 
---
 .../devicetree/bindings/net/samsung-sxgbe.txt  |   52 
 1 file changed, 52 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/net/samsung-sxgbe.txt

diff --git a/Documentation/devicetree/bindings/net/samsung-sxgbe.txt 
b/Documentation/devicetree/bindings/net/samsung-sxgbe.txt
new file mode 100644
index 000..340eff6
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/samsung-sxgbe.txt
@@ -0,0 +1,52 @@
+* Samsung 10G Ethernet driver (SXGBE)
+
+Required properties:
+- compatible: Should be "samsung,sxgbe-v2.0a"
+- reg: Address and length of the register set for the device
+- interrupt-parent: Should be the phandle for the interrupt controller
+  that services interrupts for this device
+- interrupts: Should contain the SXGBE interrupts
+  These interrupts are ordered by fixed and follows variable
+  trasmit DMA interrupts, receive DMA interrupts and lpi interrupt.
+  index 0 - this is fixed common interrupt of SXGBE and it is always
+  available.
+  index 1 to 25 - 8 variable trasmit interrupts, variable 16 receive interrupts
+  and 1 optional lpi interrupt.
+- phy-mode: String, operation mode of the PHY interface.
+  Supported values are: "xaui", "gmii".
+- samsung,pbl: Integer, Programmable Burst Length.
+  Supported values are 1, 2, 4, 8, 16, or 32.
+- samsung,burst-map: Integer, Program the possible bursts supported by sxgbe
+  This is an interger and represents allowable DMA bursts when fixed burst.
+  Allowable range is 0x00-0x3F. This field is valid only when fixed burst is
+  enabled, otherwise ignored.
+- samsung,adv-addr-mode: Boolean, Program the DMA to use Enhanced address mode.
+- samsung,force-thresh-dma-mode: Boolean, Force DMA to use the threshold mode
+  for both tx and rx
+- samsung,force-sf-dma-mode: Boolean, Force DMA to use the Store and Forward
+  mode for both tx and rx. This flag is ignored if force-thresh-dma-mode is 
set.
+- samsung,phy-addr: Integer, Address of the PHY attached with SXGBE.
+
+Optional properties:
+- mac-address: 6 bytes, mac address
+
+Example:
+
+   aliases {
+   ethernet0 = <&sxgbe0>;
+   };
+
+   sxgbe0: ethernet@1a04 {
+   compatible = "samsung,sxgbe-v2.0a";
+   reg = <0 0x1a04 0 0x1>;
+   interrupt-parent = <&gic>;
+   interrupts = <0 209 4>, <0 185 4>, <0 186 4>, <0 187 4>,
+<0 188 4>, <0 189 4>, <0 190 4>, <0 191 4>,
+<0 192 4>, <0 193 4>, <0 194 4>, <0 195 4>,
+<0 196 4>, <0 197 4>, <0 198 4>, <0 199 4>,
+<0 200 4>, <0 201 4>, <0 202 4>, <0 203 4>,
+<0 204 4>, <0 205 4>, <0 206 4>, <0 207 4>,
+<0 208 4>, <0 210 4>;
+   mac-address = []; /* Filled in by U-Boot */
+   phy-mode = "xaui";
+   };
-- 
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 V5 0/8] add new Samsung SXGBE driver

2014-03-18 Thread Byungho An
Hi all,

This is 5th posting for SAMSUNG SXGBE driver.

Changes since v1:
- changed name of driver to SXGbE as per Ben's comment
- squashed Joe's neatening for many stuff in original patches

Changes since v2:
- updated and splited binding document as per Mark's comment
- clean up codes as per Joe's comment
- removed unused fields and clean up codes as per Froancois's comment
- removed module parameters as per Dave's comment
- moved driver directory to samsung/sxgbe/

Changes since v3:
- fixed Missing a blank line after declarations as per Dave's comment
- clean up codes as per Joe's comment
- removed reference of net_device.{irq, base_addr}

Changes since v4:
- updated binding document and DT related function per Mark's comment

Byungho An (1):
  MAINTAINERS: add maintainer for Samsung sxgbe driver

Girish K S (2):
  net: sxgbe: add EEE(Energy Efficient Ethernet) for Samsung sxgbe
  net: sxgbe: add WOL(Wakeup-On-Lan)support for Samsung sxgbe

Siva Reddy (2):
  sxgbe: Add device-tree binding support document
  net: sxgbe: add basic framework for Samsung 10Gb ethernet driver

Vipul Pandya (3):
  net: sxgbe: add TSO support for Samsung sxgbe
  net: sxgbe: add Checksum offload support for Samsung sxgbe
  net: sxgbe: add ethtool related functions support Samsung sxgbe

 .../devicetree/bindings/net/samsung-sxgbe.txt  |   52 +
 MAINTAINERS|9 +
 drivers/net/ethernet/Kconfig   |1 +
 drivers/net/ethernet/Makefile  |1 +
 drivers/net/ethernet/samsung/Kconfig   |   20 +
 drivers/net/ethernet/samsung/Makefile  |5 +
 drivers/net/ethernet/samsung/sxgbe/Kconfig |9 +
 drivers/net/ethernet/samsung/sxgbe/Makefile|4 +
 drivers/net/ethernet/samsung/sxgbe/sxgbe_common.h  |  553 +
 drivers/net/ethernet/samsung/sxgbe/sxgbe_core.c|  290 +++
 drivers/net/ethernet/samsung/sxgbe/sxgbe_desc.c|  515 +
 drivers/net/ethernet/samsung/sxgbe/sxgbe_desc.h|  298 +++
 drivers/net/ethernet/samsung/sxgbe/sxgbe_dma.c |  387 
 drivers/net/ethernet/samsung/sxgbe/sxgbe_dma.h |   51 +
 drivers/net/ethernet/samsung/sxgbe/sxgbe_ethtool.c |  634 ++
 drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c| 2382 
 drivers/net/ethernet/samsung/sxgbe/sxgbe_mdio.c|  274 +++
 drivers/net/ethernet/samsung/sxgbe/sxgbe_mtl.c |  293 +++
 drivers/net/ethernet/samsung/sxgbe/sxgbe_mtl.h |  108 +
 .../net/ethernet/samsung/sxgbe/sxgbe_platform.c|  268 +++
 drivers/net/ethernet/samsung/sxgbe/sxgbe_reg.h |  491 
 drivers/net/ethernet/samsung/sxgbe/sxgbe_xpcs.c|   92 +
 drivers/net/ethernet/samsung/sxgbe/sxgbe_xpcs.h|   38 +
 include/linux/sxgbe_platform.h |   54 +
 24 files changed, 6829 insertions(+)

Thanks,
Byungho An

--
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 V5 5/8] net: sxgbe: add Checksum offload support for Samsung sxgbe

2014-03-18 Thread Byungho An
From: Vipul Pandya 

This patch adds TX and RX checksum offload support.

Signed-off-by: Vipul Pandya 
Neatening-by: Joe Perches 
Signed-off-by: Byungho An 
---
 drivers/net/ethernet/samsung/sxgbe/sxgbe_common.h |5 +++
 drivers/net/ethernet/samsung/sxgbe/sxgbe_core.c   |   20 +
 drivers/net/ethernet/samsung/sxgbe/sxgbe_desc.h   |6 +--
 drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c   |   46 -
 4 files changed, 63 insertions(+), 14 deletions(-)

diff --git a/drivers/net/ethernet/samsung/sxgbe/sxgbe_common.h 
b/drivers/net/ethernet/samsung/sxgbe/sxgbe_common.h
index 937969c..7937493 100644
--- a/drivers/net/ethernet/samsung/sxgbe/sxgbe_common.h
+++ b/drivers/net/ethernet/samsung/sxgbe/sxgbe_common.h
@@ -337,6 +337,10 @@ struct sxgbe_core_ops {
void (*set_eee_timer)(void __iomem *ioaddr, const int ls,
  const int tw);
void (*set_eee_pls)(void __iomem *ioaddr, const int link);
+
+   /* Enable disable checksum offload operations */
+   void (*enable_rx_csum)(void __iomem *ioaddr);
+   void (*disable_rx_csum)(void __iomem *ioaddr);
 };
 
 const struct sxgbe_core_ops *sxgbe_get_core_ops(void);
@@ -448,6 +452,7 @@ struct sxgbe_priv_data {
struct sxgbe_ops *hw;   /* sxgbe specific ops */
int no_csum_insertion;
int irq;
+   int rxcsum_insertion;
spinlock_t stats_lock;  /* lock for tx/rx statatics */
 
struct phy_device *phydev;
diff --git a/drivers/net/ethernet/samsung/sxgbe/sxgbe_core.c 
b/drivers/net/ethernet/samsung/sxgbe/sxgbe_core.c
index bf93b16..5885fd6 100644
--- a/drivers/net/ethernet/samsung/sxgbe/sxgbe_core.c
+++ b/drivers/net/ethernet/samsung/sxgbe/sxgbe_core.c
@@ -217,6 +217,24 @@ static void  sxgbe_set_eee_timer(void __iomem *ioaddr,
writel(value, ioaddr + SXGBE_CORE_LPI_TIMER_CTRL);
 }
 
+static void sxgbe_enable_rx_csum(void __iomem *ioaddr)
+{
+   u32 ctrl;
+
+   ctrl = readl(ioaddr + SXGBE_CORE_RX_CONFIG_REG);
+   ctrl |= SXGBE_RX_CSUMOFFLOAD_ENABLE;
+   writel(ctrl, ioaddr + SXGBE_CORE_RX_CONFIG_REG);
+}
+
+static void sxgbe_disable_rx_csum(void __iomem *ioaddr)
+{
+   u32 ctrl;
+
+   ctrl = readl(ioaddr + SXGBE_CORE_RX_CONFIG_REG);
+   ctrl &= ~SXGBE_RX_CSUMOFFLOAD_ENABLE;
+   writel(ctrl, ioaddr + SXGBE_CORE_RX_CONFIG_REG);
+}
+
 const struct sxgbe_core_ops core_ops = {
.core_init = sxgbe_core_init,
.dump_regs = sxgbe_core_dump_regs,
@@ -233,6 +251,8 @@ const struct sxgbe_core_ops core_ops = {
.reset_eee_mode = sxgbe_reset_eee_mode,
.set_eee_timer = sxgbe_set_eee_timer,
.set_eee_pls = sxgbe_set_eee_pls,
+   .enable_rx_csum = sxgbe_enable_rx_csum,
+   .disable_rx_csum = sxgbe_disable_rx_csum,
 };
 
 const struct sxgbe_core_ops *sxgbe_get_core_ops(void)
diff --git a/drivers/net/ethernet/samsung/sxgbe/sxgbe_desc.h 
b/drivers/net/ethernet/samsung/sxgbe/sxgbe_desc.h
index 547edf3..3c0b5a8 100644
--- a/drivers/net/ethernet/samsung/sxgbe/sxgbe_desc.h
+++ b/drivers/net/ethernet/samsung/sxgbe/sxgbe_desc.h
@@ -113,7 +113,7 @@ struct sxgbe_rx_norm_desc {
/* WB RDES3 */
u32 pkt_len:14;
u32 rdes3_reserved:1;
-   u32 err_summary:15;
+   u32 err_summary:1;
u32 err_l2_type:4;
u32 layer34_pkt_type:4;
u32 no_coagulation_pkt:1;
@@ -273,8 +273,8 @@ struct sxgbe_desc_ops {
int (*get_rx_ld_status)(struct sxgbe_rx_norm_desc *p);
 
/* Return the reception status looking at the RDES1 */
-   void (*rx_wbstatus)(struct sxgbe_rx_norm_desc *p,
-   struct sxgbe_extra_stats *x);
+   int (*rx_wbstatus)(struct sxgbe_rx_norm_desc *p,
+  struct sxgbe_extra_stats *x, int *checksum);
 
/* Get own bit */
int (*get_rx_ctxt_owner)(struct sxgbe_rx_ctxt_desc *p);
diff --git a/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c 
b/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c
index 5490cf4..13bdb54 100644
--- a/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c
+++ b/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c
@@ -1257,6 +1257,7 @@ void sxgbe_tso_prepare(struct sxgbe_priv_data *priv,
 static netdev_tx_t sxgbe_xmit(struct sk_buff *skb, struct net_device *dev)
 {
unsigned int entry, frag_num;
+   int cksum_flag = 0;
struct netdev_queue *dev_txq;
unsigned txq_index = skb_get_queue_mapping(skb);
struct sxgbe_priv_data *priv = netdev_priv(dev);
@@ -1328,7 +1329,7 @@ static netdev_tx_t sxgbe_xmit(struct sk_buff *skb, struct 
net_device *dev)
   __func__);
 
priv->hw->desc->prepare_tx_desc(tx_desc, 1, no_pagedlen,
-   no_pagedlen);
+   no_pagedlen, 
cksu

[PATCH V5 4/8] net: sxgbe: add EEE(Energy Efficient Ethernet) for Samsung sxgbe

2014-03-18 Thread Byungho An
From: Girish K S 

Added support for the EEE(Energy Efficient Ethernet) in 10G ethernet driver.

Signed-off-by: Girish K S 
Neatening-by: Joe Perches 
Signed-off-by: Byungho An 
---
 drivers/net/ethernet/samsung/sxgbe/sxgbe_common.h  |   53 +++
 drivers/net/ethernet/samsung/sxgbe/sxgbe_core.c|   86 +-
 drivers/net/ethernet/samsung/sxgbe/sxgbe_ethtool.c |   47 ++
 drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c|  165 +++-
 .../net/ethernet/samsung/sxgbe/sxgbe_platform.c|4 +
 drivers/net/ethernet/samsung/sxgbe/sxgbe_reg.h |5 +
 6 files changed, 358 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/samsung/sxgbe/sxgbe_common.h 
b/drivers/net/ethernet/samsung/sxgbe/sxgbe_common.h
index 587b691..937969c 100644
--- a/drivers/net/ethernet/samsung/sxgbe/sxgbe_common.h
+++ b/drivers/net/ethernet/samsung/sxgbe/sxgbe_common.h
@@ -115,6 +115,33 @@ struct sxgbe_mtl_ops;
 #define RX_PTP_SIGNAL  0x0A
 #define RX_PTP_RESV_MSG0x0F
 
+/* EEE-LPI mode  flags*/
+#define TX_ENTRY_LPI_MODE  0x10
+#define TX_EXIT_LPI_MODE   0x20
+#define RX_ENTRY_LPI_MODE  0x40
+#define RX_EXIT_LPI_MODE   0x80
+
+/* EEE-LPI Interrupt status flag */
+#define LPI_INT_STATUS BIT(5)
+
+/* EEE-LPI Default timer values */
+#define LPI_LINK_STATUS_TIMER  0x3E8
+#define LPI_MAC_WAIT_TIMER 0x00
+
+/* EEE-LPI Control and status definitions */
+#define LPI_CTRL_STATUS_TXABIT(19)
+#define LPI_CTRL_STATUS_PLSDIS BIT(18)
+#define LPI_CTRL_STATUS_PLSBIT(17)
+#define LPI_CTRL_STATUS_LPIEN  BIT(16)
+#define LPI_CTRL_STATUS_TXRSTP BIT(11)
+#define LPI_CTRL_STATUS_RXRSTP BIT(10)
+#define LPI_CTRL_STATUS_RLPIST BIT(9)
+#define LPI_CTRL_STATUS_TLPIST BIT(8)
+#define LPI_CTRL_STATUS_RLPIEX BIT(3)
+#define LPI_CTRL_STATUS_RLPIEN BIT(2)
+#define LPI_CTRL_STATUS_TLPIEX BIT(1)
+#define LPI_CTRL_STATUS_TLPIEN BIT(0)
+
 enum dma_irq_status {
tx_hard_error   = BIT(0),
tx_bump_tc  = BIT(1),
@@ -199,6 +226,13 @@ struct sxgbe_extra_stats {
unsigned long rx_buffer_access_err;
unsigned long rx_data_transfer_err;
 
+   /* EEE-LPI stats */
+   unsigned long tx_lpi_entry_n;
+   unsigned long tx_lpi_exit_n;
+   unsigned long rx_lpi_entry_n;
+   unsigned long rx_lpi_exit_n;
+   unsigned long eee_wakeup_error_n;
+
/* RX specific */
/* L2 error */
unsigned long rx_code_gmii_err;
@@ -296,6 +330,13 @@ struct sxgbe_core_ops {
   unsigned char feature_index);
/* adjust SXGBE speed */
void (*set_speed)(void __iomem *ioaddr, unsigned char speed);
+
+   /* EEE-LPI specific operations */
+   void (*set_eee_mode)(void __iomem *ioaddr);
+   void (*reset_eee_mode)(void __iomem *ioaddr);
+   void (*set_eee_timer)(void __iomem *ioaddr, const int ls,
+ const int tw);
+   void (*set_eee_pls)(void __iomem *ioaddr, const int link);
 };
 
 const struct sxgbe_core_ops *sxgbe_get_core_ops(void);
@@ -351,6 +392,8 @@ struct sxgbe_hw_features {
/* IEEE 1588-2008 */
unsigned int atime_stamp;
 
+   unsigned int eee;
+
unsigned int tx_csum_offload;
unsigned int rx_csum_offload;
unsigned int multi_macaddr;
@@ -434,6 +477,13 @@ struct sxgbe_priv_data {
/* tc control */
int tx_tc;
int rx_tc;
+   /* EEE-LPI specific members */
+   struct timer_list eee_ctrl_timer;
+   bool tx_path_in_lpi_mode;
+   int lpi_irq;
+   int eee_enabled;
+   int eee_active;
+   int tx_lpi_timer;
 };
 
 /* Function prototypes */
@@ -456,4 +506,7 @@ int sxgbe_restore(struct net_device *ndev);
 
 const struct sxgbe_mtl_ops *sxgbe_get_mtl_ops(void);
 
+void sxgbe_disable_eee_mode(struct sxgbe_priv_data * const priv);
+bool sxgbe_eee_init(struct sxgbe_priv_data * const priv);
+
 #endif /* __SXGBE_COMMON_H__ */
diff --git a/drivers/net/ethernet/samsung/sxgbe/sxgbe_core.c 
b/drivers/net/ethernet/samsung/sxgbe/sxgbe_core.c
index 17eea58..bf93b16 100644
--- a/drivers/net/ethernet/samsung/sxgbe/sxgbe_core.c
+++ b/drivers/net/ethernet/samsung/sxgbe/sxgbe_core.c
@@ -47,11 +47,38 @@ static void sxgbe_core_dump_regs(void __iomem *ioaddr)
 {
 }
 
+static int sxgbe_get_lpi_status(void __iomem *ioaddr, const u32 irq_status)
+{
+   int status = 0;
+   int lpi_status;
+
+   /* Reading this register shall clear all the LPI status bits */
+   lpi_status = readl(ioaddr + SXGBE_CORE_LPI_CTRL_STATUS);
+
+   if (lpi_status & LPI_CTRL_STATUS_TLPIEN)
+   status |= TX_ENTRY_LPI_MODE;
+   if (lpi_status & LPI_CTRL_STATUS_TLPIEX)
+   status |= TX_EXIT_LPI_MODE;
+   if (lpi_status & LPI_CTRL_STATUS_RLPIEN)
+   status |= RX_ENTRY_LPI_MODE;
+   if (lpi_status & LPI_CTRL_STATUS_RLPIEX)
+   status |= RX_EXIT_LPI_MODE;
+
+   return status;
+}
+
 /* Handle extra events on specific interrup

[PATCH V5 8/8] MAINTAINERS: add maintainer for Samsung sxgbe driver

2014-03-18 Thread Byungho An
From: Byungho An 

Signed-off-by: Byungho An 
---
 MAINTAINERS |9 +
 1 file changed, 9 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index b7befe7..aeb81f2 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -7536,6 +7536,15 @@ S:   Supported
 L: linux-samsung-soc@vger.kernel.org (moderated for non-subscribers)
 F: drivers/clk/samsung/
 
+SAMSUNG SXGBE DRIVERS
+M: Byungho An 
+M: Girish K S 
+M: Siva Reddy Kallam 
+M: Vipul Pandya 
+S: Supported
+L: net...@vger.kernel.org
+F: drivers/net/ethernet/samsung/sxgbe/
+
 SERIAL DRIVERS
 M: Greg Kroah-Hartman 
 L: linux-ser...@vger.kernel.org
-- 
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 V5 6/8] net: sxgbe: add WOL(Wakeup-On-Lan)support for Samsung sxgbe

2014-03-18 Thread Byungho An
From: Girish K S 

This patch adds support for wake up on magic frame arrival.
Also remote wake up on all other packets (unicast, multicast broadcast) is 
supported.

Signed-off-by: Girish K S 
Neatening-by: Joe Perches 
Signed-off-by: Byungho An 
---
 drivers/net/ethernet/samsung/sxgbe/sxgbe_common.h  |   15 +
 drivers/net/ethernet/samsung/sxgbe/sxgbe_core.c|   29 
 drivers/net/ethernet/samsung/sxgbe/sxgbe_ethtool.c |   47 +
 drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c|   71 
 drivers/net/ethernet/samsung/sxgbe/sxgbe_mtl.c |   43 +++-
 drivers/net/ethernet/samsung/sxgbe/sxgbe_mtl.h |4 ++
 .../net/ethernet/samsung/sxgbe/sxgbe_platform.c|4 ++
 drivers/net/ethernet/samsung/sxgbe/sxgbe_reg.h |3 +
 8 files changed, 215 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/samsung/sxgbe/sxgbe_common.h 
b/drivers/net/ethernet/samsung/sxgbe/sxgbe_common.h
index 7937493..30adc81 100644
--- a/drivers/net/ethernet/samsung/sxgbe/sxgbe_common.h
+++ b/drivers/net/ethernet/samsung/sxgbe/sxgbe_common.h
@@ -121,9 +121,18 @@ struct sxgbe_mtl_ops;
 #define RX_ENTRY_LPI_MODE  0x40
 #define RX_EXIT_LPI_MODE   0x80
 
+/* PMT mode bits */
+#define PMT_PWRDWN BIT(0)
+#define PMT_MGPKT_EN   BIT(1)
+#define PMT_RWKPKT_EN  BIT(2)
+#define PMT_GUCAST_EN  BIT(9)
+
 /* EEE-LPI Interrupt status flag */
 #define LPI_INT_STATUS BIT(5)
 
+/* PMT Interrupt status */
+#define PMT_INT_STATUS BIT(4)
+
 /* EEE-LPI Default timer values */
 #define LPI_LINK_STATUS_TIMER  0x3E8
 #define LPI_MAC_WAIT_TIMER 0x00
@@ -225,6 +234,7 @@ struct sxgbe_extra_stats {
unsigned long rx_desc_access_err;
unsigned long rx_buffer_access_err;
unsigned long rx_data_transfer_err;
+   unsigned long pmt_irq_event_n;
 
/* EEE-LPI stats */
unsigned long tx_lpi_entry_n;
@@ -489,6 +499,11 @@ struct sxgbe_priv_data {
int eee_enabled;
int eee_active;
int tx_lpi_timer;
+
+   /* PM-WOL specific members */
+   int wolopts;
+   int wolenabled;
+   int wol_irq;
 };
 
 /* Function prototypes */
diff --git a/drivers/net/ethernet/samsung/sxgbe/sxgbe_core.c 
b/drivers/net/ethernet/samsung/sxgbe/sxgbe_core.c
index 5885fd6..334d196 100644
--- a/drivers/net/ethernet/samsung/sxgbe/sxgbe_core.c
+++ b/drivers/net/ethernet/samsung/sxgbe/sxgbe_core.c
@@ -78,12 +78,41 @@ static int sxgbe_core_host_irq_status(void __iomem *ioaddr,
if (unlikely(irq_status & LPI_INT_STATUS))
status |= sxgbe_get_lpi_status(ioaddr, irq_status);
 
+   if (unlikely(irq_status & PMT_INT_STATUS)) {
+   /* clear the PMT bits 5 and 6 by reading the PMT status reg */
+   readl(ioaddr + SXGBE_CORE_PMT_CTL_STATUS_REG);
+   x->pmt_irq_event_n++;
+   }
+
return status;
 }
 
 /* Set power management mode (e.g. magic frame) */
 static void sxgbe_core_pmt(void __iomem *ioaddr, unsigned long mode)
 {
+   unsigned int pmt = 0;
+
+   if (mode & WAKE_MAGIC) {
+   pr_debug("WOL Magic frame\n");
+   pmt |= PMT_MGPKT_EN;
+   }
+   if (mode & WAKE_UCAST) {
+   pr_debug("WOL on global unicast\n");
+   pmt |= PMT_GUCAST_EN;
+   }
+   if (mode & (WAKE_MCAST | WAKE_BCAST)) {
+   pr_debug("WOL on any other packet\n");
+   pmt |= PMT_RWKPKT_EN;
+   }
+
+   writel(pmt, ioaddr + SXGBE_CORE_PMT_CTL_STATUS_REG);
+
+   /* Enable power down bit if any of the requested mode is enabled */
+   if (pmt) {
+   writel(SXGBE_RX_ENABLE, ioaddr + SXGBE_CORE_RX_CONFIG_REG);
+   pmt |= PMT_PWRDWN;
+   writel(pmt, ioaddr + SXGBE_CORE_PMT_CTL_STATUS_REG);
+   }
 }
 
 /* Set/Get Unicast MAC addresses */
diff --git a/drivers/net/ethernet/samsung/sxgbe/sxgbe_ethtool.c 
b/drivers/net/ethernet/samsung/sxgbe/sxgbe_ethtool.c
index 9083300..89b1450 100644
--- a/drivers/net/ethernet/samsung/sxgbe/sxgbe_ethtool.c
+++ b/drivers/net/ethernet/samsung/sxgbe/sxgbe_ethtool.c
@@ -12,6 +12,7 @@
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
+#include 
 #include 
 #include 
 #include 
@@ -37,6 +38,7 @@ static const struct sxgbe_stats sxgbe_gstrings_stats[] = {
SXGBE_STAT(rx_lpi_entry_n),
SXGBE_STAT(rx_lpi_exit_n),
SXGBE_STAT(eee_wakeup_error_n),
+   SXGBE_STAT(pmt_irq_event_n),
 };
 #define SXGBE_STATS_LEN ARRAY_SIZE(sxgbe_gstrings_stats)
 
@@ -80,9 +82,54 @@ static int sxgbe_ethtool_set_eee(struct net_device *dev,
return phy_ethtool_set_eee(priv->phydev, edata);
 }
 
+static void sxgbe_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
+{
+   struct sxgbe_priv_data *priv = netdev_priv(dev);
+
+   wol->wolopts = 0;
+   if (!device_can_wakeup(priv->device)) {
+   dev_err(priv->device, "cannot wakeup device\n");
+   return;
+   

[PATCH V5 7/8] net: sxgbe: add ethtool related functions support Samsung sxgbe

2014-03-18 Thread Byungho An
From: Vipul Pandya 

This patch adds ethtool related functions.

Signed-off-by: Vipul Pandya 
Neatening-by: Joe Perches 
Signed-off-by: Byungho An 
---
 drivers/net/ethernet/samsung/sxgbe/sxgbe_common.h  |   25 +-
 drivers/net/ethernet/samsung/sxgbe/sxgbe_ethtool.c |  510 +++-
 drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c|8 +-
 drivers/net/ethernet/samsung/sxgbe/sxgbe_reg.h |6 +
 4 files changed, 537 insertions(+), 12 deletions(-)

diff --git a/drivers/net/ethernet/samsung/sxgbe/sxgbe_common.h 
b/drivers/net/ethernet/samsung/sxgbe/sxgbe_common.h
index 30adc81..c592841 100644
--- a/drivers/net/ethernet/samsung/sxgbe/sxgbe_common.h
+++ b/drivers/net/ethernet/samsung/sxgbe/sxgbe_common.h
@@ -42,8 +42,12 @@ struct sxgbe_mtl_ops;
 #define SXGBE_RX_QUEUES   16
 
 /* Max/Min RI Watchdog Timer count value */
-#define SXGBE_MAX_DMA_RIWT 0xff
-#define SXGBE_MIN_DMA_RIWT 0x20
+/* Calculated based how much time does it take to fill 256KB Rx memory
+ * at 10Gb speed at 156MHz clock rate and considered little less then
+ * the actual value.
+ */
+#define SXGBE_MAX_DMA_RIWT 0x70
+#define SXGBE_MIN_DMA_RIWT 0x01
 
 /* Tx coalesce parameters */
 #define SXGBE_COAL_TX_TIMER4
@@ -203,6 +207,20 @@ enum dma_irq_status {
 #define SXGBE_FOR_EACH_QUEUE(max_queues, queue_num)\
for (queue_num = 0; queue_num < max_queues; queue_num++)
 
+#define DRV_VERSION "1.0.0"
+
+#define SXGBE_MAX_RX_CHANNELS  16
+#define SXGBE_MAX_TX_CHANNELS  16
+
+#define START_MAC_REG_OFFSET   0x
+#define MAX_MAC_REG_OFFSET 0x0DFC
+#define START_MTL_REG_OFFSET   0x1000
+#define MAX_MTL_REG_OFFSET 0x18FC
+#define START_DMA_REG_OFFSET   0x3000
+#define MAX_DMA_REG_OFFSET 0x38FC
+
+#define REG_SPACE_SIZE 0x2000
+
 /* sxgbe statistics counters */
 struct sxgbe_extra_stats {
/* TX/RX IRQ events */
@@ -488,6 +506,7 @@ struct sxgbe_priv_data {
/* advanced time stamp support */
u32 adv_ts;
int use_riwt;
+   struct ptp_clock *ptp_clock;
 
/* tc control */
int tx_tc;
@@ -529,4 +548,6 @@ const struct sxgbe_mtl_ops *sxgbe_get_mtl_ops(void);
 void sxgbe_disable_eee_mode(struct sxgbe_priv_data * const priv);
 bool sxgbe_eee_init(struct sxgbe_priv_data * const priv);
 
+int sxgbe_set_flow_ctrl(struct sxgbe_priv_data *priv, int rx, int tx);
+
 #endif /* __SXGBE_COMMON_H__ */
diff --git a/drivers/net/ethernet/samsung/sxgbe/sxgbe_ethtool.c 
b/drivers/net/ethernet/samsung/sxgbe/sxgbe_ethtool.c
index 89b1450..3421ca2 100644
--- a/drivers/net/ethernet/samsung/sxgbe/sxgbe_ethtool.c
+++ b/drivers/net/ethernet/samsung/sxgbe/sxgbe_ethtool.c
@@ -12,12 +12,17 @@
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
+#include 
 #include 
 #include 
 #include 
+#include 
 #include 
+#include 
 
 #include "sxgbe_common.h"
+#include "sxgbe_reg.h"
+#include "sxgbe_dma.h"
 
 struct sxgbe_stats {
char stat_string[ETH_GSTRING_LEN];
@@ -33,17 +38,106 @@ struct sxgbe_stats {
 }
 
 static const struct sxgbe_stats sxgbe_gstrings_stats[] = {
+   /* TX/RX IRQ events */
+   SXGBE_STAT(tx_process_stopped_irq),
+   SXGBE_STAT(tx_ctxt_desc_err),
+   SXGBE_STAT(tx_threshold),
+   SXGBE_STAT(rx_threshold),
+   SXGBE_STAT(tx_pkt_n),
+   SXGBE_STAT(rx_pkt_n),
+   SXGBE_STAT(normal_irq_n),
+   SXGBE_STAT(tx_normal_irq_n),
+   SXGBE_STAT(rx_normal_irq_n),
+   SXGBE_STAT(napi_poll),
+   SXGBE_STAT(tx_clean),
+   SXGBE_STAT(tx_reset_ic_bit),
+   SXGBE_STAT(rx_process_stopped_irq),
+   SXGBE_STAT(rx_underflow_irq),
+
+   /* Bus access errors */
+   SXGBE_STAT(fatal_bus_error_irq),
+   SXGBE_STAT(tx_read_transfer_err),
+   SXGBE_STAT(tx_write_transfer_err),
+   SXGBE_STAT(tx_desc_access_err),
+   SXGBE_STAT(tx_buffer_access_err),
+   SXGBE_STAT(tx_data_transfer_err),
+   SXGBE_STAT(rx_read_transfer_err),
+   SXGBE_STAT(rx_write_transfer_err),
+   SXGBE_STAT(rx_desc_access_err),
+   SXGBE_STAT(rx_buffer_access_err),
+   SXGBE_STAT(rx_data_transfer_err),
+   SXGBE_STAT(pmt_irq_event_n),
+
+   /* EEE-LPI stats */
SXGBE_STAT(tx_lpi_entry_n),
SXGBE_STAT(tx_lpi_exit_n),
SXGBE_STAT(rx_lpi_entry_n),
SXGBE_STAT(rx_lpi_exit_n),
SXGBE_STAT(eee_wakeup_error_n),
-   SXGBE_STAT(pmt_irq_event_n),
+
+   /* RX specific */
+   /* L2 error */
+   SXGBE_STAT(rx_code_gmii_err),
+   SXGBE_STAT(rx_watchdog_err),
+   SXGBE_STAT(rx_crc_err),
+   SXGBE_STAT(rx_gaint_pkt_err),
+   SXGBE_STAT(ip_hdr_err),
+   SXGBE_STAT(ip_payload_err),
+   SXGBE_STAT(overflow_error),
+
+   /* L2 Pkt type */
+   SXGBE_STAT(len_pkt),
+   SXGBE_STAT(mac_ctl_pkt),
+   SXGBE_STAT(dcb_ctl_pkt),
+   SXGBE_STAT(arp_pkt),
+   SXGBE_STAT(oam_pkt),
+   SXGBE_STAT(untag_okt),
+   SXGBE_STAT(other_pkt),
+   SXGBE_STAT(svlan_tag_pkt),
+   SXGBE_STAT(cvlan_tag_pkt),
+   

Re: [PATCH v2 0/3] regulator: s2mps11: Add support for S2MPS14 regulators

2014-03-18 Thread Mark Brown
On Tue, Mar 18, 2014 at 06:34:12PM +0100, Krzysztof Kozlowski wrote:

> Lee Jones in his pull request [1] put also my changes for S2MPS14
> support in MFD sec-core driver. They are needed by this patchset for adding
> suppt for regulators on S2MPS14.

> Do you have time to look at these patches and apply them if they're OK
> (or ACK them)?

Possibly, though we are *very* near to the merge window.


signature.asc
Description: Digital signature


Re: [PATCH V5 1/8] sxgbe: Add device-tree binding support document

2014-03-18 Thread Florian Fainelli
2014-03-18 11:19 GMT-07:00 Byungho An :
> From: Siva Reddy 
>
> This patch adds binding document for SXGBE ethernet driver via device-tree.
>
> Signed-off-by: Siva Reddy Kallam 
> Signed-off-by: Byungho An 
> ---
>  .../devicetree/bindings/net/samsung-sxgbe.txt  |   52 
> 
>  1 file changed, 52 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/net/samsung-sxgbe.txt
>
> diff --git a/Documentation/devicetree/bindings/net/samsung-sxgbe.txt 
> b/Documentation/devicetree/bindings/net/samsung-sxgbe.txt
> new file mode 100644
> index 000..340eff6
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/net/samsung-sxgbe.txt
> @@ -0,0 +1,52 @@
> +* Samsung 10G Ethernet driver (SXGBE)
> +
> +Required properties:
> +- compatible: Should be "samsung,sxgbe-v2.0a"
> +- reg: Address and length of the register set for the device
> +- interrupt-parent: Should be the phandle for the interrupt controller
> +  that services interrupts for this device
> +- interrupts: Should contain the SXGBE interrupts
> +  These interrupts are ordered by fixed and follows variable
> +  trasmit DMA interrupts, receive DMA interrupts and lpi interrupt.
> +  index 0 - this is fixed common interrupt of SXGBE and it is always
> +  available.
> +  index 1 to 25 - 8 variable trasmit interrupts, variable 16 receive 
> interrupts
> +  and 1 optional lpi interrupt.
> +- phy-mode: String, operation mode of the PHY interface.

You should reference
Documentation/devicetree/bindings/net/ethernet.txt which is more
thorough about what this is about.

> +  Supported values are: "xaui", "gmii".

xaui is not documented in
Documentation/devicetree/bindings/net/ethernet.txt, nor is it
supported in include/linux/phy.h and drivers/of/of_net.c, that should
be part of the patchset.

> +- samsung,pbl: Integer, Programmable Burst Length.
> +  Supported values are 1, 2, 4, 8, 16, or 32.
> +- samsung,burst-map: Integer, Program the possible bursts supported by sxgbe
> +  This is an interger and represents allowable DMA bursts when fixed burst.
> +  Allowable range is 0x00-0x3F. This field is valid only when fixed burst is
> +  enabled, otherwise ignored.
> +- samsung,adv-addr-mode: Boolean, Program the DMA to use Enhanced address 
> mode.
> +- samsung,force-thresh-dma-mode: Boolean, Force DMA to use the threshold mode
> +  for both tx and rx
> +- samsung,force-sf-dma-mode: Boolean, Force DMA to use the Store and Forward
> +  mode for both tx and rx. This flag is ignored if force-thresh-dma-mode is 
> set.
> +- samsung,phy-addr: Integer, Address of the PHY attached with SXGBE.

Please don't use a custom property for that, use a phy-handle which
points to an ePAPR compliant Ethernet PHY device tree node as
described in Documentation/devicetree/bindings/net/phy.txt.

> +
> +Optional properties:
> +- mac-address: 6 bytes, mac address

Did you intend to use 'local-mac-address'. 'mac-address' is described
by ePAPR as:

"Specifies the MAC address that was last used by the boot program.
This property should be
used in cases where the MAC address assigned to the device by the boot
program is different
from the local-mac-address property. This property shall be used only
if the value differs
from local-mac-address property value."

Does your bootloader really do something which falls into that
description? If not, use 'local-mac-address'.

> +
> +Example:
> +
> +   aliases {
> +   ethernet0 = <&sxgbe0>;
> +   };
> +
> +   sxgbe0: ethernet@1a04 {
> +   compatible = "samsung,sxgbe-v2.0a";
> +   reg = <0 0x1a04 0 0x1>;
> +   interrupt-parent = <&gic>;
> +   interrupts = <0 209 4>, <0 185 4>, <0 186 4>, <0 187 4>,
> +<0 188 4>, <0 189 4>, <0 190 4>, <0 191 4>,
> +<0 192 4>, <0 193 4>, <0 194 4>, <0 195 4>,
> +<0 196 4>, <0 197 4>, <0 198 4>, <0 199 4>,
> +<0 200 4>, <0 201 4>, <0 202 4>, <0 203 4>,
> +<0 204 4>, <0 205 4>, <0 206 4>, <0 207 4>,
> +<0 208 4>, <0 210 4>;
> +   mac-address = []; /* Filled in by U-Boot */

The preferred way to format this is:
mac-address = [ 00 00 00 00 00 00 ];
even better is something directly usable in case people copy/paste
this example such as 00 11 22 33 44 55.

> +   phy-mode = "xaui";

Your example is lacking a corresponding Ethernet PHY address/node.
--
Florian
--
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 V5 2/8] net: sxgbe: add basic framework for Samsung 10Gb ethernet driver

2014-03-18 Thread Florian Fainelli
2014-03-18 11:19 GMT-07:00 Byungho An :
> From: Siva Reddy 
>
> This patch adds support for Samsung 10Gb ethernet driver(sxgbe).
>
> - sxgbe core initialization
> - Tx and Rx support
> - MDIO support
> - ISRs for Tx and Rx
> - ifconfig support to driver

Too many files to review at once, the diffstat was around 5000+ lines!
You should split this into logical parts, or just submit the basic
bits for now and add the features later.

[snip]

> +   ret = register_netdev(ndev);
> +   if (ret) {
> +   pr_err("%s: ERROR %i registering the device\n", __func__, 
> ret);
> +   goto error_netdev_register;
> +   }
> +
> +   priv->sxgbe_clk = clk_get(priv->device, SXGBE_RESOURCE_NAME);
> +   if (IS_ERR(priv->sxgbe_clk)) {
> +   netdev_warn(ndev, "%s: warning: cannot get CSR clock\n",
> +   __func__);
> +   goto error_clk_get;
> +   }

This is racy, after register_netdev() is called, the network stack is
free to use the interface, which means that as much as possible needs
to be initialized before you call it, including clocks, and MDIO.

> +
> +   /* If a specific clk_csr value is passed from the platform
> +* this means that the CSR Clock Range selection cannot be
> +* changed at run-time and it is fixed. Viceversa the driver'll try to
> +* set the MDC clock dynamically according to the csr actual
> +* clock input.
> +*/
> +   if (!priv->plat->clk_csr)
> +   sxgbe_clk_csr_set(priv);
> +   else
> +   priv->clk_csr = priv->plat->clk_csr;
> +
> +   /* MDIO bus Registration */
> +   ret = sxgbe_mdio_register(ndev);
> +   if (ret < 0) {
> +   netdev_dbg(ndev, "%s: MDIO bus (id: %d) registration 
> failed\n",
> +  __func__, priv->plat->bus_id);
> +   goto error_mdio_register;
> +   }

Don't do this, register your MDIO bus before calling register_netdev().

> +
> +   sxgbe_check_ether_addr(priv);
> +
> +   return priv;
> +
> +error_mdio_register:
> +   clk_put(priv->sxgbe_clk);
> +error_clk_get:
> +   unregister_netdev(ndev);
> +error_netdev_register:
> +   netif_napi_del(&priv->napi);
> +error_free_netdev:
> +   free_netdev(ndev);
> +
> +   return NULL;
> +}
> +
> +/**
> + * sxgbe_dvr_remove
> + * @ndev: net device pointer
> + * Description: this function resets the TX/RX processes, disables the MAC 
> RX/TX
> + * changes the link status, releases the DMA descriptor rings.
> + */
> +int sxgbe_dvr_remove(struct net_device *ndev)
> +{
> +   struct sxgbe_priv_data *priv = netdev_priv(ndev);
> +
> +   netdev_info(ndev, "%s: removing driver\n", __func__);
> +
> +   priv->hw->dma->stop_rx(priv->ioaddr, SXGBE_RX_QUEUES);
> +   priv->hw->dma->stop_tx(priv->ioaddr, SXGBE_TX_QUEUES);
> +
> +   priv->hw->mac->enable_tx(priv->ioaddr, false);
> +   priv->hw->mac->enable_rx(priv->ioaddr, false);
> +
> +   netif_napi_del(&priv->napi);
> +
> +   sxgbe_mdio_unregister(ndev);
> +
> +   netif_carrier_off(ndev);

This is not required, both the PHY library and the network stack will
do that for you.

[snip]

> +   /* register with kernel subsystem */
> +   err = mdiobus_register(mdio_bus);
> +   if (err != 0) {
> +   netdev_err(ndev, "mdiobus register failed\n");
> +   goto mdiobus_err;
> +   }
> +
> +   for (phy_addr = 0; phy_addr < PHY_MAX_ADDR; phy_addr++) {
> +   struct phy_device *phy = mdio_bus->phy_map[phy_addr];
> +   if (phy) {
> +   char irq_num[4];
> +   char *irq_str;
> +   /* If an IRQ was provided to be assigned after
> +* the bus probe, do it here.
> +*/
> +   if ((mdio_data->irqs == NULL) &&
> +   (mdio_data->probed_phy_irq > 0)) {
> +   irqlist[phy_addr] = mdio_data->probed_phy_irq;
> +   phy->irq = mdio_data->probed_phy_irq;
> +   }
> +
> +   /* If we're  going to bind the MAC to this PHY bus,
> +* and no PHY number was provided to the MAC,
> +* use the one probed here.
> +*/
> +   if (priv->plat->phy_addr == -1)
> +   priv->plat->phy_addr = phy_addr;
> +
> +   act = (priv->plat->phy_addr == phy_addr);
> +   switch (phy->irq) {
> +   case PHY_POLL:
> +   irq_str = "POLL";
> +   break;
> +   case PHY_IGNORE_INTERRUPT:
> +   irq_str = "IGNORE";
> +   break;
> +   default:
> +

Re: [PATCH V5 2/8] net: sxgbe: add basic framework for Samsung 10Gb ethernet driver

2014-03-18 Thread Joe Perches
On Tue, 2014-03-18 at 11:19 -0700, Byungho An wrote:
> From: Siva Reddy 
> 
> This patch adds support for Samsung 10Gb ethernet driver(sxgbe).

More trivia, nothing that should stop this from
being applied and updated later...

> diff --git a/drivers/net/ethernet/samsung/sxgbe/sxgbe_mdio.c 
> b/drivers/net/ethernet/samsung/sxgbe/sxgbe_mdio.c
[]
> +static int sxgbe_mdio_busy_wait(void __iomem *ioaddr, unsigned int mii_data)
> +{
> + unsigned long cur_time;
> + unsigned long fin_time = jiffies + 3 * HZ; /* 30 ms */

This is actually 3 seconds.
If this should be 30ms, then use msecs_to_jiffies(30)

> +
> + do {
> + cur_time = jiffies;
> + if (readl(ioaddr + mii_data) & SXGBE_MII_BUSY)
> + cpu_relax();
> + else
> + return 0;
> + } while (!time_after_eq(cur_time, fin_time));
> +
> + return -EBUSY;
> +}

This may be clearer as

unsigned long fin_time = jiffies + msecs_to_jiffies(30);
 
while (!time_after(jiffies, fin_time))
if (!(readl(ioaddr + mii_data) & SXGBE_MII_BUSY))
return 0;
cpu_relax();
}

return -EBUSY;


--
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 v3 2/3] mfd: sec-core: Add of_compatible strings for clock MFD cells

2014-03-18 Thread Lee Jones
> Add of_compatible strings for S5M8767 and S2MPS14 clock MFD cells.
> 
> Signed-off-by: Krzysztof Kozlowski 
> ---
>  drivers/mfd/sec-core.c |3 +++
>  1 file changed, 3 insertions(+)

Applied with Tomasz' Reviewed-by.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
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 v3 3/3] Documentation: mfd: s2mps11: Describe S5M8767 and S2MPS14 clocks

2014-03-18 Thread Lee Jones
> Add bindings documentation for clocks on S5M8767 and S2MPS14 devices.
> 
> Signed-off-by: Krzysztof Kozlowski 
> Cc: Tomasz Figa 
> Cc: devicet...@vger.kernel.org
> Cc: Rob Herring 
> Cc: Pawel Moll 
> Cc: Mark Rutland 
> Cc: Ian Campbell 
> Cc: Kumar Gala 
> Reviewed-by: Tomasz Figa 
> ---
>  Documentation/devicetree/bindings/mfd/s2mps11.txt |   24 
> +
>  1 file changed, 15 insertions(+), 9 deletions(-)

Applied, thanks.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
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 V5 2/8] net: sxgbe: add basic framework for Samsung 10Gb ethernet driver

2014-03-18 Thread Byungho An

Joe Perches  wrote : 
> On Tue, 2014-03-18 at 11:19 -0700, Byungho An wrote:
> > From: Siva Reddy 
> >
> > This patch adds support for Samsung 10Gb ethernet driver(sxgbe).
> 
> More trivia, nothing that should stop this from being applied and updated
> later...
> 
> > diff --git a/drivers/net/ethernet/samsung/sxgbe/sxgbe_mdio.c
> > b/drivers/net/ethernet/samsung/sxgbe/sxgbe_mdio.c
> []
> > +static int sxgbe_mdio_busy_wait(void __iomem *ioaddr, unsigned int
> > +mii_data) {
> > +   unsigned long cur_time;
> > +   unsigned long fin_time = jiffies + 3 * HZ; /* 30 ms */
> 
> This is actually 3 seconds.
> If this should be 30ms, then use msecs_to_jiffies(30)
This is a typo, comment will be changed to "3 sec".

> 
> > +
> > +   do {
> > +   cur_time = jiffies;
> > +   if (readl(ioaddr + mii_data) & SXGBE_MII_BUSY)
> > +   cpu_relax();
> > +   else
> > +   return 0;
> > +   } while (!time_after_eq(cur_time, fin_time));
> > +
> > +   return -EBUSY;
> > +}
> 
> This may be clearer as
> 
>   unsigned long fin_time = jiffies + msecs_to_jiffies(30);
> 
>   while (!time_after(jiffies, fin_time))
>   if (!(readl(ioaddr + mii_data) & SXGBE_MII_BUSY))
>   return 0;
>   cpu_relax();
>   }
> 
>   return -EBUSY;
OK.

--
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 V5 1/8] sxgbe: Add device-tree binding support document

2014-03-18 Thread Byungho An
Florian Fainelli  wrote :
> 2014-03-18 11:19 GMT-07:00 Byungho An :
> > From: Siva Reddy 
> >
> > This patch adds binding document for SXGBE ethernet driver via device-tree.
> >
> > Signed-off-by: Siva Reddy Kallam 
> > Signed-off-by: Byungho An 
> > ---
> >  .../devicetree/bindings/net/samsung-sxgbe.txt  |   52 
> > 
> >  1 file changed, 52 insertions(+)
> >  create mode 100644
> > Documentation/devicetree/bindings/net/samsung-sxgbe.txt
> >
> > diff --git a/Documentation/devicetree/bindings/net/samsung-sxgbe.txt
> > b/Documentation/devicetree/bindings/net/samsung-sxgbe.txt
> > new file mode 100644
> > index 000..340eff6
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/net/samsung-sxgbe.txt
> > @@ -0,0 +1,52 @@
> > +* Samsung 10G Ethernet driver (SXGBE)
> > +
> > +Required properties:
> > +- compatible: Should be "samsung,sxgbe-v2.0a"
> > +- reg: Address and length of the register set for the device
> > +- interrupt-parent: Should be the phandle for the interrupt
> > +controller
> > +  that services interrupts for this device
> > +- interrupts: Should contain the SXGBE interrupts
> > +  These interrupts are ordered by fixed and follows variable
> > +  trasmit DMA interrupts, receive DMA interrupts and lpi interrupt.
> > +  index 0 - this is fixed common interrupt of SXGBE and it is always
> > +  available.
> > +  index 1 to 25 - 8 variable trasmit interrupts, variable 16 receive
> > +interrupts
> > +  and 1 optional lpi interrupt.
> > +- phy-mode: String, operation mode of the PHY interface.
> 
> You should reference
> Documentation/devicetree/bindings/net/ethernet.txt which is more thorough 
> about what this is about.
OK.

> 
> > +  Supported values are: "xaui", "gmii".
> 
> xaui is not documented in
> Documentation/devicetree/bindings/net/ethernet.txt, nor is it supported in 
> include/linux/phy.h and drivers/of/of_net.c, that should
> be part of the patchset.
OK.  It will be changed to xgmii and xaui support patch will be posted later.

> 
> > +- samsung,pbl: Integer, Programmable Burst Length.
> > +  Supported values are 1, 2, 4, 8, 16, or 32.
> > +- samsung,burst-map: Integer, Program the possible bursts supported
> > +by sxgbe
> > +  This is an interger and represents allowable DMA bursts when fixed burst.
> > +  Allowable range is 0x00-0x3F. This field is valid only when fixed
> > +burst is
> > +  enabled, otherwise ignored.
> > +- samsung,adv-addr-mode: Boolean, Program the DMA to use Enhanced address 
> > mode.
> > +- samsung,force-thresh-dma-mode: Boolean, Force DMA to use the
> > +threshold mode
> > +  for both tx and rx
> > +- samsung,force-sf-dma-mode: Boolean, Force DMA to use the Store and
> > +Forward
> > +  mode for both tx and rx. This flag is ignored if force-thresh-dma-mode 
> > is set.
> > +- samsung,phy-addr: Integer, Address of the PHY attached with SXGBE.
> 
> Please don't use a custom property for that, use a phy-handle which points to 
> an ePAPR compliant Ethernet PHY device tree node as
> described in Documentation/devicetree/bindings/net/phy.txt.
OK.

> 
> > +
> > +Optional properties:
> > +- mac-address: 6 bytes, mac address
> 
> Did you intend to use 'local-mac-address'. 'mac-address' is described by 
> ePAPR as:
> 
> "Specifies the MAC address that was last used by the boot program.
> This property should be
> used in cases where the MAC address assigned to the device by the boot 
> program is different from the local-mac-address property.
> This property shall be used only if the value differs from local-mac-address 
> property value."
> 
> Does your bootloader really do something which falls into that description? 
> If not, use 'local-mac-address'.
In my case, bootloader assigns mac address so mac-address is suitable according 
to Documentation/devicetree/binings/net/ethernet.txt.

> 
> > +
> > +Example:
> > +
> > +   aliases {
> > +   ethernet0 = <&sxgbe0>;
> > +   };
> > +
> > +   sxgbe0: ethernet@1a04 {
> > +   compatible = "samsung,sxgbe-v2.0a";
> > +   reg = <0 0x1a04 0 0x1>;
> > +   interrupt-parent = <&gic>;
> > +   interrupts = <0 209 4>, <0 185 4>, <0 186 4>, <0 187 4>,
> > +<0 188 4>, <0 189 4>, <0 190 4>, <0 191 4>,
> > +<0 192 4>, <0 193 4>, <0 194 4>, <0 195 4>,
> > +<0 196 4>, <0 197 4>, <0 198 4>, <0 199 4>,
> > +<0 200 4>, <0 201 4>, <0 202 4>, <0 203 4>,
> > +<0 204 4>, <0 205 4>, <0 206 4>, <0 207 4>,
> > +<0 208 4>, <0 210 4>;
> > +   mac-address = []; /* Filled in by U-Boot
> > + */
> 
> The preferred way to format this is:
> mac-address = [ 00 00 00 00 00 00 ]; even better is 
> something directly usable in case people copy/paste this example such as
> 00 11 22 33 44 55.
OK.

> 
> > +   phy-mode = "xaui";
> 

RE: [PATCH V5 2/8] net: sxgbe: add basic framework for Samsung 10Gb ethernet driver

2014-03-18 Thread Byungho An
Florian Fainelli  wrote:
> 2014-03-18 11:19 GMT-07:00 Byungho An :
> > From: Siva Reddy 
> >
> > This patch adds support for Samsung 10Gb ethernet driver(sxgbe).
> >
> > - sxgbe core initialization
> > - Tx and Rx support
> > - MDIO support
> > - ISRs for Tx and Rx
> > - ifconfig support to driver
> 
> Too many files to review at once, the diffstat was around 5000+ lines!
> You should split this into logical parts, or just submit the basic bits for 
> now and
> add the features later.
Yes. but I think it is one logically, after this patch there won't be much code 
at once.

> 
> [snip]
> 
> > +   ret = register_netdev(ndev);
> > +   if (ret) {
> > +   pr_err("%s: ERROR %i registering the device\n", __func__, 
> > ret);
> > +   goto error_netdev_register;
> > +   }
> > +
> > +   priv->sxgbe_clk = clk_get(priv->device, SXGBE_RESOURCE_NAME);
> > +   if (IS_ERR(priv->sxgbe_clk)) {
> > +   netdev_warn(ndev, "%s: warning: cannot get CSR clock\n",
> > +   __func__);
> > +   goto error_clk_get;
> > +   }
> 
> This is racy, after register_netdev() is called, the network stack is free to 
> use
> the interface, which means that as much as possible needs to be initialized
> before you call it, including clocks, and MDIO.
> 
> > +
> > +   /* If a specific clk_csr value is passed from the platform
> > +* this means that the CSR Clock Range selection cannot be
> > +* changed at run-time and it is fixed. Viceversa the driver'll try 
> > to
> > +* set the MDC clock dynamically according to the csr actual
> > +* clock input.
> > +*/
> > +   if (!priv->plat->clk_csr)
> > +   sxgbe_clk_csr_set(priv);
> > +   else
> > +   priv->clk_csr = priv->plat->clk_csr;
> > +
> > +   /* MDIO bus Registration */
> > +   ret = sxgbe_mdio_register(ndev);
> > +   if (ret < 0) {
> > +   netdev_dbg(ndev, "%s: MDIO bus (id: %d) registration 
> > failed\n",
> > +  __func__, priv->plat->bus_id);
> > +   goto error_mdio_register;
> > +   }
> 
> Don't do this, register your MDIO bus before calling register_netdev().
OK.

> 
> > +
> > +   sxgbe_check_ether_addr(priv);
> > +
> > +   return priv;
> > +
> > +error_mdio_register:
> > +   clk_put(priv->sxgbe_clk);
> > +error_clk_get:
> > +   unregister_netdev(ndev);
> > +error_netdev_register:
> > +   netif_napi_del(&priv->napi);
> > +error_free_netdev:
> > +   free_netdev(ndev);
> > +
> > +   return NULL;
> > +}
> > +
> > +/**
> > + * sxgbe_dvr_remove
> > + * @ndev: net device pointer
> > + * Description: this function resets the TX/RX processes, disables
> > +the MAC RX/TX
> > + * changes the link status, releases the DMA descriptor rings.
> > + */
> > +int sxgbe_dvr_remove(struct net_device *ndev) {
> > +   struct sxgbe_priv_data *priv = netdev_priv(ndev);
> > +
> > +   netdev_info(ndev, "%s: removing driver\n", __func__);
> > +
> > +   priv->hw->dma->stop_rx(priv->ioaddr, SXGBE_RX_QUEUES);
> > +   priv->hw->dma->stop_tx(priv->ioaddr, SXGBE_TX_QUEUES);
> > +
> > +   priv->hw->mac->enable_tx(priv->ioaddr, false);
> > +   priv->hw->mac->enable_rx(priv->ioaddr, false);
> > +
> > +   netif_napi_del(&priv->napi);
> > +
> > +   sxgbe_mdio_unregister(ndev);
> > +
> > +   netif_carrier_off(ndev);
> 
> This is not required, both the PHY library and the network stack will do that 
> for
> you.
You mean netif_napi_del and netif_carrier_off? or all of sxgbe_dvr_remove 
function?
I think dma/mac control are needed.

> 
> [snip]
> 
> > +   /* register with kernel subsystem */
> > +   err = mdiobus_register(mdio_bus);
> > +   if (err != 0) {
> > +   netdev_err(ndev, "mdiobus register failed\n");
> > +   goto mdiobus_err;
> > +   }
> > +
> > +   for (phy_addr = 0; phy_addr < PHY_MAX_ADDR; phy_addr++) {
> > +   struct phy_device *phy = mdio_bus->phy_map[phy_addr];
> > +   if (phy) {
> > +   char irq_num[4];
> > +   char *irq_str;
> > +   /* If an IRQ was provided to be assigned after
> > +* the bus probe, do it here.
> > +*/
> > +   if ((mdio_data->irqs == NULL) &&
> > +   (mdio_data->probed_phy_irq > 0)) {
> > +   irqlist[phy_addr] = 
> > mdio_data->probed_phy_irq;
> > +   phy->irq = mdio_data->probed_phy_irq;
> > +   }
> > +
> > +   /* If we're  going to bind the MAC to this PHY bus,
> > +* and no PHY number was provided to the MAC,
> > +* use the one probed here.
> > +*/
> > +   if (priv->plat->phy_addr == -1)
> > + 

Re: [PATCH V5 2/8] net: sxgbe: add basic framework for Samsung 10Gb ethernet driver

2014-03-18 Thread Florian Fainelli
2014-03-18 15:16 GMT-07:00 Byungho An :
> Florian Fainelli  wrote:
>> 2014-03-18 11:19 GMT-07:00 Byungho An :
>> > From: Siva Reddy 
>> >
>> > This patch adds support for Samsung 10Gb ethernet driver(sxgbe).
>> >
>> > - sxgbe core initialization
>> > - Tx and Rx support
>> > - MDIO support
>> > - ISRs for Tx and Rx
>> > - ifconfig support to driver
>>
>> Too many files to review at once, the diffstat was around 5000+ lines!
>> You should split this into logical parts, or just submit the basic bits for 
>> now and
>> add the features later.
> Yes. but I think it is one logically, after this patch there won't be much 
> code at once.

Since you are adding multiple objects to the Makefile at once, you
could very well split the patches to reflect that and submit one
object as a separate patch. Also, sometimes, even if the driver is
feature complete, it helps submitting the basic support first, and
then start adding new features to it progressively.

>
>>
>> [snip]
>>
>> > +   ret = register_netdev(ndev);
>> > +   if (ret) {
>> > +   pr_err("%s: ERROR %i registering the device\n", __func__, 
>> > ret);
>> > +   goto error_netdev_register;
>> > +   }
>> > +
>> > +   priv->sxgbe_clk = clk_get(priv->device, SXGBE_RESOURCE_NAME);
>> > +   if (IS_ERR(priv->sxgbe_clk)) {
>> > +   netdev_warn(ndev, "%s: warning: cannot get CSR clock\n",
>> > +   __func__);
>> > +   goto error_clk_get;
>> > +   }
>>
>> This is racy, after register_netdev() is called, the network stack is free 
>> to use
>> the interface, which means that as much as possible needs to be initialized
>> before you call it, including clocks, and MDIO.
>>
>> > +
>> > +   /* If a specific clk_csr value is passed from the platform
>> > +* this means that the CSR Clock Range selection cannot be
>> > +* changed at run-time and it is fixed. Viceversa the driver'll 
>> > try to
>> > +* set the MDC clock dynamically according to the csr actual
>> > +* clock input.
>> > +*/
>> > +   if (!priv->plat->clk_csr)
>> > +   sxgbe_clk_csr_set(priv);
>> > +   else
>> > +   priv->clk_csr = priv->plat->clk_csr;
>> > +
>> > +   /* MDIO bus Registration */
>> > +   ret = sxgbe_mdio_register(ndev);
>> > +   if (ret < 0) {
>> > +   netdev_dbg(ndev, "%s: MDIO bus (id: %d) registration 
>> > failed\n",
>> > +  __func__, priv->plat->bus_id);
>> > +   goto error_mdio_register;
>> > +   }
>>
>> Don't do this, register your MDIO bus before calling register_netdev().
> OK.
>
>>
>> > +
>> > +   sxgbe_check_ether_addr(priv);
>> > +
>> > +   return priv;
>> > +
>> > +error_mdio_register:
>> > +   clk_put(priv->sxgbe_clk);
>> > +error_clk_get:
>> > +   unregister_netdev(ndev);
>> > +error_netdev_register:
>> > +   netif_napi_del(&priv->napi);
>> > +error_free_netdev:
>> > +   free_netdev(ndev);
>> > +
>> > +   return NULL;
>> > +}
>> > +
>> > +/**
>> > + * sxgbe_dvr_remove
>> > + * @ndev: net device pointer
>> > + * Description: this function resets the TX/RX processes, disables
>> > +the MAC RX/TX
>> > + * changes the link status, releases the DMA descriptor rings.
>> > + */
>> > +int sxgbe_dvr_remove(struct net_device *ndev) {
>> > +   struct sxgbe_priv_data *priv = netdev_priv(ndev);
>> > +
>> > +   netdev_info(ndev, "%s: removing driver\n", __func__);
>> > +
>> > +   priv->hw->dma->stop_rx(priv->ioaddr, SXGBE_RX_QUEUES);
>> > +   priv->hw->dma->stop_tx(priv->ioaddr, SXGBE_TX_QUEUES);
>> > +
>> > +   priv->hw->mac->enable_tx(priv->ioaddr, false);
>> > +   priv->hw->mac->enable_rx(priv->ioaddr, false);
>> > +
>> > +   netif_napi_del(&priv->napi);
>> > +
>> > +   sxgbe_mdio_unregister(ndev);
>> > +
>> > +   netif_carrier_off(ndev);
>>
>> This is not required, both the PHY library and the network stack will do 
>> that for
>> you.
> You mean netif_napi_del and netif_carrier_off? or all of sxgbe_dvr_remove 
> function?
> I think dma/mac control are needed.

I mean netif_carrier_off() is not required, everything else is.

>
>>
>> [snip]
>>
>> > +   /* register with kernel subsystem */
>> > +   err = mdiobus_register(mdio_bus);
>> > +   if (err != 0) {
>> > +   netdev_err(ndev, "mdiobus register failed\n");
>> > +   goto mdiobus_err;
>> > +   }
>> > +
>> > +   for (phy_addr = 0; phy_addr < PHY_MAX_ADDR; phy_addr++) {
>> > +   struct phy_device *phy = mdio_bus->phy_map[phy_addr];
>> > +   if (phy) {
>> > +   char irq_num[4];
>> > +   char *irq_str;
>> > +   /* If an IRQ was provided to be assigned after
>> > +* the bus probe, do it here.
>> > +*/
>> > +   if ((mdio_data->irqs == NULL) &&
>> > +  

Re: [PATCH v11 10/27] iommu/exynos: use managed device helper functions

2014-03-18 Thread Jingoo Han
On Wednesday, March 19, 2014 12:12 AM, Tomasz Figa wrote:
> On 18.03.2014 11:38, Cho KyongHo wrote:
> > On Fri, 14 Mar 2014 14:28:36 +0100, Tomasz Figa wrote:
> >> On 14.03.2014 06:05, Cho KyongHo wrote:
> >>> This patch uses managed device helper functions in the probe().
> >>>
> >>> Signed-off-by: Cho KyongHo 
> >>> ---
> >>>drivers/iommu/exynos-iommu.c |   64 
> >>> +-
> >>>1 file changed, 26 insertions(+), 38 deletions(-)
> >>>
> >>> diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c
> >>> index 36e6b73..33b424d 100644
> >>> --- a/drivers/iommu/exynos-iommu.c
> >>> +++ b/drivers/iommu/exynos-iommu.c

[.]

> >>>   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> >>>   if (!res) {
> >>> - dev_dbg(dev, "Unable to find IOMEM region\n");
> >>> - ret = -ENOENT;
> >>> - goto err_init;
> >>> + dev_err(dev, "Unable to find IOMEM region\n");
> >>> + return -ENOENT;
> >>>   }
> >>
> >> No need to check for error and print message, because
> >> devm_ioremap_resource() already checks the passed resource and handles
> >> error cases.
> >>
> >
> > Yes but devm_ioremap_resource() just tells that the given 'res' is not
> > correct. I think the message in the driver is more informative.
> 
> The common practice used in Linux kernel is to not duplicate such
> messages. It is obvious that devm_ioremap_resource() printing such
> message is related to an IOMEM resource anyway, as you can't used it
> with other types of resources.

+1

I agree with Tomasz Figa's opinion.
These messages have been being removed from Linux kernel.
Thank you.

Best regards,
Jingoo Han

--
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 v3 1/3] clk: s2mps11: Add support for S2MPS14 clocks

2014-03-18 Thread Mike Turquette
Quoting Krzysztof Kozlowski (2014-03-17 02:19:16)
> This patch adds support for S2MPS14 PMIC clocks (BT and AP) to the
> s2mps11 clock driver.
> 
> Signed-off-by: Krzysztof Kozlowski 
> Reviewed-by: Yadwinder Singh Brar 
> Reviewed-by: Tomasz Figa 

This does not apply cleanly to to clk tree trip, nor does it compile
after manually merging due to changes introducing
linux/mfd/samsung/s2mps14.h.

The changes look OK to me so maybe Lee can take it with my Ack?

Acked-by: Mike Turquette 

Regards,
Mike

> ---
>  drivers/clk/Kconfig   |8 +++---
>  drivers/clk/clk-s2mps11.c |   61 
> ++---
>  2 files changed, 50 insertions(+), 19 deletions(-)
> 
> diff --git a/drivers/clk/Kconfig b/drivers/clk/Kconfig
> index 6f56d3a4f010..8f9ce8ba036d 100644
> --- a/drivers/clk/Kconfig
> +++ b/drivers/clk/Kconfig
> @@ -65,12 +65,12 @@ config COMMON_CLK_SI570
>   clock generators.
>  
>  config COMMON_CLK_S2MPS11
> -   tristate "Clock driver for S2MPS11/S5M8767 MFD"
> +   tristate "Clock driver for S2MPS1X/S5M8767 MFD"
> depends on MFD_SEC_CORE
> ---help---
> - This driver supports S2MPS11/S5M8767 crystal oscillator clock. These
> - multi-function devices have 3 fixed-rate oscillators, clocked at
> - 32KHz each.
> + This driver supports S2MPS11/S2MPS14/S5M8767 crystal oscillator
> + clock. These multi-function devices have two (S2MPS14) or three
> + (S2MPS11, S5M8767) fixed-rate oscillators, clocked at 32KHz each.
>  
>  config CLK_TWL6040
> tristate "External McPDM functional clock from twl6040"
> diff --git a/drivers/clk/clk-s2mps11.c b/drivers/clk/clk-s2mps11.c
> index 508875535e1e..8dafb552274f 100644
> --- a/drivers/clk/clk-s2mps11.c
> +++ b/drivers/clk/clk-s2mps11.c
> @@ -1,7 +1,7 @@
>  /*
>   * clk-s2mps11.c - Clock driver for S2MPS11.
>   *
> - * Copyright (C) 2013 Samsung Electornics
> + * Copyright (C) 2013,2014 Samsung Electornics
>   *
>   * This program is free software; you can redistribute  it and/or modify it
>   * under  the terms of  the GNU General  Public License as published by the
> @@ -13,10 +13,6 @@
>   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>   * GNU General Public License for more details.
>   *
> - * You should have received a copy of the GNU General Public License
> - * along with this program; if not, write to the Free Software
> - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
> - *
>   */
>  
>  #include 
> @@ -27,6 +23,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  
> @@ -125,7 +122,21 @@ static struct clk_init_data 
> s2mps11_clks_init[S2MPS11_CLKS_NUM] = {
> },
>  };
>  
> -static struct device_node *s2mps11_clk_parse_dt(struct platform_device *pdev)
> +static struct clk_init_data s2mps14_clks_init[S2MPS11_CLKS_NUM] = {
> +   [S2MPS11_CLK_AP] = {
> +   .name = "s2mps14_ap",
> +   .ops = &s2mps11_clk_ops,
> +   .flags = CLK_IS_ROOT,
> +   },
> +   [S2MPS11_CLK_BT] = {
> +   .name = "s2mps14_bt",
> +   .ops = &s2mps11_clk_ops,
> +   .flags = CLK_IS_ROOT,
> +   },
> +};
> +
> +static struct device_node *s2mps11_clk_parse_dt(struct platform_device *pdev,
> +   struct clk_init_data *clks_init)
>  {
> struct sec_pmic_dev *iodev = dev_get_drvdata(pdev->dev.parent);
> struct device_node *clk_np;
> @@ -145,9 +156,12 @@ static struct device_node *s2mps11_clk_parse_dt(struct 
> platform_device *pdev)
> if (!clk_table)
> return ERR_PTR(-ENOMEM);
>  
> -   for (i = 0; i < S2MPS11_CLKS_NUM; i++)
> +   for (i = 0; i < S2MPS11_CLKS_NUM; i++) {
> +   if (!clks_init[i].name)
> +   continue; /* Skip clocks not present in some devices 
> */
> of_property_read_string_index(clk_np, "clock-output-names", i,
> -   &s2mps11_clks_init[i].name);
> +   &clks_init[i].name);
> +   }
>  
> return clk_np;
>  }
> @@ -158,6 +172,7 @@ static int s2mps11_clk_probe(struct platform_device *pdev)
> struct s2mps11_clk *s2mps11_clks, *s2mps11_clk;
> struct device_node *clk_np = NULL;
> unsigned int s2mps11_reg;
> +   struct clk_init_data *clks_init;
> int i, ret = 0;
> u32 val;
>  
> @@ -168,25 +183,33 @@ static int s2mps11_clk_probe(struct platform_device 
> *pdev)
>  
> s2mps11_clk = s2mps11_clks;
>  
> -   clk_np = s2mps11_clk_parse_dt(pdev);
> -   if (IS_ERR(clk_np))
> -   return PTR_ERR(clk_np);
> -
> switch (platform_get_device_id(pdev)->driver_data) {
> case S2MPS11X:
> s2mps11_reg = S2MPS11_REG_RTC_CTRL;
> +   clks_init = s2mps11_clks_init;
> +   break;
> +   case S2MPS14X:
> +   s2mps11_reg = 

Re: [PATCH v11 20/27] iommu/exynos: allow having multiple System MMUs for a master H/W

2014-03-18 Thread Cho KyongHo
On Tue, 18 Mar 2014 15:26:48 +0100, Tomasz Figa wrote:
> 
> 
> On 18.03.2014 14:01, Cho KyongHo wrote:
> > On Fri, 14 Mar 2014 17:12:03 +0100, Tomasz Figa wrote:
> >> Hi KyongHo,
> >>
> >> On 14.03.2014 06:10, Cho KyongHo wrote:
> >>> Some master device descriptor like fimc-is which is an abstraction
> >>> of very complex H/W may have multiple System MMUs. For those devices,
> >>> the design of the link between System MMU and its master H/W is needed
> >>> to be reconsidered.
> >>>
> >>> A link structure, sysmmu_list_data is introduced that provides a link
> >>> to master H/W and that has a pointer to the device descriptor of a
> >>> System MMU. Given a device descriptor of a master H/W, it is possible
> >>> to traverse all System MMUs that must be controlled along with the
> >>> master H/W.
> >>
> >> NAK.
> >>
> >> A device driver should handle particular hardware instances separately,
> >> without abstracting a virtual hardware instance consisting of multiple
> >> physical ones.
> >>
> >> If such abstraction is needed, it should be done above the exynos-iommu
> >> driver, e.g. by something like iommu-composite driver that would
> >> aggregate several IOMMUs. Keep in mind that such IOMMUs in a group could
> >> be different, e.g. different Exynos SysMMU versions or even completely
> >> different IPs handled by different drivers.
> >>
> >> Still, I don't think there is a real need for such abstraction. Instead,
> >> related drivers shall be fixed to properly handle multiple memory
> >> masters and their IOMMUs.
> >>
> >
> > G2D, Scalers and FIMD of Exynos5420 has 2 System MMUs while aother SoC like
> > Exynos5250 does not.
> >
> > I don't understand why you are negative to this approach.
> > This is the simplest than the others.
> >
> > Let me show you an example.
> > FIMC-IS driver just controls MCU in FIMC-IS subsystem and the firmware of
> > the MCU controls all other peripherals in the subsystem. Each peripherals
> > have their own System MMU. Moreover, the configuration of the peripherals
> > varies according to the SoCs.
> >
> > If System MMU driver accepts multiple masters, everything is done in DT.
> > But I worry that it is not easy if System MMU driver does not support
> > multiple masters.
> 
> I believe I have stated enough reasons why this kind of implementation 
> is bad. I'm not going to waste time repeating myself.
> 
> Your concerns presented above are valid, however they are not related to 
> what is wrong with this patch. I have given you two proper ways to 
> handle this, none should be forced upon particular IOMMU master drivers 
> - their authors should have the chance to select the method that works 
> best for them.
> 

I don't still understand why you think this patch is wrong.
I think this is the best way not to think for all the driver developers
about other things than their business logic.

This does not hurt anyone and I think this is good enough.

If you want to provide another layer between master device and system mmu
as you mentioned, you do that. This patch does not restrict it.

Regards,

KyongHo

--
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 v11 17/27] iommu/exynos: remove calls to Runtime PM API functions

2014-03-18 Thread Cho KyongHo
On Tue, 18 Mar 2014 16:09:50 +0100, Tomasz Figa wrote:
> On 18.03.2014 10:56, Cho KyongHo wrote:
> > On Fri, 14 Mar 2014 13:59:00 +0100, Tomasz Figa wrote:
> >> Hi KyongHo,
> >>
> >> On 14.03.2014 06:08, Cho KyongHo wrote:
> 
> [snip]
> 
> >>> -static bool __exynos_sysmmu_disable(struct sysmmu_drvdata *data)
> >>> +static void __sysmmu_disable_nocount(struct sysmmu_drvdata *data)
> >>
> >> If you are changing the names anyway, it would be probably a good idea
> >> to reduce code obfuscation a bit and drop the underscores from
> >> beginnings of function names. Also I'd suggest keeping the "exynos_" 
> >> prefix.
> >
> > Thanks for the suggestion.
> > __exynos_sysmmu_disable is splitted into 2 functions: __sysmmu_disable
> > and __sysmmu_disable_nocount.
> > I agree with you that it is good idea to reduce code obfuscation but
> > I don't think dropping beginning underscores of function names reduces
> > obfuscation.
> >
> 
> Well, if you are ending up with a function like 
> __sysmmu_enable_nocount() below with every line starting with two 
> underscores, do you think this improves code readability?
> 
> Of course this is a minor issue, but let's keep some code quality level 
> in Linux kernel.
> 

Ok. understood what your are concerning about.

> >>
> >>>{
> >>> - unsigned long flags;
> >>> - bool disabled = false;
> >>> -
> >>> - write_lock_irqsave(&data->lock, flags);
> 
> [snip]
> 
> Here's the function mentioned above:
> 
> >>> +
> >>> +static void __sysmmu_enable_nocount(struct sysmmu_drvdata *data)
> >>> +{
> >>> + __master_clk_enable(data);
> >>> + __sysmmu_clk_enable(data);
> >>> +
> >>> + __raw_writel(CTRL_BLOCK, data->sfrbase + REG_MMU_CTRL);
> >>> +
> >>> + __sysmmu_init_config(data);
> >>> +
> >>> + __sysmmu_set_ptbase(data->sfrbase, data->pgtable);
> >>> +
> >>> + __raw_writel(CTRL_ENABLE, data->sfrbase + REG_MMU_CTRL);
> >>> +
> >>> + __master_clk_disable(data);
> >>> +}
> >>> +
> 
> [snip]
> 
> >>>
> >>> @@ -629,7 +700,7 @@ err_pgtable:
> >>>static void exynos_iommu_domain_destroy(struct iommu_domain *domain)
> >>>{
> >>>   struct exynos_iommu_domain *priv = domain->priv;
> >>> - struct sysmmu_drvdata *data;
> >>> + struct exynos_iommu_owner *owner;
> >>>   unsigned long flags;
> >>>   int i;
> >>>
> >>> @@ -637,11 +708,14 @@ static void exynos_iommu_domain_destroy(struct 
> >>> iommu_domain *domain)
> >>>
> >>>   spin_lock_irqsave(&priv->lock, flags);
> >>>
> >>> - list_for_each_entry(data, &priv->clients, node) {
> >>> - while (!exynos_sysmmu_disable(data->dev))
> >>> + list_for_each_entry(owner, &priv->clients, client) {
> >>> + while (!exynos_sysmmu_disable(owner->dev))
> >>>   ; /* until System MMU is actually disabled */
> >>
> >> What about using list_for_each_entry_safe() and calling list_del_init()
> >> here directly?
> >>
> >
> > That require another variable to be defined.
> 
> Is it a problem?
> 
That is not a problem.
But I think using list_for_each_entry() is not a problem likewise.

> > I just wanted to avoid that because I think it is prettier.
> > Moreover, list_del_init() below the empty while() clause may make
> > the source code readers misunderstood..
> 
> This raises another question, why the loop above is even needed. 
> exynos_sysmmu_disable() should make sure that SYSMMU is actually 
> disabled, without any need for looping like this.

Some driver needs enabling sysmmu to be counted due to its complex structure.
It can be also removed by the driver with an extra effort
but the reality is important.
Device driver is not only for the scholarship but also for the real use.

> >>>   }
> >>>
> >>> + while (!list_empty(&priv->clients))
> >>> + list_del_init(priv->clients.next);
> >>> +
> >>>   spin_unlock_irqrestore(&priv->lock, flags);
> >>>
> >>>   for (i = 0; i < NUM_LV1ENTRIES; i++)
> 
> [snip]
> 
> >>> +static int sysmmu_hook_driver_register(struct notifier_block *nb,
> >>> + unsigned long val,
> >>> + void *p)
> >>> +{
> >>> + struct device *dev = p;
> >>> +
> >>> + switch (val) {
> >>> + case BUS_NOTIFY_BIND_DRIVER:
> >>> + {
> >>> + struct exynos_iommu_owner *owner;
> >>
> >> Please move this variable to the top of the function and drop the braces
> >> around case blocks.
> >
> > I don't think it is required because this function is modified
> > by the following patches.
> 
> OK, if so, and similar issue is not present after further patches.
> 
> >
> >>
> >>> +
> >>> + /* No System MMU assigned. See exynos_sysmmu_probe(). */
> >>> + if (dev->archdata.iommu == NULL)
> >>> + break;
> >>
> >> This looks strange... (see below)
> >>
> >> Also this looks racy. There are no guarantees about device probing
> >> order, so you may end up with master devices being probed before the
> >> IOMMUs. Deferred probing should be used to handle this correctly.
> >
> > 

Re: [PATCH v3 1/3] clk: s2mps11: Add support for S2MPS14 clocks

2014-03-18 Thread Mike Turquette
Quoting Krzysztof Kozlowski (2014-03-17 02:19:16)
> This patch adds support for S2MPS14 PMIC clocks (BT and AP) to the
> s2mps11 clock driver.
> 
> Signed-off-by: Krzysztof Kozlowski 
> Reviewed-by: Yadwinder Singh Brar 
> Reviewed-by: Tomasz Figa 

Taken into clk-next.

Regards,
Mike

> ---
>  drivers/clk/Kconfig   |8 +++---
>  drivers/clk/clk-s2mps11.c |   61 
> ++---
>  2 files changed, 50 insertions(+), 19 deletions(-)
> 
> diff --git a/drivers/clk/Kconfig b/drivers/clk/Kconfig
> index 6f56d3a4f010..8f9ce8ba036d 100644
> --- a/drivers/clk/Kconfig
> +++ b/drivers/clk/Kconfig
> @@ -65,12 +65,12 @@ config COMMON_CLK_SI570
>   clock generators.
>  
>  config COMMON_CLK_S2MPS11
> -   tristate "Clock driver for S2MPS11/S5M8767 MFD"
> +   tristate "Clock driver for S2MPS1X/S5M8767 MFD"
> depends on MFD_SEC_CORE
> ---help---
> - This driver supports S2MPS11/S5M8767 crystal oscillator clock. These
> - multi-function devices have 3 fixed-rate oscillators, clocked at
> - 32KHz each.
> + This driver supports S2MPS11/S2MPS14/S5M8767 crystal oscillator
> + clock. These multi-function devices have two (S2MPS14) or three
> + (S2MPS11, S5M8767) fixed-rate oscillators, clocked at 32KHz each.
>  
>  config CLK_TWL6040
> tristate "External McPDM functional clock from twl6040"
> diff --git a/drivers/clk/clk-s2mps11.c b/drivers/clk/clk-s2mps11.c
> index 508875535e1e..8dafb552274f 100644
> --- a/drivers/clk/clk-s2mps11.c
> +++ b/drivers/clk/clk-s2mps11.c
> @@ -1,7 +1,7 @@
>  /*
>   * clk-s2mps11.c - Clock driver for S2MPS11.
>   *
> - * Copyright (C) 2013 Samsung Electornics
> + * Copyright (C) 2013,2014 Samsung Electornics
>   *
>   * This program is free software; you can redistribute  it and/or modify it
>   * under  the terms of  the GNU General  Public License as published by the
> @@ -13,10 +13,6 @@
>   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>   * GNU General Public License for more details.
>   *
> - * You should have received a copy of the GNU General Public License
> - * along with this program; if not, write to the Free Software
> - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
> - *
>   */
>  
>  #include 
> @@ -27,6 +23,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  
> @@ -125,7 +122,21 @@ static struct clk_init_data 
> s2mps11_clks_init[S2MPS11_CLKS_NUM] = {
> },
>  };
>  
> -static struct device_node *s2mps11_clk_parse_dt(struct platform_device *pdev)
> +static struct clk_init_data s2mps14_clks_init[S2MPS11_CLKS_NUM] = {
> +   [S2MPS11_CLK_AP] = {
> +   .name = "s2mps14_ap",
> +   .ops = &s2mps11_clk_ops,
> +   .flags = CLK_IS_ROOT,
> +   },
> +   [S2MPS11_CLK_BT] = {
> +   .name = "s2mps14_bt",
> +   .ops = &s2mps11_clk_ops,
> +   .flags = CLK_IS_ROOT,
> +   },
> +};
> +
> +static struct device_node *s2mps11_clk_parse_dt(struct platform_device *pdev,
> +   struct clk_init_data *clks_init)
>  {
> struct sec_pmic_dev *iodev = dev_get_drvdata(pdev->dev.parent);
> struct device_node *clk_np;
> @@ -145,9 +156,12 @@ static struct device_node *s2mps11_clk_parse_dt(struct 
> platform_device *pdev)
> if (!clk_table)
> return ERR_PTR(-ENOMEM);
>  
> -   for (i = 0; i < S2MPS11_CLKS_NUM; i++)
> +   for (i = 0; i < S2MPS11_CLKS_NUM; i++) {
> +   if (!clks_init[i].name)
> +   continue; /* Skip clocks not present in some devices 
> */
> of_property_read_string_index(clk_np, "clock-output-names", i,
> -   &s2mps11_clks_init[i].name);
> +   &clks_init[i].name);
> +   }
>  
> return clk_np;
>  }
> @@ -158,6 +172,7 @@ static int s2mps11_clk_probe(struct platform_device *pdev)
> struct s2mps11_clk *s2mps11_clks, *s2mps11_clk;
> struct device_node *clk_np = NULL;
> unsigned int s2mps11_reg;
> +   struct clk_init_data *clks_init;
> int i, ret = 0;
> u32 val;
>  
> @@ -168,25 +183,33 @@ static int s2mps11_clk_probe(struct platform_device 
> *pdev)
>  
> s2mps11_clk = s2mps11_clks;
>  
> -   clk_np = s2mps11_clk_parse_dt(pdev);
> -   if (IS_ERR(clk_np))
> -   return PTR_ERR(clk_np);
> -
> switch (platform_get_device_id(pdev)->driver_data) {
> case S2MPS11X:
> s2mps11_reg = S2MPS11_REG_RTC_CTRL;
> +   clks_init = s2mps11_clks_init;
> +   break;
> +   case S2MPS14X:
> +   s2mps11_reg = S2MPS14_REG_RTCCTRL;
> +   clks_init = s2mps14_clks_init;
> break;
> case S5M8767X:
> s2mps11_reg = S5M8767_REG_CTRL1;
> +   clks_init = s2mps11_clks_init;

Re: [PATCH v3 1/3] clk: s2mps11: Add support for S2MPS14 clocks

2014-03-18 Thread Mike Turquette
On Tue, Mar 18, 2014 at 6:09 PM, Mike Turquette  wrote:
> Quoting Krzysztof Kozlowski (2014-03-17 02:19:16)
>> This patch adds support for S2MPS14 PMIC clocks (BT and AP) to the
>> s2mps11 clock driver.
>>
>> Signed-off-by: Krzysztof Kozlowski 
>> Reviewed-by: Yadwinder Singh Brar 
>> Reviewed-by: Tomasz Figa 
>
> Taken into clk-next.

Oops. Please disregard. My auto patch application script sent his by
accident. I have not applied this patches, as indicated in my previous
mail were I gave out an Ack.

Regards,
Mike

>
> Regards,
> Mike
>
>> ---
>>  drivers/clk/Kconfig   |8 +++---
>>  drivers/clk/clk-s2mps11.c |   61 
>> ++---
>>  2 files changed, 50 insertions(+), 19 deletions(-)
>>
>> diff --git a/drivers/clk/Kconfig b/drivers/clk/Kconfig
>> index 6f56d3a4f010..8f9ce8ba036d 100644
>> --- a/drivers/clk/Kconfig
>> +++ b/drivers/clk/Kconfig
>> @@ -65,12 +65,12 @@ config COMMON_CLK_SI570
>>   clock generators.
>>
>>  config COMMON_CLK_S2MPS11
>> -   tristate "Clock driver for S2MPS11/S5M8767 MFD"
>> +   tristate "Clock driver for S2MPS1X/S5M8767 MFD"
>> depends on MFD_SEC_CORE
>> ---help---
>> - This driver supports S2MPS11/S5M8767 crystal oscillator clock. 
>> These
>> - multi-function devices have 3 fixed-rate oscillators, clocked at
>> - 32KHz each.
>> + This driver supports S2MPS11/S2MPS14/S5M8767 crystal oscillator
>> + clock. These multi-function devices have two (S2MPS14) or three
>> + (S2MPS11, S5M8767) fixed-rate oscillators, clocked at 32KHz each.
>>
>>  config CLK_TWL6040
>> tristate "External McPDM functional clock from twl6040"
>> diff --git a/drivers/clk/clk-s2mps11.c b/drivers/clk/clk-s2mps11.c
>> index 508875535e1e..8dafb552274f 100644
>> --- a/drivers/clk/clk-s2mps11.c
>> +++ b/drivers/clk/clk-s2mps11.c
>> @@ -1,7 +1,7 @@
>>  /*
>>   * clk-s2mps11.c - Clock driver for S2MPS11.
>>   *
>> - * Copyright (C) 2013 Samsung Electornics
>> + * Copyright (C) 2013,2014 Samsung Electornics
>>   *
>>   * This program is free software; you can redistribute  it and/or modify it
>>   * under  the terms of  the GNU General  Public License as published by the
>> @@ -13,10 +13,6 @@
>>   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>>   * GNU General Public License for more details.
>>   *
>> - * You should have received a copy of the GNU General Public License
>> - * along with this program; if not, write to the Free Software
>> - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
>> - *
>>   */
>>
>>  #include 
>> @@ -27,6 +23,7 @@
>>  #include 
>>  #include 
>>  #include 
>> +#include 
>>  #include 
>>  #include 
>>
>> @@ -125,7 +122,21 @@ static struct clk_init_data 
>> s2mps11_clks_init[S2MPS11_CLKS_NUM] = {
>> },
>>  };
>>
>> -static struct device_node *s2mps11_clk_parse_dt(struct platform_device 
>> *pdev)
>> +static struct clk_init_data s2mps14_clks_init[S2MPS11_CLKS_NUM] = {
>> +   [S2MPS11_CLK_AP] = {
>> +   .name = "s2mps14_ap",
>> +   .ops = &s2mps11_clk_ops,
>> +   .flags = CLK_IS_ROOT,
>> +   },
>> +   [S2MPS11_CLK_BT] = {
>> +   .name = "s2mps14_bt",
>> +   .ops = &s2mps11_clk_ops,
>> +   .flags = CLK_IS_ROOT,
>> +   },
>> +};
>> +
>> +static struct device_node *s2mps11_clk_parse_dt(struct platform_device 
>> *pdev,
>> +   struct clk_init_data *clks_init)
>>  {
>> struct sec_pmic_dev *iodev = dev_get_drvdata(pdev->dev.parent);
>> struct device_node *clk_np;
>> @@ -145,9 +156,12 @@ static struct device_node *s2mps11_clk_parse_dt(struct 
>> platform_device *pdev)
>> if (!clk_table)
>> return ERR_PTR(-ENOMEM);
>>
>> -   for (i = 0; i < S2MPS11_CLKS_NUM; i++)
>> +   for (i = 0; i < S2MPS11_CLKS_NUM; i++) {
>> +   if (!clks_init[i].name)
>> +   continue; /* Skip clocks not present in some devices 
>> */
>> of_property_read_string_index(clk_np, "clock-output-names", 
>> i,
>> -   &s2mps11_clks_init[i].name);
>> +   &clks_init[i].name);
>> +   }
>>
>> return clk_np;
>>  }
>> @@ -158,6 +172,7 @@ static int s2mps11_clk_probe(struct platform_device 
>> *pdev)
>> struct s2mps11_clk *s2mps11_clks, *s2mps11_clk;
>> struct device_node *clk_np = NULL;
>> unsigned int s2mps11_reg;
>> +   struct clk_init_data *clks_init;
>> int i, ret = 0;
>> u32 val;
>>
>> @@ -168,25 +183,33 @@ static int s2mps11_clk_probe(struct platform_device 
>> *pdev)
>>
>> s2mps11_clk = s2mps11_clks;
>>
>> -   clk_np = s2mps11_clk_parse_dt(pdev);
>> -   if (IS_ERR(clk_np))
>> -   return PTR_ERR(clk_np);
>> -
>> switch (platform_get_device_id(pdev)->driver_data) {
>> case S2MPS11X:
>> s2mps11_r

Re: [GIT PULL] Samsung clock changes for v3.15

2014-03-18 Thread Tomasz Figa

Hi Mike,

On 19.03.2014 02:06, Mike Turquette wrote:

Quoting Tomasz Figa (2014-03-17 10:59:57)

The following changes since commit 38dbfb59d1175ef458d006556061adeaa8751b72:

   Linus 3.14-rc1 (2014-02-02 16:42:13 -0800)

are available in the git repository at:

   git://git.kernel.org/pub/scm/linux/kernel/git/tfiga/samsung-clk.git 
tags/for_3.15/samsung-clk

for you to fetch changes up to 70d1cf1c85486753fec0c60a9a093bdfe42b89b4:

   Merge branch 'for_3.15/misc' into samsung-next (2014-03-17 13:00:01 +0100)



Samsung clock patches for v3.15.

Due to dependencies, most of the patches already went through linux-samsung
tree, so this pull request is rather small.


I'm a bit confused. This PR is not really small (32 patches) and it
covers more stuff from arch/arm that I usually take.


It contains various patches
collected since the last merge window:

1) non-critical fixes (without need to push to stable):

220b0cc clk: samsung: Initialize clock table with error pointers
58d83cb clk: exynos-5420: Fix VPLL lock offset
3299bc3 clk: samsung: fixed compiler warning [-Wpointer-to-int-cast]

2) clock driver extensions:

db40d0c clk: samsung exynos5250/5420: Add gate clock for SSS module
d8b9731 clk/samsung: add support for multiple clock providers
45af130 clk/samsung: add support for pll2550xx
adec437 clk/samsung: add support for pll2650xx


Right, these 7 patches would constitute a small PR. Was there a mistake
when generating this pull request?


The problem with this pull request is that it contains patches that 
require quite a lot of dependencies that have been already applied into 
Samsung SoC tree. I'm not sure how else such situation could be handled, 
other than pulling respective commits into my tree as well.


I don't think this would make any problem when merging into Linus' tree, 
as these are exactly the same commits that will go through ARM SoC, so 
git should merge them just fine. Still, if you have a better idea what 
to do now, I will do so.


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 v11 24/27] iommu/exynos: use exynos-iommu specific typedef

2014-03-18 Thread Grant Grundler
On Thu, Mar 13, 2014 at 10:13 PM, Cho KyongHo  wrote:
> This commit introduces sysmmu_pte_t for page table entries and
> sysmmu_iova_t vor I/O virtual address that is manipulated by
> exynos-iommu driver. The purpose of the typedef is to remove
> dependencies to the driver code from the change of CPU architecture
> from 32 bit to 64 bit.

hi Cho,
I noticed this before but understood this code was only compiled for
ILP-32 programming model. I'm assuming that is going to change in the
not-to-distant future. Good. :)

>
> Signed-off-by: Cho KyongHo 
> ---
>  drivers/iommu/exynos-iommu.c |  103 
> ++
>  1 file changed, 54 insertions(+), 49 deletions(-)
>
> diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c
> index e375501..6e716cc 100644
> --- a/drivers/iommu/exynos-iommu.c
> +++ b/drivers/iommu/exynos-iommu.c
> @@ -56,19 +56,19 @@
>  #define lv2ent_large(pent) ((*(pent) & 3) == 1)
>
>  #define section_phys(sent) (*(sent) & SECT_MASK)
> -#define section_offs(iova) ((iova) & 0xF)
> +#define section_offs(iova) ((sysmmu_iova_t)(iova) & 0xF)

The cast will mask abuses of iova. Define section_offs as a static
function and GCC can type check iova parameter to make sure it's a
sysmmu_iova_t.
Thoughts?

I was thinking "((iova) & (sysmmu_iova_t) 0XF)" might do what you
want but it doesn't warn on abuse that I tried. I believe GCC knows
the upper bits are being ignored.

cheers,
grant
--
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: [PATCHv2 3/8] devfreq: exynos4: Add ppmu's clock control and code clean about regulator control

2014-03-18 Thread Chanwoo Choi
Hi Tomasz,

On 03/18/2014 08:13 PM, Tomasz Figa wrote:
> Hi Chanwoo,
> 
> On 17.03.2014 06:59, Chanwoo Choi wrote:
>> Hi Tomasz,
>>
>> On 03/17/2014 11:51 AM, Chanwoo Choi wrote:
>>> Hi Tomasz,
>>>
>>> On 03/15/2014 02:42 AM, Tomasz Figa wrote:
 Hi Chanwoo,

 On 13.03.2014 09:17, Chanwoo Choi wrote:
> There are not the clock controller of ppmudmc0/1. This patch control the 
> clock
> of ppmudmc0/1 which is used for monitoring memory bus utilization.
>
> Also, this patch code clean about regulator control and free resource
> when calling exit/remove function.
>
> For example,
> busfreq@106A {
>  compatible = "samsung,exynos4x12-busfreq";
>
>  /* Clock for PPMUDMC0/1 */
>  clocks = <&clock CLK_PPMUDMC0>, <&clock CLK_PPMUDMC1>;
>  clock-names = "ppmudmc0", "ppmudmc1";
>
>  /* Regulator for MIF/INT block */
>  vdd_mif-supply = <&buck1_reg>;
>  vdd_int-supply = <&buck3_reg>;
> };
>
> Signed-off-by: Chanwoo Choi 
>>
>> I modify this patch according your comment as following:
>>
>> Best Regards,
>> Chanwoo Choi
>>
>>> From c8f2fbc4c1166ec02fb2ad46164bc7ed9118721b Mon Sep 17 00:00:00 2001
>> From: Chanwoo Choi 
>> Date: Fri, 14 Mar 2014 12:05:54 +0900
>> Subject: [PATCH] devfreq: exynos4: Add ppmu's clock control and code clean
>>   about regulator control
>>
>> There are not the clock controller of ppmudmc0/1. This patch control the 
>> clock
>> of ppmudmc0/1 which is used for monitoring memory bus utilization.
>>
>> Also, this patch code clean about regulator control and free resource
>> when calling exit/remove function.
>>
>> For example,
>> busfreq@106A {
>> compatible = "samsung,exynos4x12-busfreq";
>>
>> /* Clock for PPMUDMC0/1 */
>> clocks = <&clock CLK_PPMUDMC0>, <&clock CLK_PPMUDMC1>;
>> clock-names = "ppmudmc0", "ppmudmc1";
>>
>> /* Regulator for MIF/INT block */
>> vdd_mif-supply = <&buck1_reg>;
>> vdd_int-supply = <&buck3_reg>;
>> };
>>
>> Signed-off-by: Chanwoo Choi 
>> ---
>>   drivers/devfreq/exynos/exynos4_bus.c | 97 
>> +++-
>>   1 file changed, 84 insertions(+), 13 deletions(-)
>>
>> diff --git a/drivers/devfreq/exynos/exynos4_bus.c 
>> b/drivers/devfreq/exynos/exynos4_bus.c
>> index 4c630fb..3956bcc 100644
>> --- a/drivers/devfreq/exynos/exynos4_bus.c
>> +++ b/drivers/devfreq/exynos/exynos4_bus.c
>> @@ -62,6 +62,11 @@ enum exynos_ppmu_idx {
>>   PPMU_END,
>>   };
>>
>> +static const char *exynos_ppmu_clk_name[] = {
>> +[PPMU_DMC0]= "ppmudmc0",
>> +[PPMU_DMC1]= "ppmudmc1",
>> +};
>> +
>>   #define EX4210_LV_MAXLV_2
>>   #define EX4x12_LV_MAXLV_4
>>   #define EX4210_LV_NUM(LV_2 + 1)
>> @@ -86,6 +91,7 @@ struct busfreq_data {
>>   struct regulator *vdd_mif; /* Exynos4412/4212 only */
>>   struct busfreq_opp_info curr_oppinfo;
>>   struct exynos_ppmu ppmu[PPMU_END];
>> +struct clk *clk_ppmu[PPMU_END];
>>
>>   struct notifier_block pm_notifier;
>>   struct mutex lock;
>> @@ -724,6 +730,17 @@ static void exynos4_bus_exit(struct device *dev)
>>   struct busfreq_data *data = dev_get_drvdata(dev);
>>   int i;
>>
>> +/*
>> + * Un-map memory map and disable regulator/clocks
>> + * to prevent power leakage.
>> + */
>> +regulator_disable(data->vdd_int);
>> +if (data->type == TYPE_BUSF_EXYNOS4x12)
>> +regulator_disable(data->vdd_mif);
>> +
>> +for (i = 0; i < PPMU_END; i++)
>> +clk_disable_unprepare(data->clk_ppmu[i]);
>> +
>>   for (i = 0; i < PPMU_END; i++)
>>   iounmap(data->ppmu[i].hw_base);
>>   }
>> @@ -989,6 +1006,7 @@ static int exynos4_busfreq_parse_dt(struct busfreq_data 
>> *data)
>>   {
>>   struct device *dev = data->dev;
>>   struct device_node *np = dev->of_node;
>> +const char **clk_name = exynos_ppmu_clk_name;
>>   int i, ret = 0;
>>
>>   if (!np) {
>> @@ -1006,8 +1024,67 @@ static int exynos4_busfreq_parse_dt(struct 
>> busfreq_data *data)
>>   }
>>   }
>>
>> +for (i = 0; i < PPMU_END; i++) {
>> +data->clk_ppmu[i] = devm_clk_get(dev, clk_name[i]);
>> +if (IS_ERR(data->clk_ppmu[i])) {
>> +dev_warn(dev, "Failed to get %s clock\n", clk_name[i]);
> 
> dev_err() since this is an error.

OK, I'll fix it.

> 
>> +goto err_clocks;
>> +}
>> +
>> +ret = clk_prepare_enable(data->clk_ppmu[i]);
>> +if (ret < 0) {
>> +dev_warn(dev, "Failed to enable %s clock\n", clk_name[i]);
> 
> Ditto.

OK, I'll fix it.

> 
>> +data->clk_ppmu[i] = NULL;
>> +goto err_clocks;
>> +}
>> +}
>> +
>> +/* Get regulator to control voltage of int block */
>> +data->vdd_int = devm_regulator_get(dev, "vdd_int");
>> +if (IS_ERR(data->vdd_int)) {
>> +dev_err(dev, "Failed to get the regulator of vdd_int\n");
>> +ret = PTR_ERR(data->vdd_int);
>> +g

Re: [PATCHv2 4/8] devfreq: exynos4: Fix bug of resource leak and code clean on probe()

2014-03-18 Thread Chanwoo Choi
Hi Tomasz,

On 03/18/2014 09:18 PM, Tomasz Figa wrote:
> On 17.03.2014 06:05, Chanwoo Choi wrote:
>> Hi Tomasz,
>>
>> On 03/15/2014 02:49 AM, Tomasz Figa wrote:
>>> Hi Chanwoo,
>>>
>>> On 13.03.2014 09:17, Chanwoo Choi wrote:
 This patch fix bug about resource leak when happening probe fail and code 
 clean
 to add debug message.

 Signed-off-by: Chanwoo Choi 
 ---
drivers/devfreq/exynos/exynos4_bus.c | 32 
 ++--
1 file changed, 26 insertions(+), 6 deletions(-)

 diff --git a/drivers/devfreq/exynos/exynos4_bus.c 
 b/drivers/devfreq/exynos/exynos4_bus.c
 index a2a3a47..152a3e9 100644
 --- a/drivers/devfreq/exynos/exynos4_bus.c
 +++ b/drivers/devfreq/exynos/exynos4_bus.c
 @@ -1152,8 +1152,11 @@ static int exynos4_busfreq_probe(struct 
 platform_device *pdev)
dev_err(dev, "Cannot determine the device id %d\n", data->type);
err = -EINVAL;
}
 -if (err)
 +if (err) {
 +dev_err(dev, "Cannot initialize busfreq table %d\n",
 + data->type);
return err;
 +}

rcu_read_lock();
opp = dev_pm_opp_find_freq_floor(dev,
 @@ -1176,7 +1179,7 @@ static int exynos4_busfreq_probe(struct 
 platform_device *pdev)
if (IS_ERR(data->devfreq)) {
dev_err(dev, "Failed to add devfreq device\n");
err = PTR_ERR(data->devfreq);
 -goto err_opp;
 +goto err_devfreq;
}

/*
 @@ -1185,18 +1188,35 @@ static int exynos4_busfreq_probe(struct 
 platform_device *pdev)
 */
busfreq_mon_reset(data);

 -devfreq_register_opp_notifier(dev, data->devfreq);
 +/* Register opp_notifier for Exynos4 busfreq */
 +err = devfreq_register_opp_notifier(dev, data->devfreq);
 +if (err < 0) {
 +dev_err(dev, "Failed to register opp notifier\n");
 +goto err_notifier_opp;
 +}

 +/* Register pm_notifier for Exynos4 busfreq */
err = register_pm_notifier(&data->pm_notifier);
if (err) {
dev_err(dev, "Failed to setup pm notifier\n");
 -devfreq_remove_device(data->devfreq);
 -return err;
 +goto err_notifier_pm;
}

return 0;

 -err_opp:
 +err_notifier_pm:
 +devfreq_unregister_opp_notifier(dev, data->devfreq);
 +err_notifier_opp:
 +/*
 + * The devfreq_remove_device() would execute finally devfreq->profile
 + * ->exit(). To avoid duplicate resource free operation, return 
 directly
 + * before executing resource free below 'err_devfreq' goto statement.
 + */
>>>
>>> I'm not quite sure about this. I believe that in this case 
>>> devfreq->profile->exit() would be exynos4_bus_exit() and all it does is 
>>> devfreq_unregister_opp_notifier(dev, data->devfreq), so all remaining 
>>> resources (regulators, clocks, etc.) would get leaked.
>>
>> This patch execute following sequence to probe exynos4_busfreq.c:
>>
>> 1. Parse dt node to get resource(regulator/clock/memory address).
>> 2. Enable regulator/clock and map memory.
>> 3. Add devfreq device using devfreq_add_device().
>> The devfreq_add_device() return devfreq instance(data->devfreq).
>> 4. Register opp_notifier using devfreq instance(data->devfreq) which is 
>> created in sequence #3.
>>
>> Case 1,
>> If an error happens in sequence #3 for registering devfreq_add_device(),
>>
>> this case can't execute devfreq->profile->exit() to free resource
>> because this case has failed to register devfreq->profile to devfreq_list.
>>
>> So, must goto 'err_devfreq' statement to free 
>> resource(regulator/clock/memory).
>>
>>
>> Case 2,
>> If an error happens in sequence #4 for registering opp_notifier,
>>
>> In contrast
>> this case can execute devfreq->profile->exit() to free resource.
>> But, After executed devfreq->profile->exit(),
>> should not execute 'err_devfreq' statement to free resource.
>> In case, will operate twice of resource.
>>
>> If my explanation is wrong, please reply your comment.
>>
> 
> OK, it will work indeed, however the code is barely readable with this.
> 
> For consistency (and readability), resources acquired in platform driver's 
> .probe() should be freed in .remove() and error path of .probe() should not 
> rely on external code to do the clean-up.
> 
> So, as I proposed in my previous reply:

OK, I'll modify it according to your previous comment.

> 
>>>
>>> I believe the correct thing to do would be to remove the .exit() callback 
>>> from exynos4_devfreq_profile struct and handle all the clean-up here in 
>>> error path.
>>>

Best Regards,
Chanwoo Choi
 
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.

Re: [GIT PULL 5/6] Samsung PM updates for v3.15

2014-03-18 Thread Mike Turquette
Quoting Olof Johansson (2014-03-10 19:52:01)
> On Mon, Mar 10, 2014 at 6:50 PM, Kukjin Kim  wrote:
> > Olof Johansson wrote:
> >>
> >> >> Hi,
> >> >>
> >> >> I don't see a single cc or acked-by line from Mike Turquette here. I'll
> >> >> hold
> >> >> off until he's had a chance to take a look at these ones; I suspect
> >> >> they'll be
> >> >> fine since it's mostly code refactoring though.
> >> >
> >> >
> >> > I guess I should have ACKed them too, but it felt kind of strange to ACK
> >> my
> >> > own patches. ;)
> >> >
> >> > Anyway, for all samsung-clk patches:
> >> >
> >> > Acked-by: Tomasz Figa 
> >>
> >> Yeah, self-acking doesn't make much sense. :)
> >>
> >> I'm mostly worried about patches touching other subsystems without the
> >> other maintainer being aware of it or having reviewed them. As I said,
> >> these mostly look like refactorings but it's still good habit.
> >>
> > OK, agreed, I think Mike knew about that though. Let's wait for Mike's
> > response.
> >
> > BTW, should I sort out the branch again if Mike gives ack on that?
> 
> If I hear from Mike that he's OK with it then I can merge it, no need to 
> rebase.

Acked-by: Mike Turquette 

> 
> 
> -Olof
--
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: [GIT PULL] Samsung clock changes for v3.15

2014-03-18 Thread Mike Turquette
Quoting Tomasz Figa (2014-03-18 18:19:25)
> Hi Mike,
> 
> On 19.03.2014 02:06, Mike Turquette wrote:
> > Quoting Tomasz Figa (2014-03-17 10:59:57)
> >> The following changes since commit 
> >> 38dbfb59d1175ef458d006556061adeaa8751b72:
> >>
> >>Linus 3.14-rc1 (2014-02-02 16:42:13 -0800)
> >>
> >> are available in the git repository at:
> >>
> >>git://git.kernel.org/pub/scm/linux/kernel/git/tfiga/samsung-clk.git 
> >> tags/for_3.15/samsung-clk
> >>
> >> for you to fetch changes up to 70d1cf1c85486753fec0c60a9a093bdfe42b89b4:
> >>
> >>Merge branch 'for_3.15/misc' into samsung-next (2014-03-17 13:00:01 
> >> +0100)
> >>
> >> 
> >>
> >> Samsung clock patches for v3.15.
> >>
> >> Due to dependencies, most of the patches already went through linux-samsung
> >> tree, so this pull request is rather small.
> >
> > I'm a bit confused. This PR is not really small (32 patches) and it
> > covers more stuff from arch/arm that I usually take.
> >
> >> It contains various patches
> >> collected since the last merge window:
> >>
> >> 1) non-critical fixes (without need to push to stable):
> >>
> >> 220b0cc clk: samsung: Initialize clock table with error pointers
> >> 58d83cb clk: exynos-5420: Fix VPLL lock offset
> >> 3299bc3 clk: samsung: fixed compiler warning [-Wpointer-to-int-cast]
> >>
> >> 2) clock driver extensions:
> >>
> >> db40d0c clk: samsung exynos5250/5420: Add gate clock for SSS module
> >> d8b9731 clk/samsung: add support for multiple clock providers
> >> 45af130 clk/samsung: add support for pll2550xx
> >> adec437 clk/samsung: add support for pll2650xx
> >
> > Right, these 7 patches would constitute a small PR. Was there a mistake
> > when generating this pull request?
> 
> The problem with this pull request is that it contains patches that 
> require quite a lot of dependencies that have been already applied into 
> Samsung SoC tree. I'm not sure how else such situation could be handled, 
> other than pulling respective commits into my tree as well.

There are already a fair number of clk patches going through the samsung
tree. So in the name of consistency for this upcoming merge window it
might be best to take these patches through there as well. Let me know
if that creates any undo burden on you. Otherwise please add:

Acked-by: Mike Turquette 

Regards,
Mike

> 
> I don't think this would make any problem when merging into Linus' tree, 
> as these are exactly the same commits that will go through ARM SoC, so 
> git should merge them just fine. Still, if you have a better idea what 
> to do now, I will do so.
> 
> 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 1/3] ARM: S3C24XX: Remove invalid code from hardware.h

2014-03-18 Thread Sachin Kamat
On 3 January 2014 14:54, Sachin Kamat  wrote:
> Remove the code that is not referenced anywhere. While at it also
> remove incorrect file path.
>
> Signed-off-by: Sachin Kamat 
> ---

Gentle ping on this series, Kukjin.


-- 
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 V5 2/8] net: sxgbe: add basic framework for Samsung 10Gb ethernet driver

2014-03-18 Thread Byungho An
Florian Fainelli   wrote :
> 2014-03-18 15:16 GMT-07:00 Byungho An :
> > Florian Fainelli  wrote:
> >> 2014-03-18 11:19 GMT-07:00 Byungho An :
> >> > From: Siva Reddy 
> >> >
> >> > This patch adds support for Samsung 10Gb ethernet driver(sxgbe).
> >> >
> >> > - sxgbe core initialization
> >> > - Tx and Rx support
> >> > - MDIO support
> >> > - ISRs for Tx and Rx
> >> > - ifconfig support to driver
> >>
> >> Too many files to review at once, the diffstat was around 5000+ lines!
> >> You should split this into logical parts, or just submit the basic
> >> bits for now and add the features later.
> > Yes. but I think it is one logically, after this patch there won't be much 
> > code at once.
> 
> Since you are adding multiple objects to the Makefile at once, you could very 
> well split the patches to reflect that and submit one
> object as a separate patch. Also, sometimes, even if the driver is feature 
> complete, it helps submitting the basic support first, and
> then start adding new features to it progressively.
But it is basic framework itself.
Since this #2 patch contains changes that are required for its basic 
functionality, it is not easy to split.

> 
> >
> >>
> >> [snip]
> >>
> >> > +   ret = register_netdev(ndev);
> >> > +   if (ret) {
> >> > +   pr_err("%s: ERROR %i registering the device\n", 
> >> > __func__, ret);
> >> > +   goto error_netdev_register;
> >> > +   }
> >> > +
> >> > +   priv->sxgbe_clk = clk_get(priv->device, SXGBE_RESOURCE_NAME);
> >> > +   if (IS_ERR(priv->sxgbe_clk)) {
> >> > +   netdev_warn(ndev, "%s: warning: cannot get CSR clock\n",
> >> > +   __func__);
> >> > +   goto error_clk_get;
> >> > +   }
> >>
> >> This is racy, after register_netdev() is called, the network stack is
> >> free to use the interface, which means that as much as possible needs
> >> to be initialized before you call it, including clocks, and MDIO.
> >>
> >> > +
> >> > +   /* If a specific clk_csr value is passed from the platform
> >> > +* this means that the CSR Clock Range selection cannot be
> >> > +* changed at run-time and it is fixed. Viceversa the driver'll 
> >> > try to
> >> > +* set the MDC clock dynamically according to the csr actual
> >> > +* clock input.
> >> > +*/
> >> > +   if (!priv->plat->clk_csr)
> >> > +   sxgbe_clk_csr_set(priv);
> >> > +   else
> >> > +   priv->clk_csr = priv->plat->clk_csr;
> >> > +
> >> > +   /* MDIO bus Registration */
> >> > +   ret = sxgbe_mdio_register(ndev);
> >> > +   if (ret < 0) {
> >> > +   netdev_dbg(ndev, "%s: MDIO bus (id: %d) registration 
> >> > failed\n",
> >> > +  __func__, priv->plat->bus_id);
> >> > +   goto error_mdio_register;
> >> > +   }
> >>
> >> Don't do this, register your MDIO bus before calling register_netdev().
> > OK.
> >
> >>
> >> > +
> >> > +   sxgbe_check_ether_addr(priv);
> >> > +
> >> > +   return priv;
> >> > +
> >> > +error_mdio_register:
> >> > +   clk_put(priv->sxgbe_clk);
> >> > +error_clk_get:
> >> > +   unregister_netdev(ndev);
> >> > +error_netdev_register:
> >> > +   netif_napi_del(&priv->napi);
> >> > +error_free_netdev:
> >> > +   free_netdev(ndev);
> >> > +
> >> > +   return NULL;
> >> > +}
> >> > +
> >> > +/**
> >> > + * sxgbe_dvr_remove
> >> > + * @ndev: net device pointer
> >> > + * Description: this function resets the TX/RX processes, disables
> >> > +the MAC RX/TX
> >> > + * changes the link status, releases the DMA descriptor rings.
> >> > + */
> >> > +int sxgbe_dvr_remove(struct net_device *ndev) {
> >> > +   struct sxgbe_priv_data *priv = netdev_priv(ndev);
> >> > +
> >> > +   netdev_info(ndev, "%s: removing driver\n", __func__);
> >> > +
> >> > +   priv->hw->dma->stop_rx(priv->ioaddr, SXGBE_RX_QUEUES);
> >> > +   priv->hw->dma->stop_tx(priv->ioaddr, SXGBE_TX_QUEUES);
> >> > +
> >> > +   priv->hw->mac->enable_tx(priv->ioaddr, false);
> >> > +   priv->hw->mac->enable_rx(priv->ioaddr, false);
> >> > +
> >> > +   netif_napi_del(&priv->napi);
> >> > +
> >> > +   sxgbe_mdio_unregister(ndev);
> >> > +
> >> > +   netif_carrier_off(ndev);
> >>
> >> This is not required, both the PHY library and the network stack will
> >> do that for you.
> > You mean netif_napi_del and netif_carrier_off? or all of sxgbe_dvr_remove 
> > function?
> > I think dma/mac control are needed.
> 
> I mean netif_carrier_off() is not required, everything else is.
> 
> >
> >>
> >> [snip]
> >>
> >> > +   /* register with kernel subsystem */
> >> > +   err = mdiobus_register(mdio_bus);
> >> > +   if (err != 0) {
> >> > +   netdev_err(ndev, "mdiobus register failed\n");
> >> > +   goto mdiobus_err;
> >> > +   }
> >> > +
> >> > +   for (phy_addr = 0; phy_addr < PHY_MAX_ADDR; phy_addr++) {
> >> > + 

[PATCH V6 0/8] add new Samsung SXGBE driver

2014-03-18 Thread Byungho An
Hi all,

This is 6th posting for SAMSUNG SXGBE driver.

Changes since v1:
- changed name of driver to SXGbE as per Ben's comment
- squashed Joe's neatening for many stuff in original patches

Changes since v2:
- updated and split binding document as per Mark's comment
- clean up codes as per Joe's comment
- removed unused fields and clean up codes as per Francois's comment
- removed module parameters as per Dave's comment
- moved driver directory to samsung/sxgbe/

Changes since v3:
- fixed Missing a blank line after declarations as per Dave's comment
- clean up codes as per Joe's comment
- removed reference of net_device.{irq, base_addr}

Changes since v4:
- updated binding document and DT related function as per Mark's comment

Changes since v5:
- updated binding document and DT related function as per Florian's comment
- fixed typo and shortened code as per Joe's comment

Byungho An (1):
  MAINTAINERS: add maintainer for Samsung sxgbe driver

Girish K S (2):
  net: sxgbe: add EEE(Energy Efficient Ethernet) for Samsung sxgbe
  net: sxgbe: add WOL(Wakeup-On-Lan)support for Samsung sxgbe

Siva Reddy (2):
  sxgbe: Add device-tree binding support document
  net: sxgbe: add basic framework for Samsung 10Gb ethernet driver

Vipul Pandya (3):
  net: sxgbe: add TSO support for Samsung sxgbe
  net: sxgbe: add Checksum offload support for Samsung sxgbe
  net: sxgbe: add ethtool related functions support Samsung sxgbe

 .../devicetree/bindings/net/samsung-sxgbe.txt  |   58 +
 MAINTAINERS|9 +
 drivers/net/ethernet/Kconfig   |1 +
 drivers/net/ethernet/Makefile  |1 +
 drivers/net/ethernet/samsung/Kconfig   |   20 +
 drivers/net/ethernet/samsung/Makefile  |5 +
 drivers/net/ethernet/samsung/sxgbe/Kconfig |9 +
 drivers/net/ethernet/samsung/sxgbe/Makefile|4 +
 drivers/net/ethernet/samsung/sxgbe/sxgbe_common.h  |  553 +
 drivers/net/ethernet/samsung/sxgbe/sxgbe_core.c|  290 +++
 drivers/net/ethernet/samsung/sxgbe/sxgbe_desc.c|  515 +
 drivers/net/ethernet/samsung/sxgbe/sxgbe_desc.h|  298 +++
 drivers/net/ethernet/samsung/sxgbe/sxgbe_dma.c |  387 
 drivers/net/ethernet/samsung/sxgbe/sxgbe_dma.h |   51 +
 drivers/net/ethernet/samsung/sxgbe/sxgbe_ethtool.c |  634 ++
 drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c| 2378 
 drivers/net/ethernet/samsung/sxgbe/sxgbe_mdio.c|  271 +++
 drivers/net/ethernet/samsung/sxgbe/sxgbe_mtl.c |  293 +++
 drivers/net/ethernet/samsung/sxgbe/sxgbe_mtl.h |  108 +
 .../net/ethernet/samsung/sxgbe/sxgbe_platform.c|  266 +++
 drivers/net/ethernet/samsung/sxgbe/sxgbe_reg.h |  491 
 drivers/net/ethernet/samsung/sxgbe/sxgbe_xpcs.c|   92 +
 drivers/net/ethernet/samsung/sxgbe/sxgbe_xpcs.h|   38 +
 include/linux/sxgbe_platform.h |   54 +
 24 files changed, 6826 insertions(+)

Thanks,
Byungho An

--
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 V6 8/8] MAINTAINERS: add maintainer for Samsung sxgbe driver

2014-03-18 Thread Byungho An
From: Byungho An 

Signed-off-by: Byungho An 
---
 MAINTAINERS |9 +
 1 file changed, 9 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index b7befe7..aeb81f2 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -7536,6 +7536,15 @@ S:   Supported
 L: linux-samsung-soc@vger.kernel.org (moderated for non-subscribers)
 F: drivers/clk/samsung/
 
+SAMSUNG SXGBE DRIVERS
+M: Byungho An 
+M: Girish K S 
+M: Siva Reddy Kallam 
+M: Vipul Pandya 
+S: Supported
+L: net...@vger.kernel.org
+F: drivers/net/ethernet/samsung/sxgbe/
+
 SERIAL DRIVERS
 M: Greg Kroah-Hartman 
 L: linux-ser...@vger.kernel.org
-- 
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 V6 1/8] sxgbe: Add device-tree binding support document

2014-03-18 Thread Byungho An
From: Siva Reddy 

This patch adds binding document for SXGBE ethernet driver via device-tree.

Signed-off-by: Siva Reddy Kallam 
Signed-off-by: Byungho An 
---
 .../devicetree/bindings/net/samsung-sxgbe.txt  |   58 
 1 file changed, 58 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/net/samsung-sxgbe.txt

diff --git a/Documentation/devicetree/bindings/net/samsung-sxgbe.txt 
b/Documentation/devicetree/bindings/net/samsung-sxgbe.txt
new file mode 100644
index 000..4fc05ab
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/samsung-sxgbe.txt
@@ -0,0 +1,58 @@
+* Samsung 10G Ethernet driver (SXGBE)
+
+Required properties:
+- compatible: Should be "samsung,sxgbe-v2.0a"
+- reg: Address and length of the register set for the device
+- interrupt-parent: Should be the phandle for the interrupt controller
+  that services interrupts for this device
+- interrupts: Should contain the SXGBE interrupts
+  These interrupts are ordered by fixed and follows variable
+  trasmit DMA interrupts, receive DMA interrupts and lpi interrupt.
+  index 0 - this is fixed common interrupt of SXGBE and it is always
+  available.
+  index 1 to 25 - 8 variable trasmit interrupts, variable 16 receive interrupts
+  and 1 optional lpi interrupt.
+- phy-mode: String, operation mode of the PHY interface.
+  Supported values are: "sgmii", "xgmii".
+- samsung,pbl: Integer, Programmable Burst Length.
+  Supported values are 1, 2, 4, 8, 16, or 32.
+- samsung,burst-map: Integer, Program the possible bursts supported by sxgbe
+  This is an interger and represents allowable DMA bursts when fixed burst.
+  Allowable range is 0x00-0x3F. This field is valid only when fixed burst is
+  enabled, otherwise ignored.
+- samsung,adv-addr-mode: Boolean, Program the DMA to use Enhanced address mode.
+- samsung,force-thresh-dma-mode: Boolean, Force DMA to use the threshold mode
+  for both tx and rx
+- samsung,force-sf-dma-mode: Boolean, Force DMA to use the Store and Forward
+  mode for both tx and rx. This flag is ignored if force-thresh-dma-mode is 
set.
+
+Optional properties:
+- mac-address: 6 bytes, mac address
+- max-frame-size: Maximum Transfer Unit (IEEE defined MTU), rather
+ than the maximum frame size.
+
+Example:
+
+   aliases {
+   ethernet0 = <&sxgbe0>;
+   };
+
+   sxgbe0: ethernet@1a04 {
+   compatible = "samsung,sxgbe-v2.0a";
+   reg = <0 0x1a04 0 0x1>;
+   interrupt-parent = <&gic>;
+   interrupts = <0 209 4>, <0 185 4>, <0 186 4>, <0 187 4>,
+<0 188 4>, <0 189 4>, <0 190 4>, <0 191 4>,
+<0 192 4>, <0 193 4>, <0 194 4>, <0 195 4>,
+<0 196 4>, <0 197 4>, <0 198 4>, <0 199 4>,
+<0 200 4>, <0 201 4>, <0 202 4>, <0 203 4>,
+<0 204 4>, <0 205 4>, <0 206 4>, <0 207 4>,
+<0 208 4>, <0 210 4>;
+   samsung,pbl = <0x08>
+   samsung,burst-map = <0x20>
+   samsung,adv-addr-mode = "true"
+   samsung,force-sf-dma-mode = "true"
+   mac-address = [ 00 11 22 33 44 55 ]; /* Filled in by U-Boot */
+   max-frame-size = <9000>;
+   phy-mode = "xgmii";
+   };
-- 
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 V6 7/8] net: sxgbe: add ethtool related functions support Samsung sxgbe

2014-03-18 Thread Byungho An
From: Vipul Pandya 

This patch adds ethtool related functions.

Signed-off-by: Vipul Pandya 
Neatening-by: Joe Perches 
Signed-off-by: Byungho An 
---
 drivers/net/ethernet/samsung/sxgbe/sxgbe_common.h  |   25 +-
 drivers/net/ethernet/samsung/sxgbe/sxgbe_ethtool.c |  510 +++-
 drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c|8 +-
 drivers/net/ethernet/samsung/sxgbe/sxgbe_reg.h |6 +
 4 files changed, 537 insertions(+), 12 deletions(-)

diff --git a/drivers/net/ethernet/samsung/sxgbe/sxgbe_common.h 
b/drivers/net/ethernet/samsung/sxgbe/sxgbe_common.h
index 30adc81..c592841 100644
--- a/drivers/net/ethernet/samsung/sxgbe/sxgbe_common.h
+++ b/drivers/net/ethernet/samsung/sxgbe/sxgbe_common.h
@@ -42,8 +42,12 @@ struct sxgbe_mtl_ops;
 #define SXGBE_RX_QUEUES   16
 
 /* Max/Min RI Watchdog Timer count value */
-#define SXGBE_MAX_DMA_RIWT 0xff
-#define SXGBE_MIN_DMA_RIWT 0x20
+/* Calculated based how much time does it take to fill 256KB Rx memory
+ * at 10Gb speed at 156MHz clock rate and considered little less then
+ * the actual value.
+ */
+#define SXGBE_MAX_DMA_RIWT 0x70
+#define SXGBE_MIN_DMA_RIWT 0x01
 
 /* Tx coalesce parameters */
 #define SXGBE_COAL_TX_TIMER4
@@ -203,6 +207,20 @@ enum dma_irq_status {
 #define SXGBE_FOR_EACH_QUEUE(max_queues, queue_num)\
for (queue_num = 0; queue_num < max_queues; queue_num++)
 
+#define DRV_VERSION "1.0.0"
+
+#define SXGBE_MAX_RX_CHANNELS  16
+#define SXGBE_MAX_TX_CHANNELS  16
+
+#define START_MAC_REG_OFFSET   0x
+#define MAX_MAC_REG_OFFSET 0x0DFC
+#define START_MTL_REG_OFFSET   0x1000
+#define MAX_MTL_REG_OFFSET 0x18FC
+#define START_DMA_REG_OFFSET   0x3000
+#define MAX_DMA_REG_OFFSET 0x38FC
+
+#define REG_SPACE_SIZE 0x2000
+
 /* sxgbe statistics counters */
 struct sxgbe_extra_stats {
/* TX/RX IRQ events */
@@ -488,6 +506,7 @@ struct sxgbe_priv_data {
/* advanced time stamp support */
u32 adv_ts;
int use_riwt;
+   struct ptp_clock *ptp_clock;
 
/* tc control */
int tx_tc;
@@ -529,4 +548,6 @@ const struct sxgbe_mtl_ops *sxgbe_get_mtl_ops(void);
 void sxgbe_disable_eee_mode(struct sxgbe_priv_data * const priv);
 bool sxgbe_eee_init(struct sxgbe_priv_data * const priv);
 
+int sxgbe_set_flow_ctrl(struct sxgbe_priv_data *priv, int rx, int tx);
+
 #endif /* __SXGBE_COMMON_H__ */
diff --git a/drivers/net/ethernet/samsung/sxgbe/sxgbe_ethtool.c 
b/drivers/net/ethernet/samsung/sxgbe/sxgbe_ethtool.c
index 89b1450..3421ca2 100644
--- a/drivers/net/ethernet/samsung/sxgbe/sxgbe_ethtool.c
+++ b/drivers/net/ethernet/samsung/sxgbe/sxgbe_ethtool.c
@@ -12,12 +12,17 @@
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
+#include 
 #include 
 #include 
 #include 
+#include 
 #include 
+#include 
 
 #include "sxgbe_common.h"
+#include "sxgbe_reg.h"
+#include "sxgbe_dma.h"
 
 struct sxgbe_stats {
char stat_string[ETH_GSTRING_LEN];
@@ -33,17 +38,106 @@ struct sxgbe_stats {
 }
 
 static const struct sxgbe_stats sxgbe_gstrings_stats[] = {
+   /* TX/RX IRQ events */
+   SXGBE_STAT(tx_process_stopped_irq),
+   SXGBE_STAT(tx_ctxt_desc_err),
+   SXGBE_STAT(tx_threshold),
+   SXGBE_STAT(rx_threshold),
+   SXGBE_STAT(tx_pkt_n),
+   SXGBE_STAT(rx_pkt_n),
+   SXGBE_STAT(normal_irq_n),
+   SXGBE_STAT(tx_normal_irq_n),
+   SXGBE_STAT(rx_normal_irq_n),
+   SXGBE_STAT(napi_poll),
+   SXGBE_STAT(tx_clean),
+   SXGBE_STAT(tx_reset_ic_bit),
+   SXGBE_STAT(rx_process_stopped_irq),
+   SXGBE_STAT(rx_underflow_irq),
+
+   /* Bus access errors */
+   SXGBE_STAT(fatal_bus_error_irq),
+   SXGBE_STAT(tx_read_transfer_err),
+   SXGBE_STAT(tx_write_transfer_err),
+   SXGBE_STAT(tx_desc_access_err),
+   SXGBE_STAT(tx_buffer_access_err),
+   SXGBE_STAT(tx_data_transfer_err),
+   SXGBE_STAT(rx_read_transfer_err),
+   SXGBE_STAT(rx_write_transfer_err),
+   SXGBE_STAT(rx_desc_access_err),
+   SXGBE_STAT(rx_buffer_access_err),
+   SXGBE_STAT(rx_data_transfer_err),
+   SXGBE_STAT(pmt_irq_event_n),
+
+   /* EEE-LPI stats */
SXGBE_STAT(tx_lpi_entry_n),
SXGBE_STAT(tx_lpi_exit_n),
SXGBE_STAT(rx_lpi_entry_n),
SXGBE_STAT(rx_lpi_exit_n),
SXGBE_STAT(eee_wakeup_error_n),
-   SXGBE_STAT(pmt_irq_event_n),
+
+   /* RX specific */
+   /* L2 error */
+   SXGBE_STAT(rx_code_gmii_err),
+   SXGBE_STAT(rx_watchdog_err),
+   SXGBE_STAT(rx_crc_err),
+   SXGBE_STAT(rx_gaint_pkt_err),
+   SXGBE_STAT(ip_hdr_err),
+   SXGBE_STAT(ip_payload_err),
+   SXGBE_STAT(overflow_error),
+
+   /* L2 Pkt type */
+   SXGBE_STAT(len_pkt),
+   SXGBE_STAT(mac_ctl_pkt),
+   SXGBE_STAT(dcb_ctl_pkt),
+   SXGBE_STAT(arp_pkt),
+   SXGBE_STAT(oam_pkt),
+   SXGBE_STAT(untag_okt),
+   SXGBE_STAT(other_pkt),
+   SXGBE_STAT(svlan_tag_pkt),
+   SXGBE_STAT(cvlan_tag_pkt),
+   

[PATCH V6 4/8] net: sxgbe: add EEE(Energy Efficient Ethernet) for Samsung sxgbe

2014-03-18 Thread Byungho An
From: Girish K S 

Added support for the EEE(Energy Efficient Ethernet)in 10G ethernet driver.

Signed-off-by: Girish K S 
Neatening-by: Joe Perches 
Signed-off-by: Byungho An 
---
 drivers/net/ethernet/samsung/sxgbe/sxgbe_common.h  |   53 +++
 drivers/net/ethernet/samsung/sxgbe/sxgbe_core.c|   86 +-
 drivers/net/ethernet/samsung/sxgbe/sxgbe_ethtool.c |   47 ++
 drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c|  165 +++-
 .../net/ethernet/samsung/sxgbe/sxgbe_platform.c|4 +
 drivers/net/ethernet/samsung/sxgbe/sxgbe_reg.h |5 +
 6 files changed, 358 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/samsung/sxgbe/sxgbe_common.h 
b/drivers/net/ethernet/samsung/sxgbe/sxgbe_common.h
index 587b691..937969c 100644
--- a/drivers/net/ethernet/samsung/sxgbe/sxgbe_common.h
+++ b/drivers/net/ethernet/samsung/sxgbe/sxgbe_common.h
@@ -115,6 +115,33 @@ struct sxgbe_mtl_ops;
 #define RX_PTP_SIGNAL  0x0A
 #define RX_PTP_RESV_MSG0x0F
 
+/* EEE-LPI mode  flags*/
+#define TX_ENTRY_LPI_MODE  0x10
+#define TX_EXIT_LPI_MODE   0x20
+#define RX_ENTRY_LPI_MODE  0x40
+#define RX_EXIT_LPI_MODE   0x80
+
+/* EEE-LPI Interrupt status flag */
+#define LPI_INT_STATUS BIT(5)
+
+/* EEE-LPI Default timer values */
+#define LPI_LINK_STATUS_TIMER  0x3E8
+#define LPI_MAC_WAIT_TIMER 0x00
+
+/* EEE-LPI Control and status definitions */
+#define LPI_CTRL_STATUS_TXABIT(19)
+#define LPI_CTRL_STATUS_PLSDIS BIT(18)
+#define LPI_CTRL_STATUS_PLSBIT(17)
+#define LPI_CTRL_STATUS_LPIEN  BIT(16)
+#define LPI_CTRL_STATUS_TXRSTP BIT(11)
+#define LPI_CTRL_STATUS_RXRSTP BIT(10)
+#define LPI_CTRL_STATUS_RLPIST BIT(9)
+#define LPI_CTRL_STATUS_TLPIST BIT(8)
+#define LPI_CTRL_STATUS_RLPIEX BIT(3)
+#define LPI_CTRL_STATUS_RLPIEN BIT(2)
+#define LPI_CTRL_STATUS_TLPIEX BIT(1)
+#define LPI_CTRL_STATUS_TLPIEN BIT(0)
+
 enum dma_irq_status {
tx_hard_error   = BIT(0),
tx_bump_tc  = BIT(1),
@@ -199,6 +226,13 @@ struct sxgbe_extra_stats {
unsigned long rx_buffer_access_err;
unsigned long rx_data_transfer_err;
 
+   /* EEE-LPI stats */
+   unsigned long tx_lpi_entry_n;
+   unsigned long tx_lpi_exit_n;
+   unsigned long rx_lpi_entry_n;
+   unsigned long rx_lpi_exit_n;
+   unsigned long eee_wakeup_error_n;
+
/* RX specific */
/* L2 error */
unsigned long rx_code_gmii_err;
@@ -296,6 +330,13 @@ struct sxgbe_core_ops {
   unsigned char feature_index);
/* adjust SXGBE speed */
void (*set_speed)(void __iomem *ioaddr, unsigned char speed);
+
+   /* EEE-LPI specific operations */
+   void (*set_eee_mode)(void __iomem *ioaddr);
+   void (*reset_eee_mode)(void __iomem *ioaddr);
+   void (*set_eee_timer)(void __iomem *ioaddr, const int ls,
+ const int tw);
+   void (*set_eee_pls)(void __iomem *ioaddr, const int link);
 };
 
 const struct sxgbe_core_ops *sxgbe_get_core_ops(void);
@@ -351,6 +392,8 @@ struct sxgbe_hw_features {
/* IEEE 1588-2008 */
unsigned int atime_stamp;
 
+   unsigned int eee;
+
unsigned int tx_csum_offload;
unsigned int rx_csum_offload;
unsigned int multi_macaddr;
@@ -434,6 +477,13 @@ struct sxgbe_priv_data {
/* tc control */
int tx_tc;
int rx_tc;
+   /* EEE-LPI specific members */
+   struct timer_list eee_ctrl_timer;
+   bool tx_path_in_lpi_mode;
+   int lpi_irq;
+   int eee_enabled;
+   int eee_active;
+   int tx_lpi_timer;
 };
 
 /* Function prototypes */
@@ -456,4 +506,7 @@ int sxgbe_restore(struct net_device *ndev);
 
 const struct sxgbe_mtl_ops *sxgbe_get_mtl_ops(void);
 
+void sxgbe_disable_eee_mode(struct sxgbe_priv_data * const priv);
+bool sxgbe_eee_init(struct sxgbe_priv_data * const priv);
+
 #endif /* __SXGBE_COMMON_H__ */
diff --git a/drivers/net/ethernet/samsung/sxgbe/sxgbe_core.c 
b/drivers/net/ethernet/samsung/sxgbe/sxgbe_core.c
index 17eea58..bf93b16 100644
--- a/drivers/net/ethernet/samsung/sxgbe/sxgbe_core.c
+++ b/drivers/net/ethernet/samsung/sxgbe/sxgbe_core.c
@@ -47,11 +47,38 @@ static void sxgbe_core_dump_regs(void __iomem *ioaddr)
 {
 }
 
+static int sxgbe_get_lpi_status(void __iomem *ioaddr, const u32 irq_status)
+{
+   int status = 0;
+   int lpi_status;
+
+   /* Reading this register shall clear all the LPI status bits */
+   lpi_status = readl(ioaddr + SXGBE_CORE_LPI_CTRL_STATUS);
+
+   if (lpi_status & LPI_CTRL_STATUS_TLPIEN)
+   status |= TX_ENTRY_LPI_MODE;
+   if (lpi_status & LPI_CTRL_STATUS_TLPIEX)
+   status |= TX_EXIT_LPI_MODE;
+   if (lpi_status & LPI_CTRL_STATUS_RLPIEN)
+   status |= RX_ENTRY_LPI_MODE;
+   if (lpi_status & LPI_CTRL_STATUS_RLPIEX)
+   status |= RX_EXIT_LPI_MODE;
+
+   return status;
+}
+
 /* Handle extra events on specific interrupt

[PATCH V6 5/8] net: sxgbe: add Checksum offload support for Samsung sxgbe

2014-03-18 Thread Byungho An
From: Vipul Pandya 

This patch adds TX and RX checksum offload support.

Signed-off-by: Vipul Pandya 
Neatening-by: Joe Perches 
Signed-off-by: Byungho An 
---
 drivers/net/ethernet/samsung/sxgbe/sxgbe_common.h |5 +++
 drivers/net/ethernet/samsung/sxgbe/sxgbe_core.c   |   20 +
 drivers/net/ethernet/samsung/sxgbe/sxgbe_desc.h   |6 +--
 drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c   |   46 -
 4 files changed, 63 insertions(+), 14 deletions(-)

diff --git a/drivers/net/ethernet/samsung/sxgbe/sxgbe_common.h 
b/drivers/net/ethernet/samsung/sxgbe/sxgbe_common.h
index 937969c..7937493 100644
--- a/drivers/net/ethernet/samsung/sxgbe/sxgbe_common.h
+++ b/drivers/net/ethernet/samsung/sxgbe/sxgbe_common.h
@@ -337,6 +337,10 @@ struct sxgbe_core_ops {
void (*set_eee_timer)(void __iomem *ioaddr, const int ls,
  const int tw);
void (*set_eee_pls)(void __iomem *ioaddr, const int link);
+
+   /* Enable disable checksum offload operations */
+   void (*enable_rx_csum)(void __iomem *ioaddr);
+   void (*disable_rx_csum)(void __iomem *ioaddr);
 };
 
 const struct sxgbe_core_ops *sxgbe_get_core_ops(void);
@@ -448,6 +452,7 @@ struct sxgbe_priv_data {
struct sxgbe_ops *hw;   /* sxgbe specific ops */
int no_csum_insertion;
int irq;
+   int rxcsum_insertion;
spinlock_t stats_lock;  /* lock for tx/rx statatics */
 
struct phy_device *phydev;
diff --git a/drivers/net/ethernet/samsung/sxgbe/sxgbe_core.c 
b/drivers/net/ethernet/samsung/sxgbe/sxgbe_core.c
index bf93b16..5885fd6 100644
--- a/drivers/net/ethernet/samsung/sxgbe/sxgbe_core.c
+++ b/drivers/net/ethernet/samsung/sxgbe/sxgbe_core.c
@@ -217,6 +217,24 @@ static void  sxgbe_set_eee_timer(void __iomem *ioaddr,
writel(value, ioaddr + SXGBE_CORE_LPI_TIMER_CTRL);
 }
 
+static void sxgbe_enable_rx_csum(void __iomem *ioaddr)
+{
+   u32 ctrl;
+
+   ctrl = readl(ioaddr + SXGBE_CORE_RX_CONFIG_REG);
+   ctrl |= SXGBE_RX_CSUMOFFLOAD_ENABLE;
+   writel(ctrl, ioaddr + SXGBE_CORE_RX_CONFIG_REG);
+}
+
+static void sxgbe_disable_rx_csum(void __iomem *ioaddr)
+{
+   u32 ctrl;
+
+   ctrl = readl(ioaddr + SXGBE_CORE_RX_CONFIG_REG);
+   ctrl &= ~SXGBE_RX_CSUMOFFLOAD_ENABLE;
+   writel(ctrl, ioaddr + SXGBE_CORE_RX_CONFIG_REG);
+}
+
 const struct sxgbe_core_ops core_ops = {
.core_init = sxgbe_core_init,
.dump_regs = sxgbe_core_dump_regs,
@@ -233,6 +251,8 @@ const struct sxgbe_core_ops core_ops = {
.reset_eee_mode = sxgbe_reset_eee_mode,
.set_eee_timer = sxgbe_set_eee_timer,
.set_eee_pls = sxgbe_set_eee_pls,
+   .enable_rx_csum = sxgbe_enable_rx_csum,
+   .disable_rx_csum = sxgbe_disable_rx_csum,
 };
 
 const struct sxgbe_core_ops *sxgbe_get_core_ops(void)
diff --git a/drivers/net/ethernet/samsung/sxgbe/sxgbe_desc.h 
b/drivers/net/ethernet/samsung/sxgbe/sxgbe_desc.h
index 547edf3..3c0b5a8 100644
--- a/drivers/net/ethernet/samsung/sxgbe/sxgbe_desc.h
+++ b/drivers/net/ethernet/samsung/sxgbe/sxgbe_desc.h
@@ -113,7 +113,7 @@ struct sxgbe_rx_norm_desc {
/* WB RDES3 */
u32 pkt_len:14;
u32 rdes3_reserved:1;
-   u32 err_summary:15;
+   u32 err_summary:1;
u32 err_l2_type:4;
u32 layer34_pkt_type:4;
u32 no_coagulation_pkt:1;
@@ -273,8 +273,8 @@ struct sxgbe_desc_ops {
int (*get_rx_ld_status)(struct sxgbe_rx_norm_desc *p);
 
/* Return the reception status looking at the RDES1 */
-   void (*rx_wbstatus)(struct sxgbe_rx_norm_desc *p,
-   struct sxgbe_extra_stats *x);
+   int (*rx_wbstatus)(struct sxgbe_rx_norm_desc *p,
+  struct sxgbe_extra_stats *x, int *checksum);
 
/* Get own bit */
int (*get_rx_ctxt_owner)(struct sxgbe_rx_ctxt_desc *p);
diff --git a/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c 
b/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c
index 25a7ad5..f0ee143 100644
--- a/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c
+++ b/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c
@@ -1255,6 +1255,7 @@ void sxgbe_tso_prepare(struct sxgbe_priv_data *priv,
 static netdev_tx_t sxgbe_xmit(struct sk_buff *skb, struct net_device *dev)
 {
unsigned int entry, frag_num;
+   int cksum_flag = 0;
struct netdev_queue *dev_txq;
unsigned txq_index = skb_get_queue_mapping(skb);
struct sxgbe_priv_data *priv = netdev_priv(dev);
@@ -1326,7 +1327,7 @@ static netdev_tx_t sxgbe_xmit(struct sk_buff *skb, struct 
net_device *dev)
   __func__);
 
priv->hw->desc->prepare_tx_desc(tx_desc, 1, no_pagedlen,
-   no_pagedlen);
+   no_pagedlen, 
cksu

[PATCH V6 6/8] net: sxgbe: add WOL(Wakeup-On-Lan)support for Samsung sxgbe

2014-03-18 Thread Byungho An
From: Girish K S 

This patch adds support for wake up on magic frame arrival.
Also remote wake up on all other packets (unicast, multicast broadcast) is 
supported.

Signed-off-by: Girish K S 
Neatening-by: Joe Perches 
Signed-off-by: Byungho An 
---
 drivers/net/ethernet/samsung/sxgbe/sxgbe_common.h  |   15 +
 drivers/net/ethernet/samsung/sxgbe/sxgbe_core.c|   29 
 drivers/net/ethernet/samsung/sxgbe/sxgbe_ethtool.c |   47 +
 drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c|   71 
 drivers/net/ethernet/samsung/sxgbe/sxgbe_mtl.c |   43 +++-
 drivers/net/ethernet/samsung/sxgbe/sxgbe_mtl.h |4 ++
 .../net/ethernet/samsung/sxgbe/sxgbe_platform.c|4 ++
 drivers/net/ethernet/samsung/sxgbe/sxgbe_reg.h |3 +
 8 files changed, 215 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/samsung/sxgbe/sxgbe_common.h 
b/drivers/net/ethernet/samsung/sxgbe/sxgbe_common.h
index 7937493..30adc81 100644
--- a/drivers/net/ethernet/samsung/sxgbe/sxgbe_common.h
+++ b/drivers/net/ethernet/samsung/sxgbe/sxgbe_common.h
@@ -121,9 +121,18 @@ struct sxgbe_mtl_ops;
 #define RX_ENTRY_LPI_MODE  0x40
 #define RX_EXIT_LPI_MODE   0x80
 
+/* PMT mode bits */
+#define PMT_PWRDWN BIT(0)
+#define PMT_MGPKT_EN   BIT(1)
+#define PMT_RWKPKT_EN  BIT(2)
+#define PMT_GUCAST_EN  BIT(9)
+
 /* EEE-LPI Interrupt status flag */
 #define LPI_INT_STATUS BIT(5)
 
+/* PMT Interrupt status */
+#define PMT_INT_STATUS BIT(4)
+
 /* EEE-LPI Default timer values */
 #define LPI_LINK_STATUS_TIMER  0x3E8
 #define LPI_MAC_WAIT_TIMER 0x00
@@ -225,6 +234,7 @@ struct sxgbe_extra_stats {
unsigned long rx_desc_access_err;
unsigned long rx_buffer_access_err;
unsigned long rx_data_transfer_err;
+   unsigned long pmt_irq_event_n;
 
/* EEE-LPI stats */
unsigned long tx_lpi_entry_n;
@@ -489,6 +499,11 @@ struct sxgbe_priv_data {
int eee_enabled;
int eee_active;
int tx_lpi_timer;
+
+   /* PM-WOL specific members */
+   int wolopts;
+   int wolenabled;
+   int wol_irq;
 };
 
 /* Function prototypes */
diff --git a/drivers/net/ethernet/samsung/sxgbe/sxgbe_core.c 
b/drivers/net/ethernet/samsung/sxgbe/sxgbe_core.c
index 5885fd6..334d196 100644
--- a/drivers/net/ethernet/samsung/sxgbe/sxgbe_core.c
+++ b/drivers/net/ethernet/samsung/sxgbe/sxgbe_core.c
@@ -78,12 +78,41 @@ static int sxgbe_core_host_irq_status(void __iomem *ioaddr,
if (unlikely(irq_status & LPI_INT_STATUS))
status |= sxgbe_get_lpi_status(ioaddr, irq_status);
 
+   if (unlikely(irq_status & PMT_INT_STATUS)) {
+   /* clear the PMT bits 5 and 6 by reading the PMT status reg */
+   readl(ioaddr + SXGBE_CORE_PMT_CTL_STATUS_REG);
+   x->pmt_irq_event_n++;
+   }
+
return status;
 }
 
 /* Set power management mode (e.g. magic frame) */
 static void sxgbe_core_pmt(void __iomem *ioaddr, unsigned long mode)
 {
+   unsigned int pmt = 0;
+
+   if (mode & WAKE_MAGIC) {
+   pr_debug("WOL Magic frame\n");
+   pmt |= PMT_MGPKT_EN;
+   }
+   if (mode & WAKE_UCAST) {
+   pr_debug("WOL on global unicast\n");
+   pmt |= PMT_GUCAST_EN;
+   }
+   if (mode & (WAKE_MCAST | WAKE_BCAST)) {
+   pr_debug("WOL on any other packet\n");
+   pmt |= PMT_RWKPKT_EN;
+   }
+
+   writel(pmt, ioaddr + SXGBE_CORE_PMT_CTL_STATUS_REG);
+
+   /* Enable power down bit if any of the requested mode is enabled */
+   if (pmt) {
+   writel(SXGBE_RX_ENABLE, ioaddr + SXGBE_CORE_RX_CONFIG_REG);
+   pmt |= PMT_PWRDWN;
+   writel(pmt, ioaddr + SXGBE_CORE_PMT_CTL_STATUS_REG);
+   }
 }
 
 /* Set/Get Unicast MAC addresses */
diff --git a/drivers/net/ethernet/samsung/sxgbe/sxgbe_ethtool.c 
b/drivers/net/ethernet/samsung/sxgbe/sxgbe_ethtool.c
index 9083300..89b1450 100644
--- a/drivers/net/ethernet/samsung/sxgbe/sxgbe_ethtool.c
+++ b/drivers/net/ethernet/samsung/sxgbe/sxgbe_ethtool.c
@@ -12,6 +12,7 @@
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
+#include 
 #include 
 #include 
 #include 
@@ -37,6 +38,7 @@ static const struct sxgbe_stats sxgbe_gstrings_stats[] = {
SXGBE_STAT(rx_lpi_entry_n),
SXGBE_STAT(rx_lpi_exit_n),
SXGBE_STAT(eee_wakeup_error_n),
+   SXGBE_STAT(pmt_irq_event_n),
 };
 #define SXGBE_STATS_LEN ARRAY_SIZE(sxgbe_gstrings_stats)
 
@@ -80,9 +82,54 @@ static int sxgbe_ethtool_set_eee(struct net_device *dev,
return phy_ethtool_set_eee(priv->phydev, edata);
 }
 
+static void sxgbe_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
+{
+   struct sxgbe_priv_data *priv = netdev_priv(dev);
+
+   wol->wolopts = 0;
+   if (!device_can_wakeup(priv->device)) {
+   dev_err(priv->device, "cannot wakeup device\n");
+   return;
+   

[PATCH V6 3/8] net: sxgbe: add TSO support for Samsung sxgbe

2014-03-18 Thread Byungho An
From: Vipul Pandya 

Enable TSO during initialization for each DMA channels

Signed-off-by: Vipul Pandya 
Neatening-by: Joe Perches 
Signed-off-by: Byungho An 
---
 drivers/net/ethernet/samsung/sxgbe/sxgbe_desc.h |   17 +++--
 drivers/net/ethernet/samsung/sxgbe/sxgbe_dma.c  |   10 +++
 drivers/net/ethernet/samsung/sxgbe/sxgbe_dma.h  |2 +
 drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c |   75 ---
 4 files changed, 91 insertions(+), 13 deletions(-)

diff --git a/drivers/net/ethernet/samsung/sxgbe/sxgbe_desc.h 
b/drivers/net/ethernet/samsung/sxgbe/sxgbe_desc.h
index 41844d4..547edf3 100644
--- a/drivers/net/ethernet/samsung/sxgbe/sxgbe_desc.h
+++ b/drivers/net/ethernet/samsung/sxgbe/sxgbe_desc.h
@@ -167,8 +167,9 @@ struct sxgbe_desc_ops {
void (*init_tx_desc)(struct sxgbe_tx_norm_desc *p);
 
/* Invoked by the xmit function to prepare the tx descriptor */
-   void (*tx_enable_tse)(struct sxgbe_tx_norm_desc *p, u8 is_tse,
-   u32 hdr_len, u32 payload_len);
+   void (*tx_desc_enable_tse)(struct sxgbe_tx_norm_desc *p, u8 is_tse,
+  u32 total_hdr_len, u32 tcp_hdr_len,
+  u32 tcp_payload_len);
 
/* Assign buffer lengths for descriptor */
void (*prepare_tx_desc)(struct sxgbe_tx_norm_desc *p, u8 is_fd,
@@ -207,20 +208,26 @@ struct sxgbe_desc_ops {
int (*get_tx_timestamp_status)(struct sxgbe_tx_norm_desc *p);
 
/* TX Context Descripto Specific */
-   void (*init_tx_ctxt_desc)(struct sxgbe_tx_ctxt_desc *p);
+   void (*tx_ctxt_desc_set_ctxt)(struct sxgbe_tx_ctxt_desc *p);
 
/* Set the owner of the TX context descriptor */
-   void (*set_tx_ctxt_owner)(struct sxgbe_tx_ctxt_desc *p);
+   void (*tx_ctxt_desc_set_owner)(struct sxgbe_tx_ctxt_desc *p);
 
/* Get the owner of the TX context descriptor */
int (*get_tx_ctxt_owner)(struct sxgbe_tx_ctxt_desc *p);
 
/* Set TX mss */
-   void (*tx_ctxt_desc_setmss)(struct sxgbe_tx_ctxt_desc *p, int mss);
+   void (*tx_ctxt_desc_set_mss)(struct sxgbe_tx_ctxt_desc *p, u16 mss);
 
/* Set TX mss */
int (*tx_ctxt_desc_get_mss)(struct sxgbe_tx_ctxt_desc *p);
 
+   /* Set TX tcmssv */
+   void (*tx_ctxt_desc_set_tcmssv)(struct sxgbe_tx_ctxt_desc *p);
+
+   /* Reset TX ostc */
+   void (*tx_ctxt_desc_reset_ostc)(struct sxgbe_tx_ctxt_desc *p);
+
/* Set IVLAN information */
void (*tx_ctxt_desc_set_ivlantag)(struct sxgbe_tx_ctxt_desc *p,
  int is_ivlanvalid, int ivlan_tag,
diff --git a/drivers/net/ethernet/samsung/sxgbe/sxgbe_dma.c 
b/drivers/net/ethernet/samsung/sxgbe/sxgbe_dma.c
index 1e68ef3..1edc451 100644
--- a/drivers/net/ethernet/samsung/sxgbe/sxgbe_dma.c
+++ b/drivers/net/ethernet/samsung/sxgbe/sxgbe_dma.c
@@ -354,6 +354,15 @@ static void sxgbe_dma_rx_watchdog(void __iomem *ioaddr, 
u32 riwt)
}
 }
 
+static void sxgbe_enable_tso(void __iomem *ioaddr, u8 chan_num)
+{
+   u32 ctrl;
+
+   ctrl = readl(ioaddr + SXGBE_DMA_CHA_TXCTL_REG(chan_num));
+   ctrl |= SXGBE_DMA_CHA_TXCTL_TSE_ENABLE;
+   writel(ctrl, ioaddr + SXGBE_DMA_CHA_TXCTL_REG(chan_num));
+}
+
 static const struct sxgbe_dma_ops sxgbe_dma_ops = {
.init = sxgbe_dma_init,
.cha_init = sxgbe_dma_channel_init,
@@ -369,6 +378,7 @@ static const struct sxgbe_dma_ops sxgbe_dma_ops = {
.tx_dma_int_status = sxgbe_tx_dma_int_status,
.rx_dma_int_status = sxgbe_rx_dma_int_status,
.rx_watchdog = sxgbe_dma_rx_watchdog,
+   .enable_tso = sxgbe_enable_tso,
 };
 
 const struct sxgbe_dma_ops *sxgbe_get_dma_ops(void)
diff --git a/drivers/net/ethernet/samsung/sxgbe/sxgbe_dma.h 
b/drivers/net/ethernet/samsung/sxgbe/sxgbe_dma.h
index 50c8054..6c070ac 100644
--- a/drivers/net/ethernet/samsung/sxgbe/sxgbe_dma.h
+++ b/drivers/net/ethernet/samsung/sxgbe/sxgbe_dma.h
@@ -42,6 +42,8 @@ struct sxgbe_dma_ops {
 struct sxgbe_extra_stats *x);
/* Program the HW RX Watchdog */
void (*rx_watchdog)(void __iomem *ioaddr, u32 riwt);
+   /* Enable TSO for each DMA channel */
+   void (*enable_tso)(void __iomem *ioaddr, u8 chan_num);
 };
 
 const struct sxgbe_dma_ops *sxgbe_get_dma_ops(void);
diff --git a/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c 
b/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c
index 1714fd7..84475fa 100644
--- a/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c
+++ b/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c
@@ -1099,6 +1099,28 @@ static int sxgbe_release(struct net_device *dev)
return 0;
 }
 
+/* Prepare first Tx descriptor for doing TSO operation */
+void sxgbe_tso_prepare(struct sxgbe_priv_data *priv,
+  struct sxgbe_tx_norm_desc *first_desc,
+  struct sk_buff *skb)
+{
+   unsigned int total_hdr_len, tcp_hdr_len;
+
+   /* Write first Tx descriptor with

Re: [PATCH V6 3/8] net: sxgbe: add TSO support for Samsung sxgbe

2014-03-18 Thread Rayagond Kokatanur
On Wed, Mar 19, 2014 at 11:02 AM, Byungho An  wrote:
> From: Vipul Pandya 
>
> Enable TSO during initialization for each DMA channels
>
> Signed-off-by: Vipul Pandya 
> Neatening-by: Joe Perches 
> Signed-off-by: Byungho An 
> ---
>  drivers/net/ethernet/samsung/sxgbe/sxgbe_desc.h |   17 +++--
>  drivers/net/ethernet/samsung/sxgbe/sxgbe_dma.c  |   10 +++
>  drivers/net/ethernet/samsung/sxgbe/sxgbe_dma.h  |2 +
>  drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c |   75 
> ---
>  4 files changed, 91 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/net/ethernet/samsung/sxgbe/sxgbe_desc.h 
> b/drivers/net/ethernet/samsung/sxgbe/sxgbe_desc.h
> index 41844d4..547edf3 100644
> --- a/drivers/net/ethernet/samsung/sxgbe/sxgbe_desc.h
> +++ b/drivers/net/ethernet/samsung/sxgbe/sxgbe_desc.h
> @@ -167,8 +167,9 @@ struct sxgbe_desc_ops {
> void (*init_tx_desc)(struct sxgbe_tx_norm_desc *p);
>
> /* Invoked by the xmit function to prepare the tx descriptor */
> -   void (*tx_enable_tse)(struct sxgbe_tx_norm_desc *p, u8 is_tse,
> -   u32 hdr_len, u32 payload_len);
> +   void (*tx_desc_enable_tse)(struct sxgbe_tx_norm_desc *p, u8 is_tse,
> +  u32 total_hdr_len, u32 tcp_hdr_len,
> +  u32 tcp_payload_len);
>
> /* Assign buffer lengths for descriptor */
> void (*prepare_tx_desc)(struct sxgbe_tx_norm_desc *p, u8 is_fd,
> @@ -207,20 +208,26 @@ struct sxgbe_desc_ops {
> int (*get_tx_timestamp_status)(struct sxgbe_tx_norm_desc *p);
>
> /* TX Context Descripto Specific */
> -   void (*init_tx_ctxt_desc)(struct sxgbe_tx_ctxt_desc *p);
> +   void (*tx_ctxt_desc_set_ctxt)(struct sxgbe_tx_ctxt_desc *p);
>
> /* Set the owner of the TX context descriptor */
> -   void (*set_tx_ctxt_owner)(struct sxgbe_tx_ctxt_desc *p);
> +   void (*tx_ctxt_desc_set_owner)(struct sxgbe_tx_ctxt_desc *p);
>
> /* Get the owner of the TX context descriptor */
> int (*get_tx_ctxt_owner)(struct sxgbe_tx_ctxt_desc *p);
>
> /* Set TX mss */
> -   void (*tx_ctxt_desc_setmss)(struct sxgbe_tx_ctxt_desc *p, int mss);
> +   void (*tx_ctxt_desc_set_mss)(struct sxgbe_tx_ctxt_desc *p, u16 mss);
>
> /* Set TX mss */
> int (*tx_ctxt_desc_get_mss)(struct sxgbe_tx_ctxt_desc *p);
>
> +   /* Set TX tcmssv */
> +   void (*tx_ctxt_desc_set_tcmssv)(struct sxgbe_tx_ctxt_desc *p);
> +
> +   /* Reset TX ostc */
> +   void (*tx_ctxt_desc_reset_ostc)(struct sxgbe_tx_ctxt_desc *p);
> +
> /* Set IVLAN information */
> void (*tx_ctxt_desc_set_ivlantag)(struct sxgbe_tx_ctxt_desc *p,
>   int is_ivlanvalid, int ivlan_tag,
> diff --git a/drivers/net/ethernet/samsung/sxgbe/sxgbe_dma.c 
> b/drivers/net/ethernet/samsung/sxgbe/sxgbe_dma.c
> index 1e68ef3..1edc451 100644
> --- a/drivers/net/ethernet/samsung/sxgbe/sxgbe_dma.c
> +++ b/drivers/net/ethernet/samsung/sxgbe/sxgbe_dma.c
> @@ -354,6 +354,15 @@ static void sxgbe_dma_rx_watchdog(void __iomem *ioaddr, 
> u32 riwt)
> }
>  }
>
> +static void sxgbe_enable_tso(void __iomem *ioaddr, u8 chan_num)
> +{
> +   u32 ctrl;
> +
> +   ctrl = readl(ioaddr + SXGBE_DMA_CHA_TXCTL_REG(chan_num));
> +   ctrl |= SXGBE_DMA_CHA_TXCTL_TSE_ENABLE;
> +   writel(ctrl, ioaddr + SXGBE_DMA_CHA_TXCTL_REG(chan_num));
> +}
> +
>  static const struct sxgbe_dma_ops sxgbe_dma_ops = {
> .init = sxgbe_dma_init,
> .cha_init = sxgbe_dma_channel_init,
> @@ -369,6 +378,7 @@ static const struct sxgbe_dma_ops sxgbe_dma_ops = {
> .tx_dma_int_status = sxgbe_tx_dma_int_status,
> .rx_dma_int_status = sxgbe_rx_dma_int_status,
> .rx_watchdog = sxgbe_dma_rx_watchdog,
> +   .enable_tso = sxgbe_enable_tso,
>  };
>
>  const struct sxgbe_dma_ops *sxgbe_get_dma_ops(void)
> diff --git a/drivers/net/ethernet/samsung/sxgbe/sxgbe_dma.h 
> b/drivers/net/ethernet/samsung/sxgbe/sxgbe_dma.h
> index 50c8054..6c070ac 100644
> --- a/drivers/net/ethernet/samsung/sxgbe/sxgbe_dma.h
> +++ b/drivers/net/ethernet/samsung/sxgbe/sxgbe_dma.h
> @@ -42,6 +42,8 @@ struct sxgbe_dma_ops {
>  struct sxgbe_extra_stats *x);
> /* Program the HW RX Watchdog */
> void (*rx_watchdog)(void __iomem *ioaddr, u32 riwt);
> +   /* Enable TSO for each DMA channel */
> +   void (*enable_tso)(void __iomem *ioaddr, u8 chan_num);
>  };
>
>  const struct sxgbe_dma_ops *sxgbe_get_dma_ops(void);
> diff --git a/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c 
> b/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c
> index 1714fd7..84475fa 100644
> --- a/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c
> +++ b/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c
> @@ -1099,6 +1099,28 @@ static int sxgbe_release(struct net_device *dev)
> return 0;
>  }
>
> +/* Prepare first Tx descriptor for doing TSO operation