Re: [PATCH] mm, vmacache: Add kconfig VMACACHE_SHIFT

2015-01-21 Thread WANG Chao
Hi, Davidlohr

On 01/21/15 at 11:46pm, Davidlohr Bueso wrote:
> On Thu, 2015-01-22 at 14:29 +0800, WANG Chao wrote:
> > Add a new kconfig option VMACACHE_SHIFT (as a power of 2) to specify the
> > number of slots vma cache has for each thread. Range is chosen 0-4 (1-16
> > slots) to consider both overhead and performance penalty. Default is 2
> > (4 slots) as it originally is, which provides good enough balance.
> > 
> 
> Nack. I don't feel comfortable making scalability features of core code
> configurable.

Out of respect, is this a general rule not making scalability features
of core code configurable?

Thanks
WANG Chao
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v6 0/7] Add initial support for DA9150 Charger & Fuel-Gauge IC

2015-01-21 Thread Lee Jones
On Wed, 21 Jan 2015, Jonathan Cameron wrote:

> 
> 
> On 21 January 2015 16:52:50 GMT+00:00, Sebastian Reichel  
> wrote:
> >Hi,
> >
> >On Wed, Jan 21, 2015 at 03:46:25PM +, Adam Thomson wrote:
> >> This patch set adds initial support for the Dialog DA9150 Integrated
> >Charger &
> >> Fuel-Gauge IC. The device also provides GPIO and GPADC functionality.
> >> 
> >> In this patch set the following is provided:
> >>  - MFD Core support and DT bindings documentation.
> >>  - IIO GPADC support and DT bindings documentation.
> >>  - Power Supply Charger support and DT bindings documentation.
> >>  - Update to MAINTAINERS file to add DA9150 files to Dialog support
> >list.
> >> 
> >> To keep patch submission from being too large, support for GPIO and
> >Fuel-Gauge
> >> will come after initial support patches are accepted.
> >> 
> >> This patch set is baselined against the v3.19-rc5 kernel version.
> >> 
> >> Changes in v6:
> >> - For GPADC driver, Use lower case extended names for IIO GPADC
> >channels, and
> >>   remove extended names for GPIO related channels.
> >> - For charger driver, revert to no devm IRQ request/free functions as
> >ordering
> >>   is important, and probe failure scenario was not being correctly
> >covered. A
> >>   helper function for free IRQs has been added to make code cleaner.
> >
> >Probably a devm_ variant of power_supply_register should be created,
> >but for now this is ok for me.
> >
> >Jonathan, Lee: I assume you are ok with the whole patchset going
> >through the power supply subsystem?
> >
> Fine by me if either power supply or MFD.

I am, but there is a lot of MFD code here, so I'd like to take it in
as well.  I'd like a tagged pull-request from Sebastian.

-- 
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-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/2] i2c: tegra: Maintain CPU endianness

2015-01-21 Thread Alexandre Courbot
On Thu, Jan 22, 2015 at 4:40 PM, Thierry Reding
 wrote:
> On Tue, Jan 20, 2015 at 03:22:25PM +0300, Dmitry Osipenko wrote:
>> Support CPU BE mode by adding endianness conversion for memcpy interactions.
>>
>> Signed-off-by: Dmitry Osipenko 
>> ---
>>  drivers/i2c/busses/i2c-tegra.c | 3 +++
>>  1 file changed, 3 insertions(+)
>>
>> diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
>> index 28b87e6..e0d3ef1 100644
>> --- a/drivers/i2c/busses/i2c-tegra.c
>> +++ b/drivers/i2c/busses/i2c-tegra.c
>> @@ -286,6 +286,7 @@ static int tegra_i2c_empty_rx_fifo(struct tegra_i2c_dev 
>> *i2c_dev)
>>   if (rx_fifo_avail > 0 && buf_remaining > 0) {
>>   BUG_ON(buf_remaining > 3);
>>   val = i2c_readl(i2c_dev, I2C_RX_FIFO);
>> + val = cpu_to_le32(val);
>
> Should this not technically be le32_to_cpu() since the data originates
> from the I2C controller?
>
>>   memcpy(buf, , buf_remaining);
>>   buf_remaining = 0;
>>   rx_fifo_avail--;
>> @@ -343,7 +344,9 @@ static int tegra_i2c_fill_tx_fifo(struct tegra_i2c_dev 
>> *i2c_dev)
>>*/
>>   if (tx_fifo_avail > 0 && buf_remaining > 0) {
>>   BUG_ON(buf_remaining > 3);
>> + val = 0;
>
> Why does this have to be initialized to 0 now?

I suspect this is because we are going to memcpy less than 4 bytes
into it, but I cannot figure out how that memcpy if guaranteed to
produce the expected result for both endiannesses.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2 0/5] Overhaul the audit filename handling

2015-01-21 Thread Al Viro
On Wed, Jan 21, 2015 at 09:36:34PM -0800, Guenter Roeck wrote:
> On 01/21/2015 08:59 PM, Paul Moore wrote:
> >This patchset has some important changes from the previous revision,
> >namely a fix from Al Viro (included in 2/5) that resolves a boot panic
> >on some systems as well as some smaller, less noteworthy fixes found
> >in the linux-next announcement thread from January 20th (refcount bump
> >in __audit_reusename() and a inode type in __audit_inode()).
> >
> >This patchset still needs some additional testing to verify that the
> >audit code still functions properly (the minor fixes mentioned above)
> >and there is an additional patch from Al that should be included as
> >well, but I wanted to post this and push the series to the audit next
> >branch quickly since a number of folks were affected by the boot panic.
> >
> >---
> >
> >Paul Moore (5):
> >   fs: rework getname_kernel to handle up to PATH_MAX sized filenames
> >   fs: create proper filename objects using getname_kernel()
> >   audit: enable filename recording via getname_kernel()
> >   audit: fix filename matching in __audit_inode() and 
> > __audit_inode_child()
> >   audit: replace getname()/putname() hacks with reference counters
> >
> Hi Paul,
> 
> What is the baseline for this patch set ? Obviously -next won't work,
> and it does not apply to mainline either.

FWIW, I've ported that on top of vfs.git#for-next; result is in
vfs.git#experimental.  Paul, are you OK with that one?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] nios2: __kuser_sigtramp placement fix

2015-01-21 Thread Ley Foon Tan
On Thu, Jan 22, 2015 at 3:14 PM, Chung-Lin Tang  wrote:
> The address of __kuser_sigtramp is wrong by one word, due to padding
> __kuser_cmpxchg to fully 64 bytes. The version word at the start of the
> page displaces __kuser_sigtramp to 0x1044, instead of the intended 0x1040.
>
> Fixed by counting the 64-byte frame from the start of the page instead
> of __kuser_cmpxchg. This shortens the __kuser_cmpxchg frame to 60-bytes,
> but that's likely enough.
>
> The zero-byte padding parts of the kuser_pad macro has been removed, due
> to the .if command refusing to behave properly when there are other
> .word directives in between. Probably a binutils gas bug.
>
> Thanks,
> Chung-Lin
>
> Cc: Ley Foon Tan 
> Cc: Tobias Klauser 
> Signed-off-by: Chung-Lin Tang 
>
> diff --git a/arch/nios2/kernel/entry.S b/arch/nios2/kernel/entry.S
> index 0bdfd13..3224839 100644
> --- a/arch/nios2/kernel/entry.S
> +++ b/arch/nios2/kernel/entry.S
> @@ -492,14 +492,7 @@ ENTRY(ret_from_kernel_thread)
>
>   /* Filling pads with undefined instructions. */
>  .macro kuser_pad sym size
> -   .if ((. - \sym) & 3)
> -   .rept   (4 - (. - \sym) & 3)
> -   .byte   0
> -   .endr
> -   .endif
> -   .rept   ((\size - (. - \sym)) / 4)
> -   .word   0xdeadbeef
> -   .endr
> +   .fill   ((\size - (. - \sym)) / 4), 4, 0xdeadbeef
>  .endm
>
> .align  6
> @@ -526,7 +519,10 @@ cmpxchg_stw:
>  cmpxchg_ret:
> ret
>
> -   kuser_pad __kuser_cmpxchg, 64
> +   /* The first 64-byte frame contains the version word, so note
> +  that the first padding entry is based from the start of the kuser
> +  page, instead of __kuser_cmpxchg.  */
> +   kuser_pad __kuser_helper_start, 64
>
> .globl  __kuser_sigtramp
>  __kuser_sigtramp:
> --
Hi Chung-Lin

I thought this is our original intention for it.

First 4 bytes is the __kuser_version and each __kuser function will
have 64 bytes size.

0x1000 __kuser_helper_version
0x1004 __kuser_cmpxchg
0x1044 __kuser_sigtramp

Any reason you can't use __kuser_sigtramp @ 0x1044?
Thanks.

Regards
Ley Foon
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: linux-next: strange commit in the mfd tree

2015-01-21 Thread Lee Jones
On Thu, 22 Jan 2015, Stephen Rothwell wrote:

> Hi Lee,
> 
> I noticed this commit in the mfd tree:
> 
> f11b9265e6ca "[FIX/HACK] Disable DRM"
> 
> Is that really appropriate here?  Especially given it has no explanation.
> 
> I guess it will make my builds slightly faster :-)

You're right, this is an escapee.  It should have been removed
post-testing.  I have asked Rob Clark to take a look at the issue it
'solves'. FYI, arm,multi_v7 fails to build with raised warning levels
>=1.

-- 
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-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/2] ARM: ux500: Remove unused functions and structs

2015-01-21 Thread Lee Jones
On Thu, 22 Jan 2015, Rickard Strandqvist wrote:

> Remove same unused functions and structs.

Repeating the subject line in the commit message is seldom
appropriate.  Please elaborate.

> Signed-off-by: Rickard Strandqvist 
> ---
>  arch/arm/mach-ux500/board-mop500-regulators.c |  106 
> -
>  arch/arm/mach-ux500/board-mop500-regulators.h |5 --
>  2 files changed, 111 deletions(-)
> 
> diff --git a/arch/arm/mach-ux500/board-mop500-regulators.c 
> b/arch/arm/mach-ux500/board-mop500-regulators.c
> index 32d744e..2b8f685 100644
> --- a/arch/arm/mach-ux500/board-mop500-regulators.c
> +++ b/arch/arm/mach-ux500/board-mop500-regulators.c
> @@ -19,17 +19,6 @@ static struct regulator_consumer_supply 
> gpio_en_3v3_consumers[] = {
> REGULATOR_SUPPLY("vdd33a", "smsc911x.0"),
>  };
>  
> -struct regulator_init_data gpio_en_3v3_regulator = {
> -   .constraints = {
> -   .name = "EN-3V3",
> -   .min_uV = 330,
> -   .max_uV = 330,
> -   .valid_ops_mask = REGULATOR_CHANGE_STATUS,
> -   },
> -   .num_consumer_supplies = ARRAY_SIZE(gpio_en_3v3_consumers),
> -   .consumer_supplies = gpio_en_3v3_consumers,
> -};
> -
>  /*
>   * TPS61052 regulator
>   */
> @@ -43,17 +32,6 @@ static struct regulator_consumer_supply 
> tps61052_vaudio_consumers[] = {
>   REGULATOR_SUPPLY("vintdclassint", "ab8500-codec.0"),
>  };
>  
> -struct regulator_init_data tps61052_regulator = {
> - .constraints = {
> - .name = "vaudio-hf",
> - .min_uV = 450,
> - .max_uV = 450,
> - .valid_ops_mask = REGULATOR_CHANGE_STATUS,
> - },
> - .num_consumer_supplies = ARRAY_SIZE(tps61052_vaudio_consumers),
> - .consumer_supplies = tps61052_vaudio_consumers,
> -};
> -

I guess we issue all of this stuff from DT now.

>  static struct regulator_consumer_supply ab8500_vaux1_consumers[] = {
>   /* Main display, u8500 R3 uib */
>   REGULATOR_SUPPLY("vddi", "mcde_disp_sony_acx424akp.0"),
> @@ -483,11 +461,6 @@ static struct regulator_consumer_supply 
> ab8500_ext_supply3_consumers[] = {
>   REGULATOR_SUPPLY("vinvsim", "sim-detect.0"),
>  };
>  
> -/* extended configuration for VextSupply2, only used for HREFP_V20 boards */
> -static struct ab8500_ext_regulator_cfg ab8500_ext_supply2 = {
> - .hwreq = true,
> -};
> -

So if we're not passing this stuff from platform data anymore, why is
the struct required at all?  It's the one you moved in patch 1 right?

>  /*
>   * AB8500 external regulators
>   */
> @@ -984,82 +957,3 @@ struct ab8500_regulator_platform_data 
> ab8500_regulator_plat_data = {
>   .ext_regulator  = ab8500_ext_regulators,
>   .num_ext_regulator  = ARRAY_SIZE(ab8500_ext_regulators),
>  };
> -
> -struct ab8500_regulator_platform_data ab8505_regulator_plat_data = {
> - .reg_init   = ab8505_reg_init,
> - .num_reg_init   = ARRAY_SIZE(ab8505_reg_init),
> - .regulator  = ab8505_regulators,
> - .num_regulator  = ARRAY_SIZE(ab8505_regulators),
> -};
> -
> -static void ab8500_modify_reg_init(int id, u8 mask, u8 value)
> -{
> - int i;
> -
> - if (cpu_is_u8520()) {
> - for (i = ARRAY_SIZE(ab8505_reg_init) - 1; i >= 0; i--) {
> - if (ab8505_reg_init[i].id == id) {
> - u8 initval = ab8505_reg_init[i].value;
> - initval = (initval & ~mask) | (value & mask);
> - ab8505_reg_init[i].value = initval;
> -
> - BUG_ON(mask & ~ab8505_reg_init[i].mask);
> - return;
> - }
> - }
> - } else {
> - for (i = ARRAY_SIZE(ab8500_reg_init) - 1; i >= 0; i--) {
> - if (ab8500_reg_init[i].id == id) {
> - u8 initval = ab8500_reg_init[i].value;
> - initval = (initval & ~mask) | (value & mask);
> - ab8500_reg_init[i].value = initval;
> -
> - BUG_ON(mask & ~ab8500_reg_init[i].mask);
> - return;
> - }
> - }
> - }
> -
> - BUG_ON(1);
> -}
> -
> -void mop500_regulator_init(void)
> -{
> - struct regulator_init_data *regulator;
> -
> - /*
> -  * Temporarily turn on Vaux2 on 8520 machine
> -  */
> - if (cpu_is_u8520()) {
> - /* Vaux2 initialized to be on */
> - ab8500_modify_reg_init(AB8505_VAUX12REGU, 0x0f, 0x05);
> - }
> -
> - /*
> -  * Handle AB8500_EXT_SUPPLY2 on HREFP_V20_V50 boards (do it for
> -  * all HREFP_V20 boards)
> -  */
> - if (cpu_is_u8500v20()) {
> - /* VextSupply2RequestCtrl =  HP/OFF depending on VxRequest */
> - ab8500_modify_reg_init(AB8500_REGUREQUESTCTRL3, 0x01, 0x01);
> -
> - /* 

Re: [PATCH] mm, vmacache: Add kconfig VMACACHE_SHIFT

2015-01-21 Thread Davidlohr Bueso
On Thu, 2015-01-22 at 14:29 +0800, WANG Chao wrote:
> Add a new kconfig option VMACACHE_SHIFT (as a power of 2) to specify the
> number of slots vma cache has for each thread. Range is chosen 0-4 (1-16
> slots) to consider both overhead and performance penalty. Default is 2
> (4 slots) as it originally is, which provides good enough balance.
> 

Nack. I don't feel comfortable making scalability features of core code
configurable.

Thanks,
Davidlohr



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/2] ARM: ux500: Move struct

2015-01-21 Thread Lee Jones
The subject line is not a good one.  Please elaborate.

> Move struct ab8500_ext_regulator_cfg to  the only file that is now used in.

   Attention to detail --^

> Signed-off-by: Rickard Strandqvist 
> ---
>  drivers/regulator/ab8500-ext.c   |6 ++
>  include/linux/regulator/ab8500.h |5 -
>  2 files changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/regulator/ab8500-ext.c b/drivers/regulator/ab8500-ext.c
> index 84c1ee3..a40c701 100644
> --- a/drivers/regulator/ab8500-ext.c
> +++ b/drivers/regulator/ab8500-ext.c
> @@ -25,6 +25,12 @@
>  #include 
>  #include 
>  
> +

Superfluous '\n'.

> +/* AB8500 external regulators */

No need for this commit now.

> +struct ab8500_ext_regulator_cfg {
> + bool hwreq; /* requires hw mode or high power mode */
> +};
> +

Are you sure a struct is required at all now?  It only contains a
single bool after all.

>  /**
>   * struct ab8500_ext_regulator_info - ab8500 regulator information
>   * @dev: device pointer
> diff --git a/include/linux/regulator/ab8500.h 
> b/include/linux/regulator/ab8500.h
> index d8ecefa..802529b 100644
> --- a/include/linux/regulator/ab8500.h
> +++ b/include/linux/regulator/ab8500.h
> @@ -300,11 +300,6 @@ enum ab8540_regulator_reg {
>   AB8540_NUM_REGULATOR_REGISTERS,
>  };
>  
> -/* AB8500 external regulators */
> -struct ab8500_ext_regulator_cfg {
> - bool hwreq; /* requires hw mode or high power mode */
> -};
> -
>  enum ab8500_ext_regulator_id {
>   AB8500_EXT_SUPPLY1,
>   AB8500_EXT_SUPPLY2,

-- 
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-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v4 2/2] Documentation: Add documentation for rt5033 multifunction device

2015-01-21 Thread Lee Jones
On Thu, 22 Jan 2015, Beomho Seo wrote:

> This patch device tree binding documentation for rt5033 multifunction device.
> 
> Cc: Sebastian Reichel 
> Cc: Lee Jones 
> Cc: Mark Brown 
> Cc: Rob Herring 
> Cc: Pawel Moll 
> Cc: Mark Rutland 
> Cc: Ian campbell 
> Cc: Kumar Gala 
> Signed-off-by: Beomho Seo 
> Acked-by: Chanwoo Choi 
> Acked-by: Lee Jones 

I did not Ack this patch.

Your new vendor bindings require a DT Ack.

Although, as the ones I'm concerned with are Regulator related, and
Ack from Mark Brown will also suffice.

> ---
> Changes in v4
> - none.
> Changes in v3
> - Add Acked-by
> Changes in v2
> - Fix incorrect typo.
> - Align -uamp and -uvolt names with regulator binding suffixes.
> - Drop incorrect phandle.
> - Fix incorrect example.
> ---
> 
>  Documentation/devicetree/bindings/mfd/rt5033.txt   |  101 
> 
>  .../devicetree/bindings/vendor-prefixes.txt|1 +
>  2 files changed, 102 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/mfd/rt5033.txt
> 
> diff --git a/Documentation/devicetree/bindings/mfd/rt5033.txt 
> b/Documentation/devicetree/bindings/mfd/rt5033.txt
> new file mode 100644
> index 000..64b23e8
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/mfd/rt5033.txt
> @@ -0,0 +1,101 @@
> +Richtek RT5033 Power management Integrated Circuit
> +
> +RT5033 is a Multifunction device which includes battery charger, fuel gauge,
> +flash LED current source, LDO and synchronous Buck converter for portable
> +applications. It is interfaced to host controller using i2c interface.
> +
> +Required properties:
> +- compatible : Must be "richtek,rt5033"
> +- reg : Specifies the i2c slave address of general part.
> +- interrupts : This i2c devices has an IRQ line connected to the main SoC.
> +- interrupt-parent : The parent interrupt controller.
> +
> +Optional node:
> +Regulators: The regulators of RT5033 have to be instantiated under sub-node
> +named "regulators" using the following format.
> +
> + regulators {
> + regulator-name {
> + regulator-name = LDO/BUCK
> + regulator subnodes called X, Y and Z
> + };
> + };
> + refer Documentation/devicetree/bindings/regulator/regulator.txt
> +
> +
> +Battery charger: There battery charger of RT5033 have to be instantiated 
> under
> +sub-node named "charger" using the following format.
> +
> +Required properties:
> +- compatible : Must be "richtek,rt5033-charger".
> +- richtek,pre-uamp : Current of pre-charge mode. The pre-charge current 
> levels
> +  are 350 mA to 650 mA programmed by I2C per 100 mA.
> +- richtek,fast-uamp : Current of fast-charge mode. The fast-charge current
> +  levels are 700 mA to 2000 mA programmed by I2C per 100 mA.
> +- richtek,eoc-uamp : This property is end of charge current. Its level 150 mA
> +  to 200 mA.
> +- richtek,pre-threshold-uvolt : Voltage of threshold pre-charge mode. Battery
> +  voltage is below pre-charge threshold voltage, the charger is in pre-charge
> +  mode with pre-charge current. Its levels are 2.3 V  to 3.8 V programmed
> +  by I2C per 0.1 V.
> +- richtek,const-uvolt :  Battery regulation voltage of constant voltage mode.
> +  This voltage level 3.65 V to 4.4 V bye I2C per 0.025 V.
> +
> + charger {
> + compatible = "richtek,rt5033-charger";
> + richtek,pre-uamp = <35>;
> + richtek,fast-uamp = <200>;
> + richtek,eoc-uamp = <25>;
> + richtek,pre-threshold-uvolt = <340>;
> + richtek,const-uvolt = <435>;
> +
> + };
> +
> +
> +Fuelgauge: There fuelgauge of RT5033 to be instantiated node named 
> "fuelgauge"
> +using the following format.
> +
> +Required properties:
> +- compatible = Must be "richtek,rt5033-battery".
> +
> + rt5033@35 {
> + compatible = "richtek,rt5033-battery";
> + interrupt-parent = <>;
> + interrupts = <3 0>;
> + reg = <0x35>;
> + };
> +
> +Example:
> +
> + rt5033@34 {
> + compatible = "richtek,rt5033";
> + reg = <0x34>;
> + interrupt-parent = <>;
> + interrupts = <5 0>;
> +
> + regulators {
> + buck_reg: BUCK {
> + regulator-name = "BUCK";
> + regulator-min-microvolt = <120>;
> + regulator-max-microvolt = <120>;
> + regulator-always-on;
> + };
> + };
> +
> + charger {
> + compatible = "richtek,rt5033-charger";
> + richtek,pre-uamp = <35>;
> + richtek,fast-uamp = <200>;
> + richtek,eoc-uamp = <25>;
> +

Re: [RESEND PATCH v2 4/9] mfd: rtsx: update driving settings

2015-01-21 Thread Joe Perches
On Thu, 2015-01-22 at 15:30 +0800, micky_ch...@realsil.com.cn wrote:
> update card drive settings, This setting can be used for rts5249
> rts524A and rts525A.
[]
> diff --git a/drivers/mfd/rts5249.c b/drivers/mfd/rts5249.c

> @@ -36,16 +36,16 @@ static u8 rts5249_get_ic_version(struct rtsx_pcr *pcr)
>  static void rts5249_fill_driving(struct rtsx_pcr *pcr, u8 voltage)
>  {
>   u8 driving_3v3[4][3] = {

It'd be nice to make these arrays static const

> - {0x11, 0x11, 0x11},
> + {0x11, 0x11, 0x18},
>   {0x55, 0x55, 0x5C},
> - {0x99, 0x99, 0x92},
> - {0x99, 0x99, 0x92},
> + {0xFF, 0xFF, 0xFF},
> + {0x96, 0x96, 0x96},
>   };
>   u8 driving_1v8[4][3] = {
> + {0xC4, 0xC4, 0xC4},
>   {0x3C, 0x3C, 0x3C},
> - {0xB3, 0xB3, 0xB3},
>   {0xFE, 0xFE, 0xFE},
> - {0xC4, 0xC4, 0xC4},
> + {0xB3, 0xB3, 0xB3},
>   };
>   u8 (*driving)[3], drive_sel;


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/2] i2c: tegra: Maintain CPU endianness

2015-01-21 Thread Thierry Reding
On Tue, Jan 20, 2015 at 03:22:25PM +0300, Dmitry Osipenko wrote:
> Support CPU BE mode by adding endianness conversion for memcpy interactions.
> 
> Signed-off-by: Dmitry Osipenko 
> ---
>  drivers/i2c/busses/i2c-tegra.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
> index 28b87e6..e0d3ef1 100644
> --- a/drivers/i2c/busses/i2c-tegra.c
> +++ b/drivers/i2c/busses/i2c-tegra.c
> @@ -286,6 +286,7 @@ static int tegra_i2c_empty_rx_fifo(struct tegra_i2c_dev 
> *i2c_dev)
>   if (rx_fifo_avail > 0 && buf_remaining > 0) {
>   BUG_ON(buf_remaining > 3);
>   val = i2c_readl(i2c_dev, I2C_RX_FIFO);
> + val = cpu_to_le32(val);

Should this not technically be le32_to_cpu() since the data originates
from the I2C controller?

>   memcpy(buf, , buf_remaining);
>   buf_remaining = 0;
>   rx_fifo_avail--;
> @@ -343,7 +344,9 @@ static int tegra_i2c_fill_tx_fifo(struct tegra_i2c_dev 
> *i2c_dev)
>*/
>   if (tx_fifo_avail > 0 && buf_remaining > 0) {
>   BUG_ON(buf_remaining > 3);
> + val = 0;

Why does this have to be initialized to 0 now?

Thierry


pgpYy2UvwAmD5.pgp
Description: PGP signature


[PATCH] hrtimer: add hrtimer_start_now()

2015-01-21 Thread Olliver Schinagl
From: Olliver Schinagl 

When using a hrtimer for repeating periodic ticks, hrtimer_forward_now()
is often used. Quite possibly the timer loop is thus probably fully
controlled by hrtimer_forward_now() and we don't really care when the
timer is started. With hrtimer_start() we need to define exactly when a
event has to start. By introducing hrtimer_start_now() we do the same as
what hrtimer_forward_now() does, start as soon as possible and get into
the timer loop.

Signed-off-by: Olliver Schinagl 
---
 include/linux/hrtimer.h | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h
index a036d05..080a5f5 100644
--- a/include/linux/hrtimer.h
+++ b/include/linux/hrtimer.h
@@ -353,6 +353,12 @@ static inline void destroy_hrtimer_on_stack(struct hrtimer 
*timer) { }
 /* Basic timer operations: */
 extern int hrtimer_start(struct hrtimer *timer, ktime_t tim,
 const enum hrtimer_mode mode);
+
+static inline int hrtimer_start_now(struct hrtimer *timer,
+   const enum hrtimer_mode mode)
+{
+   return hrtimer_start(timer, timer->base->get_time(), mode);
+}
 extern int hrtimer_start_range_ns(struct hrtimer *timer, ktime_t tim,
unsigned long range_ns, const enum hrtimer_mode mode);
 extern int
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2] clk: Introduce clk_has_parent()

2015-01-21 Thread Thierry Reding
On Wed, Jan 21, 2015 at 04:16:05PM -0800, Stephen Boyd wrote:
> On 01/21/2015 08:13 AM, Thierry Reding wrote:
> > From: Thierry Reding 
> >
> > This new function is similar to clk_set_parent(), except that it doesn't
> > actually change the parent. It merely checks that the given parent clock
> > can be a parent for the given clock.
> >
> > A situation where this is useful is to check that a particular setup is
> > valid before switching to it. One specific use-case for this is atomic
> > modesetting in the DRM framework where setting a mode is divided into a
> > check phase where a given configuration is validated before applying
> > changes to the hardware.
> >
> > Cc: Russell King 
> > Cc: Mike Turquette 
> > Cc: Stephen Boyd 
> > Signed-off-by: Thierry Reding 
> > ---
> 
> Reviewed-by: Stephen Boyd 
> 
> This will slightly conflict with Tomeu's  patches for per-user clock
> constraints. It would be best if we can take this through the clk tree
> to fix up any conflicts

I had hoped to take this through the drm tree to resolve the build-time.
Another possibility would be for me to include the clk tree (or a subset
thereof) in my pull-request. That way you can still fix things up in the
clock tree if there are any conflicts with other work. We could make
that work two ways: this patch gets applied to the clk tree and I pull
it, or I provide a stable branch that I base my pull request on and that
branch can be pulled into the clk tree.

Yet another alternative would be to split out the clk_has_parent()
change from the series and not use it for now. That way we're going to
miss this check, but we do that anyway currently and it will only be
temporary until v3.21.

Perhaps given where we are in the release cycle the latter would make
the most sense for now.

> > diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
[...]
> > +   /* Optimize for the case where the parent is already the parent. */
> > +   if (clk->parent == parent)
> > +   return true;
> 
> I worry that we'll need to grab a lock here with Tomeu's patches, but
> maybe I'm wrong.

Why would this need a lock? Worst case somebody concurrently changes the
parent, in which case will not succeed and fallback to the lookup below.

It's been a while since I last looked at Tomeu's series, but I seem to
remember that struct clk was going to be per-user, in which case I guess
the code would have to be modified anyway since ->parent and
->parent_names will likely become properties of the clock structure
shared by all users (was it struct clk_core?).

Thierry


pgpcfp9ai2yM5.pgp
Description: PGP signature


Re: [PATCH 1/2] drm/rockchip: vop use is_enabled instead of dpms mode

2015-01-21 Thread Daniel Vetter
On Thu, Jan 22, 2015 at 03:05:32PM +0800, Mark Yao wrote:
> drm dpms have many power modes: ON,OFF,SUSPEND,STANDBY, etc.
> but vop only have enable/disable mode, maybe case such bug:
>  --> DRM_DPMS_ON: power on vop
>  --> DRM_DPMS_SUSPEND: power off vop
>  --> DRM_DPMS_OFF: already power off at SUSPEND, crash
> so use a bool val is more suitable.
> 
> Signed-off-by: Mark Yao 

Long term I highly suggest you switch to atomic, since with atomic all the
legacy dpms modes are remapped to a simple on/off. Also the new atomic
helpers make sure that your backend isn't called multiple times, so you
can ditch all your is_enabled tracking with that.
-Daniel

> ---
>  drivers/gpu/drm/rockchip/rockchip_drm_vop.c |   34 
> ++-
>  1 file changed, 18 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c 
> b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> index 9a5c571..f278c09 100644
> --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> @@ -81,7 +81,7 @@ struct vop {
>   struct drm_crtc crtc;
>   struct device *dev;
>   struct drm_device *drm_dev;
> - unsigned int dpms;
> + bool is_enabled;
>  
>   int connector_type;
>   int connector_out_mode;
> @@ -387,6 +387,9 @@ static void vop_enable(struct drm_crtc *crtc)
>   struct vop *vop = to_vop(crtc);
>   int ret;
>  
> + if (vop->is_enabled)
> + return;
> +
>   ret = clk_enable(vop->hclk);
>   if (ret < 0) {
>   dev_err(vop->dev, "failed to enable hclk - %d\n", ret);
> @@ -427,6 +430,8 @@ static void vop_enable(struct drm_crtc *crtc)
>  
>   drm_vblank_on(vop->drm_dev, vop->pipe);
>  
> + vop->is_enabled = false;
> +
>   return;
>  
>  err_disable_aclk:
> @@ -441,6 +446,9 @@ static void vop_disable(struct drm_crtc *crtc)
>  {
>   struct vop *vop = to_vop(crtc);
>  
> + if (vop->is_enabled)
> + return;
> +
>   drm_vblank_off(crtc->dev, vop->pipe);
>  
>   disable_irq(vop->irq);
> @@ -463,6 +471,8 @@ static void vop_disable(struct drm_crtc *crtc)
>  
>   clk_disable(vop->aclk);
>   clk_disable(vop->hclk);
> +
> + vop->is_enabled = false;
>  }
>  
>  /*
> @@ -742,7 +752,7 @@ static int vop_crtc_enable_vblank(struct drm_crtc *crtc)
>   struct vop *vop = to_vop(crtc);
>   unsigned long flags;
>  
> - if (vop->dpms != DRM_MODE_DPMS_ON)
> + if (!vop->is_enabled)
>   return -EPERM;
>  
>   spin_lock_irqsave(>irq_lock, flags);
> @@ -759,8 +769,9 @@ static void vop_crtc_disable_vblank(struct drm_crtc *crtc)
>   struct vop *vop = to_vop(crtc);
>   unsigned long flags;
>  
> - if (vop->dpms != DRM_MODE_DPMS_ON)
> + if (!vop->is_enabled)
>   return;
> +
>   spin_lock_irqsave(>irq_lock, flags);
>   vop_mask_write(vop, INTR_CTRL0, FS_INTR_MASK, FS_INTR_EN(0));
>   spin_unlock_irqrestore(>irq_lock, flags);
> @@ -773,15 +784,8 @@ static const struct rockchip_crtc_funcs 
> private_crtc_funcs = {
>  
>  static void vop_crtc_dpms(struct drm_crtc *crtc, int mode)
>  {
> - struct vop *vop = to_vop(crtc);
> -
>   DRM_DEBUG_KMS("crtc[%d] mode[%d]\n", crtc->base.id, mode);
>  
> - if (vop->dpms == mode) {
> - DRM_DEBUG_KMS("desired dpms mode is same as previous one.\n");
> - return;
> - }
> -
>   switch (mode) {
>   case DRM_MODE_DPMS_ON:
>   vop_enable(crtc);
> @@ -795,8 +799,6 @@ static void vop_crtc_dpms(struct drm_crtc *crtc, int mode)
>   DRM_DEBUG_KMS("unspecified mode %d\n", mode);
>   break;
>   }
> -
> - vop->dpms = mode;
>  }
>  
>  static void vop_crtc_prepare(struct drm_crtc *crtc)
> @@ -934,9 +936,9 @@ static int vop_crtc_page_flip(struct drm_crtc *crtc,
>   struct drm_framebuffer *old_fb = crtc->primary->fb;
>   int ret;
>  
> - /* when the page flip is requested, crtc's dpms should be on */
> - if (vop->dpms > DRM_MODE_DPMS_ON) {
> - DRM_DEBUG("failed page flip request at dpms[%d].\n", vop->dpms);
> + /* when the page flip is requested, crtc should be on */
> + if (!vop->is_enabled) {
> + DRM_DEBUG("page flip request rejected because crtc is off.\n");
>   return 0;
>   }
>  
> @@ -1302,7 +1304,7 @@ static int vop_initial(struct vop *vop)
>  
>   clk_disable(vop->hclk);
>  
> - vop->dpms = DRM_MODE_DPMS_OFF;
> + vop->is_enabled = false;
>  
>   return 0;
>  
> -- 
> 1.7.9.5
> 
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


linux-next: build failure after merge of the akpm-current tree

2015-01-21 Thread Stephen Rothwell
Hi Andrew,

After merging the akpm-current tree, today's linux-next build (x86_64 
allmodconfig)
failed like this:

fs/ocfs2/aops.c: In function 'ocfs2_direct_IO_write':
fs/ocfs2/aops.c:784:9: error: too few arguments to function 
'blkdev_issue_zeroout'
   ret = blkdev_issue_zeroout(osb->sb->s_bdev,
 ^
In file included from fs/ocfs2/aops.c:31:0:
include/linux/blkdev.h:1165:12: note: declared here
 extern int blkdev_issue_zeroout(struct block_device *bdev, sector_t sector,
^

Caused by commit e95f8b5356c4 ("ocfs2: implement
ocfs2_direct_IO_write") interacting with commit d93ba7a5a97c ("block:
Add discard flag to blkdev_issue_zeroout() function") from the block
tree.

I have added this merge fix patch:

From: Stephen Rothwell 
Date: Thu, 22 Jan 2015 18:28:21 +1100
Subject: [PATCH] ocfs2: implement ocfs2_direct_IO_write fix

update for an API change

Signed-off-by: Stephen Rothwell 
---
 fs/ocfs2/aops.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c
index 89f43dc7e440..af22615afd35 100644
--- a/fs/ocfs2/aops.c
+++ b/fs/ocfs2/aops.c
@@ -784,7 +784,7 @@ static ssize_t ocfs2_direct_IO_write(struct kiocb *iocb,
ret = blkdev_issue_zeroout(osb->sb->s_bdev,
p_cpos << (osb->s_clustersize_bits - 9),
zero_len >> 9,
-   GFP_KERNEL);
+   GFP_KERNEL, false);
if (ret < 0)
mlog_errno(ret);
}
-- 
2.1.4

-- 
Cheers,
Stephen Rothwells...@canb.auug.org.au


pgp0gECBXcbmm.pgp
Description: OpenPGP digital signature


[RESEND PATCH v2 0/9] mfd: rtsx: add support for new rts524A and rts525A

2015-01-21 Thread micky_ching
From: Micky Ching 

resend:
- add lee jones ack for some patch.
v2:
- remove debug info when access failed.
- using macro list for phy register init.
- rename function for multi chip prefix with rtsx_base_
- save pcie_cap offset when init chip, not calling pci_find_capacity()
  every time.
- add pcr->ops: write_phy/read_phy for special chip.

This patchset including re-format some coding-style and add two new chip
rts524A and rts525A.


Micky Ching (9):
  mfd: rtsx: replace TAB by SPC after #define
  mfd: rtsx: place register address and values togather
  mfd: rtsx: update PETXCFG address
  mfd: rtsx: update driving settings
  mfd: rtsx: update phy register
  mfd: rtsx: remove LCTLR defination
  mfd: rtsx: add support for rts524A
  mfd: rtsx: add support for rts525A
  mfd: rtsx: using pcr_dbg replace dev_dbg

 drivers/mfd/Makefile |2 +-
 drivers/mfd/rtl8411.c|   11 +-
 drivers/mfd/rts5209.c|4 +-
 drivers/mfd/rts5227.c|   12 +-
 drivers/mfd/rts5229.c|4 +-
 drivers/mfd/rts5249.c|  368 +++---
 drivers/mfd/rtsx_gops.c  |   37 --
 drivers/mfd/rtsx_pcr.c   |  109 +++--
 drivers/mfd/rtsx_pcr.h   |8 +
 include/linux/mfd/rtsx_pci.h | 1109 ++
 10 files changed, 965 insertions(+), 699 deletions(-)
 delete mode 100644 drivers/mfd/rtsx_gops.c

-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[RESEND PATCH v2 5/9] mfd: rtsx: update phy register

2015-01-21 Thread micky_ching
From: Micky Ching 

update phy register value and using direct value instead of macros.
It is much easier to debug using constant value than a lot of macros.
We usually need compare the value directly to check the configure.

Signed-off-by: Micky Ching 
---
 drivers/mfd/rts5249.c|  55 --
 include/linux/mfd/rtsx_pci.h | 109 ++-
 2 files changed, 85 insertions(+), 79 deletions(-)

diff --git a/drivers/mfd/rts5249.c b/drivers/mfd/rts5249.c
index 2fe2854..d8072f6 100644
--- a/drivers/mfd/rts5249.c
+++ b/drivers/mfd/rts5249.c
@@ -132,57 +132,62 @@ static int rts5249_optimize_phy(struct rtsx_pcr *pcr)
if (err < 0)
return err;
 
-   err = rtsx_pci_write_phy_register(pcr, PHY_REG_REV,
-   PHY_REG_REV_RESV | PHY_REG_REV_RXIDLE_LATCHED |
-   PHY_REG_REV_P1_EN | PHY_REG_REV_RXIDLE_EN |
-   PHY_REG_REV_RX_PWST | PHY_REG_REV_CLKREQ_DLY_TIMER_1_0 |
-   PHY_REG_REV_STOP_CLKRD | PHY_REG_REV_STOP_CLKWR);
+   err = rtsx_pci_write_phy_register(pcr, PHY_REV,
+   PHY_REV_RESV | PHY_REV_RXIDLE_LATCHED |
+   PHY_REV_P1_EN | PHY_REV_RXIDLE_EN |
+   PHY_REV_CLKREQ_TX_EN | PHY_REV_RX_PWST |
+   PHY_REV_CLKREQ_DT_1_0 | PHY_REV_STOP_CLKRD |
+   PHY_REV_STOP_CLKWR);
if (err < 0)
return err;
 
msleep(1);
 
err = rtsx_pci_write_phy_register(pcr, PHY_BPCR,
-   PHY_BPCR_IBRXSEL | PHY_BPCR_IBTXSEL |
-   PHY_BPCR_IB_FILTER | PHY_BPCR_CMIRROR_EN);
+   PHY_BPCR_IBRXSEL | PHY_BPCR_IBTXSEL |
+   PHY_BPCR_IB_FILTER | PHY_BPCR_CMIRROR_EN);
if (err < 0)
return err;
+
err = rtsx_pci_write_phy_register(pcr, PHY_PCR,
-   PHY_PCR_FORCE_CODE | PHY_PCR_OOBS_CALI_50 |
-   PHY_PCR_OOBS_VCM_08 | PHY_PCR_OOBS_SEN_90 |
-   PHY_PCR_RSSI_EN);
+   PHY_PCR_FORCE_CODE | PHY_PCR_OOBS_CALI_50 |
+   PHY_PCR_OOBS_VCM_08 | PHY_PCR_OOBS_SEN_90 |
+   PHY_PCR_RSSI_EN | PHY_PCR_RX10K);
if (err < 0)
return err;
+
err = rtsx_pci_write_phy_register(pcr, PHY_RCR2,
-   PHY_RCR2_EMPHASE_EN | PHY_RCR2_NADJR |
-   PHY_RCR2_CDR_CP_10 | PHY_RCR2_CDR_SR_2 |
-   PHY_RCR2_FREQSEL_12 | PHY_RCR2_CPADJEN |
-   PHY_RCR2_CDR_SC_8 | PHY_RCR2_CALIB_LATE);
+   PHY_RCR2_EMPHASE_EN | PHY_RCR2_NADJR |
+   PHY_RCR2_CDR_SR_2 | PHY_RCR2_FREQSEL_12 |
+   PHY_RCR2_CDR_SC_12P | PHY_RCR2_CALIB_LATE);
if (err < 0)
return err;
+
err = rtsx_pci_write_phy_register(pcr, PHY_FLD4,
-   PHY_FLD4_FLDEN_SEL | PHY_FLD4_REQ_REF |
-   PHY_FLD4_RXAMP_OFF | PHY_FLD4_REQ_ADDA |
-   PHY_FLD4_BER_COUNT | PHY_FLD4_BER_TIMER |
-   PHY_FLD4_BER_CHK_EN);
+   PHY_FLD4_FLDEN_SEL | PHY_FLD4_REQ_REF |
+   PHY_FLD4_RXAMP_OFF | PHY_FLD4_REQ_ADDA |
+   PHY_FLD4_BER_COUNT | PHY_FLD4_BER_TIMER |
+   PHY_FLD4_BER_CHK_EN);
if (err < 0)
return err;
-   err = rtsx_pci_write_phy_register(pcr, PHY_RDR, PHY_RDR_RXDSEL_1_9);
+   err = rtsx_pci_write_phy_register(pcr, PHY_RDR,
+   PHY_RDR_RXDSEL_1_9 | PHY_SSC_AUTO_PWD);
if (err < 0)
return err;
err = rtsx_pci_write_phy_register(pcr, PHY_RCR1,
-   PHY_RCR1_ADP_TIME | PHY_RCR1_VCO_COARSE);
+   PHY_RCR1_ADP_TIME_4 | PHY_RCR1_VCO_COARSE);
if (err < 0)
return err;
err = rtsx_pci_write_phy_register(pcr, PHY_FLD3,
-   PHY_FLD3_TIMER_4 | PHY_FLD3_TIMER_6 |
-   PHY_FLD3_RXDELINK);
+   PHY_FLD3_TIMER_4 | PHY_FLD3_TIMER_6 |
+   PHY_FLD3_RXDELINK);
if (err < 0)
return err;
+
return rtsx_pci_write_phy_register(pcr, PHY_TUNE,
-   PHY_TUNE_TUNEREF_1_0 | PHY_TUNE_VBGSEL_1252 |
-   PHY_TUNE_SDBUS_33 | PHY_TUNE_TUNED18 |
-   PHY_TUNE_TUNED12);
+   PHY_TUNE_TUNEREF_1_0 | PHY_TUNE_VBGSEL_1252 |
+   PHY_TUNE_SDBUS_33 | PHY_TUNE_TUNED18 |
+   PHY_TUNE_TUNED12 | PHY_TUNE_TUNEA12);
 }
 
 static int rts5249_turn_on_led(struct rtsx_pcr *pcr)
diff --git a/include/linux/mfd/rtsx_pci.h b/include/linux/mfd/rtsx_pci.h
index 87cff60..0103210 100644
--- a/include/linux/mfd/rtsx_pci.h
+++ b/include/linux/mfd/rtsx_pci.h
@@ -630,16 +630,47 @@
 
 /* Phy register */
 #define PHY_PCR0x00
+#define   PHY_PCR_FORCE_CODE   0xB000
+#define   PHY_PCR_OOBS_CALI_50 0x0800
+#define   

[RESEND PATCH v2 4/9] mfd: rtsx: update driving settings

2015-01-21 Thread micky_ching
From: Micky Ching 

update card drive settings, This setting can be used for rts5249
rts524A and rts525A.

Signed-off-by: Micky Ching 
Acked-by: Lee Jones 
---
 drivers/mfd/rts5249.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/mfd/rts5249.c b/drivers/mfd/rts5249.c
index 225ad55..2fe2854 100644
--- a/drivers/mfd/rts5249.c
+++ b/drivers/mfd/rts5249.c
@@ -36,16 +36,16 @@ static u8 rts5249_get_ic_version(struct rtsx_pcr *pcr)
 static void rts5249_fill_driving(struct rtsx_pcr *pcr, u8 voltage)
 {
u8 driving_3v3[4][3] = {
-   {0x11, 0x11, 0x11},
+   {0x11, 0x11, 0x18},
{0x55, 0x55, 0x5C},
-   {0x99, 0x99, 0x92},
-   {0x99, 0x99, 0x92},
+   {0xFF, 0xFF, 0xFF},
+   {0x96, 0x96, 0x96},
};
u8 driving_1v8[4][3] = {
+   {0xC4, 0xC4, 0xC4},
{0x3C, 0x3C, 0x3C},
-   {0xB3, 0xB3, 0xB3},
{0xFE, 0xFE, 0xFE},
-   {0xC4, 0xC4, 0xC4},
+   {0xB3, 0xB3, 0xB3},
};
u8 (*driving)[3], drive_sel;
 
@@ -341,7 +341,7 @@ void rts5249_init_params(struct rtsx_pcr *pcr)
 
pcr->flags = 0;
pcr->card_drive_sel = RTSX_CARD_DRIVE_DEFAULT;
-   pcr->sd30_drive_sel_1v8 = CFG_DRIVER_TYPE_C;
+   pcr->sd30_drive_sel_1v8 = CFG_DRIVER_TYPE_B;
pcr->sd30_drive_sel_3v3 = CFG_DRIVER_TYPE_B;
pcr->aspm_en = ASPM_L1_EN;
pcr->tx_initial_phase = SET_CLOCK_PHASE(1, 29, 16);
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[RESEND PATCH v2 2/9] mfd: rtsx: place register address and values togather

2015-01-21 Thread micky_ching
From: Micky Ching 

It is more readable to place register address and values define
togather. The values define add two leading space indicate belong
to the register address defined above.

Signed-off-by: Micky Ching 
Acked-by: Lee Jones 
---
 include/linux/mfd/rtsx_pci.h | 836 +++
 1 file changed, 369 insertions(+), 467 deletions(-)

diff --git a/include/linux/mfd/rtsx_pci.h b/include/linux/mfd/rtsx_pci.h
index a9c2a14..e81f2bb 100644
--- a/include/linux/mfd/rtsx_pci.h
+++ b/include/linux/mfd/rtsx_pci.h
@@ -28,74 +28,72 @@
 
 #define MAX_RW_REG_CNT 1024
 
-/* PCI Operation Register Address */
 #define RTSX_HCBAR 0x00
 #define RTSX_HCBCTLR   0x04
+#define   STOP_CMD (0x01 << 28)
+#define   READ_REG_CMD 0
+#define   WRITE_REG_CMD1
+#define   CHECK_REG_CMD2
+
 #define RTSX_HDBAR 0x08
+#define   SG_INT   0x04
+#define   SG_END   0x02
+#define   SG_VALID 0x01
+#define   SG_NO_OP 0x00
+#define   SG_TRANS_DATA(0x02 << 4)
+#define   SG_LINK_DESC (0x03 << 4)
 #define RTSX_HDBCTLR   0x0C
+#define   SDMA_MODE0x00
+#define   ADMA_MODE(0x02 << 26)
+#define   STOP_DMA (0x01 << 28)
+#define   TRIG_DMA (0x01 << 31)
+
 #define RTSX_HAIMR 0x10
-#define RTSX_BIPR  0x14
-#define RTSX_BIER  0x18
+#define   HAIMR_TRANS_START(0x01 << 31)
+#define   HAIMR_READ   0x00
+#define   HAIMR_WRITE  (0x01 << 30)
+#define   HAIMR_READ_START (HAIMR_TRANS_START | HAIMR_READ)
+#define   HAIMR_WRITE_START(HAIMR_TRANS_START | HAIMR_WRITE)
+#define   HAIMR_TRANS_END  (HAIMR_TRANS_START)
 
-/* Host command buffer control register */
-#define STOP_CMD   (0x01 << 28)
-
-/* Host data buffer control register */
-#define SDMA_MODE  0x00
-#define ADMA_MODE  (0x02 << 26)
-#define STOP_DMA   (0x01 << 28)
-#define TRIG_DMA   (0x01 << 31)
-
-/* Host access internal memory register */
-#define HAIMR_TRANS_START  (0x01 << 31)
-#define HAIMR_READ 0x00
-#define HAIMR_WRITE(0x01 << 30)
-#define HAIMR_READ_START   (HAIMR_TRANS_START | HAIMR_READ)
-#define HAIMR_WRITE_START  (HAIMR_TRANS_START | HAIMR_WRITE)
-#define HAIMR_TRANS_END(HAIMR_TRANS_START)
-
-/* Bus interrupt pending register */
-#define CMD_DONE_INT   (1 << 31)
-#define DATA_DONE_INT  (1 << 30)
-#define TRANS_OK_INT   (1 << 29)
-#define TRANS_FAIL_INT (1 << 28)
-#define XD_INT (1 << 27)
-#define MS_INT (1 << 26)
-#define SD_INT (1 << 25)
-#define GPIO0_INT  (1 << 24)
-#define OC_INT (1 << 23)
-#define SD_WRITE_PROTECT   (1 << 19)
-#define XD_EXIST   (1 << 18)
-#define MS_EXIST   (1 << 17)
-#define SD_EXIST   (1 << 16)
-#define DELINK_INT GPIO0_INT
-#define MS_OC_INT  (1 << 23)
-#define SD_OC_INT  (1 << 22)
+#define RTSX_BIPR  0x14
+#define   CMD_DONE_INT (1 << 31)
+#define   DATA_DONE_INT(1 << 30)
+#define   TRANS_OK_INT (1 << 29)
+#define   TRANS_FAIL_INT   (1 << 28)
+#define   XD_INT   (1 << 27)
+#define   MS_INT   (1 << 26)
+#define   SD_INT   (1 << 25)
+#define   GPIO0_INT(1 << 24)
+#define   OC_INT   (1 << 23)
+#define   SD_WRITE_PROTECT (1 << 19)
+#define   XD_EXIST (1 << 18)
+#define   MS_EXIST (1 << 17)
+#define   SD_EXIST (1 << 16)
+#define   DELINK_INT   GPIO0_INT
+#define   MS_OC_INT(1 << 23)
+#define   SD_OC_INT(1 << 22)
 
 #define CARD_INT   (XD_INT | MS_INT | SD_INT)
 #define NEED_COMPLETE_INT  (DATA_DONE_INT | TRANS_OK_INT | TRANS_FAIL_INT)
 #define RTSX_INT   (CMD_DONE_INT | NEED_COMPLETE_INT | \
CARD_INT | GPIO0_INT | OC_INT)
-
 #define CARD_EXIST (XD_EXIST | MS_EXIST | SD_EXIST)
 
-/* Bus interrupt enable register */
-#define CMD_DONE_INT_EN(1 << 31)
-#define DATA_DONE_INT_EN   (1 << 30)
-#define TRANS_OK_INT_EN   

[RESEND PATCH v2 6/9] mfd: rtsx: remove LCTLR defination

2015-01-21 Thread micky_ching
From: Micky Ching 

To enable/disable ASPM we should find LINK CONTROL register
in PCI config space. All old chip use 0x80 address, but new
chip may use another address, so we using pci_find_capability()
to get LINK CONTROL address.

rtsx_gops.c was removed, we consider to put some common operations
to this file, but the actual thing is, only a group of chips
are in common ops1, and another group of chips in common ops2,
it is hard to decide put which ops into generic ops file.

Signed-off-by: Micky Ching 
---
 drivers/mfd/Makefile |  2 +-
 drivers/mfd/rts5227.c|  2 +-
 drivers/mfd/rts5249.c|  3 +--
 drivers/mfd/rtsx_gops.c  | 37 -
 drivers/mfd/rtsx_pcr.c   | 22 +-
 include/linux/mfd/rtsx_pci.h | 10 +-
 6 files changed, 21 insertions(+), 55 deletions(-)
 delete mode 100644 drivers/mfd/rtsx_gops.c

diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
index 53467e2..2cd7e74 100644
--- a/drivers/mfd/Makefile
+++ b/drivers/mfd/Makefile
@@ -13,7 +13,7 @@ obj-$(CONFIG_MFD_CROS_EC) += cros_ec.o
 obj-$(CONFIG_MFD_CROS_EC_I2C)  += cros_ec_i2c.o
 obj-$(CONFIG_MFD_CROS_EC_SPI)  += cros_ec_spi.o
 
-rtsx_pci-objs  := rtsx_pcr.o rtsx_gops.o rts5209.o rts5229.o 
rtl8411.o rts5227.o rts5249.o
+rtsx_pci-objs  := rtsx_pcr.o rts5209.o rts5229.o rtl8411.o 
rts5227.o rts5249.o
 obj-$(CONFIG_MFD_RTSX_PCI) += rtsx_pci.o
 obj-$(CONFIG_MFD_RTSX_USB) += rtsx_usb.o
 
diff --git a/drivers/mfd/rts5227.c b/drivers/mfd/rts5227.c
index 1f387d4..0c02831 100644
--- a/drivers/mfd/rts5227.c
+++ b/drivers/mfd/rts5227.c
@@ -130,7 +130,7 @@ static int rts5227_optimize_phy(struct rtsx_pcr *pcr)
 {
int err;
 
-   err = rtsx_gops_pm_reset(pcr);
+   err = rtsx_pci_write_register(pcr, PM_CTRL3, D3_DELINK_MODE_EN, 0x00);
if (err < 0)
return err;
 
diff --git a/drivers/mfd/rts5249.c b/drivers/mfd/rts5249.c
index d8072f6..3977946 100644
--- a/drivers/mfd/rts5249.c
+++ b/drivers/mfd/rts5249.c
@@ -119,7 +119,6 @@ static int rts5249_extra_init_hw(struct rtsx_pcr *pcr)
rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, PETXCFG, 0xB0, 0xB0);
else
rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, PETXCFG, 0xB0, 0x80);
-   rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, PM_CTRL3, 0x10, 0x00);
 
return rtsx_pci_send_cmd(pcr, 100);
 }
@@ -128,7 +127,7 @@ static int rts5249_optimize_phy(struct rtsx_pcr *pcr)
 {
int err;
 
-   err = rtsx_gops_pm_reset(pcr);
+   err = rtsx_pci_write_register(pcr, PM_CTRL3, D3_DELINK_MODE_EN, 0x00);
if (err < 0)
return err;
 
diff --git a/drivers/mfd/rtsx_gops.c b/drivers/mfd/rtsx_gops.c
deleted file mode 100644
index b1a98c6..000
--- a/drivers/mfd/rtsx_gops.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Driver for Realtek PCI-Express card reader
- *
- * Copyright(c) 2009-2013 Realtek Semiconductor Corp. All rights reserved.
- *
- * 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
- * Free Software Foundation; either version 2, or (at your option) any
- * later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * 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, see .
- *
- * Author:
- *   Micky Ching 
- */
-
-#include 
-#include "rtsx_pcr.h"
-
-int rtsx_gops_pm_reset(struct rtsx_pcr *pcr)
-{
-   int err;
-
-   /* init aspm */
-   rtsx_pci_write_register(pcr, ASPM_FORCE_CTL, 0xFF, 0x00);
-   err = rtsx_pci_update_cfg_byte(pcr, LCTLR, ~LCTLR_ASPM_CTL_MASK, 0x00);
-   if (err < 0)
-   return err;
-
-   /* reset PM_CTRL3 before send buffer cmd */
-   return rtsx_pci_write_register(pcr, PM_CTRL3, D3_DELINK_MODE_EN, 0x00);
-}
diff --git a/drivers/mfd/rtsx_pcr.c b/drivers/mfd/rtsx_pcr.c
index 30f7ca8..81b9c2c 100644
--- a/drivers/mfd/rtsx_pcr.c
+++ b/drivers/mfd/rtsx_pcr.c
@@ -63,6 +63,18 @@ static const struct pci_device_id rtsx_pci_ids[] = {
 
 MODULE_DEVICE_TABLE(pci, rtsx_pci_ids);
 
+static inline void rtsx_pci_enable_aspm(struct rtsx_pcr *pcr)
+{
+   rtsx_pci_update_cfg_byte(pcr, pcr->pcie_cap + PCI_EXP_LNKCTL,
+   0xFC, pcr->aspm_en);
+}
+
+static inline void rtsx_pci_disable_aspm(struct rtsx_pcr *pcr)
+{
+   rtsx_pci_update_cfg_byte(pcr, pcr->pcie_cap + PCI_EXP_LNKCTL,
+   0xFC, 0);
+}
+
 void rtsx_pci_start_run(struct rtsx_pcr *pcr)
 {
/* If pci device removed, don't queue idle work any more */
@@ -75,7 +87,7 @@ void rtsx_pci_start_run(struct rtsx_pcr *pcr)
pcr->ops->enable_auto_blink(pcr);
 

[RESEND PATCH v2 8/9] mfd: rtsx: add support for rts525A

2015-01-21 Thread micky_ching
From: Micky Ching 

add support for new chip rts525A.

Signed-off-by: Micky Ching 
---
 drivers/mfd/rts5249.c| 104 ++-
 drivers/mfd/rtsx_pcr.c   |  13 --
 drivers/mfd/rtsx_pcr.h   |   1 +
 include/linux/mfd/rtsx_pci.h |  15 +++
 4 files changed, 129 insertions(+), 4 deletions(-)

diff --git a/drivers/mfd/rts5249.c b/drivers/mfd/rts5249.c
index 97dde92..134e03f 100644
--- a/drivers/mfd/rts5249.c
+++ b/drivers/mfd/rts5249.c
@@ -97,7 +97,7 @@ static void rtsx_base_force_power_down(struct rtsx_pcr *pcr, 
u8 pm_state)
rtsx_pci_write_register(pcr, AUTOLOAD_CFG_BASE + 3, 0x01, 0);
 
if (pm_state == HOST_ENTER_S3) {
-   if (PCI_PID(pcr) == 0x524A)
+   if (PCI_PID(pcr) == 0x524A || PCI_PID(pcr) == 0x525A)
rtsx_pci_write_register(pcr, RTS524A_PM_CTRL3,
D3_DELINK_MODE_EN, D3_DELINK_MODE_EN);
else if (PCI_PID(pcr) == 0x5249)
@@ -485,3 +485,105 @@ void rts524a_init_params(struct rtsx_pcr *pcr)
pcr->ops = _pcr_ops;
 }
 
+static int rts525a_card_power_on(struct rtsx_pcr *pcr, int card)
+{
+   rtsx_pci_write_register(pcr, LDO_VCC_CFG1,
+   LDO_VCC_TUNE_MASK, LDO_VCC_3V3);
+   return rtsx_base_card_power_on(pcr, card);
+}
+
+static int rts525a_switch_output_voltage(struct rtsx_pcr *pcr, u8 voltage)
+{
+   switch (voltage) {
+   case OUTPUT_3V3:
+   rtsx_pci_write_register(pcr, LDO_CONFIG2,
+   LDO_D3318_MASK, LDO_D3318_33V);
+   rtsx_pci_write_register(pcr, SD_PAD_CTL, SD_IO_USING_1V8, 0);
+   break;
+   case OUTPUT_1V8:
+   rtsx_pci_write_register(pcr, LDO_CONFIG2,
+   LDO_D3318_MASK, LDO_D3318_18V);
+   rtsx_pci_write_register(pcr, SD_PAD_CTL, SD_IO_USING_1V8,
+   SD_IO_USING_1V8);
+   break;
+   default:
+   return -EINVAL;
+   }
+
+   rtsx_pci_init_cmd(pcr);
+   rts5249_fill_driving(pcr, voltage);
+   return rtsx_pci_send_cmd(pcr, 100);
+}
+
+static int rts525a_optimize_phy(struct rtsx_pcr *pcr)
+{
+   int err;
+
+   err = rtsx_pci_write_register(pcr, RTS524A_PM_CTRL3,
+   D3_DELINK_MODE_EN, 0x00);
+   if (err < 0)
+   return err;
+
+   rtsx_pci_write_phy_register(pcr, _PHY_FLD0,
+   _PHY_FLD0_CLK_REQ_20C | _PHY_FLD0_RX_IDLE_EN |
+   _PHY_FLD0_BIT_ERR_RSTN | _PHY_FLD0_BER_COUNT |
+   _PHY_FLD0_BER_TIMER | _PHY_FLD0_CHECK_EN);
+
+   rtsx_pci_write_phy_register(pcr, _PHY_ANA03,
+   _PHY_ANA03_TIMER_MAX | _PHY_ANA03_OOBS_DEB_EN |
+   _PHY_CMU_DEBUG_EN);
+
+   if (is_version(pcr, 0x525A, IC_VER_A))
+   rtsx_pci_write_phy_register(pcr, _PHY_REV0,
+   _PHY_REV0_FILTER_OUT | _PHY_REV0_CDR_BYPASS_PFD |
+   _PHY_REV0_CDR_RX_IDLE_BYPASS);
+
+   return 0;
+}
+
+static int rts525a_extra_init_hw(struct rtsx_pcr *pcr)
+{
+   rts5249_extra_init_hw(pcr);
+
+   rtsx_pci_write_register(pcr, PCLK_CTL, PCLK_MODE_SEL, PCLK_MODE_SEL);
+   if (is_version(pcr, 0x525A, IC_VER_A)) {
+   rtsx_pci_write_register(pcr, L1SUB_CONFIG2,
+   L1SUB_AUTO_CFG, L1SUB_AUTO_CFG);
+   rtsx_pci_write_register(pcr, RREF_CFG,
+   RREF_VBGSEL_MASK, RREF_VBGSEL_1V25);
+   rtsx_pci_write_register(pcr, LDO_VIO_CFG,
+   LDO_VIO_TUNE_MASK, LDO_VIO_1V7);
+   rtsx_pci_write_register(pcr, LDO_DV12S_CFG,
+   LDO_D12_TUNE_MASK, LDO_D12_TUNE_DF);
+   rtsx_pci_write_register(pcr, LDO_AV12S_CFG,
+   LDO_AV12S_TUNE_MASK, LDO_AV12S_TUNE_DF);
+   rtsx_pci_write_register(pcr, LDO_VCC_CFG0,
+   LDO_VCC_LMTVTH_MASK, LDO_VCC_LMTVTH_2A);
+   rtsx_pci_write_register(pcr, OOBS_CONFIG,
+   OOBS_AUTOK_DIS | OOBS_VAL_MASK, 0x89);
+   }
+
+   return 0;
+}
+
+static const struct pcr_ops rts525a_pcr_ops = {
+   .fetch_vendor_settings = rtsx_base_fetch_vendor_settings,
+   .extra_init_hw = rts525a_extra_init_hw,
+   .optimize_phy = rts525a_optimize_phy,
+   .turn_on_led = rtsx_base_turn_on_led,
+   .turn_off_led = rtsx_base_turn_off_led,
+   .enable_auto_blink = rtsx_base_enable_auto_blink,
+   .disable_auto_blink = rtsx_base_disable_auto_blink,
+   .card_power_on = rts525a_card_power_on,
+   .card_power_off = rtsx_base_card_power_off,
+   .switch_output_voltage = rts525a_switch_output_voltage,
+   .force_power_down = rtsx_base_force_power_down,
+};
+
+void rts525a_init_params(struct rtsx_pcr *pcr)
+{
+   rts5249_init_params(pcr);
+
+   pcr->ops = _pcr_ops;
+}
+
diff --git a/drivers/mfd/rtsx_pcr.c b/drivers/mfd/rtsx_pcr.c
index e6d97ad..4c47f94 100644
--- 

[RESEND PATCH v2 9/9] mfd: rtsx: using pcr_dbg replace dev_dbg

2015-01-21 Thread micky_ching
From: Micky Ching 

pcr_dbg is a wrapper of dev_dbg, which can save some code,
and help to enable/disable debug message static.

Signed-off-by: Micky Ching 
Acked-by: Lee Jones 
---
 drivers/mfd/rtl8411.c  | 11 +--
 drivers/mfd/rts5209.c  |  4 ++--
 drivers/mfd/rts5227.c  |  4 ++--
 drivers/mfd/rts5229.c  |  4 ++--
 drivers/mfd/rts5249.c  |  4 ++--
 drivers/mfd/rtsx_pcr.c | 49 ++---
 6 files changed, 35 insertions(+), 41 deletions(-)

diff --git a/drivers/mfd/rtl8411.c b/drivers/mfd/rtl8411.c
index fdd34c8..b3ae659 100644
--- a/drivers/mfd/rtl8411.c
+++ b/drivers/mfd/rtl8411.c
@@ -53,7 +53,7 @@ static void rtl8411_fetch_vendor_settings(struct rtsx_pcr 
*pcr)
u8 reg3 = 0;
 
rtsx_pci_read_config_dword(pcr, PCR_SETTING_REG1, );
-   dev_dbg(&(pcr->pci->dev), "Cfg 0x%x: 0x%x\n", PCR_SETTING_REG1, reg1);
+   pcr_dbg(pcr, "Cfg 0x%x: 0x%x\n", PCR_SETTING_REG1, reg1);
 
if (!rtsx_vendor_setting_valid(reg1))
return;
@@ -65,7 +65,7 @@ static void rtl8411_fetch_vendor_settings(struct rtsx_pcr 
*pcr)
pcr->card_drive_sel |= rtsx_reg_to_card_drive_sel(reg1);
 
rtsx_pci_read_config_byte(pcr, PCR_SETTING_REG3, );
-   dev_dbg(&(pcr->pci->dev), "Cfg 0x%x: 0x%x\n", PCR_SETTING_REG3, reg3);
+   pcr_dbg(pcr, "Cfg 0x%x: 0x%x\n", PCR_SETTING_REG3, reg3);
pcr->sd30_drive_sel_3v3 = rtl8411_reg_to_sd30_drive_sel_3v3(reg3);
 }
 
@@ -74,7 +74,7 @@ static void rtl8411b_fetch_vendor_settings(struct rtsx_pcr 
*pcr)
u32 reg = 0;
 
rtsx_pci_read_config_dword(pcr, PCR_SETTING_REG1, );
-   dev_dbg(&(pcr->pci->dev), "Cfg 0x%x: 0x%x\n", PCR_SETTING_REG1, reg);
+   pcr_dbg(pcr, "Cfg 0x%x: 0x%x\n", PCR_SETTING_REG1, reg);
 
if (!rtsx_vendor_setting_valid(reg))
return;
@@ -260,9 +260,8 @@ static unsigned int rtl8411_cd_deglitch(struct rtsx_pcr 
*pcr)
rtsx_pci_write_register(pcr, CARD_PWR_CTL,
BPP_POWER_MASK, BPP_POWER_OFF);
 
-   dev_dbg(&(pcr->pci->dev),
-   "After CD deglitch, card_exist = 0x%x\n",
-   card_exist);
+   pcr_dbg(pcr, "After CD deglitch, card_exist = 0x%x\n",
+   card_exist);
}
 
if (card_exist & MS_EXIST) {
diff --git a/drivers/mfd/rts5209.c b/drivers/mfd/rts5209.c
index cb04174..373e253 100644
--- a/drivers/mfd/rts5209.c
+++ b/drivers/mfd/rts5209.c
@@ -38,7 +38,7 @@ static void rts5209_fetch_vendor_settings(struct rtsx_pcr 
*pcr)
u32 reg;
 
rtsx_pci_read_config_dword(pcr, PCR_SETTING_REG1, );
-   dev_dbg(&(pcr->pci->dev), "Cfg 0x%x: 0x%x\n", PCR_SETTING_REG1, reg);
+   pcr_dbg(pcr, "Cfg 0x%x: 0x%x\n", PCR_SETTING_REG1, reg);
 
if (rts5209_vendor_setting1_valid(reg)) {
if (rts5209_reg_check_ms_pmos(reg))
@@ -47,7 +47,7 @@ static void rts5209_fetch_vendor_settings(struct rtsx_pcr 
*pcr)
}
 
rtsx_pci_read_config_dword(pcr, PCR_SETTING_REG2, );
-   dev_dbg(&(pcr->pci->dev), "Cfg 0x%x: 0x%x\n", PCR_SETTING_REG2, reg);
+   pcr_dbg(pcr, "Cfg 0x%x: 0x%x\n", PCR_SETTING_REG2, reg);
 
if (rts5209_vendor_setting2_valid(reg)) {
pcr->sd30_drive_sel_1v8 =
diff --git a/drivers/mfd/rts5227.c b/drivers/mfd/rts5227.c
index 0c02831..ce012d7 100644
--- a/drivers/mfd/rts5227.c
+++ b/drivers/mfd/rts5227.c
@@ -63,7 +63,7 @@ static void rts5227_fetch_vendor_settings(struct rtsx_pcr 
*pcr)
u32 reg;
 
rtsx_pci_read_config_dword(pcr, PCR_SETTING_REG1, );
-   dev_dbg(&(pcr->pci->dev), "Cfg 0x%x: 0x%x\n", PCR_SETTING_REG1, reg);
+   pcr_dbg(pcr, "Cfg 0x%x: 0x%x\n", PCR_SETTING_REG1, reg);
 
if (!rtsx_vendor_setting_valid(reg))
return;
@@ -74,7 +74,7 @@ static void rts5227_fetch_vendor_settings(struct rtsx_pcr 
*pcr)
pcr->card_drive_sel |= rtsx_reg_to_card_drive_sel(reg);
 
rtsx_pci_read_config_dword(pcr, PCR_SETTING_REG2, );
-   dev_dbg(&(pcr->pci->dev), "Cfg 0x%x: 0x%x\n", PCR_SETTING_REG2, reg);
+   pcr_dbg(pcr, "Cfg 0x%x: 0x%x\n", PCR_SETTING_REG2, reg);
pcr->sd30_drive_sel_3v3 = rtsx_reg_to_sd30_drive_sel_3v3(reg);
if (rtsx_reg_check_reverse_socket(reg))
pcr->flags |= PCR_REVERSE_SOCKET;
diff --git a/drivers/mfd/rts5229.c b/drivers/mfd/rts5229.c
index 6353f5d..ace4538 100644
--- a/drivers/mfd/rts5229.c
+++ b/drivers/mfd/rts5229.c
@@ -38,7 +38,7 @@ static void rts5229_fetch_vendor_settings(struct rtsx_pcr 
*pcr)
u32 reg;
 
rtsx_pci_read_config_dword(pcr, PCR_SETTING_REG1, );
-   dev_dbg(&(pcr->pci->dev), "Cfg 0x%x: 0x%x\n", PCR_SETTING_REG1, reg);
+   pcr_dbg(pcr, "Cfg 0x%x: 0x%x\n", PCR_SETTING_REG1, reg);
 
if (!rtsx_vendor_setting_valid(reg))
return;
@@ -50,7 +50,7 @@ static void rts5229_fetch_vendor_settings(struct rtsx_pcr 
*pcr)
pcr->card_drive_sel |= 

[RESEND PATCH v2 7/9] mfd: rtsx: add support for rts524A

2015-01-21 Thread micky_ching
From: Micky Ching 

add support for new chip rts524A.

Signed-off-by: Micky Ching 
---
 drivers/mfd/rts5249.c| 186 ---
 drivers/mfd/rtsx_pcr.c   |  25 +-
 drivers/mfd/rtsx_pcr.h   |   7 ++
 include/linux/mfd/rtsx_pci.h | 125 -
 4 files changed, 310 insertions(+), 33 deletions(-)

diff --git a/drivers/mfd/rts5249.c b/drivers/mfd/rts5249.c
index 3977946..97dde92 100644
--- a/drivers/mfd/rts5249.c
+++ b/drivers/mfd/rts5249.c
@@ -65,15 +65,17 @@ static void rts5249_fill_driving(struct rtsx_pcr *pcr, u8 
voltage)
0xFF, driving[drive_sel][2]);
 }
 
-static void rts5249_fetch_vendor_settings(struct rtsx_pcr *pcr)
+static void rtsx_base_fetch_vendor_settings(struct rtsx_pcr *pcr)
 {
u32 reg;
 
rtsx_pci_read_config_dword(pcr, PCR_SETTING_REG1, );
dev_dbg(&(pcr->pci->dev), "Cfg 0x%x: 0x%x\n", PCR_SETTING_REG1, reg);
 
-   if (!rtsx_vendor_setting_valid(reg))
+   if (!rtsx_vendor_setting_valid(reg)) {
+   pcr_dbg(pcr, "skip fetch vendor setting\n");
return;
+   }
 
pcr->aspm_en = rtsx_reg_to_aspm(reg);
pcr->sd30_drive_sel_1v8 = rtsx_reg_to_sd30_drive_sel_1v8(reg);
@@ -87,15 +89,21 @@ static void rts5249_fetch_vendor_settings(struct rtsx_pcr 
*pcr)
pcr->flags |= PCR_REVERSE_SOCKET;
 }
 
-static void rts5249_force_power_down(struct rtsx_pcr *pcr, u8 pm_state)
+static void rtsx_base_force_power_down(struct rtsx_pcr *pcr, u8 pm_state)
 {
/* Set relink_time to 0 */
rtsx_pci_write_register(pcr, AUTOLOAD_CFG_BASE + 1, 0xFF, 0);
rtsx_pci_write_register(pcr, AUTOLOAD_CFG_BASE + 2, 0xFF, 0);
rtsx_pci_write_register(pcr, AUTOLOAD_CFG_BASE + 3, 0x01, 0);
 
-   if (pm_state == HOST_ENTER_S3)
-   rtsx_pci_write_register(pcr, PM_CTRL3, 0x10, 0x10);
+   if (pm_state == HOST_ENTER_S3) {
+   if (PCI_PID(pcr) == 0x524A)
+   rtsx_pci_write_register(pcr, RTS524A_PM_CTRL3,
+   D3_DELINK_MODE_EN, D3_DELINK_MODE_EN);
+   else if (PCI_PID(pcr) == 0x5249)
+   rtsx_pci_write_register(pcr, PM_CTRL3,
+   D3_DELINK_MODE_EN, D3_DELINK_MODE_EN);
+   }
 
rtsx_pci_write_register(pcr, FPDCTL, 0x03, 0x03);
 }
@@ -104,6 +112,8 @@ static int rts5249_extra_init_hw(struct rtsx_pcr *pcr)
 {
rtsx_pci_init_cmd(pcr);
 
+   /* Rest L1SUB Config */
+   rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, L1SUB_CONFIG3, 0xFF, 0x00);
/* Configure GPIO as output */
rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, GPIO_CTL, 0x02, 0x02);
/* Reset ASPM state to default value */
@@ -189,27 +199,27 @@ static int rts5249_optimize_phy(struct rtsx_pcr *pcr)
PHY_TUNE_TUNED12 | PHY_TUNE_TUNEA12);
 }
 
-static int rts5249_turn_on_led(struct rtsx_pcr *pcr)
+static int rtsx_base_turn_on_led(struct rtsx_pcr *pcr)
 {
return rtsx_pci_write_register(pcr, GPIO_CTL, 0x02, 0x02);
 }
 
-static int rts5249_turn_off_led(struct rtsx_pcr *pcr)
+static int rtsx_base_turn_off_led(struct rtsx_pcr *pcr)
 {
return rtsx_pci_write_register(pcr, GPIO_CTL, 0x02, 0x00);
 }
 
-static int rts5249_enable_auto_blink(struct rtsx_pcr *pcr)
+static int rtsx_base_enable_auto_blink(struct rtsx_pcr *pcr)
 {
return rtsx_pci_write_register(pcr, OLT_LED_CTL, 0x08, 0x08);
 }
 
-static int rts5249_disable_auto_blink(struct rtsx_pcr *pcr)
+static int rtsx_base_disable_auto_blink(struct rtsx_pcr *pcr)
 {
return rtsx_pci_write_register(pcr, OLT_LED_CTL, 0x08, 0x00);
 }
 
-static int rts5249_card_power_on(struct rtsx_pcr *pcr, int card)
+static int rtsx_base_card_power_on(struct rtsx_pcr *pcr, int card)
 {
int err;
 
@@ -236,7 +246,7 @@ static int rts5249_card_power_on(struct rtsx_pcr *pcr, int 
card)
return 0;
 }
 
-static int rts5249_card_power_off(struct rtsx_pcr *pcr, int card)
+static int rtsx_base_card_power_off(struct rtsx_pcr *pcr, int card)
 {
rtsx_pci_init_cmd(pcr);
rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, CARD_PWR_CTL,
@@ -246,22 +256,31 @@ static int rts5249_card_power_off(struct rtsx_pcr *pcr, 
int card)
return rtsx_pci_send_cmd(pcr, 100);
 }
 
-static int rts5249_switch_output_voltage(struct rtsx_pcr *pcr, u8 voltage)
+static int rtsx_base_switch_output_voltage(struct rtsx_pcr *pcr, u8 voltage)
 {
int err;
+   u16 append;
 
-   if (voltage == OUTPUT_3V3) {
-   err = rtsx_pci_write_phy_register(pcr, PHY_TUNE, 0x4FC0 | 0x24);
-   if (err < 0)
-   return err;
-   } else if (voltage == OUTPUT_1V8) {
-   err = rtsx_pci_write_phy_register(pcr, PHY_BACR, 0x3C02);
+   switch (voltage) {
+   case OUTPUT_3V3:
+   err = rtsx_pci_update_phy(pcr, PHY_TUNE, 0xFC3F, 0x03C0);
if (err < 0)
return err;
-  

[RESEND PATCH v2 3/9] mfd: rtsx: update PETXCFG address

2015-01-21 Thread micky_ching
From: Micky Ching 

PETXCFG is defined at 0xFF03, the old 0xFE49 not used any more.

Signed-off-by: Micky Ching 
Acked-by: Lee Jones 
---
 drivers/mfd/rts5227.c| 6 ++
 drivers/mfd/rts5249.c| 6 ++
 include/linux/mfd/rtsx_pci.h | 2 +-
 3 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/drivers/mfd/rts5227.c b/drivers/mfd/rts5227.c
index 3240740..1f387d4 100644
--- a/drivers/mfd/rts5227.c
+++ b/drivers/mfd/rts5227.c
@@ -118,11 +118,9 @@ static int rts5227_extra_init_hw(struct rtsx_pcr *pcr)
rts5227_fill_driving(pcr, OUTPUT_3V3);
/* Configure force_clock_req */
if (pcr->flags & PCR_REVERSE_SOCKET)
-   rtsx_pci_add_cmd(pcr, WRITE_REG_CMD,
-   AUTOLOAD_CFG_BASE + 3, 0xB8, 0xB8);
+   rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, PETXCFG, 0xB8, 0xB8);
else
-   rtsx_pci_add_cmd(pcr, WRITE_REG_CMD,
-   AUTOLOAD_CFG_BASE + 3, 0xB8, 0x88);
+   rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, PETXCFG, 0xB8, 0x88);
rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, PM_CTRL3, 0x10, 0x00);
 
return rtsx_pci_send_cmd(pcr, 100);
diff --git a/drivers/mfd/rts5249.c b/drivers/mfd/rts5249.c
index cf425cc..225ad55 100644
--- a/drivers/mfd/rts5249.c
+++ b/drivers/mfd/rts5249.c
@@ -116,11 +116,9 @@ static int rts5249_extra_init_hw(struct rtsx_pcr *pcr)
/* Configure driving */
rts5249_fill_driving(pcr, OUTPUT_3V3);
if (pcr->flags & PCR_REVERSE_SOCKET)
-   rtsx_pci_add_cmd(pcr, WRITE_REG_CMD,
-   AUTOLOAD_CFG_BASE + 3, 0xB0, 0xB0);
+   rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, PETXCFG, 0xB0, 0xB0);
else
-   rtsx_pci_add_cmd(pcr, WRITE_REG_CMD,
-   AUTOLOAD_CFG_BASE + 3, 0xB0, 0x80);
+   rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, PETXCFG, 0xB0, 0x80);
rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, PM_CTRL3, 0x10, 0x00);
 
return rtsx_pci_send_cmd(pcr, 100);
diff --git a/include/linux/mfd/rtsx_pci.h b/include/linux/mfd/rtsx_pci.h
index e81f2bb..87cff60 100644
--- a/include/linux/mfd/rtsx_pci.h
+++ b/include/linux/mfd/rtsx_pci.h
@@ -572,7 +572,6 @@
 #define MSGTXDATA2 0xFE46
 #define MSGTXDATA3 0xFE47
 #define MSGTXCTL   0xFE48
-#define PETXCFG0xFE49
 #define LTR_CTL0xFE4A
 #define OBFF_CFG   0xFE4C
 
@@ -606,6 +605,7 @@
 #define DUMMY_REG_RESET_0  0xFE90
 
 #define AUTOLOAD_CFG_BASE  0xFF00
+#define PETXCFG0xFF03
 
 #define PM_CTRL1   0xFF44
 #define PM_CTRL2   0xFF45
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[RESEND PATCH v2 1/9] mfd: rtsx: replace TAB by SPC after #define

2015-01-21 Thread micky_ching
From: Micky Ching 

Re-format coding-style, using uniform SPC after "#define" keyword
instead of mixing using TAB and SPC.

Signed-off-by: Micky Ching 
Acked-by: Lee Jones 
---
 include/linux/mfd/rtsx_pci.h | 254 +--
 1 file changed, 127 insertions(+), 127 deletions(-)

diff --git a/include/linux/mfd/rtsx_pci.h b/include/linux/mfd/rtsx_pci.h
index 0c12628..a9c2a14 100644
--- a/include/linux/mfd/rtsx_pci.h
+++ b/include/linux/mfd/rtsx_pci.h
@@ -175,9 +175,9 @@
 /* CARD_SHARE_MODE */
 #define CARD_SHARE_MASK0x0F
 #define CARD_SHARE_MULTI_LUN   0x00
-#defineCARD_SHARE_NORMAL   0x00
-#defineCARD_SHARE_48_SD0x04
-#defineCARD_SHARE_48_MS0x08
+#define CARD_SHARE_NORMAL  0x00
+#define CARD_SHARE_48_SD   0x04
+#define CARD_SHARE_48_MS   0x08
 /* CARD_SHARE_MODE for barossa */
 #define CARD_SHARE_BAROSSA_SD  0x01
 #define CARD_SHARE_BAROSSA_MS  0x02
@@ -249,76 +249,76 @@
 #define CD_AUTO_DISABLE0x40
 
 /* SD_STAT1 */
-#defineSD_CRC7_ERR 0x80
-#defineSD_CRC16_ERR0x40
-#defineSD_CRC_WRITE_ERR0x20
-#defineSD_CRC_WRITE_ERR_MASK   0x1C
-#defineGET_CRC_TIME_OUT0x02
-#defineSD_TUNING_COMPARE_ERR   0x01
+#define SD_CRC7_ERR0x80
+#define SD_CRC16_ERR   0x40
+#define SD_CRC_WRITE_ERR   0x20
+#define SD_CRC_WRITE_ERR_MASK  0x1C
+#define GET_CRC_TIME_OUT   0x02
+#define SD_TUNING_COMPARE_ERR  0x01
 
 /* SD_STAT2 */
-#defineSD_RSP_80CLK_TIMEOUT0x01
+#define SD_RSP_80CLK_TIMEOUT   0x01
 
 /* SD_BUS_STAT */
-#defineSD_CLK_TOGGLE_EN0x80
-#defineSD_CLK_FORCE_STOP   0x40
-#defineSD_DAT3_STATUS  0x10
-#defineSD_DAT2_STATUS  0x08
-#defineSD_DAT1_STATUS  0x04
-#defineSD_DAT0_STATUS  0x02
-#defineSD_CMD_STATUS   0x01
+#define SD_CLK_TOGGLE_EN   0x80
+#define SD_CLK_FORCE_STOP  0x40
+#define SD_DAT3_STATUS 0x10
+#define SD_DAT2_STATUS 0x08
+#define SD_DAT1_STATUS 0x04
+#define SD_DAT0_STATUS 0x02
+#define SD_CMD_STATUS  0x01
 
 /* SD_PAD_CTL */
-#defineSD_IO_USING_1V8 0x80
-#defineSD_IO_USING_3V3 0x7F
-#defineTYPE_A_DRIVING  0x00
-#defineTYPE_B_DRIVING  0x01
-#defineTYPE_C_DRIVING  0x02
-#defineTYPE_D_DRIVING  0x03
+#define SD_IO_USING_1V80x80
+#define SD_IO_USING_3V30x7F
+#define TYPE_A_DRIVING 0x00
+#define TYPE_B_DRIVING 0x01
+#define TYPE_C_DRIVING 0x02
+#define TYPE_D_DRIVING 0x03
 
 /* SD_SAMPLE_POINT_CTL */
-#defineDDR_FIX_RX_DAT  0x00
-#defineDDR_VAR_RX_DAT  0x80
-#defineDDR_FIX_RX_DAT_EDGE 0x00
-#defineDDR_FIX_RX_DAT_14_DELAY 0x40
-#defineDDR_FIX_RX_CMD  0x00
-#defineDDR_VAR_RX_CMD  0x20
-#defineDDR_FIX_RX_CMD_POS_EDGE 0x00
-#defineDDR_FIX_RX_CMD_14_DELAY 0x10
-#defineSD20_RX_POS_EDGE0x00
-#defineSD20_RX_14_DELAY0x08
+#define DDR_FIX_RX_DAT 0x00
+#define DDR_VAR_RX_DAT 0x80
+#define DDR_FIX_RX_DAT_EDGE0x00
+#define DDR_FIX_RX_DAT_14_DELAY0x40
+#define DDR_FIX_RX_CMD 0x00
+#define DDR_VAR_RX_CMD 0x20
+#define DDR_FIX_RX_CMD_POS_EDGE0x00
+#define DDR_FIX_RX_CMD_14_DELAY0x10
+#define SD20_RX_POS_EDGE   0x00
+#define SD20_RX_14_DELAY   0x08
 #define SD20_RX_SEL_MASK   0x08
 
 /* SD_PUSH_POINT_CTL */
-#defineDDR_FIX_TX_CMD_DAT  0x00
-#defineDDR_VAR_TX_CMD_DAT  0x80
-#defineDDR_FIX_TX_DAT_14_TSU   0x00
-#defineDDR_FIX_TX_DAT_12_TSU   0x40
-#defineDDR_FIX_TX_CMD_NEG_EDGE 0x00
-#defineDDR_FIX_TX_CMD_14_AHEAD 0x20
-#defineSD20_TX_NEG_EDGE0x00
-#defineSD20_TX_14_AHEAD0x10
+#define DDR_FIX_TX_CMD_DAT 0x00
+#define DDR_VAR_TX_CMD_DAT 0x80
+#define DDR_FIX_TX_DAT_14_TSU  0x00
+#define DDR_FIX_TX_DAT_12_TSU  0x40
+#define DDR_FIX_TX_CMD_NEG_EDGE0x00
+#define DDR_FIX_TX_CMD_14_AHEAD0x20
+#define 

Re: [PATCH v2] dma: imx-sdma: switch to dynamic context mode after script loaded

2015-01-21 Thread Sascha Hauer
On Thu, Jan 22, 2015 at 11:59:37AM +0800, Robin Gong wrote:
> Below comments got from Page4724 of Reference Manual of i.mx6q:
> http://cache.freescale.com/files/32bit/doc/ref_manual/IMX6DQRM.pdf
> 
> --"Static context mode should be used for the first channel called
> after reset to ensure that the all context RAM for that channel is
> initialized during the context SAVE phase when the channel is
> done or yields. Subsequent calls to the same channel or
> different channels may use any of the dynamic context modes.
> This will ensure that all context locations for the bootload
> channel are initialized, and prevent undefined values in context
> RAM from being loaded during the context restore if the
> channel is re-started later"
> 
> Unfortunately, the rule was broken by 
> commit(5b28aa319bba96987316425a1131813d87cbab35)
> .This patch just take them back.
> 
> Signed-off-by: Robin Gong 
> ---
>  drivers/dma/imx-sdma.c | 11 ---
>  1 file changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c
> index d0df198..d84b7a8 100644
> --- a/drivers/dma/imx-sdma.c
> +++ b/drivers/dma/imx-sdma.c
> @@ -330,6 +330,8 @@ struct sdma_engine {
>   const struct sdma_driver_data   *drvdata;
>  };
>  
> +static bool channel0_first;

Nah, don't break the multi instance capability of drivers without a
reason. Don't use global static variables in driver context.

> +
>  static struct sdma_driver_data sdma_imx31 = {
>   .chnenbl0 = SDMA_CHNENBL0_IMX31,
>   .num_events = 32,
> @@ -531,6 +533,12 @@ static int sdma_run_channel0(struct sdma_engine *sdma)
>   dev_err(sdma->dev, "Timeout waiting for CH0 ready\n");
>   }
>  
> + if (!channel0_first) {
> + /* Set bits of CONFIG register with given context switching 
> mode */
> + writel_relaxed(SDMA_H_CONFIG_CSM, sdma->regs + SDMA_H_CONFIG);
> + channel0_first = true;
> + }

You don't need a variable. How about:

if (readl(sdma->regs + SDMA_H_CONFIG) == 0)
writel_relaxed(SDMA_H_CONFIG_CSM, sdma->regs + SDMA_H_CONFIG);

Sascha

-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/5] drivers/rtc/interface.c: Update code to use y2038-safe time interfaces

2015-01-21 Thread John Stultz
On Wed, Jan 21, 2015 at 6:31 PM, Xunlei Pang  wrote:
> Currently, interface.c uses y2038 problematic rtc_tm_to_time()
> and rtc_time_to_tm(). So replace them with their corresponding
> y2038-safe versions: rtc_tm_to_time64() and rtc_time64_to_tm().


Ok, I've queued this set of 5 (with a few minor tweaks). If I don't
hear any other objections I'll submit them in with my 3.20 set.

You're other patchset focusing on the setmms64 change and the hardware
specific rtc drivers should probably go in via Alessandro (unless
Alessandro suggests otherwise).  There may be slight fuzz in -next
between the first patch here and that patchset (which I hit), but it
should be easy enough to resolve.

thanks
-john
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2 0/9] mfd: rtsx: add support for new rts524A and rts525A

2015-01-21 Thread Lee Jones
Have you reworked all of these patches?

If not, why haven't my Acks been carried forward?

Please [RESEND] with the Acks applied.

> From: Micky Ching 
> 
> v2:
> - remove debug info when access failed.
> - using macro list for phy register init.
> - rename function for multi chip prefix with rtsx_base_
> - save pcie_cap offset when init chip, not calling pci_find_capacity()
>   every time.
> - add pcr->ops: write_phy/read_phy for special chip.
> 
> This patchset including re-format some coding-style and add two new chip
> rts524A and rts525A.
> 
> 
> Micky Ching (9):
>   mfd: rtsx: replace TAB by SPC after #define
>   mfd: rtsx: place register address and values togather
>   mfd: rtsx: update PETXCFG address
>   mfd: rtsx: update driving settings
>   mfd: rtsx: update phy register
>   mfd: rtsx: remove LCTLR defination
>   mfd: rtsx: add support for rts524A
>   mfd: rtsx: add support for rts525A
>   mfd: rtsx: using pcr_dbg replace dev_dbg
> 
>  drivers/mfd/Makefile |2 +-
>  drivers/mfd/rtl8411.c|   11 +-
>  drivers/mfd/rts5209.c|4 +-
>  drivers/mfd/rts5227.c|   12 +-
>  drivers/mfd/rts5229.c|4 +-
>  drivers/mfd/rts5249.c|  368 +++---
>  drivers/mfd/rtsx_gops.c  |   37 --
>  drivers/mfd/rtsx_pcr.c   |  110 +++--
>  drivers/mfd/rtsx_pcr.h   |8 +
>  include/linux/mfd/rtsx_pci.h | 1109 
> ++
>  10 files changed, 966 insertions(+), 699 deletions(-)
>  delete mode 100644 drivers/mfd/rtsx_gops.c
> 

-- 
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-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] ARM: use default ioremap alignment for SMP or LPAE

2015-01-21 Thread Sergey Dyasly
16MB alignment for ioremap mappings was added by commit a069c896d0d6 ("[ARM]
3705/1: add supersection support to ioremap()") in order to support supersection
mappings. But __arm_ioremap_pfn_caller uses section and supersection mappings
only in !SMP && !LPAE case. There is no need for such big alignment if either
SMP or LPAE is enabled.

After this change, ioremap will use default maximum alignment of 128 pages.

Cc: Russell King 
Cc: Guan Xuetao 
Cc: Nicolas Pitre 
Cc: James Bottomley 
Cc: Will Deacon 
Cc: Arnd Bergmann 
Cc: Catalin Marinas 
Cc: Andrew Morton 
Cc: Dmitry Safonov 
Link: 
https://lkml.kernel.org/g/1419328813-2211-1-git-send-email-d.safo...@partner.samsung.com
Signed-off-by: Sergey Dyasly 
---
 arch/arm/include/asm/memory.h |2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm/include/asm/memory.h b/arch/arm/include/asm/memory.h
index 184def0..c3ef139 100644
--- a/arch/arm/include/asm/memory.h
+++ b/arch/arm/include/asm/memory.h
@@ -78,10 +78,12 @@
  */
 #define XIP_VIRT_ADDR(physaddr)  (MODULES_VADDR + ((physaddr) & 0x000f))
 
+#if !defined(CONFIG_SMP) && !defined(CONFIG_ARM_LPAE)
 /*
  * Allow 16MB-aligned ioremap pages
  */
 #define IOREMAP_MAX_ORDER  24
+#endif
 
 #else /* CONFIG_MMU */
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC][PATCH] procfs: Always expose /proc//map_files/ and make it readable

2015-01-21 Thread Cyrill Gorcunov
On Wed, Jan 21, 2015 at 06:45:54PM -0800, Calvin Owens wrote:
> Currently, /proc//map_files/ is restricted to CAP_SYS_ADMIN, and
> is only exposed if CONFIG_CHECKPOINT_RESTORE is set. This interface
> is very useful for enumerating the files mapped into a process when
> the more verbose information in /proc//maps is not needed.
> 
> This patch moves the folder out from behind CHECKPOINT_RESTORE, and
> removes the CAP_SYS_ADMIN restrictions. To avoid exposing files to
> processes for whom they may not be visible, a follow_link() stub is
> added to the inode_operations struct attached to the symlinks that
> prevent them from being followed without CAP_SYS_ADMIN.
> 
> Signed-off-by: Calvin Owens 

Looks good to me, thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] nios2: __kuser_sigtramp placement fix

2015-01-21 Thread Chung-Lin Tang
The address of __kuser_sigtramp is wrong by one word, due to padding
__kuser_cmpxchg to fully 64 bytes. The version word at the start of the
page displaces __kuser_sigtramp to 0x1044, instead of the intended 0x1040.

Fixed by counting the 64-byte frame from the start of the page instead
of __kuser_cmpxchg. This shortens the __kuser_cmpxchg frame to 60-bytes,
but that's likely enough.

The zero-byte padding parts of the kuser_pad macro has been removed, due
to the .if command refusing to behave properly when there are other
.word directives in between. Probably a binutils gas bug.

Thanks,
Chung-Lin

Cc: Ley Foon Tan 
Cc: Tobias Klauser 
Signed-off-by: Chung-Lin Tang 

diff --git a/arch/nios2/kernel/entry.S b/arch/nios2/kernel/entry.S
index 0bdfd13..3224839 100644
--- a/arch/nios2/kernel/entry.S
+++ b/arch/nios2/kernel/entry.S
@@ -492,14 +492,7 @@ ENTRY(ret_from_kernel_thread)

  /* Filling pads with undefined instructions. */
 .macro kuser_pad sym size
-   .if ((. - \sym) & 3)
-   .rept   (4 - (. - \sym) & 3)
-   .byte   0
-   .endr
-   .endif
-   .rept   ((\size - (. - \sym)) / 4)
-   .word   0xdeadbeef
-   .endr
+   .fill   ((\size - (. - \sym)) / 4), 4, 0xdeadbeef
 .endm

.align  6
@@ -526,7 +519,10 @@ cmpxchg_stw:
 cmpxchg_ret:
ret

-   kuser_pad __kuser_cmpxchg, 64
+   /* The first 64-byte frame contains the version word, so note
+  that the first padding entry is based from the start of the kuser
+  page, instead of __kuser_cmpxchg.  */
+   kuser_pad __kuser_helper_start, 64

.globl  __kuser_sigtramp
 __kuser_sigtramp:
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH V6 01/18] x86: Make page cache mode a real type

2015-01-21 Thread Steven Noonan
On Mon, Nov 3, 2014 at 5:01 AM, Juergen Gross  wrote:
> At the moment there are a lot of places that handle setting or getting
> the page cache mode by treating the pgprot bits equal to the cache mode.
> This is only true because there are a lot of assumptions about the setup
> of the PAT MSR. Otherwise the cache type needs to get translated into
> pgprot bits and vice versa.
>
> This patch tries to prepare for that by introducing a separate type
> for the cache mode and adding functions to translate between those and
> pgprot values.
>
> To avoid too much performance penalty the translation between cache mode
> and pgprot values is done via tables which contain the relevant
> information.  Write-back cache mode is hard-wired to be 0, all other
> modes are configurable via those tables. For large pages there are
> translation functions as the PAT bit is located at different positions
> in the ptes of 4k and large pages.
>
> Based-on-patch-by: Stefan Bader 
> Signed-off-by: Juergen Gross 
> Reviewed-by: Thomas Gleixner 
> ---
>  arch/x86/include/asm/pgtable_types.h | 73 
> +++-
>  arch/x86/mm/init.c   | 29 ++
>  2 files changed, 101 insertions(+), 1 deletion(-)
>
> diff --git a/arch/x86/include/asm/pgtable_types.h 
> b/arch/x86/include/asm/pgtable_types.h
> index 0778964..5124642 100644
> --- a/arch/x86/include/asm/pgtable_types.h
> +++ b/arch/x86/include/asm/pgtable_types.h
> @@ -128,12 +128,34 @@
>  _PAGE_SOFT_DIRTY | _PAGE_NUMA)
>  #define _HPAGE_CHG_MASK (_PAGE_CHG_MASK | _PAGE_PSE | _PAGE_NUMA)
>
> -#define _PAGE_CACHE_MASK   (_PAGE_PCD | _PAGE_PWT)
>  #define _PAGE_CACHE_WB (0)
>  #define _PAGE_CACHE_WC (_PAGE_PWT)
>  #define _PAGE_CACHE_UC_MINUS   (_PAGE_PCD)
>  #define _PAGE_CACHE_UC (_PAGE_PCD | _PAGE_PWT)
>
> +/*
> + * The cache modes defined here are used to translate between pure SW usage
> + * and the HW defined cache mode bits and/or PAT entries.
> + *
> + * The resulting bits for PWT, PCD and PAT should be chosen in a way
> + * to have the WB mode at index 0 (all bits clear). This is the default
> + * right now and likely would break too much if changed.
> + */
> +#ifndef __ASSEMBLY__
> +enum page_cache_mode {
> +   _PAGE_CACHE_MODE_WB = 0,
> +   _PAGE_CACHE_MODE_WC = 1,
> +   _PAGE_CACHE_MODE_UC_MINUS = 2,
> +   _PAGE_CACHE_MODE_UC = 3,
> +   _PAGE_CACHE_MODE_WT = 4,
> +   _PAGE_CACHE_MODE_WP = 5,
> +   _PAGE_CACHE_MODE_NUM = 8
> +};
> +#endif
> +
> +#define _PAGE_CACHE_MASK   (_PAGE_PAT | _PAGE_PCD | _PAGE_PWT)
> +#define _PAGE_NOCACHE  (cachemode2protval(_PAGE_CACHE_MODE_UC))
> +
>  #define PAGE_NONE  __pgprot(_PAGE_PROTNONE | _PAGE_ACCESSED)
>  #define PAGE_SHARED__pgprot(_PAGE_PRESENT | _PAGE_RW | _PAGE_USER | \
>  _PAGE_ACCESSED | _PAGE_NX)
> @@ -341,6 +363,55 @@ static inline pmdval_t pmdnuma_flags(pmd_t pmd)
>  #define pgprot_val(x)  ((x).pgprot)
>  #define __pgprot(x)((pgprot_t) { (x) } )
>
> +extern uint16_t __cachemode2pte_tbl[_PAGE_CACHE_MODE_NUM];
> +extern uint8_t __pte2cachemode_tbl[8];
> +
> +#define __pte2cm_idx(cb)   \
> +   cb) >> (_PAGE_BIT_PAT - 2)) & 4) |  \
> +(((cb) >> (_PAGE_BIT_PCD - 1)) & 2) |  \
> +(((cb) >> _PAGE_BIT_PWT) & 1))
> +
> +static inline unsigned long cachemode2protval(enum page_cache_mode pcm)
> +{
> +   if (likely(pcm == 0))
> +   return 0;
> +   return __cachemode2pte_tbl[pcm];
> +}
> +static inline pgprot_t cachemode2pgprot(enum page_cache_mode pcm)
> +{
> +   return __pgprot(cachemode2protval(pcm));
> +}
> +static inline enum page_cache_mode pgprot2cachemode(pgprot_t pgprot)
> +{
> +   unsigned long masked;
> +
> +   masked = pgprot_val(pgprot) & _PAGE_CACHE_MASK;
> +   if (likely(masked == 0))
> +   return 0;
> +   return __pte2cachemode_tbl[__pte2cm_idx(masked)];
> +}
> +static inline pgprot_t pgprot_4k_2_large(pgprot_t pgprot)
> +{
> +   pgprot_t new;
> +   unsigned long val;
> +
> +   val = pgprot_val(pgprot);
> +   pgprot_val(new) = (val & ~(_PAGE_PAT | _PAGE_PAT_LARGE)) |
> +   ((val & _PAGE_PAT) << (_PAGE_BIT_PAT_LARGE - _PAGE_BIT_PAT));
> +   return new;
> +}
> +static inline pgprot_t pgprot_large_2_4k(pgprot_t pgprot)
> +{
> +   pgprot_t new;
> +   unsigned long val;
> +
> +   val = pgprot_val(pgprot);
> +   pgprot_val(new) = (val & ~(_PAGE_PAT | _PAGE_PAT_LARGE)) |
> + ((val & _PAGE_PAT_LARGE) >>
> +  (_PAGE_BIT_PAT_LARGE - _PAGE_BIT_PAT));
> +   return new;
> +}
> +
>
>  typedef struct page *pgtable_t;
>
> diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c
> index 66dba36..a9776ba 100644
> --- a/arch/x86/mm/init.c
> +++ b/arch/x86/mm/init.c
> @@ -27,6 +27,35 @@
>
>  #include "mm_internal.h"
>
> +/*
> + * Tables translating 

[PATCH 2/2] drm/rockchip: vop: set vop enabled after enable iommu

2015-01-21 Thread Mark Yao
there is a Bug that:
  vop_enable()->drm_vblank_on, drm_vblank_on may call vop
enable vblank. if it happen, vblank enable would failed,
then cause irq status error. because is_enabled value is set
after drm_vblank_on.

after enable vop clocks and iommu regs, we can sure that
R/W vop regs and do vop plane flip is safe, so place
is_enabled = true after enable iommu is suitable.

Signed-off-by: Mark Yao 
---
 drivers/gpu/drm/rockchip/rockchip_drm_vop.c |   11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c 
b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
index f278c09..a009457 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
@@ -420,6 +420,11 @@ static void vop_enable(struct drm_crtc *crtc)
goto err_disable_aclk;
}
 
+   /*
+* At here, vop clock & iommu is enable, R/W vop regs would be safe.
+*/
+   vop->is_enabled = false;
+
spin_lock(>reg_lock);
 
VOP_CTRL_SET(vop, standby, 0);
@@ -430,8 +435,6 @@ static void vop_enable(struct drm_crtc *crtc)
 
drm_vblank_on(vop->drm_dev, vop->pipe);
 
-   vop->is_enabled = false;
-
return;
 
 err_disable_aclk:
@@ -462,6 +465,8 @@ static void vop_disable(struct drm_crtc *crtc)
VOP_CTRL_SET(vop, standby, 1);
 
spin_unlock(>reg_lock);
+
+   vop->is_enabled = false;
/*
 * disable dclk to stop frame scan, so we can safely detach iommu,
 */
@@ -471,8 +476,6 @@ static void vop_disable(struct drm_crtc *crtc)
 
clk_disable(vop->aclk);
clk_disable(vop->hclk);
-
-   vop->is_enabled = false;
 }
 
 /*
-- 
1.7.9.5


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 0/2] drm/rockchip: Optimization vop dpms control

2015-01-21 Thread Mark Yao
drm dpms have many power modes, ON,OFF,SUSPEND,STANDBY, etc.
but vop only have enable/disable mode, maybe case such bug:
 --> DRM_DPMS_ON: power on vop
 --> DRM_DPMS_SUSPEND: power off vop
 --> DRM_DPMS_OFF: already power off at SUSPEND, crash
so use a bool val is more suitable.

another problem at vop_crtc_dpms:
  vop_enable()->drm_vblank_on, drm_vblank_on may call vop
enable vblank. if it happen, vblank enable would failed,
then cause irq status error. because is_enabled value is set
after drm_vblank_on.

Mark Yao (2):
  drm/rockchip: vop use is_enabled instead of dpms mode
  drm/rockchip: vop: set vop enabled after enable iommu

 drivers/gpu/drm/rockchip/rockchip_drm_fbdev.c |2 +-
 drivers/gpu/drm/rockchip/rockchip_drm_gem.c   |   17 +
 drivers/gpu/drm/rockchip/rockchip_drm_gem.h   |3 +--
 3 files changed, 7 insertions(+), 15 deletions(-)

-- 
1.7.9.5


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/2] drm/rockchip: vop use is_enabled instead of dpms mode

2015-01-21 Thread Mark Yao
drm dpms have many power modes: ON,OFF,SUSPEND,STANDBY, etc.
but vop only have enable/disable mode, maybe case such bug:
 --> DRM_DPMS_ON: power on vop
 --> DRM_DPMS_SUSPEND: power off vop
 --> DRM_DPMS_OFF: already power off at SUSPEND, crash
so use a bool val is more suitable.

Signed-off-by: Mark Yao 
---
 drivers/gpu/drm/rockchip/rockchip_drm_vop.c |   34 ++-
 1 file changed, 18 insertions(+), 16 deletions(-)

diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c 
b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
index 9a5c571..f278c09 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
@@ -81,7 +81,7 @@ struct vop {
struct drm_crtc crtc;
struct device *dev;
struct drm_device *drm_dev;
-   unsigned int dpms;
+   bool is_enabled;
 
int connector_type;
int connector_out_mode;
@@ -387,6 +387,9 @@ static void vop_enable(struct drm_crtc *crtc)
struct vop *vop = to_vop(crtc);
int ret;
 
+   if (vop->is_enabled)
+   return;
+
ret = clk_enable(vop->hclk);
if (ret < 0) {
dev_err(vop->dev, "failed to enable hclk - %d\n", ret);
@@ -427,6 +430,8 @@ static void vop_enable(struct drm_crtc *crtc)
 
drm_vblank_on(vop->drm_dev, vop->pipe);
 
+   vop->is_enabled = false;
+
return;
 
 err_disable_aclk:
@@ -441,6 +446,9 @@ static void vop_disable(struct drm_crtc *crtc)
 {
struct vop *vop = to_vop(crtc);
 
+   if (vop->is_enabled)
+   return;
+
drm_vblank_off(crtc->dev, vop->pipe);
 
disable_irq(vop->irq);
@@ -463,6 +471,8 @@ static void vop_disable(struct drm_crtc *crtc)
 
clk_disable(vop->aclk);
clk_disable(vop->hclk);
+
+   vop->is_enabled = false;
 }
 
 /*
@@ -742,7 +752,7 @@ static int vop_crtc_enable_vblank(struct drm_crtc *crtc)
struct vop *vop = to_vop(crtc);
unsigned long flags;
 
-   if (vop->dpms != DRM_MODE_DPMS_ON)
+   if (!vop->is_enabled)
return -EPERM;
 
spin_lock_irqsave(>irq_lock, flags);
@@ -759,8 +769,9 @@ static void vop_crtc_disable_vblank(struct drm_crtc *crtc)
struct vop *vop = to_vop(crtc);
unsigned long flags;
 
-   if (vop->dpms != DRM_MODE_DPMS_ON)
+   if (!vop->is_enabled)
return;
+
spin_lock_irqsave(>irq_lock, flags);
vop_mask_write(vop, INTR_CTRL0, FS_INTR_MASK, FS_INTR_EN(0));
spin_unlock_irqrestore(>irq_lock, flags);
@@ -773,15 +784,8 @@ static const struct rockchip_crtc_funcs private_crtc_funcs 
= {
 
 static void vop_crtc_dpms(struct drm_crtc *crtc, int mode)
 {
-   struct vop *vop = to_vop(crtc);
-
DRM_DEBUG_KMS("crtc[%d] mode[%d]\n", crtc->base.id, mode);
 
-   if (vop->dpms == mode) {
-   DRM_DEBUG_KMS("desired dpms mode is same as previous one.\n");
-   return;
-   }
-
switch (mode) {
case DRM_MODE_DPMS_ON:
vop_enable(crtc);
@@ -795,8 +799,6 @@ static void vop_crtc_dpms(struct drm_crtc *crtc, int mode)
DRM_DEBUG_KMS("unspecified mode %d\n", mode);
break;
}
-
-   vop->dpms = mode;
 }
 
 static void vop_crtc_prepare(struct drm_crtc *crtc)
@@ -934,9 +936,9 @@ static int vop_crtc_page_flip(struct drm_crtc *crtc,
struct drm_framebuffer *old_fb = crtc->primary->fb;
int ret;
 
-   /* when the page flip is requested, crtc's dpms should be on */
-   if (vop->dpms > DRM_MODE_DPMS_ON) {
-   DRM_DEBUG("failed page flip request at dpms[%d].\n", vop->dpms);
+   /* when the page flip is requested, crtc should be on */
+   if (!vop->is_enabled) {
+   DRM_DEBUG("page flip request rejected because crtc is off.\n");
return 0;
}
 
@@ -1302,7 +1304,7 @@ static int vop_initial(struct vop *vop)
 
clk_disable(vop->hclk);
 
-   vop->dpms = DRM_MODE_DPMS_OFF;
+   vop->is_enabled = false;
 
return 0;
 
-- 
1.7.9.5


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 7/9] mfd: rtsx: add support for rts524A

2015-01-21 Thread micky_ching
From: Micky Ching 

add support for new chip rts524A.

Signed-off-by: Micky Ching 
---
 drivers/mfd/rts5249.c| 186 ---
 drivers/mfd/rtsx_pcr.c   |  25 +-
 drivers/mfd/rtsx_pcr.h   |   7 ++
 include/linux/mfd/rtsx_pci.h | 125 -
 4 files changed, 310 insertions(+), 33 deletions(-)

diff --git a/drivers/mfd/rts5249.c b/drivers/mfd/rts5249.c
index 3977946..97dde92 100644
--- a/drivers/mfd/rts5249.c
+++ b/drivers/mfd/rts5249.c
@@ -65,15 +65,17 @@ static void rts5249_fill_driving(struct rtsx_pcr *pcr, u8 
voltage)
0xFF, driving[drive_sel][2]);
 }
 
-static void rts5249_fetch_vendor_settings(struct rtsx_pcr *pcr)
+static void rtsx_base_fetch_vendor_settings(struct rtsx_pcr *pcr)
 {
u32 reg;
 
rtsx_pci_read_config_dword(pcr, PCR_SETTING_REG1, );
dev_dbg(&(pcr->pci->dev), "Cfg 0x%x: 0x%x\n", PCR_SETTING_REG1, reg);
 
-   if (!rtsx_vendor_setting_valid(reg))
+   if (!rtsx_vendor_setting_valid(reg)) {
+   pcr_dbg(pcr, "skip fetch vendor setting\n");
return;
+   }
 
pcr->aspm_en = rtsx_reg_to_aspm(reg);
pcr->sd30_drive_sel_1v8 = rtsx_reg_to_sd30_drive_sel_1v8(reg);
@@ -87,15 +89,21 @@ static void rts5249_fetch_vendor_settings(struct rtsx_pcr 
*pcr)
pcr->flags |= PCR_REVERSE_SOCKET;
 }
 
-static void rts5249_force_power_down(struct rtsx_pcr *pcr, u8 pm_state)
+static void rtsx_base_force_power_down(struct rtsx_pcr *pcr, u8 pm_state)
 {
/* Set relink_time to 0 */
rtsx_pci_write_register(pcr, AUTOLOAD_CFG_BASE + 1, 0xFF, 0);
rtsx_pci_write_register(pcr, AUTOLOAD_CFG_BASE + 2, 0xFF, 0);
rtsx_pci_write_register(pcr, AUTOLOAD_CFG_BASE + 3, 0x01, 0);
 
-   if (pm_state == HOST_ENTER_S3)
-   rtsx_pci_write_register(pcr, PM_CTRL3, 0x10, 0x10);
+   if (pm_state == HOST_ENTER_S3) {
+   if (PCI_PID(pcr) == 0x524A)
+   rtsx_pci_write_register(pcr, RTS524A_PM_CTRL3,
+   D3_DELINK_MODE_EN, D3_DELINK_MODE_EN);
+   else if (PCI_PID(pcr) == 0x5249)
+   rtsx_pci_write_register(pcr, PM_CTRL3,
+   D3_DELINK_MODE_EN, D3_DELINK_MODE_EN);
+   }
 
rtsx_pci_write_register(pcr, FPDCTL, 0x03, 0x03);
 }
@@ -104,6 +112,8 @@ static int rts5249_extra_init_hw(struct rtsx_pcr *pcr)
 {
rtsx_pci_init_cmd(pcr);
 
+   /* Rest L1SUB Config */
+   rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, L1SUB_CONFIG3, 0xFF, 0x00);
/* Configure GPIO as output */
rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, GPIO_CTL, 0x02, 0x02);
/* Reset ASPM state to default value */
@@ -189,27 +199,27 @@ static int rts5249_optimize_phy(struct rtsx_pcr *pcr)
PHY_TUNE_TUNED12 | PHY_TUNE_TUNEA12);
 }
 
-static int rts5249_turn_on_led(struct rtsx_pcr *pcr)
+static int rtsx_base_turn_on_led(struct rtsx_pcr *pcr)
 {
return rtsx_pci_write_register(pcr, GPIO_CTL, 0x02, 0x02);
 }
 
-static int rts5249_turn_off_led(struct rtsx_pcr *pcr)
+static int rtsx_base_turn_off_led(struct rtsx_pcr *pcr)
 {
return rtsx_pci_write_register(pcr, GPIO_CTL, 0x02, 0x00);
 }
 
-static int rts5249_enable_auto_blink(struct rtsx_pcr *pcr)
+static int rtsx_base_enable_auto_blink(struct rtsx_pcr *pcr)
 {
return rtsx_pci_write_register(pcr, OLT_LED_CTL, 0x08, 0x08);
 }
 
-static int rts5249_disable_auto_blink(struct rtsx_pcr *pcr)
+static int rtsx_base_disable_auto_blink(struct rtsx_pcr *pcr)
 {
return rtsx_pci_write_register(pcr, OLT_LED_CTL, 0x08, 0x00);
 }
 
-static int rts5249_card_power_on(struct rtsx_pcr *pcr, int card)
+static int rtsx_base_card_power_on(struct rtsx_pcr *pcr, int card)
 {
int err;
 
@@ -236,7 +246,7 @@ static int rts5249_card_power_on(struct rtsx_pcr *pcr, int 
card)
return 0;
 }
 
-static int rts5249_card_power_off(struct rtsx_pcr *pcr, int card)
+static int rtsx_base_card_power_off(struct rtsx_pcr *pcr, int card)
 {
rtsx_pci_init_cmd(pcr);
rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, CARD_PWR_CTL,
@@ -246,22 +256,31 @@ static int rts5249_card_power_off(struct rtsx_pcr *pcr, 
int card)
return rtsx_pci_send_cmd(pcr, 100);
 }
 
-static int rts5249_switch_output_voltage(struct rtsx_pcr *pcr, u8 voltage)
+static int rtsx_base_switch_output_voltage(struct rtsx_pcr *pcr, u8 voltage)
 {
int err;
+   u16 append;
 
-   if (voltage == OUTPUT_3V3) {
-   err = rtsx_pci_write_phy_register(pcr, PHY_TUNE, 0x4FC0 | 0x24);
-   if (err < 0)
-   return err;
-   } else if (voltage == OUTPUT_1V8) {
-   err = rtsx_pci_write_phy_register(pcr, PHY_BACR, 0x3C02);
+   switch (voltage) {
+   case OUTPUT_3V3:
+   err = rtsx_pci_update_phy(pcr, PHY_TUNE, 0xFC3F, 0x03C0);
if (err < 0)
return err;
-  

[PATCH v2 6/9] mfd: rtsx: remove LCTLR defination

2015-01-21 Thread micky_ching
From: Micky Ching 

To enable/disable ASPM we should find LINK CONTROL register
in PCI config space. All old chip use 0x80 address, but new
chip may use another address, so we using pci_find_capability()
to get LINK CONTROL address.

rtsx_gops.c was removed, we consider to put some common operations
to this file, but the actual thing is, only a group of chips
are in common ops1, and another group of chips in common ops2,
it is hard to decide put which ops into generic ops file.

Signed-off-by: Micky Ching 
---
 drivers/mfd/Makefile |  2 +-
 drivers/mfd/rts5227.c|  2 +-
 drivers/mfd/rts5249.c|  3 +--
 drivers/mfd/rtsx_gops.c  | 37 -
 drivers/mfd/rtsx_pcr.c   | 23 ++-
 include/linux/mfd/rtsx_pci.h | 10 +-
 6 files changed, 22 insertions(+), 55 deletions(-)
 delete mode 100644 drivers/mfd/rtsx_gops.c

diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
index 53467e2..2cd7e74 100644
--- a/drivers/mfd/Makefile
+++ b/drivers/mfd/Makefile
@@ -13,7 +13,7 @@ obj-$(CONFIG_MFD_CROS_EC) += cros_ec.o
 obj-$(CONFIG_MFD_CROS_EC_I2C)  += cros_ec_i2c.o
 obj-$(CONFIG_MFD_CROS_EC_SPI)  += cros_ec_spi.o
 
-rtsx_pci-objs  := rtsx_pcr.o rtsx_gops.o rts5209.o rts5229.o 
rtl8411.o rts5227.o rts5249.o
+rtsx_pci-objs  := rtsx_pcr.o rts5209.o rts5229.o rtl8411.o 
rts5227.o rts5249.o
 obj-$(CONFIG_MFD_RTSX_PCI) += rtsx_pci.o
 obj-$(CONFIG_MFD_RTSX_USB) += rtsx_usb.o
 
diff --git a/drivers/mfd/rts5227.c b/drivers/mfd/rts5227.c
index 1f387d4..0c02831 100644
--- a/drivers/mfd/rts5227.c
+++ b/drivers/mfd/rts5227.c
@@ -130,7 +130,7 @@ static int rts5227_optimize_phy(struct rtsx_pcr *pcr)
 {
int err;
 
-   err = rtsx_gops_pm_reset(pcr);
+   err = rtsx_pci_write_register(pcr, PM_CTRL3, D3_DELINK_MODE_EN, 0x00);
if (err < 0)
return err;
 
diff --git a/drivers/mfd/rts5249.c b/drivers/mfd/rts5249.c
index d8072f6..3977946 100644
--- a/drivers/mfd/rts5249.c
+++ b/drivers/mfd/rts5249.c
@@ -119,7 +119,6 @@ static int rts5249_extra_init_hw(struct rtsx_pcr *pcr)
rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, PETXCFG, 0xB0, 0xB0);
else
rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, PETXCFG, 0xB0, 0x80);
-   rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, PM_CTRL3, 0x10, 0x00);
 
return rtsx_pci_send_cmd(pcr, 100);
 }
@@ -128,7 +127,7 @@ static int rts5249_optimize_phy(struct rtsx_pcr *pcr)
 {
int err;
 
-   err = rtsx_gops_pm_reset(pcr);
+   err = rtsx_pci_write_register(pcr, PM_CTRL3, D3_DELINK_MODE_EN, 0x00);
if (err < 0)
return err;
 
diff --git a/drivers/mfd/rtsx_gops.c b/drivers/mfd/rtsx_gops.c
deleted file mode 100644
index b1a98c6..000
--- a/drivers/mfd/rtsx_gops.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Driver for Realtek PCI-Express card reader
- *
- * Copyright(c) 2009-2013 Realtek Semiconductor Corp. All rights reserved.
- *
- * 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
- * Free Software Foundation; either version 2, or (at your option) any
- * later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * 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, see .
- *
- * Author:
- *   Micky Ching 
- */
-
-#include 
-#include "rtsx_pcr.h"
-
-int rtsx_gops_pm_reset(struct rtsx_pcr *pcr)
-{
-   int err;
-
-   /* init aspm */
-   rtsx_pci_write_register(pcr, ASPM_FORCE_CTL, 0xFF, 0x00);
-   err = rtsx_pci_update_cfg_byte(pcr, LCTLR, ~LCTLR_ASPM_CTL_MASK, 0x00);
-   if (err < 0)
-   return err;
-
-   /* reset PM_CTRL3 before send buffer cmd */
-   return rtsx_pci_write_register(pcr, PM_CTRL3, D3_DELINK_MODE_EN, 0x00);
-}
diff --git a/drivers/mfd/rtsx_pcr.c b/drivers/mfd/rtsx_pcr.c
index 30f7ca8..717bfd7 100644
--- a/drivers/mfd/rtsx_pcr.c
+++ b/drivers/mfd/rtsx_pcr.c
@@ -63,6 +63,18 @@ static const struct pci_device_id rtsx_pci_ids[] = {
 
 MODULE_DEVICE_TABLE(pci, rtsx_pci_ids);
 
+static inline void rtsx_pci_enable_aspm(struct rtsx_pcr *pcr)
+{
+   rtsx_pci_update_cfg_byte(pcr, pcr->pcie_cap + PCI_EXP_LNKCTL,
+   0xFC, pcr->aspm_en);
+}
+
+static inline void rtsx_pci_disable_aspm(struct rtsx_pcr *pcr)
+{
+   rtsx_pci_update_cfg_byte(pcr, pcr->pcie_cap + PCI_EXP_LNKCTL,
+   0xFC, 0);
+}
+
 void rtsx_pci_start_run(struct rtsx_pcr *pcr)
 {
/* If pci device removed, don't queue idle work any more */
@@ -75,7 +87,8 @@ void rtsx_pci_start_run(struct rtsx_pcr *pcr)
pcr->ops->enable_auto_blink(pcr);
 
   

[PATCH v2 9/9] mfd: rtsx: using pcr_dbg replace dev_dbg

2015-01-21 Thread micky_ching
From: Micky Ching 

pcr_dbg is a wrapper of dev_dbg, which can save some code,
and help to enable/disable debug message static.

Signed-off-by: Micky Ching 
---
 drivers/mfd/rtl8411.c  | 11 +--
 drivers/mfd/rts5209.c  |  4 ++--
 drivers/mfd/rts5227.c  |  4 ++--
 drivers/mfd/rts5229.c  |  4 ++--
 drivers/mfd/rts5249.c  |  4 ++--
 drivers/mfd/rtsx_pcr.c | 49 ++---
 6 files changed, 35 insertions(+), 41 deletions(-)

diff --git a/drivers/mfd/rtl8411.c b/drivers/mfd/rtl8411.c
index fdd34c8..b3ae659 100644
--- a/drivers/mfd/rtl8411.c
+++ b/drivers/mfd/rtl8411.c
@@ -53,7 +53,7 @@ static void rtl8411_fetch_vendor_settings(struct rtsx_pcr 
*pcr)
u8 reg3 = 0;
 
rtsx_pci_read_config_dword(pcr, PCR_SETTING_REG1, );
-   dev_dbg(&(pcr->pci->dev), "Cfg 0x%x: 0x%x\n", PCR_SETTING_REG1, reg1);
+   pcr_dbg(pcr, "Cfg 0x%x: 0x%x\n", PCR_SETTING_REG1, reg1);
 
if (!rtsx_vendor_setting_valid(reg1))
return;
@@ -65,7 +65,7 @@ static void rtl8411_fetch_vendor_settings(struct rtsx_pcr 
*pcr)
pcr->card_drive_sel |= rtsx_reg_to_card_drive_sel(reg1);
 
rtsx_pci_read_config_byte(pcr, PCR_SETTING_REG3, );
-   dev_dbg(&(pcr->pci->dev), "Cfg 0x%x: 0x%x\n", PCR_SETTING_REG3, reg3);
+   pcr_dbg(pcr, "Cfg 0x%x: 0x%x\n", PCR_SETTING_REG3, reg3);
pcr->sd30_drive_sel_3v3 = rtl8411_reg_to_sd30_drive_sel_3v3(reg3);
 }
 
@@ -74,7 +74,7 @@ static void rtl8411b_fetch_vendor_settings(struct rtsx_pcr 
*pcr)
u32 reg = 0;
 
rtsx_pci_read_config_dword(pcr, PCR_SETTING_REG1, );
-   dev_dbg(&(pcr->pci->dev), "Cfg 0x%x: 0x%x\n", PCR_SETTING_REG1, reg);
+   pcr_dbg(pcr, "Cfg 0x%x: 0x%x\n", PCR_SETTING_REG1, reg);
 
if (!rtsx_vendor_setting_valid(reg))
return;
@@ -260,9 +260,8 @@ static unsigned int rtl8411_cd_deglitch(struct rtsx_pcr 
*pcr)
rtsx_pci_write_register(pcr, CARD_PWR_CTL,
BPP_POWER_MASK, BPP_POWER_OFF);
 
-   dev_dbg(&(pcr->pci->dev),
-   "After CD deglitch, card_exist = 0x%x\n",
-   card_exist);
+   pcr_dbg(pcr, "After CD deglitch, card_exist = 0x%x\n",
+   card_exist);
}
 
if (card_exist & MS_EXIST) {
diff --git a/drivers/mfd/rts5209.c b/drivers/mfd/rts5209.c
index cb04174..373e253 100644
--- a/drivers/mfd/rts5209.c
+++ b/drivers/mfd/rts5209.c
@@ -38,7 +38,7 @@ static void rts5209_fetch_vendor_settings(struct rtsx_pcr 
*pcr)
u32 reg;
 
rtsx_pci_read_config_dword(pcr, PCR_SETTING_REG1, );
-   dev_dbg(&(pcr->pci->dev), "Cfg 0x%x: 0x%x\n", PCR_SETTING_REG1, reg);
+   pcr_dbg(pcr, "Cfg 0x%x: 0x%x\n", PCR_SETTING_REG1, reg);
 
if (rts5209_vendor_setting1_valid(reg)) {
if (rts5209_reg_check_ms_pmos(reg))
@@ -47,7 +47,7 @@ static void rts5209_fetch_vendor_settings(struct rtsx_pcr 
*pcr)
}
 
rtsx_pci_read_config_dword(pcr, PCR_SETTING_REG2, );
-   dev_dbg(&(pcr->pci->dev), "Cfg 0x%x: 0x%x\n", PCR_SETTING_REG2, reg);
+   pcr_dbg(pcr, "Cfg 0x%x: 0x%x\n", PCR_SETTING_REG2, reg);
 
if (rts5209_vendor_setting2_valid(reg)) {
pcr->sd30_drive_sel_1v8 =
diff --git a/drivers/mfd/rts5227.c b/drivers/mfd/rts5227.c
index 0c02831..ce012d7 100644
--- a/drivers/mfd/rts5227.c
+++ b/drivers/mfd/rts5227.c
@@ -63,7 +63,7 @@ static void rts5227_fetch_vendor_settings(struct rtsx_pcr 
*pcr)
u32 reg;
 
rtsx_pci_read_config_dword(pcr, PCR_SETTING_REG1, );
-   dev_dbg(&(pcr->pci->dev), "Cfg 0x%x: 0x%x\n", PCR_SETTING_REG1, reg);
+   pcr_dbg(pcr, "Cfg 0x%x: 0x%x\n", PCR_SETTING_REG1, reg);
 
if (!rtsx_vendor_setting_valid(reg))
return;
@@ -74,7 +74,7 @@ static void rts5227_fetch_vendor_settings(struct rtsx_pcr 
*pcr)
pcr->card_drive_sel |= rtsx_reg_to_card_drive_sel(reg);
 
rtsx_pci_read_config_dword(pcr, PCR_SETTING_REG2, );
-   dev_dbg(&(pcr->pci->dev), "Cfg 0x%x: 0x%x\n", PCR_SETTING_REG2, reg);
+   pcr_dbg(pcr, "Cfg 0x%x: 0x%x\n", PCR_SETTING_REG2, reg);
pcr->sd30_drive_sel_3v3 = rtsx_reg_to_sd30_drive_sel_3v3(reg);
if (rtsx_reg_check_reverse_socket(reg))
pcr->flags |= PCR_REVERSE_SOCKET;
diff --git a/drivers/mfd/rts5229.c b/drivers/mfd/rts5229.c
index 6353f5d..ace4538 100644
--- a/drivers/mfd/rts5229.c
+++ b/drivers/mfd/rts5229.c
@@ -38,7 +38,7 @@ static void rts5229_fetch_vendor_settings(struct rtsx_pcr 
*pcr)
u32 reg;
 
rtsx_pci_read_config_dword(pcr, PCR_SETTING_REG1, );
-   dev_dbg(&(pcr->pci->dev), "Cfg 0x%x: 0x%x\n", PCR_SETTING_REG1, reg);
+   pcr_dbg(pcr, "Cfg 0x%x: 0x%x\n", PCR_SETTING_REG1, reg);
 
if (!rtsx_vendor_setting_valid(reg))
return;
@@ -50,7 +50,7 @@ static void rts5229_fetch_vendor_settings(struct rtsx_pcr 
*pcr)
pcr->card_drive_sel |= 

[PATCH v2 8/9] mfd: rtsx: add support for rts525A

2015-01-21 Thread micky_ching
From: Micky Ching 

add support for new chip rts525A.

Signed-off-by: Micky Ching 
---
 drivers/mfd/rts5249.c| 104 ++-
 drivers/mfd/rtsx_pcr.c   |  13 --
 drivers/mfd/rtsx_pcr.h   |   1 +
 include/linux/mfd/rtsx_pci.h |  15 +++
 4 files changed, 129 insertions(+), 4 deletions(-)

diff --git a/drivers/mfd/rts5249.c b/drivers/mfd/rts5249.c
index 97dde92..134e03f 100644
--- a/drivers/mfd/rts5249.c
+++ b/drivers/mfd/rts5249.c
@@ -97,7 +97,7 @@ static void rtsx_base_force_power_down(struct rtsx_pcr *pcr, 
u8 pm_state)
rtsx_pci_write_register(pcr, AUTOLOAD_CFG_BASE + 3, 0x01, 0);
 
if (pm_state == HOST_ENTER_S3) {
-   if (PCI_PID(pcr) == 0x524A)
+   if (PCI_PID(pcr) == 0x524A || PCI_PID(pcr) == 0x525A)
rtsx_pci_write_register(pcr, RTS524A_PM_CTRL3,
D3_DELINK_MODE_EN, D3_DELINK_MODE_EN);
else if (PCI_PID(pcr) == 0x5249)
@@ -485,3 +485,105 @@ void rts524a_init_params(struct rtsx_pcr *pcr)
pcr->ops = _pcr_ops;
 }
 
+static int rts525a_card_power_on(struct rtsx_pcr *pcr, int card)
+{
+   rtsx_pci_write_register(pcr, LDO_VCC_CFG1,
+   LDO_VCC_TUNE_MASK, LDO_VCC_3V3);
+   return rtsx_base_card_power_on(pcr, card);
+}
+
+static int rts525a_switch_output_voltage(struct rtsx_pcr *pcr, u8 voltage)
+{
+   switch (voltage) {
+   case OUTPUT_3V3:
+   rtsx_pci_write_register(pcr, LDO_CONFIG2,
+   LDO_D3318_MASK, LDO_D3318_33V);
+   rtsx_pci_write_register(pcr, SD_PAD_CTL, SD_IO_USING_1V8, 0);
+   break;
+   case OUTPUT_1V8:
+   rtsx_pci_write_register(pcr, LDO_CONFIG2,
+   LDO_D3318_MASK, LDO_D3318_18V);
+   rtsx_pci_write_register(pcr, SD_PAD_CTL, SD_IO_USING_1V8,
+   SD_IO_USING_1V8);
+   break;
+   default:
+   return -EINVAL;
+   }
+
+   rtsx_pci_init_cmd(pcr);
+   rts5249_fill_driving(pcr, voltage);
+   return rtsx_pci_send_cmd(pcr, 100);
+}
+
+static int rts525a_optimize_phy(struct rtsx_pcr *pcr)
+{
+   int err;
+
+   err = rtsx_pci_write_register(pcr, RTS524A_PM_CTRL3,
+   D3_DELINK_MODE_EN, 0x00);
+   if (err < 0)
+   return err;
+
+   rtsx_pci_write_phy_register(pcr, _PHY_FLD0,
+   _PHY_FLD0_CLK_REQ_20C | _PHY_FLD0_RX_IDLE_EN |
+   _PHY_FLD0_BIT_ERR_RSTN | _PHY_FLD0_BER_COUNT |
+   _PHY_FLD0_BER_TIMER | _PHY_FLD0_CHECK_EN);
+
+   rtsx_pci_write_phy_register(pcr, _PHY_ANA03,
+   _PHY_ANA03_TIMER_MAX | _PHY_ANA03_OOBS_DEB_EN |
+   _PHY_CMU_DEBUG_EN);
+
+   if (is_version(pcr, 0x525A, IC_VER_A))
+   rtsx_pci_write_phy_register(pcr, _PHY_REV0,
+   _PHY_REV0_FILTER_OUT | _PHY_REV0_CDR_BYPASS_PFD |
+   _PHY_REV0_CDR_RX_IDLE_BYPASS);
+
+   return 0;
+}
+
+static int rts525a_extra_init_hw(struct rtsx_pcr *pcr)
+{
+   rts5249_extra_init_hw(pcr);
+
+   rtsx_pci_write_register(pcr, PCLK_CTL, PCLK_MODE_SEL, PCLK_MODE_SEL);
+   if (is_version(pcr, 0x525A, IC_VER_A)) {
+   rtsx_pci_write_register(pcr, L1SUB_CONFIG2,
+   L1SUB_AUTO_CFG, L1SUB_AUTO_CFG);
+   rtsx_pci_write_register(pcr, RREF_CFG,
+   RREF_VBGSEL_MASK, RREF_VBGSEL_1V25);
+   rtsx_pci_write_register(pcr, LDO_VIO_CFG,
+   LDO_VIO_TUNE_MASK, LDO_VIO_1V7);
+   rtsx_pci_write_register(pcr, LDO_DV12S_CFG,
+   LDO_D12_TUNE_MASK, LDO_D12_TUNE_DF);
+   rtsx_pci_write_register(pcr, LDO_AV12S_CFG,
+   LDO_AV12S_TUNE_MASK, LDO_AV12S_TUNE_DF);
+   rtsx_pci_write_register(pcr, LDO_VCC_CFG0,
+   LDO_VCC_LMTVTH_MASK, LDO_VCC_LMTVTH_2A);
+   rtsx_pci_write_register(pcr, OOBS_CONFIG,
+   OOBS_AUTOK_DIS | OOBS_VAL_MASK, 0x89);
+   }
+
+   return 0;
+}
+
+static const struct pcr_ops rts525a_pcr_ops = {
+   .fetch_vendor_settings = rtsx_base_fetch_vendor_settings,
+   .extra_init_hw = rts525a_extra_init_hw,
+   .optimize_phy = rts525a_optimize_phy,
+   .turn_on_led = rtsx_base_turn_on_led,
+   .turn_off_led = rtsx_base_turn_off_led,
+   .enable_auto_blink = rtsx_base_enable_auto_blink,
+   .disable_auto_blink = rtsx_base_disable_auto_blink,
+   .card_power_on = rts525a_card_power_on,
+   .card_power_off = rtsx_base_card_power_off,
+   .switch_output_voltage = rts525a_switch_output_voltage,
+   .force_power_down = rtsx_base_force_power_down,
+};
+
+void rts525a_init_params(struct rtsx_pcr *pcr)
+{
+   rts5249_init_params(pcr);
+
+   pcr->ops = _pcr_ops;
+}
+
diff --git a/drivers/mfd/rtsx_pcr.c b/drivers/mfd/rtsx_pcr.c
index 69467c6..681e1a6 100644
--- 

[PATCH v2 2/9] mfd: rtsx: place register address and values togather

2015-01-21 Thread micky_ching
From: Micky Ching 

It is more readable to place register address and values define
togather. The values define add two leading space indicate belong
to the register address defined above.

Signed-off-by: Micky Ching 
---
 include/linux/mfd/rtsx_pci.h | 836 +++
 1 file changed, 369 insertions(+), 467 deletions(-)

diff --git a/include/linux/mfd/rtsx_pci.h b/include/linux/mfd/rtsx_pci.h
index a9c2a14..e81f2bb 100644
--- a/include/linux/mfd/rtsx_pci.h
+++ b/include/linux/mfd/rtsx_pci.h
@@ -28,74 +28,72 @@
 
 #define MAX_RW_REG_CNT 1024
 
-/* PCI Operation Register Address */
 #define RTSX_HCBAR 0x00
 #define RTSX_HCBCTLR   0x04
+#define   STOP_CMD (0x01 << 28)
+#define   READ_REG_CMD 0
+#define   WRITE_REG_CMD1
+#define   CHECK_REG_CMD2
+
 #define RTSX_HDBAR 0x08
+#define   SG_INT   0x04
+#define   SG_END   0x02
+#define   SG_VALID 0x01
+#define   SG_NO_OP 0x00
+#define   SG_TRANS_DATA(0x02 << 4)
+#define   SG_LINK_DESC (0x03 << 4)
 #define RTSX_HDBCTLR   0x0C
+#define   SDMA_MODE0x00
+#define   ADMA_MODE(0x02 << 26)
+#define   STOP_DMA (0x01 << 28)
+#define   TRIG_DMA (0x01 << 31)
+
 #define RTSX_HAIMR 0x10
-#define RTSX_BIPR  0x14
-#define RTSX_BIER  0x18
+#define   HAIMR_TRANS_START(0x01 << 31)
+#define   HAIMR_READ   0x00
+#define   HAIMR_WRITE  (0x01 << 30)
+#define   HAIMR_READ_START (HAIMR_TRANS_START | HAIMR_READ)
+#define   HAIMR_WRITE_START(HAIMR_TRANS_START | HAIMR_WRITE)
+#define   HAIMR_TRANS_END  (HAIMR_TRANS_START)
 
-/* Host command buffer control register */
-#define STOP_CMD   (0x01 << 28)
-
-/* Host data buffer control register */
-#define SDMA_MODE  0x00
-#define ADMA_MODE  (0x02 << 26)
-#define STOP_DMA   (0x01 << 28)
-#define TRIG_DMA   (0x01 << 31)
-
-/* Host access internal memory register */
-#define HAIMR_TRANS_START  (0x01 << 31)
-#define HAIMR_READ 0x00
-#define HAIMR_WRITE(0x01 << 30)
-#define HAIMR_READ_START   (HAIMR_TRANS_START | HAIMR_READ)
-#define HAIMR_WRITE_START  (HAIMR_TRANS_START | HAIMR_WRITE)
-#define HAIMR_TRANS_END(HAIMR_TRANS_START)
-
-/* Bus interrupt pending register */
-#define CMD_DONE_INT   (1 << 31)
-#define DATA_DONE_INT  (1 << 30)
-#define TRANS_OK_INT   (1 << 29)
-#define TRANS_FAIL_INT (1 << 28)
-#define XD_INT (1 << 27)
-#define MS_INT (1 << 26)
-#define SD_INT (1 << 25)
-#define GPIO0_INT  (1 << 24)
-#define OC_INT (1 << 23)
-#define SD_WRITE_PROTECT   (1 << 19)
-#define XD_EXIST   (1 << 18)
-#define MS_EXIST   (1 << 17)
-#define SD_EXIST   (1 << 16)
-#define DELINK_INT GPIO0_INT
-#define MS_OC_INT  (1 << 23)
-#define SD_OC_INT  (1 << 22)
+#define RTSX_BIPR  0x14
+#define   CMD_DONE_INT (1 << 31)
+#define   DATA_DONE_INT(1 << 30)
+#define   TRANS_OK_INT (1 << 29)
+#define   TRANS_FAIL_INT   (1 << 28)
+#define   XD_INT   (1 << 27)
+#define   MS_INT   (1 << 26)
+#define   SD_INT   (1 << 25)
+#define   GPIO0_INT(1 << 24)
+#define   OC_INT   (1 << 23)
+#define   SD_WRITE_PROTECT (1 << 19)
+#define   XD_EXIST (1 << 18)
+#define   MS_EXIST (1 << 17)
+#define   SD_EXIST (1 << 16)
+#define   DELINK_INT   GPIO0_INT
+#define   MS_OC_INT(1 << 23)
+#define   SD_OC_INT(1 << 22)
 
 #define CARD_INT   (XD_INT | MS_INT | SD_INT)
 #define NEED_COMPLETE_INT  (DATA_DONE_INT | TRANS_OK_INT | TRANS_FAIL_INT)
 #define RTSX_INT   (CMD_DONE_INT | NEED_COMPLETE_INT | \
CARD_INT | GPIO0_INT | OC_INT)
-
 #define CARD_EXIST (XD_EXIST | MS_EXIST | SD_EXIST)
 
-/* Bus interrupt enable register */
-#define CMD_DONE_INT_EN(1 << 31)
-#define DATA_DONE_INT_EN   (1 << 30)
-#define TRANS_OK_INT_EN(1 << 29)

[PATCH] dmaengine: qcom_bam_dma: Add support for BAM v1.7.0

2015-01-21 Thread Archit Taneja
Add register offset table entry for the newer (v1.7.0) version of the BAM IP
found on MSM8916. Update the DT bindings documentation.

Signed-off-by: Archit Taneja 
---
 .../devicetree/bindings/dma/qcom_bam_dma.txt   |  1 +
 drivers/dma/qcom_bam_dma.c | 30 ++
 2 files changed, 31 insertions(+)

diff --git a/Documentation/devicetree/bindings/dma/qcom_bam_dma.txt 
b/Documentation/devicetree/bindings/dma/qcom_bam_dma.txt
index f8c3311..1c9d48e 100644
--- a/Documentation/devicetree/bindings/dma/qcom_bam_dma.txt
+++ b/Documentation/devicetree/bindings/dma/qcom_bam_dma.txt
@@ -4,6 +4,7 @@ Required properties:
 - compatible: must be one of the following:
  * "qcom,bam-v1.4.0" for MSM8974, APQ8074 and APQ8084
  * "qcom,bam-v1.3.0" for APQ8064, IPQ8064 and MSM8960
+ * "qcom,bam-v1.7.0" for MSM8916
 - reg: Address range for DMA registers
 - interrupts: Should contain the one interrupt shared by all channels
 - #dma-cells: must be <1>, the cell in the dmas property of the client device
diff --git a/drivers/dma/qcom_bam_dma.c b/drivers/dma/qcom_bam_dma.c
index 3122a99..447ad12 100644
--- a/drivers/dma/qcom_bam_dma.c
+++ b/drivers/dma/qcom_bam_dma.c
@@ -171,6 +171,35 @@ static const struct reg_offset_data bam_v1_4_reg_info[] = {
[BAM_P_FIFO_SIZES]  = { 0x1820, 0x00, 0x1000, 0x00 },
 };
 
+static const struct reg_offset_data bam_v1_7_reg_info[] = {
+   [BAM_CTRL]  = { 0x0, 0x00, 0x00, 0x00 },
+   [BAM_REVISION]  = { 0x01000, 0x00, 0x00, 0x00 },
+   [BAM_NUM_PIPES] = { 0x01008, 0x00, 0x00, 0x00 },
+   [BAM_DESC_CNT_TRSHLD]   = { 0x8, 0x00, 0x00, 0x00 },
+   [BAM_IRQ_SRCS]  = { 0x03010, 0x00, 0x00, 0x00 },
+   [BAM_IRQ_SRCS_MSK]  = { 0x03014, 0x00, 0x00, 0x00 },
+   [BAM_IRQ_SRCS_UNMASKED] = { 0x03018, 0x00, 0x00, 0x00 },
+   [BAM_IRQ_STTS]  = { 0x00014, 0x00, 0x00, 0x00 },
+   [BAM_IRQ_CLR]   = { 0x00018, 0x00, 0x00, 0x00 },
+   [BAM_IRQ_EN]= { 0x0001C, 0x00, 0x00, 0x00 },
+   [BAM_CNFG_BITS] = { 0x0007C, 0x00, 0x00, 0x00 },
+   [BAM_IRQ_SRCS_EE]   = { 0x03000, 0x00, 0x00, 0x80 },
+   [BAM_IRQ_SRCS_MSK_EE]   = { 0x03004, 0x00, 0x00, 0x80 },
+   [BAM_P_CTRL]= { 0x13000, 0x1000, 0x00, 0x00 },
+   [BAM_P_RST] = { 0x13004, 0x1000, 0x00, 0x00 },
+   [BAM_P_HALT]= { 0x13008, 0x1000, 0x00, 0x00 },
+   [BAM_P_IRQ_STTS]= { 0x13010, 0x1000, 0x00, 0x00 },
+   [BAM_P_IRQ_CLR] = { 0x13014, 0x1000, 0x00, 0x00 },
+   [BAM_P_IRQ_EN]  = { 0x13018, 0x1000, 0x00, 0x00 },
+   [BAM_P_EVNT_DEST_ADDR]  = { 0x1382C, 0x00, 0x1000, 0x00 },
+   [BAM_P_EVNT_REG]= { 0x13818, 0x00, 0x1000, 0x00 },
+   [BAM_P_SW_OFSTS]= { 0x13800, 0x00, 0x1000, 0x00 },
+   [BAM_P_DATA_FIFO_ADDR]  = { 0x13824, 0x00, 0x1000, 0x00 },
+   [BAM_P_DESC_FIFO_ADDR]  = { 0x1381C, 0x00, 0x1000, 0x00 },
+   [BAM_P_EVNT_GEN_TRSHLD] = { 0x13828, 0x00, 0x1000, 0x00 },
+   [BAM_P_FIFO_SIZES]  = { 0x13820, 0x00, 0x1000, 0x00 },
+};
+
 /* BAM CTRL */
 #define BAM_SW_RST BIT(0)
 #define BAM_EN BIT(1)
@@ -1053,6 +1082,7 @@ static void bam_channel_init(struct bam_device *bdev, 
struct bam_chan *bchan,
 static const struct of_device_id bam_of_match[] = {
{ .compatible = "qcom,bam-v1.3.0", .data = _v1_3_reg_info },
{ .compatible = "qcom,bam-v1.4.0", .data = _v1_4_reg_info },
+   { .compatible = "qcom,bam-v1.7.0", .data = _v1_7_reg_info },
{}
 };
 
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 4/9] mfd: rtsx: update driving settings

2015-01-21 Thread micky_ching
From: Micky Ching 

update card drive settings, This setting can be used for rts5249
rts524A and rts525A.

Signed-off-by: Micky Ching 
---
 drivers/mfd/rts5249.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/mfd/rts5249.c b/drivers/mfd/rts5249.c
index 225ad55..2fe2854 100644
--- a/drivers/mfd/rts5249.c
+++ b/drivers/mfd/rts5249.c
@@ -36,16 +36,16 @@ static u8 rts5249_get_ic_version(struct rtsx_pcr *pcr)
 static void rts5249_fill_driving(struct rtsx_pcr *pcr, u8 voltage)
 {
u8 driving_3v3[4][3] = {
-   {0x11, 0x11, 0x11},
+   {0x11, 0x11, 0x18},
{0x55, 0x55, 0x5C},
-   {0x99, 0x99, 0x92},
-   {0x99, 0x99, 0x92},
+   {0xFF, 0xFF, 0xFF},
+   {0x96, 0x96, 0x96},
};
u8 driving_1v8[4][3] = {
+   {0xC4, 0xC4, 0xC4},
{0x3C, 0x3C, 0x3C},
-   {0xB3, 0xB3, 0xB3},
{0xFE, 0xFE, 0xFE},
-   {0xC4, 0xC4, 0xC4},
+   {0xB3, 0xB3, 0xB3},
};
u8 (*driving)[3], drive_sel;
 
@@ -341,7 +341,7 @@ void rts5249_init_params(struct rtsx_pcr *pcr)
 
pcr->flags = 0;
pcr->card_drive_sel = RTSX_CARD_DRIVE_DEFAULT;
-   pcr->sd30_drive_sel_1v8 = CFG_DRIVER_TYPE_C;
+   pcr->sd30_drive_sel_1v8 = CFG_DRIVER_TYPE_B;
pcr->sd30_drive_sel_3v3 = CFG_DRIVER_TYPE_B;
pcr->aspm_en = ASPM_L1_EN;
pcr->tx_initial_phase = SET_CLOCK_PHASE(1, 29, 16);
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 5/9] mfd: rtsx: update phy register

2015-01-21 Thread micky_ching
From: Micky Ching 

update phy register value and using direct value instead of macros.
It is much easier to debug using constant value than a lot of macros.
We usually need compare the value directly to check the configure.

Signed-off-by: Micky Ching 
---
 drivers/mfd/rts5249.c|  55 --
 include/linux/mfd/rtsx_pci.h | 109 ++-
 2 files changed, 85 insertions(+), 79 deletions(-)

diff --git a/drivers/mfd/rts5249.c b/drivers/mfd/rts5249.c
index 2fe2854..d8072f6 100644
--- a/drivers/mfd/rts5249.c
+++ b/drivers/mfd/rts5249.c
@@ -132,57 +132,62 @@ static int rts5249_optimize_phy(struct rtsx_pcr *pcr)
if (err < 0)
return err;
 
-   err = rtsx_pci_write_phy_register(pcr, PHY_REG_REV,
-   PHY_REG_REV_RESV | PHY_REG_REV_RXIDLE_LATCHED |
-   PHY_REG_REV_P1_EN | PHY_REG_REV_RXIDLE_EN |
-   PHY_REG_REV_RX_PWST | PHY_REG_REV_CLKREQ_DLY_TIMER_1_0 |
-   PHY_REG_REV_STOP_CLKRD | PHY_REG_REV_STOP_CLKWR);
+   err = rtsx_pci_write_phy_register(pcr, PHY_REV,
+   PHY_REV_RESV | PHY_REV_RXIDLE_LATCHED |
+   PHY_REV_P1_EN | PHY_REV_RXIDLE_EN |
+   PHY_REV_CLKREQ_TX_EN | PHY_REV_RX_PWST |
+   PHY_REV_CLKREQ_DT_1_0 | PHY_REV_STOP_CLKRD |
+   PHY_REV_STOP_CLKWR);
if (err < 0)
return err;
 
msleep(1);
 
err = rtsx_pci_write_phy_register(pcr, PHY_BPCR,
-   PHY_BPCR_IBRXSEL | PHY_BPCR_IBTXSEL |
-   PHY_BPCR_IB_FILTER | PHY_BPCR_CMIRROR_EN);
+   PHY_BPCR_IBRXSEL | PHY_BPCR_IBTXSEL |
+   PHY_BPCR_IB_FILTER | PHY_BPCR_CMIRROR_EN);
if (err < 0)
return err;
+
err = rtsx_pci_write_phy_register(pcr, PHY_PCR,
-   PHY_PCR_FORCE_CODE | PHY_PCR_OOBS_CALI_50 |
-   PHY_PCR_OOBS_VCM_08 | PHY_PCR_OOBS_SEN_90 |
-   PHY_PCR_RSSI_EN);
+   PHY_PCR_FORCE_CODE | PHY_PCR_OOBS_CALI_50 |
+   PHY_PCR_OOBS_VCM_08 | PHY_PCR_OOBS_SEN_90 |
+   PHY_PCR_RSSI_EN | PHY_PCR_RX10K);
if (err < 0)
return err;
+
err = rtsx_pci_write_phy_register(pcr, PHY_RCR2,
-   PHY_RCR2_EMPHASE_EN | PHY_RCR2_NADJR |
-   PHY_RCR2_CDR_CP_10 | PHY_RCR2_CDR_SR_2 |
-   PHY_RCR2_FREQSEL_12 | PHY_RCR2_CPADJEN |
-   PHY_RCR2_CDR_SC_8 | PHY_RCR2_CALIB_LATE);
+   PHY_RCR2_EMPHASE_EN | PHY_RCR2_NADJR |
+   PHY_RCR2_CDR_SR_2 | PHY_RCR2_FREQSEL_12 |
+   PHY_RCR2_CDR_SC_12P | PHY_RCR2_CALIB_LATE);
if (err < 0)
return err;
+
err = rtsx_pci_write_phy_register(pcr, PHY_FLD4,
-   PHY_FLD4_FLDEN_SEL | PHY_FLD4_REQ_REF |
-   PHY_FLD4_RXAMP_OFF | PHY_FLD4_REQ_ADDA |
-   PHY_FLD4_BER_COUNT | PHY_FLD4_BER_TIMER |
-   PHY_FLD4_BER_CHK_EN);
+   PHY_FLD4_FLDEN_SEL | PHY_FLD4_REQ_REF |
+   PHY_FLD4_RXAMP_OFF | PHY_FLD4_REQ_ADDA |
+   PHY_FLD4_BER_COUNT | PHY_FLD4_BER_TIMER |
+   PHY_FLD4_BER_CHK_EN);
if (err < 0)
return err;
-   err = rtsx_pci_write_phy_register(pcr, PHY_RDR, PHY_RDR_RXDSEL_1_9);
+   err = rtsx_pci_write_phy_register(pcr, PHY_RDR,
+   PHY_RDR_RXDSEL_1_9 | PHY_SSC_AUTO_PWD);
if (err < 0)
return err;
err = rtsx_pci_write_phy_register(pcr, PHY_RCR1,
-   PHY_RCR1_ADP_TIME | PHY_RCR1_VCO_COARSE);
+   PHY_RCR1_ADP_TIME_4 | PHY_RCR1_VCO_COARSE);
if (err < 0)
return err;
err = rtsx_pci_write_phy_register(pcr, PHY_FLD3,
-   PHY_FLD3_TIMER_4 | PHY_FLD3_TIMER_6 |
-   PHY_FLD3_RXDELINK);
+   PHY_FLD3_TIMER_4 | PHY_FLD3_TIMER_6 |
+   PHY_FLD3_RXDELINK);
if (err < 0)
return err;
+
return rtsx_pci_write_phy_register(pcr, PHY_TUNE,
-   PHY_TUNE_TUNEREF_1_0 | PHY_TUNE_VBGSEL_1252 |
-   PHY_TUNE_SDBUS_33 | PHY_TUNE_TUNED18 |
-   PHY_TUNE_TUNED12);
+   PHY_TUNE_TUNEREF_1_0 | PHY_TUNE_VBGSEL_1252 |
+   PHY_TUNE_SDBUS_33 | PHY_TUNE_TUNED18 |
+   PHY_TUNE_TUNED12 | PHY_TUNE_TUNEA12);
 }
 
 static int rts5249_turn_on_led(struct rtsx_pcr *pcr)
diff --git a/include/linux/mfd/rtsx_pci.h b/include/linux/mfd/rtsx_pci.h
index 87cff60..0103210 100644
--- a/include/linux/mfd/rtsx_pci.h
+++ b/include/linux/mfd/rtsx_pci.h
@@ -630,16 +630,47 @@
 
 /* Phy register */
 #define PHY_PCR0x00
+#define   PHY_PCR_FORCE_CODE   0xB000
+#define   PHY_PCR_OOBS_CALI_50 0x0800
+#define   

[PATCH v2 3/9] mfd: rtsx: update PETXCFG address

2015-01-21 Thread micky_ching
From: Micky Ching 

PETXCFG is defined at 0xFF03, the old 0xFE49 not used any more.

Signed-off-by: Micky Ching 
---
 drivers/mfd/rts5227.c| 6 ++
 drivers/mfd/rts5249.c| 6 ++
 include/linux/mfd/rtsx_pci.h | 2 +-
 3 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/drivers/mfd/rts5227.c b/drivers/mfd/rts5227.c
index 3240740..1f387d4 100644
--- a/drivers/mfd/rts5227.c
+++ b/drivers/mfd/rts5227.c
@@ -118,11 +118,9 @@ static int rts5227_extra_init_hw(struct rtsx_pcr *pcr)
rts5227_fill_driving(pcr, OUTPUT_3V3);
/* Configure force_clock_req */
if (pcr->flags & PCR_REVERSE_SOCKET)
-   rtsx_pci_add_cmd(pcr, WRITE_REG_CMD,
-   AUTOLOAD_CFG_BASE + 3, 0xB8, 0xB8);
+   rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, PETXCFG, 0xB8, 0xB8);
else
-   rtsx_pci_add_cmd(pcr, WRITE_REG_CMD,
-   AUTOLOAD_CFG_BASE + 3, 0xB8, 0x88);
+   rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, PETXCFG, 0xB8, 0x88);
rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, PM_CTRL3, 0x10, 0x00);
 
return rtsx_pci_send_cmd(pcr, 100);
diff --git a/drivers/mfd/rts5249.c b/drivers/mfd/rts5249.c
index cf425cc..225ad55 100644
--- a/drivers/mfd/rts5249.c
+++ b/drivers/mfd/rts5249.c
@@ -116,11 +116,9 @@ static int rts5249_extra_init_hw(struct rtsx_pcr *pcr)
/* Configure driving */
rts5249_fill_driving(pcr, OUTPUT_3V3);
if (pcr->flags & PCR_REVERSE_SOCKET)
-   rtsx_pci_add_cmd(pcr, WRITE_REG_CMD,
-   AUTOLOAD_CFG_BASE + 3, 0xB0, 0xB0);
+   rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, PETXCFG, 0xB0, 0xB0);
else
-   rtsx_pci_add_cmd(pcr, WRITE_REG_CMD,
-   AUTOLOAD_CFG_BASE + 3, 0xB0, 0x80);
+   rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, PETXCFG, 0xB0, 0x80);
rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, PM_CTRL3, 0x10, 0x00);
 
return rtsx_pci_send_cmd(pcr, 100);
diff --git a/include/linux/mfd/rtsx_pci.h b/include/linux/mfd/rtsx_pci.h
index e81f2bb..87cff60 100644
--- a/include/linux/mfd/rtsx_pci.h
+++ b/include/linux/mfd/rtsx_pci.h
@@ -572,7 +572,6 @@
 #define MSGTXDATA2 0xFE46
 #define MSGTXDATA3 0xFE47
 #define MSGTXCTL   0xFE48
-#define PETXCFG0xFE49
 #define LTR_CTL0xFE4A
 #define OBFF_CFG   0xFE4C
 
@@ -606,6 +605,7 @@
 #define DUMMY_REG_RESET_0  0xFE90
 
 #define AUTOLOAD_CFG_BASE  0xFF00
+#define PETXCFG0xFF03
 
 #define PM_CTRL1   0xFF44
 #define PM_CTRL2   0xFF45
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 0/9] mfd: rtsx: add support for new rts524A and rts525A

2015-01-21 Thread micky_ching
From: Micky Ching 

v2:
- remove debug info when access failed.
- using macro list for phy register init.
- rename function for multi chip prefix with rtsx_base_
- save pcie_cap offset when init chip, not calling pci_find_capacity()
  every time.
- add pcr->ops: write_phy/read_phy for special chip.

This patchset including re-format some coding-style and add two new chip
rts524A and rts525A.


Micky Ching (9):
  mfd: rtsx: replace TAB by SPC after #define
  mfd: rtsx: place register address and values togather
  mfd: rtsx: update PETXCFG address
  mfd: rtsx: update driving settings
  mfd: rtsx: update phy register
  mfd: rtsx: remove LCTLR defination
  mfd: rtsx: add support for rts524A
  mfd: rtsx: add support for rts525A
  mfd: rtsx: using pcr_dbg replace dev_dbg

 drivers/mfd/Makefile |2 +-
 drivers/mfd/rtl8411.c|   11 +-
 drivers/mfd/rts5209.c|4 +-
 drivers/mfd/rts5227.c|   12 +-
 drivers/mfd/rts5229.c|4 +-
 drivers/mfd/rts5249.c|  368 +++---
 drivers/mfd/rtsx_gops.c  |   37 --
 drivers/mfd/rtsx_pcr.c   |  110 +++--
 drivers/mfd/rtsx_pcr.h   |8 +
 include/linux/mfd/rtsx_pci.h | 1109 ++
 10 files changed, 966 insertions(+), 699 deletions(-)
 delete mode 100644 drivers/mfd/rtsx_gops.c

-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 1/9] mfd: rtsx: replace TAB by SPC after #define

2015-01-21 Thread micky_ching
From: Micky Ching 

Re-format coding-style, using uniform SPC after "#define" keyword
instead of mixing using TAB and SPC.

Signed-off-by: Micky Ching 
---
 include/linux/mfd/rtsx_pci.h | 254 +--
 1 file changed, 127 insertions(+), 127 deletions(-)

diff --git a/include/linux/mfd/rtsx_pci.h b/include/linux/mfd/rtsx_pci.h
index 0c12628..a9c2a14 100644
--- a/include/linux/mfd/rtsx_pci.h
+++ b/include/linux/mfd/rtsx_pci.h
@@ -175,9 +175,9 @@
 /* CARD_SHARE_MODE */
 #define CARD_SHARE_MASK0x0F
 #define CARD_SHARE_MULTI_LUN   0x00
-#defineCARD_SHARE_NORMAL   0x00
-#defineCARD_SHARE_48_SD0x04
-#defineCARD_SHARE_48_MS0x08
+#define CARD_SHARE_NORMAL  0x00
+#define CARD_SHARE_48_SD   0x04
+#define CARD_SHARE_48_MS   0x08
 /* CARD_SHARE_MODE for barossa */
 #define CARD_SHARE_BAROSSA_SD  0x01
 #define CARD_SHARE_BAROSSA_MS  0x02
@@ -249,76 +249,76 @@
 #define CD_AUTO_DISABLE0x40
 
 /* SD_STAT1 */
-#defineSD_CRC7_ERR 0x80
-#defineSD_CRC16_ERR0x40
-#defineSD_CRC_WRITE_ERR0x20
-#defineSD_CRC_WRITE_ERR_MASK   0x1C
-#defineGET_CRC_TIME_OUT0x02
-#defineSD_TUNING_COMPARE_ERR   0x01
+#define SD_CRC7_ERR0x80
+#define SD_CRC16_ERR   0x40
+#define SD_CRC_WRITE_ERR   0x20
+#define SD_CRC_WRITE_ERR_MASK  0x1C
+#define GET_CRC_TIME_OUT   0x02
+#define SD_TUNING_COMPARE_ERR  0x01
 
 /* SD_STAT2 */
-#defineSD_RSP_80CLK_TIMEOUT0x01
+#define SD_RSP_80CLK_TIMEOUT   0x01
 
 /* SD_BUS_STAT */
-#defineSD_CLK_TOGGLE_EN0x80
-#defineSD_CLK_FORCE_STOP   0x40
-#defineSD_DAT3_STATUS  0x10
-#defineSD_DAT2_STATUS  0x08
-#defineSD_DAT1_STATUS  0x04
-#defineSD_DAT0_STATUS  0x02
-#defineSD_CMD_STATUS   0x01
+#define SD_CLK_TOGGLE_EN   0x80
+#define SD_CLK_FORCE_STOP  0x40
+#define SD_DAT3_STATUS 0x10
+#define SD_DAT2_STATUS 0x08
+#define SD_DAT1_STATUS 0x04
+#define SD_DAT0_STATUS 0x02
+#define SD_CMD_STATUS  0x01
 
 /* SD_PAD_CTL */
-#defineSD_IO_USING_1V8 0x80
-#defineSD_IO_USING_3V3 0x7F
-#defineTYPE_A_DRIVING  0x00
-#defineTYPE_B_DRIVING  0x01
-#defineTYPE_C_DRIVING  0x02
-#defineTYPE_D_DRIVING  0x03
+#define SD_IO_USING_1V80x80
+#define SD_IO_USING_3V30x7F
+#define TYPE_A_DRIVING 0x00
+#define TYPE_B_DRIVING 0x01
+#define TYPE_C_DRIVING 0x02
+#define TYPE_D_DRIVING 0x03
 
 /* SD_SAMPLE_POINT_CTL */
-#defineDDR_FIX_RX_DAT  0x00
-#defineDDR_VAR_RX_DAT  0x80
-#defineDDR_FIX_RX_DAT_EDGE 0x00
-#defineDDR_FIX_RX_DAT_14_DELAY 0x40
-#defineDDR_FIX_RX_CMD  0x00
-#defineDDR_VAR_RX_CMD  0x20
-#defineDDR_FIX_RX_CMD_POS_EDGE 0x00
-#defineDDR_FIX_RX_CMD_14_DELAY 0x10
-#defineSD20_RX_POS_EDGE0x00
-#defineSD20_RX_14_DELAY0x08
+#define DDR_FIX_RX_DAT 0x00
+#define DDR_VAR_RX_DAT 0x80
+#define DDR_FIX_RX_DAT_EDGE0x00
+#define DDR_FIX_RX_DAT_14_DELAY0x40
+#define DDR_FIX_RX_CMD 0x00
+#define DDR_VAR_RX_CMD 0x20
+#define DDR_FIX_RX_CMD_POS_EDGE0x00
+#define DDR_FIX_RX_CMD_14_DELAY0x10
+#define SD20_RX_POS_EDGE   0x00
+#define SD20_RX_14_DELAY   0x08
 #define SD20_RX_SEL_MASK   0x08
 
 /* SD_PUSH_POINT_CTL */
-#defineDDR_FIX_TX_CMD_DAT  0x00
-#defineDDR_VAR_TX_CMD_DAT  0x80
-#defineDDR_FIX_TX_DAT_14_TSU   0x00
-#defineDDR_FIX_TX_DAT_12_TSU   0x40
-#defineDDR_FIX_TX_CMD_NEG_EDGE 0x00
-#defineDDR_FIX_TX_CMD_14_AHEAD 0x20
-#defineSD20_TX_NEG_EDGE0x00
-#defineSD20_TX_14_AHEAD0x10
+#define DDR_FIX_TX_CMD_DAT 0x00
+#define DDR_VAR_TX_CMD_DAT 0x80
+#define DDR_FIX_TX_DAT_14_TSU  0x00
+#define DDR_FIX_TX_DAT_12_TSU  0x40
+#define DDR_FIX_TX_CMD_NEG_EDGE0x00
+#define DDR_FIX_TX_CMD_14_AHEAD0x20
+#define SD20_TX_NEG_EDGE

Re: perf: behavior of poll() changed in 3.18

2015-01-21 Thread Vince Weaver
On Wed, 21 Jan 2015, Jiri Olsa wrote:
> 
> However if we revert this code, we'll loose nice (and standard) way
> to check if the event is still valid.. not sure how to handle this.

there's likely no need to revert as my code wasn't really released and 
I've already fixed it to work with the new interface.

I was mostly asking just so I could update the manpage to explain the new 
behavior, as tools that expect to be backwards compatible will have to 
handle both ways of detecting a process dieing.

> > Part of why my code doesn't just exit on POLLHUP is because you can
> > get that result for reasons other than a process exit (for example,
> > if you are using ioctl(PERF_EVENT_IOC_REFRESH)
> 
> Nope, this is related to POOL_HUP (notice the '_') which you'll get
> accompanied with SIGIO if you setup this.

So what happens if you are using a signal handler to monitor a child and 
the child exits?

It's a shame the poll and signal handler interfaces are subtly different, 
though I guess some of that is probably due to historical reasons.

Vince
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/2] input: cyapa: fix sparse warning issue of incorrect type in assiggment

2015-01-21 Thread Dudley Du
Fixes the sparse warning issue of the incorrect type in assignment which
found by the kbuild test robot.

Signed-off-by: Dudley Du 
---
 drivers/input/mouse/cyapa_gen5.c | 80 
 1 file changed, 41 insertions(+), 39 deletions(-)

diff --git a/drivers/input/mouse/cyapa_gen5.c b/drivers/input/mouse/cyapa_gen5.c
index ced2a2c..69d9059 100644
--- a/drivers/input/mouse/cyapa_gen5.c
+++ b/drivers/input/mouse/cyapa_gen5.c
@@ -319,7 +319,7 @@ struct gen5_bl_initiate_cmd_data {
 
 struct gen5_bl_metadata_row_params {
__le16 size;
-   __le16 maximun_size;
+   __le16 maximum_size;
__le32 app_start;
__le16 app_len;
__le16 app_crc;
@@ -1192,67 +1192,69 @@ static int cyapa_gen5_bl_enter(struct cyapa *cyapa)
 static int cyapa_gen5_check_fw(struct cyapa *cyapa, const struct firmware *fw)
 {
struct device *dev = >client->dev;
-   struct gen5_bl_metadata_row_params metadata;
-   struct cyapa_tsg_bin_image *image;
-   int flash_records_count;
-   u16 app_crc = 0;
-   u16 app_integrity_crc = 0;
-   u16 row_num;
-   u8 *data;
+   const struct cyapa_tsg_bin_image *image = (const void *)fw->data;
+   const struct cyapa_tsg_bin_image_data_record *app_integrity;
+   const struct gen5_bl_metadata_row_params *metadata;
+   size_t flash_records_count;
+   u32 fw_app_start, fw_upgrade_start;
+   u16 fw_app_len, fw_upgrade_len;
+   u16 app_crc;
+   u16 app_integrity_crc;
int record_index;
int i;
 
-   image = (struct cyapa_tsg_bin_image *)fw->data;
flash_records_count = (fw->size -
sizeof(struct cyapa_tsg_bin_image_head)) /
sizeof(struct cyapa_tsg_bin_image_data_record);
 
-   /* APP_INTEGRITY row is always the last row block,
-* and the row id must be 0x01ff */
-   row_num = get_unaligned_be16(
-   >records[flash_records_count - 1].row_number);
-   if (image->records[flash_records_count - 1].flash_array_id != 0x00 &&
-   row_num != 0x01ff) {
+   /*
+* APP_INTEGRITY row is always the last row block,
+* and the row id must be 0x01ff.
+*/
+   app_integrity = >records[flash_records_count - 1];
+
+   if (app_integrity->flash_array_id != 0x00 ||
+   get_unaligned_be16(_integrity->row_number) != 0x01ff) {
dev_err(dev, "%s: invalid app_integrity data.\n", __func__);
return -EINVAL;
}
-   data = image->records[flash_records_count - 1].record_data;
-
-   metadata.app_start = get_unaligned_le32([4]);
-   metadata.app_len = get_unaligned_le16([8]);
-   metadata.app_crc = get_unaligned_le16([10]);
-   metadata.upgrade_start = get_unaligned_le32([16]);
-   metadata.upgrade_len  = get_unaligned_le16([20]);
-   metadata.metadata_crc = get_unaligned_le16([60]);
-
-   if ((metadata.app_start + metadata.app_len +
-   metadata.upgrade_start + metadata.upgrade_len) %
-   CYAPA_TSG_FW_ROW_SIZE) {
-   dev_err(dev, "%s: invalid image alignment.\n", __func__);
-   return -EINVAL;
-   }
+
+   metadata = (const void *)app_integrity->record_data;
 
/* Verify app_integrity crc */
-   app_integrity_crc = crc_itu_t(0x, data,
-   CYAPA_TSG_APP_INTEGRITY_SIZE);
-   if (app_integrity_crc != metadata.metadata_crc) {
+   app_integrity_crc = crc_itu_t(0x, app_integrity->record_data,
+ CYAPA_TSG_APP_INTEGRITY_SIZE);
+   if (app_integrity_crc != get_unaligned_le16(>metadata_crc)) {
dev_err(dev, "%s: invalid app_integrity crc.\n", __func__);
return -EINVAL;
}
 
+   fw_app_start = get_unaligned_le32(>app_start);
+   fw_app_len = get_unaligned_le16(>app_len);
+   fw_upgrade_start = get_unaligned_le32(>upgrade_start);
+   fw_upgrade_len = get_unaligned_le16(>upgrade_len);
+
+   if (fw_app_start % CYAPA_TSG_FW_ROW_SIZE ||
+   fw_app_len % CYAPA_TSG_FW_ROW_SIZE ||
+   fw_upgrade_start % CYAPA_TSG_FW_ROW_SIZE ||
+   fw_upgrade_len % CYAPA_TSG_FW_ROW_SIZE) {
+   dev_err(dev, "%s: invalid image alignment.\n", __func__);
+   return -EINVAL;
+   }
+
/*
 * Verify application image CRC
 */
-   record_index = metadata.app_start / CYAPA_TSG_FW_ROW_SIZE -
+   record_index = fw_app_start / CYAPA_TSG_FW_ROW_SIZE -
CYAPA_TSG_IMG_START_ROW_NUM;
-   data = (u8 *)>records[record_index].record_data;
-   app_crc = crc_itu_t(0x, data, CYAPA_TSG_FW_ROW_SIZE);
-   for (i = 1; i < (metadata.app_len / CYAPA_TSG_FW_ROW_SIZE); i++) {
-   data = (u8 *)>records[++record_index].record_data;
+   app_crc = 0xU;
+   for (i = 0; i < fw_app_len / 

[PATCH 2/2] input: cyapa: fix variable dereferenced before check 'gen5_pip->resp_len' issue

2015-01-21 Thread Dudley Du
Fixes the warning issue of the variable dereferenced before check
'gen5_pip->resp_len' report by dan Carpenter.

Signed-off-by: Dudley Du 
---
 drivers/input/mouse/cyapa_gen5.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/input/mouse/cyapa_gen5.c b/drivers/input/mouse/cyapa_gen5.c
index 69d9059..ed1af74 100644
--- a/drivers/input/mouse/cyapa_gen5.c
+++ b/drivers/input/mouse/cyapa_gen5.c
@@ -2558,7 +2558,9 @@ static bool cyapa_gen5_irq_cmd_handler(struct cyapa 
*cyapa)
 * trackpad device when booting/rebooting
 * their chrome book.
 */
-   length = *gen5_pip->resp_len;
+   length = 0;
+   if (gen5_pip->resp_len)
+   length = *gen5_pip->resp_len;
cyapa_empty_pip_output_data(cyapa,
gen5_pip->resp_data,
,
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


RE: About 2 ACPICA table patches

2015-01-21 Thread Zheng, Lv
Hi, Octavian

> From: Octavian Purdila [mailto:octavian.purd...@intel.com]
> Sent: Saturday, January 17, 2015 2:03 PM
> 
> On Fri, Jan 16, 2015 at 11:44 AM, Zheng, Lv  wrote:
> > Hi, Octavian
> >
> 
> Hi Lv,
> 
> > I noticed there are 2 patches you've sent to the community.
> > But unfortunately I didn't find them in my mailbox.
> > Let me comment you here.
> >
> > https://patchwork.kernel.org/patch/5501621/
> > This patch seem to be correct.
> > But Rafael should merge it directly via Linux because 
> > acpi_unload_table_id() is not in the ACPICA upstream.
> 
> OK, thanks for letting me know. Rafel, does the patch look ok to you?
> 
> > We expect the OSPMs to use acpi_unload_parent_table() instead.
> > I have a divergences reduction series to achieve the transition.
> > But they are pending for review for almost half a year.
> > If you have an environment to test.
> > Could you help to test this again?
> > I can prepare the patchset for you.
> >
> 
> Sure, if you can point me to the patch-set I can test it on my setup.

I didn't have environment to test, so let me send it as RFC with some 
pci-hotplug/ia64 guys Cced...

Thanks
-Lv


> 
> > https://patchwork.kernel.org/patch/5501561/
> > This patch is correct, I've put it in the 201501 ACPICA release materials 
> > for review:
> > https://patchwork.kernel.org/patch/5501621/
> > The patch can be found at:
> > https://github.com/zetalog/acpica/commit/281ff873
> > So if it is merged, you'll see it in the upstream after 201501 ACPICA 
> > release cycle.
> > And hence Linux trees doesn't need to merge this patch directly.
> >
> 
> Thanks,
> Tavi
N�r��yb�X��ǧv�^�)޺{.n�+{zX����ܨ}���Ơz�:+v���zZ+��+zf���h���~i���z��w���?�&�)ߢf��^jǫy�m��@A�a���
0��h���i

[PATCH] staging: rtl8712: remove unused function

2015-01-21 Thread Sudip Mukherjee
mp_query_drv_var() was only being used by
oid_rt_pro_query_dr_variable_hdl() but after commit
 mp_query_drv_var() became
unused. so it is safe to remove it.

Signed-off-by: Sudip Mukherjee 
---
 drivers/staging/rtl8712/rtl871x_mp_ioctl.c | 7 ---
 1 file changed, 7 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl871x_mp_ioctl.c 
b/drivers/staging/rtl8712/rtl871x_mp_ioctl.c
index 49fa1d1..0b54612 100644
--- a/drivers/staging/rtl8712/rtl871x_mp_ioctl.c
+++ b/drivers/staging/rtl8712/rtl871x_mp_ioctl.c
@@ -704,13 +704,6 @@ uint oid_rt_get_thermal_meter_hdl(struct oid_par_priv 
*poid_par_priv)
return RNDIS_STATUS_SUCCESS;
 }
 
-/*--*/
-static u32 mp_query_drv_var(struct _adapter *padapter, u8 offset, u32 var)
-{
-   return var;
-}
-
-/**/
 uint oid_rt_pro_read_efuse_hdl(struct oid_par_priv *poid_par_priv)
 {
struct _adapter *Adapter = (struct _adapter *)
-- 
1.8.1.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/5] mtd: nand: Add qcom nand controller driver

2015-01-21 Thread Archit Taneja

Hi,

On 01/21/2015 06:24 AM, Daniel Ehrenberg wrote:

On Fri, Jan 16, 2015 at 6:48 AM, Archit Taneja  wrote:

+/*
+ * the bad block marker is readable only when we read the page with ECC
+ * disabled. all the read/write commands like NAND_CMD_READOOB, NAND_CMD_READ0
+ * and NAND_CMD_PAGEPROG are executed in the driver with ECC enabled. 
therefore,
+ * the default nand helper functions to detect a bad block or mark a bad block
+ * can't be used.
+ */
+static int qcom_nandc_block_bad(struct mtd_info *mtd, loff_t ofs, int getchip)
+{
+   int page, r, mark, bad = 0;
+   struct nand_chip *chip = mtd->priv;
+   struct nand_ecc_ctrl *ecc = >ecc;
+   int cwperpage = ecc->steps;
+   struct qcom_nandc_data *this = chip->priv;
+   u32 flash_status;
+
+   pre_command(this, NAND_CMD_NONE);
+
+   page = (int)(ofs >> chip->page_shift) & chip->pagemask;
+
+   /*
+* configure registers for a raw page read, the address is set to the
+* beginning of the last codeword
+*/
+   this->use_ecc = false;
+   set_address(this, this->cw_size * (cwperpage - 1), page);
+
+   /* we just read one codeword that contains the bad block marker */
+   update_rw_regs(this, 1, true);
+
+   read_cw(this, this->cw_size, 0);
+
+   r = submit_descs(this);
+   if (r) {
+   dev_err(this->dev, "error submitting descs\n");
+   goto err;
+   }
+
+   flash_status = this->reg_read_buf[0];
+
+   /*
+* unable to read the marker successfully, is that sufficient to report
+* the block as bad?
+*/
+   if (flash_status & (FS_OP_ERR | FS_MPU_ERR)) {
+   dev_warn(this->dev, "error while reading bad block mark\n");
+   goto err;
+   }
+
+   mark = mtd->writesize - (this->cw_size * (cwperpage - 1));
+
+   if (chip->options & NAND_BUSWIDTH_16)
+   bad = this->data_buffer[mark] != 0xff ||
+   this->data_buffer[mark + 1] != 0xff;
+
+   bad = this->data_buffer[mark] != 0xff;
+err:
+   free_descs(this);
+
+   return bad;
+}
+
+static int qcom_nandc_block_markbad(struct mtd_info *mtd, loff_t ofs)
+{
+   int page, r;
+   struct nand_chip *chip = mtd->priv;
+   struct nand_ecc_ctrl *ecc = >ecc;
+   int cwperpage = ecc->steps;
+   struct qcom_nandc_data *this = chip->priv;
+   u32 flash_status;
+
+   pre_command(this, NAND_CMD_NONE);
+
+   /* fill our internal buffer's oob area with 0's */
+   memset(this->data_buffer, 0x00, mtd->writesize + mtd->oobsize);
+
+   page = (int)(ofs >> chip->page_shift) & chip->pagemask;
+
+   this->use_ecc = false;
+   set_address(this, this->cw_size * (cwperpage - 1), page);
+
+   /* we just write to one codeword that contains the bad block marker*/
+   update_rw_regs(this, 1, false);
+
+   /*
+* overwrite the last codeword with 0s, this will result in setting
+* the bad block marker to 0 too
+*/
+   write_cw(this, this->cw_size, 0);
+
+   r = submit_descs(this);
+   if (r) {
+   dev_err(this->dev, "error submitting descs\n");
+   r = -EIO;
+   goto err;
+   }
+
+   flash_status = this->reg_read_buf[0];
+
+   if (flash_status & (FS_OP_ERR | FS_MPU_ERR))
+   r = -EIO;
+
+err:
+   free_descs(this);
+
+   return r;
+}


Looks like this code marks block bad and reads bad block information
based on information in the OOB area. And in qcom_nandc_init,
NAND_SKIP_BBTSCAN is set, meaning that this is the code used in
practice on the chip in the mtd_block_isbad path. Can this driver be
used with an on-flash OOB table by editing the init function's chip
flags, or would it need more significant changes to allow that?


The code doesn't exactly read the OOB area. When the ECC HW block is 
enabled, the bad block isn't in either oob or data area! We can access 
it only when ECC is disabled. With ECC disabled, the bad block marker 
lies in the last codeword somewhere in the middle of the user data. For 
the mtd_read_oob()/write_oob() functions, we have the ECC always 
enabled, hence, we never access the bad block marker through them at all.


Creating an on-flash bad block table won't work right now. The reason is 
that the nand_bbt library assumes that it can find the bad block marker 
by reading oob. While creating a bbt in memory, it scans the device for 
bad blocks using the function scan_block_fast(). This would currently 
result in not reading the bad block marker, and therefore break things.


I'm trying to find out if there is a way by which the controller can 
access the bad block marker with ECC HW enabled. If that works, we can 
use the nand_bbt helper as is. For now, I wanted to get the driver 
upstream without the BBT functionality.


Archit
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to 

[PATCH] mm, vmacache: Add kconfig VMACACHE_SHIFT

2015-01-21 Thread WANG Chao
Add a new kconfig option VMACACHE_SHIFT (as a power of 2) to specify the
number of slots vma cache has for each thread. Range is chosen 0-4 (1-16
slots) to consider both overhead and performance penalty. Default is 2
(4 slots) as it originally is, which provides good enough balance.

Signed-off-by: WANG Chao 
---
 include/linux/sched.h | 2 +-
 mm/Kconfig| 7 +++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/include/linux/sched.h b/include/linux/sched.h
index 8db31ef..56fd96d 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -134,7 +134,7 @@ struct perf_event_context;
 struct blk_plug;
 struct filename;
 
-#define VMACACHE_BITS 2
+#define VMACACHE_BITS CONFIG_VMACACHE_SHIFT
 #define VMACACHE_SIZE (1U << VMACACHE_BITS)
 #define VMACACHE_MASK (VMACACHE_SIZE - 1)
 
diff --git a/mm/Kconfig b/mm/Kconfig
index 1d1ae6b..7b82a52 100644
--- a/mm/Kconfig
+++ b/mm/Kconfig
@@ -618,3 +618,10 @@ config MAX_STACK_SIZE_MB
  changed to a smaller value in which case that is used.
 
  A sane initial value is 80 MB.
+
+config VMACACHE_SHIFT
+   int "Number of slots in per-thread VMA cache (as a power of 2)"
+   range 0 4
+   default 2
+   help
+ This is the number of slots VMA cache has for each thread.
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [alsa-devel][PATCH 2/3] ASoC: fsl_sai: Add support for tdm slots operation

2015-01-21 Thread Zidan Wang
On Wed, Jan 21, 2015 at 09:44:10PM -0800, Nicolin Chen wrote:
> On Thu, Jan 22, 2015 at 12:55:35PM +0800, Zidan Wang wrote:
> > On Wed, Jan 21, 2015 at 10:08:03AM -0800, Nicolin Chen wrote:
> > > On Tue, Jan 20, 2015 at 08:21:19PM +0800, Zidan Wang wrote:
> > > > @@ -369,10 +380,25 @@ static int fsl_sai_hw_params(struct 
> > > > snd_pcm_substream *substream,
> > > > u32 word_width = snd_pcm_format_width(params_format(params));
> > > > u32 val_cr4 = 0, val_cr5 = 0;
> > > > int ret;
> > > > +   u32 bclk;
> > > > +
> > > > +   if (channels == 1)
> > > > +   channels = 2;
> > > > +
> > > > +   if (!sai->slots || sai->slots % channels)
> > > > +   sai->slots = channels;
> > > > +
> > > > +   sai->slots = sai->slots / channels;
> > > > +
> > > > +   if (sai->slot_width < word_width || sai->is_dsp_mode)
> > > > +   sai->slot_width = word_width;
> > > 
> > > Could you pls explain a bit what's this overriding for?
> > > Or it might be better to put into a comment.
> > >
> > In machine driver, we should use snd_soc_dai_set_tdm_slot to set slots
> > and slot width. In my opinion, slots in machine driver means the slot
> > number of all channels. But in sai driver, the slots means the slot number
> > of one channel. So snd_soc_calc_bclk use fs*sample_size*channels*tdm_slots
> > to caculate bclk.
> 
> Could you pls use the standard way as you described for slot number
> in machine driver instead of defining some other meanings? That one
> is really confusing, not to mention a code without any comment.
> 
> You can add some extra local variables with extinguished names and
> calculate the slot number and channels you want without changing
> the original sai->slots and channels in the hw_params(). As you said,
> you only need that new slot number and channels for snd_soc_calc_bclk
> call. So you may also put this code right before the call -- a normal
> routine doesn't need to recalculate the special slots and channels,
> right?
> 
> Nicolin

Actually i don't kown which meaning is the standard way. Because i found
in wm8993 and wm8904 codec driver, they also use slots/channels to set 
tdm_slots in set_tdm_slot function.


Best Regards,
Zidan
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH V3] tick/broadcast: Make movement of broadcast hrtimer robust against hotplug

2015-01-21 Thread Preeti U Murthy
On 01/21/2015 05:16 PM, Thomas Gleixner wrote:
> On Tue, 20 Jan 2015, Preeti U Murthy wrote:
>> diff --git a/kernel/time/clockevents.c b/kernel/time/clockevents.c
>> index 5544990..f3907c9 100644
>> --- a/kernel/time/clockevents.c
>> +++ b/kernel/time/clockevents.c
>> @@ -568,6 +568,7 @@ int clockevents_notify(unsigned long reason, void *arg)
>>  
>>  case CLOCK_EVT_NOTIFY_CPU_DYING:
>>  tick_handover_do_timer(arg);
>> +tick_shutdown_broadcast_oneshot(arg);
>>  break;
>>  
>>  case CLOCK_EVT_NOTIFY_SUSPEND:
>> @@ -580,7 +581,6 @@ int clockevents_notify(unsigned long reason, void *arg)
>>  break;
>>  
>>  case CLOCK_EVT_NOTIFY_CPU_DEAD:
>> -tick_shutdown_broadcast_oneshot(arg);
>>  tick_shutdown_broadcast(arg);
>>  tick_shutdown(arg);
>>  /*
>> diff --git a/kernel/time/tick-broadcast.c b/kernel/time/tick-broadcast.c
>> index 066f0ec..f983983 100644
>> --- a/kernel/time/tick-broadcast.c
>> +++ b/kernel/time/tick-broadcast.c
>> @@ -675,8 +675,11 @@ static void broadcast_move_bc(int deadcpu)
>>  
>>  if (!bc || !broadcast_needs_cpu(bc, deadcpu))
>>  return;
>> -/* This moves the broadcast assignment to this cpu */
>> -clockevents_program_event(bc, bc->next_event, 1);
>> +/* Since a cpu with the earliest wakeup is nominated as the 
>> + * standby cpu, the next cpu to invoke BROADCAST_ENTER
>> + * will now automatically take up the duty of broadcasting.
>> + */
>> +bc->next_event.tv64 = KTIME_MAX;
> 
> So that relies on the fact, that cpu_down() currently forces ALL cpus
> into stop_machine(). Of course this is not in any way obvious and any
> change to this will cause even more hard to debug issues.

Hmm.. true this is a concern.
> 
> And to be honest, the clever 'set next_event to KTIME_MAX' is even
> more nonobvious because it's only relevant for your hrtimer based
> broadcasting magic. Any real broadcast device does not care about this
> at all.

bc->next_event is set to max only if CLOCK_EVT_FEATURE_HRTIMER is true.
It does not affect the usual broadcast logic.

> 
> This whole random notifier driven hotplug business is just a
> trainwreck. I'm still trying to convert this to a well documented
> state machine, so I rather prefer to make this an explicit take over
> rather than a completely undocumented 'works today' mechanism.
> 
> What about the patch below?
> 
> Thanks,
> 
>   tglx
> 
> diff --git a/kernel/cpu.c b/kernel/cpu.c
> index 5d220234b3ca..7a9b1ae4a945 100644
> --- a/kernel/cpu.c
> +++ b/kernel/cpu.c
> @@ -16,6 +16,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -421,6 +422,12 @@ static int __ref _cpu_down(unsigned int cpu, int 
> tasks_frozen)
>   while (!idle_cpu(cpu))
>   cpu_relax();
> 
> + /*
> +  * Before waiting for the cpu to enter DEAD state, take over
> +  * any tick related duties
> +  */
> + clockevents_notify(CLOCK_EVT_NOTIFY_CPU_DEAD, );
> +
>   /* This actually kills the CPU. */
>   __cpu_die(cpu);
> 
> diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c
> index 37e50aadd471..3c1bfd0f7074 100644
> --- a/kernel/time/hrtimer.c
> +++ b/kernel/time/hrtimer.c
> @@ -1721,11 +1721,8 @@ static int hrtimer_cpu_notify(struct notifier_block 
> *self,
>   break;
>   case CPU_DEAD:
>   case CPU_DEAD_FROZEN:
> - {
> - clockevents_notify(CLOCK_EVT_NOTIFY_CPU_DEAD, );
>   migrate_hrtimers(scpu);
>   break;
> - }
>  #endif
> 
>   default:
> 


How about when the cpu that is going offline receives a timer interrupt
just before setting its state to CPU_DEAD ? That is still possible right
given that its clock devices may not have been shutdown and it is
capable of receiving interrupts for a short duration. Even with the
above patch, is the following scenario possible ?

CPU0  CPU1
t0 Receives timer interrupt

t1 Sees that there are hrtimers
   to be serviced (hrtimers are not yet migrated)

t2 calls hrtimer_interrupt()

t3 tick_program_event()   CPU_DEAD notifiers
CPU0's td->evtdev = NULL

t4 clockevent_program_event()
   references NULL tick device pointer

So my concern is that since the CLOCK_EVT_NOTIFY_CPU_DEAD callback
handles shutting down of devices besides moving tick related duties.
it's functions may race with the hotplug cpu still handling tick events.

We do check on powerpc if the timer interrupt has arrived on an offline
cpu, but that is to avoid an entirely different scenario and not one
like the above. I would not expect the arch to check if a timer
interrupt arrived on an offline cpu. A timer interrupt may be serviced
as long as the tick device is alive.

Regards
Preeti U Murthy

--
To 

[PATCH 1/1] 8250_core.c

2015-01-21 Thread Dick Hollenbeck
This was generated from 3.14 kernel, but since its so small it will likely 
apply to newer
kernels without issue.

A lesser travelled code path specifically crafted for "tx interrupt buggy"
UARTs seems to be testing the wrong bit for whether or not to prime the
transmit pump.  The result is that the tx interrupt never occurs on one chip
I am using that falls into the UART_BUG_TXEN category as I understand it.

The 16550 data sheet even names the interrupt "THRE" and not transmit
shift register empty.  The interrupt is fired when the holding register, or its
logical equivalent, the fifo, goes empty;  not when the shift register goes
empty.  This is a code bug in code hoping to fix a bug in hardware.

The reason this is so late coming to the surface is that lately the 8250
interrupt handler polls for all kinds of special status beyond the intention
of the hardware's purpose specific interrupt. Therefore so long as you
were in the interrupt handler (even if for purposes of servicing a recv
interrupt, you could recover from the broken transmit chain.  But if you are
only transmitting, not receiving, then this bug can manifest itself.

This is the fix.  It is harmless because so long as the fifo is empty, it
should be legal to re-fill it fully anyways.

Signed-off-by: Dick Hollenbeck 

=== modified file 'drivers/tty/serial/8250/8250_core.c'
--- old/drivers/tty/serial/8250/8250_core.c	2014-07-14 18:39:13 +
+++ new/drivers/tty/serial/8250/8250_core.c	2015-01-22 05:28:33 +
@@ -1302,11 +1302,15 @@ static void serial8250_start_tx(struct u
		up->ier |= UART_IER_THRI;
		serial_port_out(port, UART_IER, up->ier);

+		/*
+		 * If setting UART_IER_THRI does not cause an
+		 * immediate tx interrupt
+		 */
		if (up->bugs & UART_BUG_TXEN) {
			unsigned char lsr;
			lsr = serial_in(up, UART_LSR);
			up->lsr_saved_flags |= lsr & LSR_SAVE_FLAGS;
-			if (lsr & UART_LSR_TEMT)
+			if (lsr & UART_LSR_THRE)
serial8250_tx_chars(up);
		}
	}



Linux 3.18.2 / xen 4.4.1 dom0 - microcode oops

2015-01-21 Thread James Dingwall
Hi,

Since 3.18.2 I am getting the oops below during boot whilst running as a dom0 
under xen 4.4.1 / 4.5.0.  Is this a known issue or worth bisecting to identify 
the exact commit which causes this?

Thanks,
James

[  173.735541] BUG: unable to handle kernel NULL pointer dereference at 
0008
[  173.735789] IP: [] misc_deregister+0x50/0xa5
[  173.735958] PGD 71480067 PUD 71bc6067 PMD 0 
[  173.736077] Oops: 0002 [#1] SMP 
[  173.736152] Modules linked in: it87 hwmon_vid autofs4 nfsd xen_pciback 
xen_gntalloc bridge stp llc ipv6 rbd ceph libceph openvswitch geneve vxlan 
ip6_udp_tunnel udp_tunnel tun tmem 
xen_acpi_processor xen_gntdev xen_blkback xen_netback i915 fbcon bitblit 
softcursor font tileblit video drm_kms_helper snd_hda_codec_realtek 
snd_hda_codec_generic coretemp microcode(-) drm lpc_ich 
i2c_i801 mfd_core snd_hda_intel firewire_ohci r8169 mii ata_generic evdev 
e1000e snd_hda_controller rtc_cmos i2c_algo_bit snd_hda_codec i2c_core 
cfbfillrect cfbimgblt cfbcopyarea backlight fb 
snd_pcm processor fbdev snd_hwdep snd_timer button intel_agp intel_gtt snd 
parport_pc parport thermal_sys dm_zero dm_thin_pool dm_persistent_data 
dm_bio_prison xts lrw gf128mul glue_helper 
ablk_helper cryptd aes_x86_64 iscsi_tcp libiscsi_tcp
[  173.738197]  libiscsi scsi_transport_iscsi tg3 ptp pps_core libphy hwmon 
e1000 fuse btrfs ext4 jbd2 linear raid0 dm_raid raid1 raid10 dm_snapshot 
dm_bufio dm_crypt dm_mirror dm_region_hash 
dm_log firewire_core hid_sunplus hid_samsung hid_pl hid_petalynx hid_gyration 
usbhid ohci_hcd uhci_hcd usb_storage ehci_pci ehci_hcd megaraid_sas 3w_ 
qla1280 aic7xxx scsi_transport_spi sr_mod 
cdrom sg ahci libahci sata_nv sata_sil pata_amd libata
[  173.738197] CPU: 1 PID: 5381 Comm: rmmod Tainted: GW  3.18.2 #118
[  173.738197] Hardware name: Gigabyte Technology Co., Ltd. G33M-S2/G33M-S2, 
BIOS F7K 07/31/2009
[  173.738197] task: 880073dca940 ti: 880071434000 task.ti: 
880071434000
[  173.738197] RIP: e030:[]  [] 
misc_deregister+0x50/0xa5
[  173.738197] RSP: e02b:880071437eb8  EFLAGS: 00010247
[  173.738197] RAX:  RBX: a0511e20 RCX: 0028739a828b
[  173.738197] RDX:  RSI: 880073dc0604 RDI: 880078866840
[  173.738197] RBP: 880071437ec8 R08: bfff1433 R09: 88007f68a0b0
[  173.738197] R10: 7ff0 R11:  R12: ff87
[  173.738197] R13: 0800 R14: 019c11c0 R15: 019c1010
[  173.738197] FS:  7f7ac2926700() GS:88007f68() 
knlGS:
[  173.738197] CS:  e033 DS:  ES:  CR0: 8005003b
[  173.738197] CR2: 0008 CR3: 72886000 CR4: 2660
[  173.738197] Stack:
[  173.738197]  88007f6113c0  880071437ee8 
a0511253
[  173.738197]   a0511f30 880071437f78 
81093fdf
[  173.738197]  c22d6d00 a0511f30 88000800 
880071437efc
[  173.738197] Call Trace:
[  173.738197]  [] microcode_exit+0x20/0xb1 [microcode]
[  173.738197]  [] SyS_delete_module+0x118/0x1a6
[  173.738197]  [] ? do_notify_resume+0x6a/0x78
[  173.738197]  [] system_call_fastpath+0x12/0x17
[  173.738197] Code: f1 07 64 81 e8 3a 70 cf ff b8 ea ff ff ff eb 6b 48 c7 c7 
20 fa 71 81 e8 1a a4 17 00 48 8b 43 20 48 8b 53 18 48 8b 3d e6 73 57 00 <48> 89 
42 08 48 89 10 48 b8 00 01 10 00 00 00 
ad de 8b 33 48 89 
[  173.738197] RIP  [] misc_deregister+0x50/0xa5
[  173.738197]  RSP 
[  173.738197] CR2: 0008
[  173.784081] ---[ end trace 0ab648576ba0af94 ]---


Previously in 3.18.1:
[  176.855832] microcode: CPU0 sig=0x10676, pf=0x1, revision=0x60c
[  176.855844] microcode: CPU0 update to revision 0x60f failed
[  176.856107] microcode: CPU1 sig=0x10676, pf=0x1, revision=0x60c
[  176.856115] microcode: CPU1 update to revision 0x60f failed
[  176.861597] microcode: Microcode Update Driver: v2.00 removed.


Same 3.18.2 kernel on bare metal (different system but identical hardware):
[   46.002857] microcode: Microcode Update Driver: v2.00 removed.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v9 00/17] Kernel address sanitizer - runtime memory debugger.

2015-01-21 Thread Andrey Ryabinin
2015-01-22 8:34 GMT+03:00 Andrey Ryabinin :
> 2015-01-22 3:22 GMT+03:00 Sasha Levin :
>> On 01/21/2015 11:51 AM, Andrey Ryabinin wrote:
>>> Changes since v8:
>>>   - Fixed unpoisoned redzones for not-allocated-yet object
>>>   in newly allocated slab page. (from Dmitry C.)
>>>
>>>   - Some minor non-function cleanups in kasan internals.
>>>
>>>   - Added ack from Catalin
>>>
>>>   - Added stack instrumentation. With this we could detect
>>>   out of bounds accesses in stack variables. (patch 12)
>>>
>>>   - Added globals instrumentation - catching out of bounds in
>>>   global varibles. (patches 13-17)
>>>
>>>   - Shadow moved out from vmalloc into hole between vmemmap
>>>   and %esp fixup stacks. For globals instrumentation
>>>   we will need shadow backing modules addresses.
>>>   So we need some sort of a shadow memory allocator
>>>   (something like vmmemap_populate() function, except
>>>   that it should be available after boot).
>>>
>>>   __vmalloc_node_range() suits that purpose, except that
>>>   it can't be used for allocating for shadow in vmalloc
>>>   area because shadow in vmalloc is already 'allocated'
>>>   to protect us from other vmalloc users. So we need
>>>   16TB of unused addresses. And we have big enough hole
>>>   between vmemmap and %esp fixup stacks. So I moved shadow
>>>   there.
>>
>> I'm not sure which new addition caused it, but I'm getting tons of
>> false positives from platform drivers trying to access memory they
>> don't "own" - because they expect to find hardware there.
>>
>
> To be sure, that this is really false positives, could you try with
> patches in attachment?

Attaching properly formed patches
From 8aca28dc4df2ed597f4fe0d49468021db5f29c61 Mon Sep 17 00:00:00 2001
From: Andrey Ryabinin 
Date: Thu, 22 Jan 2015 12:44:42 +0300
Subject: [PATCH 1/3] backlight: da9052_bl: terminate da9052_wled_ids array
 with empty element

Array of platform_device_id elements should be terminated
with empty element.

Signed-off-by: Andrey Ryabinin 
---
 drivers/video/backlight/da9052_bl.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/video/backlight/da9052_bl.c b/drivers/video/backlight/da9052_bl.c
index d4bd74bd..b1943e7 100644
--- a/drivers/video/backlight/da9052_bl.c
+++ b/drivers/video/backlight/da9052_bl.c
@@ -165,6 +165,7 @@ static struct platform_device_id da9052_wled_ids[] = {
 		.name		= "da9052-wled3",
 		.driver_data	= DA9052_TYPE_WLED3,
 	},
+	{ },
 };
 
 static struct platform_driver da9052_wled_driver = {
-- 
2.0.4

From 27f8cf0aff7d16c061dda9dd219887cae2214586 Mon Sep 17 00:00:00 2001
From: Andrey Ryabinin 
Date: Thu, 22 Jan 2015 12:46:44 +0300
Subject: [PATCH 2/3] crypto: ccp: terminate ccp_support array with empty
 element

x86_match_cpu() expects array of x86_cpu_ids terminated
with empty element.

Signed-off-by: Andrey Ryabinin 
---
 drivers/crypto/ccp/ccp-dev.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/crypto/ccp/ccp-dev.c b/drivers/crypto/ccp/ccp-dev.c
index c6e6171..ca29c12 100644
--- a/drivers/crypto/ccp/ccp-dev.c
+++ b/drivers/crypto/ccp/ccp-dev.c
@@ -583,6 +583,7 @@ bool ccp_queues_suspended(struct ccp_device *ccp)
 #ifdef CONFIG_X86
 static const struct x86_cpu_id ccp_support[] = {
 	{ X86_VENDOR_AMD, 22, },
+	{ },
 };
 #endif
 
-- 
2.0.4

From 3a3bd9cfd223f14d31352b9a44209476b3f5ef11 Mon Sep 17 00:00:00 2001
From: Andrey Ryabinin 
Date: Thu, 22 Jan 2015 12:48:15 +0300
Subject: [PATCH 3/3] rtc: s5m: terminate s5m_rtc_id array with empty element

Array of platform_device_id elements should be terminated
with empty element.

Signed-off-by: Andrey Ryabinin 
---
 drivers/rtc/rtc-s5m.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/rtc/rtc-s5m.c b/drivers/rtc/rtc-s5m.c
index b5e7c46..89ac1d5 100644
--- a/drivers/rtc/rtc-s5m.c
+++ b/drivers/rtc/rtc-s5m.c
@@ -832,6 +832,7 @@ static SIMPLE_DEV_PM_OPS(s5m_rtc_pm_ops, s5m_rtc_suspend, s5m_rtc_resume);
 static const struct platform_device_id s5m_rtc_id[] = {
 	{ "s5m-rtc",		S5M8767X },
 	{ "s2mps14-rtc",	S2MPS14X },
+	{ },
 };
 
 static struct platform_driver s5m_rtc_driver = {
-- 
2.0.4



Re: mmotm: mm-slub-optimize-alloc-free-fastpath-by-removing-preemption-on-off.patch is causing preemptible splats

2015-01-21 Thread Andrew Morton
On Thu, 22 Jan 2015 16:14:02 +1100 Stephen Rothwell  
wrote:

> Hi Andrew,
> 
> On Wed, 21 Jan 2015 19:34:11 -0800 Andrew Morton  
> wrote:
> >
> > On Thu, 22 Jan 2015 10:51:23 +0900 Joonsoo Kim  
> > wrote:
> > 
> > > > The most recent -mmotm was a bit of a trainwreck.  I'm scrambling to
> > > > get the holes plugged so I can get another mmotm out today.
> > > 
> > > Another mmotm will fix many issues from me. :/
> > 
> > I hit a wont-boot-cant-find-init in linux-next so I get to spend
> > tomorrow bisecting that :(
> 
> There has been a long discussion about something like that already.
> Subject "Re: linux-next: Tree for Jan 20 -- Kernel panic - Unable to
> mount root fs"

ah, thanks.  You might have saved me a ton of effort there.

And oolookitat, a fix.  I love it when viro says "Oh, fuck".

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [alsa-devel][PATCH 3/3] ASoC: fsl_sai: Add support for Right-J mode

2015-01-21 Thread Nicolin Chen
On Thu, Jan 22, 2015 at 01:13:46PM +0800, Zidan Wang wrote:
> On Wed, Jan 21, 2015 at 10:53:20AM -0800, Nicolin Chen wrote:
> > On Tue, Jan 20, 2015 at 08:21:20PM +0800, Zidan Wang wrote:
> > > Add Right-J mode and set TCR5 FBT bit to let data right justify.
> > > 
> > > Signed-off-by: Zidan Wang 
> > 
> > > - if (sai->is_lsb_first)
> > > + if (sai->is_lsb_first && sai->is_right_j_mode)
> > >   val_cr5 |= FSL_SAI_CR5_FBT(0);
> > 
> > Are you sure that FBT(0) is correct for right justified mode?
> > Because the original code is using FBT(0) for the lsb_first
> > situation and it shouldn't be right justified mode as default.
> >
> I am not sure about that. 
> 
> I assume lsb_first as big endian data.

Correct.

> For 16 bit data format, the 2 bytes data will in high address of 4 bytes
> fifo. So the FBT is 16 for left-j and 0 for right-j. But big endian is
> bytes convert not bits convert. It makes me confuse. And send to
> community for help.

Either waiting for Xiubo to test it or asking IC owner for help.

Nicolin
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [alsa-devel][PATCH 2/3] ASoC: fsl_sai: Add support for tdm slots operation

2015-01-21 Thread Nicolin Chen
On Thu, Jan 22, 2015 at 12:55:35PM +0800, Zidan Wang wrote:
> On Wed, Jan 21, 2015 at 10:08:03AM -0800, Nicolin Chen wrote:
> > On Tue, Jan 20, 2015 at 08:21:19PM +0800, Zidan Wang wrote:
> > > @@ -369,10 +380,25 @@ static int fsl_sai_hw_params(struct 
> > > snd_pcm_substream *substream,
> > >   u32 word_width = snd_pcm_format_width(params_format(params));
> > >   u32 val_cr4 = 0, val_cr5 = 0;
> > >   int ret;
> > > + u32 bclk;
> > > +
> > > + if (channels == 1)
> > > + channels = 2;
> > > +
> > > + if (!sai->slots || sai->slots % channels)
> > > + sai->slots = channels;
> > > +
> > > + sai->slots = sai->slots / channels;
> > > +
> > > + if (sai->slot_width < word_width || sai->is_dsp_mode)
> > > + sai->slot_width = word_width;
> > 
> > Could you pls explain a bit what's this overriding for?
> > Or it might be better to put into a comment.
> >
> In machine driver, we should use snd_soc_dai_set_tdm_slot to set slots
> and slot width. In my opinion, slots in machine driver means the slot
> number of all channels. But in sai driver, the slots means the slot number
> of one channel. So snd_soc_calc_bclk use fs*sample_size*channels*tdm_slots
> to caculate bclk.

Could you pls use the standard way as you described for slot number
in machine driver instead of defining some other meanings? That one
is really confusing, not to mention a code without any comment.

You can add some extra local variables with extinguished names and
calculate the slot number and channels you want without changing
the original sai->slots and channels in the hw_params(). As you said,
you only need that new slot number and channels for snd_soc_calc_bclk
call. So you may also put this code right before the call -- a normal
routine doesn't need to recalculate the special slots and channels,
right?

Nicolin
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH RFC 2/2] perf: convert: fix duplicate field names and avoid reserved keywords.

2015-01-21 Thread Wang Nan
(If Steven Rostedt accept the previous patch which introduce a priv
 field to 'struct format_field', we can use a relative simple method
 for name conversion. If not , perf must track name conversion by
 itself.)

Some parameters of syscall tracepoints named as 'nr', 'event', etc.
When dealing with them, perf convert to ctf meets some problem:

 1. If a parameter with name 'nr', it will duplicate syscall's
common field 'nr'. One such syscall is io_submit().

 2. If a parameter with name 'event', it is denied to be inserted
because 'event' is a babeltrace keywork. One such syscall is
epoll_ctl.

This patch appends '_dupl_X' suffix to avoid problem 1, prepend a '_'
prefix to avoid problem 2.

Signed-off-by: Wang Nan 
---
 tools/perf/util/data-convert-bt.c | 94 +--
 1 file changed, 90 insertions(+), 4 deletions(-)

diff --git a/tools/perf/util/data-convert-bt.c 
b/tools/perf/util/data-convert-bt.c
index ddecce8..a94f3bd 100644
--- a/tools/perf/util/data-convert-bt.c
+++ b/tools/perf/util/data-convert-bt.c
@@ -184,6 +184,7 @@ static int add_tracepoint_field_value(struct ctf_writer *cw,
unsigned int len;
int ret;
 
+   name = fmtf->priv ? (const char *)fmtf->priv : fmtf->name;
offset = fmtf->offset;
len = fmtf->size;
if (flags & FIELD_IS_STRING)
@@ -567,6 +568,91 @@ static int process_sample_event(struct perf_tool *tool,
return cs ? 0 : -1;
 }
 
+/* If dup < 0, add a prefix. Else, add _dupl_X suffix. */
+static char *change_name(char *name, char *orig_name, int dup)
+{
+   char *new_name = NULL;
+   size_t len;
+
+   if (!name)
+   name = orig_name;
+
+   if (dup >= 10)
+   goto out;
+
+   if (dup < 0)
+   len = strlen(name) + sizeof("_");
+   else
+   len = strlen(orig_name) + sizeof("_dupl_X");
+
+   new_name = malloc(len);
+   if (!new_name)
+   goto out;
+
+   if (dup < 0)
+   snprintf(new_name, len, "_%s", name);
+   else
+   snprintf(new_name, len, "%s_dupl_%d", orig_name, dup);
+
+out:
+   if (name != orig_name)
+   free(name);
+   return new_name;
+}
+
+static void destroy_field_priv(struct format_field *field)
+{
+   if (!field->priv)
+   return;
+
+   if (field->priv != field->name)
+   free(field->priv);
+
+   field->priv = NULL;
+   field->destroy_priv = NULL;
+}
+
+static int event_class_add_field(struct bt_ctf_event_class *event_class,
+   struct bt_ctf_field_type *type,
+   struct format_field *field)
+{
+   struct bt_ctf_field_type *t = NULL;
+   char *name;
+   int dup = 1;
+   int ret;
+
+   if (field->priv)
+   return bt_ctf_event_class_add_field(event_class, type,
+   (char *)field->priv);
+
+   name = field->name;
+   while (t = bt_ctf_event_class_get_field_by_name(event_class, name)) {
+   bt_ctf_field_type_put(t);
+   name = change_name(name, field->name, dup++);
+   if (!name) {
+   pr_err("Failed to create dup name for '%s'\n", 
field->name);
+   return -1;
+   }
+   }
+
+   ret = bt_ctf_event_class_add_field(event_class, type, name);
+
+   /* if failed, we may hit a keywork. try again with a '_' prefix */
+   if (ret) {
+   name = change_name(name, field->name, -1);
+   if (!name) {
+   pr_err("Failed to alloc name for '_%s'\n", field->name);
+   return -1;
+   }
+   ret = bt_ctf_event_class_add_field(event_class, type, name);
+   }
+
+   field->priv = name;
+   field->destroy_priv = destroy_field_priv;
+
+   return ret;
+}
+
 static int add_tracepoint_fields_types(struct ctf_writer *cw,
   struct format_field *fields,
   struct bt_ctf_event_class *event_class)
@@ -595,14 +681,14 @@ static int add_tracepoint_fields_types(struct ctf_writer 
*cw,
if (flags & FIELD_IS_ARRAY)
type = bt_ctf_field_type_array_create(type, 
field->arraylen);
 
-   ret = bt_ctf_event_class_add_field(event_class, type,
-   field->name);
+   ret = event_class_add_field(event_class, type, field);
 
if (flags & FIELD_IS_ARRAY)
bt_ctf_field_type_put(type);
 
if (ret) {
-   pr_err("Failed to add field '%s\n", field->name);
+   pr_err("Failed to add field '%s': %d\n",
+   field->name, ret);
return -1;
}
}
@@ -646,7 +732,7 @@ static int add_generic_types(struct ctf_writer *cw, struct 
perf_evsel *evsel,
 

[PATCH RFC 1/2] tools lib traceevent: add priv field to truct format_field.

2015-01-21 Thread Wang Nan
In https://lkml.org/lkml/2015/1/21/383 , Jiri Olsa gives a suggestion
about changing lib traceevent to solve a bug of perf-convert-to-ctf,
which is related to duplicated field names. I think his suggestion
should be something like this patch.

Signed-off-by: Wang Nan 
---
 tools/lib/traceevent/event-parse.c | 2 ++
 tools/lib/traceevent/event-parse.h | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/tools/lib/traceevent/event-parse.c 
b/tools/lib/traceevent/event-parse.c
index cf3a44b..5f76003 100644
--- a/tools/lib/traceevent/event-parse.c
+++ b/tools/lib/traceevent/event-parse.c
@@ -5909,6 +5909,8 @@ static void free_format_fields(struct format_field *field)
free(field->type);
free(field->name);
free(field);
+   if (field->destroy_priv)
+   field->destroy_priv(field);
field = next;
}
 }
diff --git a/tools/lib/traceevent/event-parse.h 
b/tools/lib/traceevent/event-parse.h
index 7a3873f..928d801 100644
--- a/tools/lib/traceevent/event-parse.h
+++ b/tools/lib/traceevent/event-parse.h
@@ -190,6 +190,8 @@ struct format_field {
unsigned intarraylen;
unsigned intelementsize;
unsigned long   flags;
+   void*priv;
+   void(*destroy_priv)(struct format_field *);
 };
 
 struct format {
-- 
1.8.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH RFC 0/2] tools lib traceevent: introduces priv field to struct format_field.

2015-01-21 Thread Wang Nan
Hi Jiri Olsa and Steven Rostedt (and others),

Here I post 2 patches. Patch 1 is for Steven Rostedt for his question:

https://lkml.org/lkml/2015/1/21/397

(Jiri, I hope you don't mind me posting this patch if you are working on
 it. I just want to solve the problem.)

The second patch is for Jiri. If the first patch is acceptable, we can
use it to deal with name conversion problem.

Thanks.

Wang Nan (2):
  tools lib traceevent: add priv field to truct format_field.
  perf: convert: fix duplicate field names and avoid reserved keywords.

 tools/lib/traceevent/event-parse.c |  2 +
 tools/lib/traceevent/event-parse.h |  2 +
 tools/perf/util/data-convert-bt.c  | 94 --
 3 files changed, 94 insertions(+), 4 deletions(-)

-- 
1.8.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [LKP] [block] 34b48db66e0: +3291.6% iostat.sde.wrqm/s

2015-01-21 Thread Jens Axboe

On 01/21/2015 06:21 PM, Huang Ying wrote:

FYI, we noticed the below changes on

commit 34b48db66e08ca1c1bc07cf305d672ac940268dc ("block: remove artifical 
max_hw_sectors cap")

testbox/testcase/testparams: 
lkp-ws02/fileio/600s-100%-1HDD-btrfs-64G-1024f-seqrewr-sync

c2661b806092d8ea  34b48db66e08ca1c1bc07cf305
  --
  %stddev %change %stddev
  \  |\
  47176 ±  2% -67.3%  15406 ±  4%  softirqs.BLOCK
   1110 ± 44% -51.0%544 ± 35%  sched_debug.cpu#8.curr->pid
 22 ± 33% -48.9% 11 ± 43%  sched_debug.cpu#1.cpu_load[0]
 91 ± 43%+125.0%204 ± 32%  
sched_debug.cfs_rq[4]:/.blocked_load_avg
 17 ± 46% -65.2%  6 ± 31%  
sched_debug.cfs_rq[1]:/.runnable_load_avg
105 ± 43%+102.6%213 ± 32%  
sched_debug.cfs_rq[4]:/.tg_load_contrib
163 ± 35% +62.6%265 ± 27%  
sched_debug.cfs_rq[16]:/.blocked_load_avg
183 ± 29% +51.4%277 ± 26%  
sched_debug.cfs_rq[16]:/.tg_load_contrib
   1411 ± 31% -42.5%812 ± 32%  sched_debug.cpu#6.curr->pid
   57565068 ± 15% +66.8%   96024066 ± 17%  cpuidle.C1E-NHM.time
  94625 ±  9% -32.5%  63893 ±  4%  cpuidle.C3-NHM.usage
200 ± 14% -22.8%155 ± 24%  
sched_debug.cfs_rq[8]:/.tg_load_contrib
244 ± 33% -39.0%149 ± 11%  
sched_debug.cfs_rq[6]:/.blocked_load_avg
265 ± 31% -38.4%163 ±  9%  
sched_debug.cfs_rq[6]:/.tg_load_contrib
   4959 ±  9% -18.2%   4058 ±  1%  slabinfo.kmalloc-128.active_objs
   4987 ±  9% -18.6%   4058 ±  1%  slabinfo.kmalloc-128.num_objs
 19 ±  8% -19.7% 15 ± 14%  sched_debug.cpu#0.cpu_load[1]
 662307 ±  7% -12.6% 579108 ±  3%  cpuidle.C6-NHM.usage
   3028 ±  7% -12.3%   2656 ±  1%  
slabinfo.ext4_extent_status.num_objs
   3028 ±  7% -12.3%   2656 ±  1%  
slabinfo.ext4_extent_status.active_objs
   4.87 ±  0%   +3291.6% 165.07 ±  0%  iostat.sde.wrqm/s
   1006 ±  0%+120.3%   2216 ±  0%  iostat.sde.avgrq-sz


So these two above tells us that we are doing way more write merges per 
second, and that the average request size has roughly doubled from 1006 
to 2216 - both are excellent news.



466 ±  0%+115.9%   1007 ±  0%  iostat.sde.await
466 ±  0%+115.9%   1007 ±  0%  iostat.sde.w_await


Service time roughly doubled, must be mostly stream time.


301 ±  0% -52.7%142 ±  0%  iostat.sde.w/s


About half the number of writes completed, but from the stats above, 
those writes are more than double. 1006 * 301 < 2216 * 142, so again, 
this looks good.



   2230 ±  2%  -8.2%   2048 ±  2%  vmstat.system.in


And a nice reduction in irq rate, also nice. Way less software irqs from 
the first few lines, also a win.


--
Jens Axboe

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2 0/5] Overhaul the audit filename handling

2015-01-21 Thread Guenter Roeck

On 01/21/2015 08:59 PM, Paul Moore wrote:

This patchset has some important changes from the previous revision,
namely a fix from Al Viro (included in 2/5) that resolves a boot panic
on some systems as well as some smaller, less noteworthy fixes found
in the linux-next announcement thread from January 20th (refcount bump
in __audit_reusename() and a inode type in __audit_inode()).

This patchset still needs some additional testing to verify that the
audit code still functions properly (the minor fixes mentioned above)
and there is an additional patch from Al that should be included as
well, but I wanted to post this and push the series to the audit next
branch quickly since a number of folks were affected by the boot panic.

---

Paul Moore (5):
   fs: rework getname_kernel to handle up to PATH_MAX sized filenames
   fs: create proper filename objects using getname_kernel()
   audit: enable filename recording via getname_kernel()
   audit: fix filename matching in __audit_inode() and __audit_inode_child()
   audit: replace getname()/putname() hacks with reference counters


Hi Paul,

What is the baseline for this patch set ? Obviously -next won't work,
and it does not apply to mainline either.

Thanks,
Guenter

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v9 00/17] Kernel address sanitizer - runtime memory debugger.

2015-01-21 Thread Andrey Ryabinin
2015-01-22 3:22 GMT+03:00 Sasha Levin :
> On 01/21/2015 11:51 AM, Andrey Ryabinin wrote:
>> Changes since v8:
>>   - Fixed unpoisoned redzones for not-allocated-yet object
>>   in newly allocated slab page. (from Dmitry C.)
>>
>>   - Some minor non-function cleanups in kasan internals.
>>
>>   - Added ack from Catalin
>>
>>   - Added stack instrumentation. With this we could detect
>>   out of bounds accesses in stack variables. (patch 12)
>>
>>   - Added globals instrumentation - catching out of bounds in
>>   global varibles. (patches 13-17)
>>
>>   - Shadow moved out from vmalloc into hole between vmemmap
>>   and %esp fixup stacks. For globals instrumentation
>>   we will need shadow backing modules addresses.
>>   So we need some sort of a shadow memory allocator
>>   (something like vmmemap_populate() function, except
>>   that it should be available after boot).
>>
>>   __vmalloc_node_range() suits that purpose, except that
>>   it can't be used for allocating for shadow in vmalloc
>>   area because shadow in vmalloc is already 'allocated'
>>   to protect us from other vmalloc users. So we need
>>   16TB of unused addresses. And we have big enough hole
>>   between vmemmap and %esp fixup stacks. So I moved shadow
>>   there.
>
> I'm not sure which new addition caused it, but I'm getting tons of
> false positives from platform drivers trying to access memory they
> don't "own" - because they expect to find hardware there.
>

To be sure, that this is really false positives, could you try with
patches in attachment?
That should fix some bugs in several platform drivers.

> I suspect we'd need to mark that memory region somehow to prevent
> accesses to it from triggering warnings?
>
>
> Thanks,
> Sasha
>
diff --git a/drivers/video/backlight/da9052_bl.c b/drivers/video/backlight/da9052_bl.c
index d4bd74bd..b1943e7 100644
--- a/drivers/video/backlight/da9052_bl.c
+++ b/drivers/video/backlight/da9052_bl.c
@@ -165,6 +165,7 @@ static struct platform_device_id da9052_wled_ids[] = {
 		.name		= "da9052-wled3",
 		.driver_data	= DA9052_TYPE_WLED3,
 	},
+	{ },
 };
 
 static struct platform_driver da9052_wled_driver = {
diff --git a/drivers/crypto/ccp/ccp-dev.c b/drivers/crypto/ccp/ccp-dev.c
index c6e6171..ca29c12 100644
--- a/drivers/crypto/ccp/ccp-dev.c
+++ b/drivers/crypto/ccp/ccp-dev.c
@@ -583,6 +583,7 @@ bool ccp_queues_suspended(struct ccp_device *ccp)
 #ifdef CONFIG_X86
 static const struct x86_cpu_id ccp_support[] = {
 	{ X86_VENDOR_AMD, 22, },
+	{ },
 };
 #endif
 
diff --git a/drivers/rtc/rtc-s5m.c b/drivers/rtc/rtc-s5m.c
index b5e7c46..89ac1d5 100644
--- a/drivers/rtc/rtc-s5m.c
+++ b/drivers/rtc/rtc-s5m.c
@@ -832,6 +832,7 @@ static SIMPLE_DEV_PM_OPS(s5m_rtc_pm_ops, s5m_rtc_suspend, s5m_rtc_resume);
 static const struct platform_device_id s5m_rtc_id[] = {
 	{ "s5m-rtc",		S5M8767X },
 	{ "s2mps14-rtc",	S2MPS14X },
+	{ },
 };
 
 static struct platform_driver s5m_rtc_driver = {


Re: [PATCH 1/2] watchdog: dw_wdt: pat the watchdog before enabling it

2015-01-21 Thread Guenter Roeck

On 01/21/2015 09:22 PM, Jisheng Zhang wrote:

Dear Doug,

On Wed, 21 Jan 2015 15:17:22 -0800
Doug Anderson  wrote:


On some dw_wdt implementations the "top" register may be initted to 0
at bootup.  In such a case, each "pat" of the watchdog will reset the
timer to 0x.  That's pretty short.


+ Guenter Roeck

This should have been fixed by dfa07141e7a792("watchdog: dw_wdt: initialise
TOP_INIT in dw_wdt_set_top()")


Ah, yes. Doug, can you check if your patch is still needed ?

Thanks,
Guenter

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/2] watchdog: dw_wdt: pat the watchdog before enabling it

2015-01-21 Thread Jisheng Zhang
Dear Doug,

On Wed, 21 Jan 2015 15:17:22 -0800
Doug Anderson  wrote:

> On some dw_wdt implementations the "top" register may be initted to 0
> at bootup.  In such a case, each "pat" of the watchdog will reset the
> timer to 0x.  That's pretty short.

+ Guenter Roeck

This should have been fixed by dfa07141e7a792("watchdog: dw_wdt: initialise
TOP_INIT in dw_wdt_set_top()")

In fact, my original fix is as similar as your patch

http://www.spinics.net/lists/arm-kernel/msg363658.html

Then Guenter Roeck suggest one elegant solution which is the base of
commit dfa07141e7a792.

http://www.spinics.net/lists/arm-kernel/msg363908.html

> 
> The input clock of the wdt can be any of a wide range of values.  On
> an rk3288 system, I've seen the wdt clock be 24.75 MHz.  That means
> each tick is ~40ns and we'll count to 0x in ~2.6ms.
> 
> Because of the above two facts, it's a really good idea to pat the
> watchdog after initting the "top" register properly and before
> enabling the watchdog.  If you don't then there's no way we'll get the
> next heartbeat in time.
> 
> Signed-off-by: Doug Anderson 
> ---
>  drivers/watchdog/dw_wdt.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/watchdog/dw_wdt.c b/drivers/watchdog/dw_wdt.c
> index b34a2e4..fc92bea 100644
> --- a/drivers/watchdog/dw_wdt.c
> +++ b/drivers/watchdog/dw_wdt.c
> @@ -170,6 +170,7 @@ static int dw_wdt_open(struct inode *inode, struct file
> *filp)
>* the maximum and then start it.
>*/
>   dw_wdt_set_top(DW_WDT_MAX_TOP);
> + dw_wdt_keepalive();
>   writel(WDOG_CONTROL_REG_WDT_EN_MASK,
>  dw_wdt.regs + WDOG_CONTROL_REG_OFFSET);
>   }

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] ARM: decompressor: remove unused cache flush code

2015-01-21 Thread Masahiro Yamada
As ARM ARM says, the bit 19-16 of ID_MMFR1 is always 0b because
ARMv7 requires a hierarchical cache implementation.
The line "mcrp15, 0, r10, c7, c14, 0" is not reachable.

Moreover, the v7_flush_dcache_all in arch/arm/mm/cache-v7.S does not
check the ID_MMFR1.

Signed-off-by: Masahiro Yamada 
---

 arch/arm/boot/compressed/head.S | 8 +---
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S
index 9dff614..32f0d79 100644
--- a/arch/arm/boot/compressed/head.S
+++ b/arch/arm/boot/compressed/head.S
@@ -1085,15 +1085,9 @@ __armv6_mmu_cache_flush:
 __armv7_mmu_cache_flush:
tst r4, #1
bne iflush
-   mrc p15, 0, r10, c0, c1, 5  @ read ID_MMFR1
-   tst r10, #0xf << 16 @ hierarchical cache (ARMv7)
+   stmfd   sp!, {r0-r7, r9-r11}
mov r10, #0
-   beq hierarchical
-   mcr p15, 0, r10, c7, c14, 0 @ clean+invalidate D
-   b   iflush
-hierarchical:
mcr p15, 0, r10, c7, c10, 5 @ DMB
-   stmfd   sp!, {r0-r7, r9-r11}
mrc p15, 1, r0, c0, c0, 1   @ read clidr
andsr3, r0, #0x700  @ extract loc from clidr
mov r3, r3, lsr #23 @ left align loc bit field
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2] dma: imx-sdma: switch to dynamic context mode after script loaded

2015-01-21 Thread Robin Gong
Below comments got from Page4724 of Reference Manual of i.mx6q:
http://cache.freescale.com/files/32bit/doc/ref_manual/IMX6DQRM.pdf

--"Static context mode should be used for the first channel called
after reset to ensure that the all context RAM for that channel is
initialized during the context SAVE phase when the channel is
done or yields. Subsequent calls to the same channel or
different channels may use any of the dynamic context modes.
This will ensure that all context locations for the bootload
channel are initialized, and prevent undefined values in context
RAM from being loaded during the context restore if the
channel is re-started later"

Unfortunately, the rule was broken by 
commit(5b28aa319bba96987316425a1131813d87cbab35)
.This patch just take them back.

Signed-off-by: Robin Gong 
---
 drivers/dma/imx-sdma.c | 11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c
index d0df198..d84b7a8 100644
--- a/drivers/dma/imx-sdma.c
+++ b/drivers/dma/imx-sdma.c
@@ -330,6 +330,8 @@ struct sdma_engine {
const struct sdma_driver_data   *drvdata;
 };
 
+static bool channel0_first;
+
 static struct sdma_driver_data sdma_imx31 = {
.chnenbl0 = SDMA_CHNENBL0_IMX31,
.num_events = 32,
@@ -531,6 +533,12 @@ static int sdma_run_channel0(struct sdma_engine *sdma)
dev_err(sdma->dev, "Timeout waiting for CH0 ready\n");
}
 
+   if (!channel0_first) {
+   /* Set bits of CONFIG register with given context switching 
mode */
+   writel_relaxed(SDMA_H_CONFIG_CSM, sdma->regs + SDMA_H_CONFIG);
+   channel0_first = true;
+   }
+
return ret ? 0 : -ETIMEDOUT;
 }
 
@@ -1401,9 +1409,6 @@ static int sdma_init(struct sdma_engine *sdma)
 
writel_relaxed(ccb_phys, sdma->regs + SDMA_H_C0PTR);
 
-   /* Set bits of CONFIG register with given context switching mode */
-   writel_relaxed(SDMA_H_CONFIG_CSM, sdma->regs + SDMA_H_CONFIG);
-
/* Initializes channel's priorities */
sdma_set_channel_priority(>channel[0], 7);
 
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2 2/2] powerpc/powernv: Skip registering log region when CONFIG_PRINTK=n

2015-01-21 Thread Michael Ellerman
On Wed, 2015-01-21 at 21:26 -0500, Pranith Kumar wrote:
> When CONFIG_PRINTK=n, log_buf_addr_get() returns NULL and log_buf_len_get()
> return 0. Check for these return values and skip registering the dump buffer.
> 
> Signed-off-by: Pranith Kumar 
> CC: Michael Ellerman 
> ---
>  arch/powerpc/platforms/powernv/opal.c | 6 ++
>  1 file changed, 6 insertions(+)

What changed since v1? I don't see anything?

cheers


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: RCU CPU stall console spews leads to soft lockup disabled is reasonable ?

2015-01-21 Thread Paul E. McKenney
On Thu, Jan 22, 2015 at 11:08:11AM +0800, Zhang Zhen wrote:
> On 2015/1/22 4:06, Paul E. McKenney wrote:
> > On Wed, Jan 21, 2015 at 10:10:51AM -0500, Don Zickus wrote:
> >> On Wed, Jan 21, 2015 at 10:26:27AM +0800, Zhang Zhen wrote:
>  This may not cause other problems but what happens if you comment out the
>  'touch_softlockup_watchdog' from the touch_nmi_watchdog function like
>  below (based on latest upstream cb59670870)?
> 
>  The idea is that console printing for that cpu won't reset the softlockup
>  detector.  Again other bad things might happen and this patch may not be 
>  a
>  good final solution, but it can help give me a clue about what is going
>  on.
> >>>
> >>> I commented out the 'touch_softlockup_watchdog' from the 
> >>> touch_nmi_watchdog function
> >>> (based on latest upstream ec6f34e5b552).
> >>> This triggered RCU stall and softlockup, but softlockup just printk only 
> >>> once.
> >>
> >> Yes, as expected.  Instead of flooding the console with the same message,
> >> report only once until the high priority task is re-kicked and can re-arm
> >> the softlockup timer again.  So this makes sense.  Based on your double
> >> spin lock test, I don't ever expect this to get re-armed, so you should
> >> not expect to see another message.
> >>
> >>
> >>> As you mentioned "other bad things" lead to softlockup just printk only 
> >>> once.
> >>> What's the bad thing ?
> >>
> >> Well, one of the assumptions here is that if you are going to have
> >> interrupts disabled for a long time and purposely kick the hardlockup
> >> detector (with touch_nmi_watchdog), then you can reasonably assume that
> >> softlockups will go off too if you don't also kick the softlockup detector
> >> (even though there is a window where this isn't true: 2*thresh - thresh).
> >>
> >>
> >> So the patch I gave you, can lead to false softlockup warnings.
> >>
> >>
> >> On the flip side, printing to the console also blocks hardlockups from
> >> showing up.  But I believe lng ago, Paul adjusted the rcu stalls to be
> >> longer than a hardlockup/softlockup timeout to prevent such scenarios.
> >>
> >>
> >>
> >> I am not sure what to do here.  Printing to the console has traditionally
> >> been slow (especially if doing so with interrupts disabled), so a
> >> touch_nmi_watchdog has been necessary.  But a side effect of that, is it
> >> prevents the lockup detectors from going off if printing repeatedly.
> >>
> >>
> >> Now we can hack up rcu stall to only print once until it is re-armed.
> >> This would show rcu stall printing first, followed two minutes later by
> >> a softlockup, which sorta achieves what you want.
> >>
> >>
> >>
> >> However, at the end of the day, an rcu stall, softlockup or hardlockup is
> >> a bad thing, does it matter if you get one or all of them?  One should be
> >> enough to start an investigation, no?
> > 
> > Hear, hear!!!
> > 
> Ok, thanks for Don's and your patience!
> We enriched softlockup printk information, so we want to get softlockup 
> warnning.

Booting with "rcupdate.rcu_cpu_stall_suppress=1" will shut up the RCU
CPU stall warnings.

Thanx, Paul

> >> I don't know.  I am leaning towards 'working as expected' and nothing to
> >> really fix here.  Does anyone have any suggestions on what assumptions we
> >> could change to handle this better?
> >>
> >>
> >> Cheers,
> >> Don
> >>
> >>>
> >>> / #
> >>> / # echo 60 > /proc/sys/kernel/watchdog_thresh
> >>> / # busybox insmod softlockup_test.ko &
> >>> / # [   39.044058] INFO: rcu_preempt detected stalls on CPUs/tasks: {} 
> >>> (detected by 0, t=21002 jiffies, g=78, c=77, q=4)
> >>> [   39.044058] INFO: Stall ended before state dump start
> >>> [  102.049045] INFO: rcu_preempt detected stalls on CPUs/tasks: {} 
> >>> (detected by 0, t=84007 jiffies, g=78, c=77, q=4)
> >>> [  102.049045] INFO: Stall ended before state dump start
> >>> [  160.482123] BUG: soft lockup - CPU#0 stuck for 134s! [busybox:54]
> >>> [  165.054075] INFO: rcu_preempt detected stalls on CPUs/tasks: {} 
> >>> (detected by 0, t=147012 jiffies, g=78, c=77, q=4)
> >>> [  165.054075] INFO: Stall ended before state dump start
> >>> [  228.059045] INFO: rcu_preempt detected stalls on CPUs/tasks: {} 
> >>> (detected by 0, t=210017 jiffies, g=78, c=77, q=4)
> >>> [  228.059045] INFO: Stall ended before state dump start
> >>> [  291.064099] INFO: rcu_preempt detected stalls on CPUs/tasks: {} 
> >>> (detected by 0, t=273022 jiffies, g=78, c=77, q=4)
> >>> [  291.064099] INFO: Stall ended before state dump start
> >>> [  354.069074] INFO: rcu_preempt detected stalls on CPUs/tasks: {} 
> >>> (detected by 0, t=336027 jiffies, g=78, c=77, q=4)
> >>> [  354.069099] INFO: Stall ended before state dump start
> >>> [  417.074045] INFO: rcu_preempt detected stalls on CPUs/tasks: {} 
> >>> (detected by 0, t=399032 jiffies, g=78, c=77, q=4)
> >>> [  417.074045] INFO: Stall ended before state dump 

Re: mmotm: mm-slub-optimize-alloc-free-fastpath-by-removing-preemption-on-off.patch is causing preemptible splats

2015-01-21 Thread Stephen Rothwell
Hi Andrew,

On Wed, 21 Jan 2015 19:34:11 -0800 Andrew Morton  
wrote:
>
> On Thu, 22 Jan 2015 10:51:23 +0900 Joonsoo Kim  wrote:
> 
> > > The most recent -mmotm was a bit of a trainwreck.  I'm scrambling to
> > > get the holes plugged so I can get another mmotm out today.
> > 
> > Another mmotm will fix many issues from me. :/
> 
> I hit a wont-boot-cant-find-init in linux-next so I get to spend
> tomorrow bisecting that :(

There has been a long discussion about something like that already.
Subject "Re: linux-next: Tree for Jan 20 -- Kernel panic - Unable to
mount root fs"

-- 
Cheers,
Stephen Rothwells...@canb.auug.org.au


pgpFgdYeB9yzO.pgp
Description: OpenPGP digital signature


Re: [alsa-devel][PATCH 3/3] ASoC: fsl_sai: Add support for Right-J mode

2015-01-21 Thread Zidan Wang
On Wed, Jan 21, 2015 at 10:53:20AM -0800, Nicolin Chen wrote:
> On Tue, Jan 20, 2015 at 08:21:20PM +0800, Zidan Wang wrote:
> > Add Right-J mode and set TCR5 FBT bit to let data right justify.
> > 
> > Signed-off-by: Zidan Wang 
> 
> > -   if (sai->is_lsb_first)
> > +   if (sai->is_lsb_first && sai->is_right_j_mode)
> > val_cr5 |= FSL_SAI_CR5_FBT(0);
> 
> Are you sure that FBT(0) is correct for right justified mode?
> Because the original code is using FBT(0) for the lsb_first
> situation and it shouldn't be right justified mode as default.
>
I am not sure about that. 

I assume lsb_first as big endian data.

For 16 bit data format, the 2 bytes data will in high address of 4 bytes
fifo. So the FBT is 16 for left-j and 0 for right-j. But big endian is
bytes convert not bits convert. It makes me confuse. And send to
community for help.

> Nicolin
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: perf: easily crash kernel with rapl event close

2015-01-21 Thread Stephane Eranian
Vince,

On Wed, Jan 21, 2015 at 10:55 AM, Vince Weaver  wrote:
> Hello
>
> on my haswell system, running 3.19-rc5, and with
> echo "0" > /proc/sys/kernel/perf_event_paranoid
>
> I can easily crash my system with the attached test program that simply
> opens a RAPL event and then closes it.
>
> This bug was found by the perf_fuzzer.
>
> It looks like somehow rapl_pmu gets freed to NULL but the
> call in rapl_scale()
> __this_cpu_read(rapl_pmu->hw_unit)
> still happens.
>
I don't see how this can happen.

I get some crashes but not with your program on my laptop.
But I cannot catch the serial console from my laptop.
Will try with another machine tomorrow.

> [  189.424003] BUG: unable to handle kernel paging request at cc68
> [  189.431591] IP: [] rapl_event_update+0x82/0xb0
> [  189.438069] PGD 0
> [  189.440308] Oops:  [#1] SMP
> [  189.443882] Modules linked in: fuse x86_pkg_temp_thermal intel_powerclamp 
> intel_rapl iosf_mbi coretemp kvm crct10dif_pclmul crc32_pclmul 
> ghash_clmulni_intel aesni_intel snd_hda_codec_hdmi aes_x86_64 lrw i915 
> gf128mul glue_helper evdev mei_me snd_hda_codec_realtek snd_hda_codec_generic 
> xhci_pci ppdev iTCO_wdt iTCO_vendor_support lpc_ich mfd_core mei psmouse 
> ablk_helper serio_raw parport_pc cryptd pcspkr i2c_i801 xhci_hcd tpm_tis 
> snd_hda_intel parport tpm battery video snd_hda_controller snd_hda_codec 
> snd_hwdep snd_pcm snd_timer drm_kms_helper snd soundcore wmi button processor 
> drm i2c_algo_bit sg sr_mod sd_mod cdrom ehci_pci ehci_hcd ahci libahci libata 
> e1000e usbcore ptp crc32c_intel scsi_mod usb_common pps_core thermal fan 
> thermal_sys
> [  189.515919] CPU: 5 PID: 0 Comm: swapper/5 Not tainted 3.19.0-rc5+ #123
> [  189.522911] Hardware name: LENOVO 10AM000AUS/SHARKBAY, BIOS FBKT72AUS 
> 01/26/2014
> [  189.530797] task: 880119470390 ti: 880119474000 task.ti: 
> 880119474000
> [  189.538773] RIP: 0010:[]  [] 
> rapl_event_update+0x82/0xb0
> [  189.547823] RSP: 0018:88011eb43e40  EFLAGS: 00010046
> [  189.553485] RAX: 0208d460 RBX: 88011eb43e4c RCX: 
> 0020
> [  189.561104] RDX:  RSI: 0208d460 RDI: 
> 
> [  189.568774] RBP: 88011eb43e78 R08:  R09: 
> 0090
> [  189.576300] R10:  R11: 0001 R12: 
> 0208d460
> [  189.583903] R13: 8800cfbb29a0 R14: 8800cfbb2800 R15: 
> 0208d460
> [  189.591389] FS:  () GS:88011eb4() 
> knlGS:
> [  189.600138] CS:  0010 DS:  ES:  CR0: 80050033
> [  189.606320] CR2: cc68 CR3: 01c13000 CR4: 
> 001407e0
> [  189.613965] DR0:  DR1:  DR2: 
> 
> [  189.621567] DR3:  DR6: fffe0ff0 DR7: 
> 0400
> [  189.629219] Stack:
> [  189.631419]  8800cd9ffbe0 cd9ffb80 8800cfbb2800 
> 8800cd9ffb80
> [  189.639447]  0082 0004 e8d43f54 
> 88011eb43ea8
> [  189.647569]  81032db8 8800cfbb2800 e8d43d10 
> 002c1a89ebed
> [  189.655590] Call Trace:
> [  189.658229]  
> [  189.660307]  [] rapl_pmu_event_stop+0x98/0x120
> [  189.666975]  [] rapl_pmu_event_del+0x13/0x20
> [  189.673271]  [] event_sched_out.isra.73+0xf6/0x240
> [  189.680082]  [] __perf_remove_from_context+0x59/0xd0
> [  189.687086]  [] ? tick_nohz_irq_exit+0x29/0x30
> [  189.693536]  [] remote_function+0x50/0x60
> [  189.699549]  [] flush_smp_call_function_queue+0x62/0x140
> [  189.706905]  [] 
> generic_smp_call_function_single_interrupt+0x13/0x60
> [  189.715411]  [] 
> smp_call_function_single_interrupt+0x27/0x40
> [  189.723165]  [] call_function_single_interrupt+0x6d/0x80
> [  189.730545]  
> [  189.732617]  [] ? cpuidle_enter_state+0x65/0x160
> [  189.739449]  [] ? cpuidle_enter_state+0x51/0x160
> [  189.746056]  [] cpuidle_enter+0x17/0x20
> [  189.751787]  [] cpu_startup_entry+0x311/0x3c0
> [  189.758151]  [] start_secondary+0x140/0x150
> [  189.764307] Code: 00 00 41 8b be 48 01 00 00 48 89 de e8 d8 42 02 00 66 90 
> 49 89 c7 4c 89 e0 4d 0f b1 7d 00 4c 39 e0 75 d6 4c 89 f8 b9 20 00 00 00 <48> 
> 8b 15 af a0 fd 7e 4c 29 e0 65 8b 52 38 48 98 29 d1 48 d3 e0
> [  189.785900] RIP  [] rapl_event_update+0x82/0xb0
> [  189.792456]  RSP 
> [  189.796233] CR2: cc68
> [  189.799800] ---[ end trace 71cd60a89559b021 ]---
> [  189.804777] Kernel panic - not syncing: Fatal exception in interrupt
> [  189.811644] Kernel Offset: 0x0 from 0x8100 (relocation range: 
> 0x8000-0x9fff)
> [  189.822598] drm_kms_helper: panic occurred, switching back to text console
> [  189.829996] ---[ end Kernel panic - not syncing: Fatal exception in 
> interrupt
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  

Re: [PATCH v4 0/2] power: rt5033: Add Richtek RT533 drivers

2015-01-21 Thread Sebastian Reichel
Hi,

On Thu, Jan 22, 2015 at 01:06:38PM +0900, Beomho Seo wrote:
> This patchset adds driver for Richtek rt5033 chip The chip contains
> switching charge mode Li-Ion/Li-Polymer battery charger, fuelgauge.
> Additionally, This includes document for device tree of RT5033 device.

Thanks, applied.

-- Sebastian


signature.asc
Description: Digital signature


Re: [PATCH] mm/slub: use unchecked percpu access within preemptible sections

2015-01-21 Thread Joonsoo Kim
On Wed, Jan 21, 2015 at 09:27:41PM -0500, Sasha Levin wrote:
> On 01/21/2015 08:59 PM, Joonsoo Kim wrote:
> > On Tue, Jan 20, 2015 at 11:31:43PM -0500, Sasha Levin wrote:
> >> > Commit "mm/slub: optimize alloc/free fastpath by removing preemption 
> >> > on/off"
> >> > has added access to percpu memory while the code is preemptible.
> >> > 
> >> > While those accesses are okay, this creates a huge amount of warnings 
> >> > from
> >> > the code that checks for that.
> >> > 
> >> > Signed-off-by: Sasha Levin 
> > Hello,
> > 
> > I already sent the patch to fix this issue and it is in mmotm, but,
> > not be released yet.
> > 
> > https://lkml.org/lkml/2015/1/19/17
> 
> The patch you sent out still has the issue. The one I sent goes on top of
> it.
> 
> + do {
> + tid = this_cpu_read(s->cpu_slab->tid); <=== checked percpu 
> access
> + c = raw_cpu_ptr(s->cpu_slab);
> + } while (IS_ENABLED(CONFIG_PREEMPT) && unlikely(tid != c->tid));
> 

Hello,

this_cpu_xxx() is designed to be called regardless of interrupts and
preemption.

In Documentation/this_cpu_ops.txt,

The following this_cpu() operations with implied preemption protection
are defined. These operations can be used without worrying about
preemption and interrupts.

this_cpu_read(pcp)
...

And, for correctness of algorithm, tid should be fetched through
this_cpu_read() rather than raw_cpu_read(). Generic implementation of
raw_cpu_read() has a race window to fetch different cpu's tid instead
of the cpu where we are at now and this will cause algorithm broken.

Thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


linux-next: manual merge of the kvm-arm tree with the rcu tree

2015-01-21 Thread Stephen Rothwell
Hi all,

Today's linux-next merge of the kvm-arm tree got a conflict in
arch/arm64/kvm/Kconfig between commit 83fe27ea5311 ("rcu: Make SRCU
optional by using CONFIG_SRCU") from the rcu tree and commit
7276030a082c ("KVM: arm/arm64: Enable Dirty Page logging for ARMv8")
from the kvm-arm tree.

I fixed it up (see below) and can carry the fix as necessary (no action
is required).

-- 
Cheers,
Stephen Rothwells...@canb.auug.org.au

diff --cc arch/arm64/kvm/Kconfig
index b334084d3675,3ce389b3c21c..
--- a/arch/arm64/kvm/Kconfig
+++ b/arch/arm64/kvm/Kconfig
@@@ -26,7 -27,7 +27,8 @@@ config KV
select KVM_ARM_HOST
select KVM_ARM_VGIC
select KVM_ARM_TIMER
+   select KVM_GENERIC_DIRTYLOG_READ_PROTECT
 +  select SRCU
---help---
  Support hosting virtualized guest machines.
  


pgp6ldIgKt0ZS.pgp
Description: OpenPGP digital signature


linux-next: manual merge of the kvm-arm tree with the arm64 tree

2015-01-21 Thread Stephen Rothwell
Hi all,

Today's linux-next merge of the kvm-arm tree got a conflict in
arch/arm64/include/asm/kvm_arm.h between commit 6e53031ed840 ("arm64:
kvm: remove ESR_EL2_* macros") from the arm64 tree and commit
0d97f8848104 ("arm/arm64: KVM: add tracing support for arm64 exit
handler") from the kvm-arm tree.

I fixed it up (see below, but this probably requires more work) and can
carry the fix as necessary (no action is required).

-- 
Cheers,
Stephen Rothwells...@canb.auug.org.au

diff --cc arch/arm64/include/asm/kvm_arm.h
index 94674eb7e7bb,3da2d3acec0b..
--- a/arch/arm64/include/asm/kvm_arm.h
+++ b/arch/arm64/include/asm/kvm_arm.h
@@@ -192,4 -217,46 +192,6 @@@
  /* Hyp Prefetch Fault Address Register (HPFAR/HDFAR) */
  #define HPFAR_MASK(~UL(0xf))
  
 -#define ESR_EL2_EC_UNKNOWN(0x00)
 -#define ESR_EL2_EC_WFI(0x01)
 -#define ESR_EL2_EC_CP15_32(0x03)
 -#define ESR_EL2_EC_CP15_64(0x04)
 -#define ESR_EL2_EC_CP14_MR(0x05)
 -#define ESR_EL2_EC_CP14_LS(0x06)
 -#define ESR_EL2_EC_FP_ASIMD   (0x07)
 -#define ESR_EL2_EC_CP10_ID(0x08)
 -#define ESR_EL2_EC_CP14_64(0x0C)
 -#define ESR_EL2_EC_ILL_ISS(0x0E)
 -#define ESR_EL2_EC_SVC32  (0x11)
 -#define ESR_EL2_EC_HVC32  (0x12)
 -#define ESR_EL2_EC_SMC32  (0x13)
 -#define ESR_EL2_EC_SVC64  (0x15)
 -#define ESR_EL2_EC_HVC64  (0x16)
 -#define ESR_EL2_EC_SMC64  (0x17)
 -#define ESR_EL2_EC_SYS64  (0x18)
 -#define ESR_EL2_EC_IABT   (0x20)
 -#define ESR_EL2_EC_IABT_HYP   (0x21)
 -#define ESR_EL2_EC_PC_ALIGN   (0x22)
 -#define ESR_EL2_EC_DABT   (0x24)
 -#define ESR_EL2_EC_DABT_HYP   (0x25)
 -#define ESR_EL2_EC_SP_ALIGN   (0x26)
 -#define ESR_EL2_EC_FP_EXC32   (0x28)
 -#define ESR_EL2_EC_FP_EXC64   (0x2C)
 -#define ESR_EL2_EC_SERROR (0x2F)
 -#define ESR_EL2_EC_BREAKPT(0x30)
 -#define ESR_EL2_EC_BREAKPT_HYP(0x31)
 -#define ESR_EL2_EC_SOFTSTP(0x32)
 -#define ESR_EL2_EC_SOFTSTP_HYP(0x33)
 -#define ESR_EL2_EC_WATCHPT(0x34)
 -#define ESR_EL2_EC_WATCHPT_HYP(0x35)
 -#define ESR_EL2_EC_BKPT32 (0x38)
 -#define ESR_EL2_EC_VECTOR32   (0x3A)
 -#define ESR_EL2_EC_BRK64  (0x3C)
 -
 -#define ESR_EL2_EC_xABT_xFSR_EXTABT   0x10
 -
 -#define ESR_EL2_EC_WFI_ISS_WFE(1 << 0)
 -
+ #define ESR_EL2_HVC_IMM_MASK  ((1UL << 16) - 1)
+ 
  #endif /* __ARM64_KVM_ARM_H__ */


pgpyAj7xyFZil.pgp
Description: OpenPGP digital signature


linux-next: manual merge of the kvm-arm tree with the arm64 tree

2015-01-21 Thread Stephen Rothwell
Hi all,

Today's linux-next merge of the kvm-arm tree got a conflict in
arch/arm64/kvm/handle_exit.c between commit c6d01a947a51 ("arm64: kvm:
move to ESR_ELx macros") from the arm64 tree and commit 0d97f8848104
("arm/arm64: KVM: add tracing support for arm64 exit handler") from the
kvm-arm tree.

I fixed it up (see below) and can carry the fix as necessary (no action
is required).

-- 
Cheers,
Stephen Rothwells...@canb.auug.org.au

diff --cc arch/arm64/kvm/handle_exit.c
index 29b184a8f3f8,6a7eb3ce7027..
--- a/arch/arm64/kvm/handle_exit.c
+++ b/arch/arm64/kvm/handle_exit.c
@@@ -63,10 -67,13 +69,13 @@@ static int handle_smc(struct kvm_vcpu *
   */
  static int kvm_handle_wfx(struct kvm_vcpu *vcpu, struct kvm_run *run)
  {
-   if (kvm_vcpu_get_hsr(vcpu) & ESR_ELx_WFx_ISS_WFE)
 -  if (kvm_vcpu_get_hsr(vcpu) & ESR_EL2_EC_WFI_ISS_WFE) {
++  if (kvm_vcpu_get_hsr(vcpu) & ESR_ELx_WFx_ISS_WFE) {
+   trace_kvm_wfx_arm64(*vcpu_pc(vcpu), true);
kvm_vcpu_on_spin(vcpu);
-   else
+   } else {
+   trace_kvm_wfx_arm64(*vcpu_pc(vcpu), false);
kvm_vcpu_block(vcpu);
+   }
  
kvm_skip_instr(vcpu, kvm_vcpu_trap_il_is32bit(vcpu));
  


pgpdiCwYFQzTn.pgp
Description: OpenPGP digital signature


[PATCH v2 3/5] audit: enable filename recording via getname_kernel()

2015-01-21 Thread Paul Moore
Enable recording of filenames in getname_kernel() and remove the
kludgy workaround in __audit_inode() now that we have proper filename
logging for kernel users.

CC: v...@zeniv.linux.org.uk
CC: linux-fsde...@vger.kernel.org
Signed-off-by: Paul Moore 
Reviewed-by: Richard Guy Briggs 
---
 fs/namei.c   |1 +
 kernel/auditsc.c |   40 +++-
 2 files changed, 4 insertions(+), 37 deletions(-)

diff --git a/fs/namei.c b/fs/namei.c
index f793fe4..e18a2b5 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -242,6 +242,7 @@ getname_kernel(const char * filename)
memcpy((char *)result->name, filename, len);
result->uptr = NULL;
result->aname = NULL;
+   audit_getname(result);
 
return result;
 }
diff --git a/kernel/auditsc.c b/kernel/auditsc.c
index 793e9e9..c967ffc 100644
--- a/kernel/auditsc.c
+++ b/kernel/auditsc.c
@@ -1882,44 +1882,10 @@ out_alloc:
n = audit_alloc_name(context, AUDIT_TYPE_UNKNOWN);
if (!n)
return;
-   /* unfortunately, while we may have a path name to record with the
-* inode, we can't always rely on the string lasting until the end of
-* the syscall so we need to create our own copy, it may fail due to
-* memory allocation issues, but we do our best */
-   if (name) {
-   /* we can't use getname_kernel() due to size limits */
-   size_t len = strlen(name->name) + 1;
-   struct filename *new = __getname();
-
-   if (unlikely(!new))
-   goto out;
+   if (name)
+   /* no need to set ->name_put as the original will cleanup */
+   n->name = name;
 
-   if (len <= (PATH_MAX - sizeof(*new))) {
-   new->name = (char *)(new) + sizeof(*new);
-   new->separate = false;
-   } else if (len <= PATH_MAX) {
-   /* this looks odd, but is due to final_putname() */
-   struct filename *new2;
-
-   new2 = kmalloc(sizeof(*new2), GFP_KERNEL);
-   if (unlikely(!new2)) {
-   __putname(new);
-   goto out;
-   }
-   new2->name = (char *)new;
-   new2->separate = true;
-   new = new2;
-   } else {
-   /* we should never get here, but let's be safe */
-   __putname(new);
-   goto out;
-   }
-   strlcpy((char *)new->name, name->name, len);
-   new->uptr = NULL;
-   new->aname = n;
-   n->name = new;
-   n->name_put = true;
-   }
 out:
if (parent) {
n->name_len = n->name ? parent_len(n->name->name) : 
AUDIT_NAME_FULL;

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 0/5] Overhaul the audit filename handling

2015-01-21 Thread Paul Moore
This patchset has some important changes from the previous revision,
namely a fix from Al Viro (included in 2/5) that resolves a boot panic
on some systems as well as some smaller, less noteworthy fixes found
in the linux-next announcement thread from January 20th (refcount bump
in __audit_reusename() and a inode type in __audit_inode()).

This patchset still needs some additional testing to verify that the
audit code still functions properly (the minor fixes mentioned above)
and there is an additional patch from Al that should be included as
well, but I wanted to post this and push the series to the audit next
branch quickly since a number of folks were affected by the boot panic.

---

Paul Moore (5):
  fs: rework getname_kernel to handle up to PATH_MAX sized filenames
  fs: create proper filename objects using getname_kernel()
  audit: enable filename recording via getname_kernel()
  audit: fix filename matching in __audit_inode() and __audit_inode_child()
  audit: replace getname()/putname() hacks with reference counters


 fs/exec.c |   11 +++
 fs/namei.c|  144 -
 fs/open.c |   11 +++
 include/linux/audit.h |3 -
 include/linux/fs.h|9 +--
 kernel/audit.h|   17 +
 kernel/auditsc.c  |  171 ++---
 7 files changed, 155 insertions(+), 211 deletions(-)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


linux-next: manual merge of the kvm-arm tree with the rcu tree

2015-01-21 Thread Stephen Rothwell
Hi all,

Today's linux-next merge of the kvm-arm tree got a conflict in
arch/arm/kvm/Kconfig between commit 83fe27ea5311 ("rcu: Make SRCU
optional by using CONFIG_SRCU") from the rcu tree and commit
53c810c364d7 ("KVM: arm: dirty logging write protect support") from the
kvm-arm tree.

I fixed it up (see below) and can carry the fix as necessary (no action
is required).

-- 
Cheers,
Stephen Rothwells...@canb.auug.org.au

diff --cc arch/arm/kvm/Kconfig
index 3afee5f40f4f,a8d1ace3ea51..
--- a/arch/arm/kvm/Kconfig
+++ b/arch/arm/kvm/Kconfig
@@@ -21,9 -21,10 +21,11 @@@ config KV
select PREEMPT_NOTIFIERS
select ANON_INODES
select HAVE_KVM_CPU_RELAX_INTERCEPT
+   select HAVE_KVM_ARCH_TLB_FLUSH_ALL
select KVM_MMIO
select KVM_ARM_HOST
+   select KVM_GENERIC_DIRTYLOG_READ_PROTECT
 +  select SRCU
depends on ARM_VIRT_EXT && ARM_LPAE
---help---
  Support hosting virtualized guest machines. You will also


pgpRZq2RtxAMq.pgp
Description: OpenPGP digital signature


[PATCH v2 5/5] audit: replace getname()/putname() hacks with reference counters

2015-01-21 Thread Paul Moore
In order to ensure that filenames are not released before the audit
subsystem is done with the strings there are a number of hacks built
into the fs and audit subsystems around getname() and putname().  To
say these hacks are "ugly" would be kind.

This patch removes the filename hackery in favor of a more
conventional reference count based approach.  The diffstat below tells
most of the story; lots of audit/fs specific code is replaced with a
traditional reference count based approach that is easily understood,
even by those not familiar with the audit and/or fs subsystems.

CC: v...@zeniv.linux.org.uk
CC: linux-fsde...@vger.kernel.org
Signed-off-by: Paul Moore 
---
 fs/namei.c|   29 +++---
 include/linux/audit.h |3 -
 include/linux/fs.h|9 +---
 kernel/audit.h|   17 +---
 kernel/auditsc.c  |  105 +
 5 files changed, 29 insertions(+), 134 deletions(-)

diff --git a/fs/namei.c b/fs/namei.c
index e18a2b5..f73e757 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -117,15 +117,6 @@
  * POSIX.1 2.4: an empty pathname is invalid (ENOENT).
  * PATH_MAX includes the nul terminator --RR.
  */
-void final_putname(struct filename *name)
-{
-   if (name->separate) {
-   __putname(name->name);
-   kfree(name);
-   } else {
-   __putname(name);
-   }
-}
 
 #define EMBEDDED_NAME_MAX  (PATH_MAX - sizeof(struct filename))
 
@@ -144,6 +135,7 @@ getname_flags(const char __user *filename, int flags, int 
*empty)
result = __getname();
if (unlikely(!result))
return ERR_PTR(-ENOMEM);
+   result->refcnt = 1;
 
/*
 * First, try to embed the struct filename inside the names_cache
@@ -178,6 +170,7 @@ recopy:
}
result->name = kname;
result->separate = true;
+   result->refcnt = 1;
max = PATH_MAX;
goto recopy;
}
@@ -201,7 +194,7 @@ recopy:
return result;
 
 error:
-   final_putname(result);
+   putname(result);
return err;
 }
 
@@ -242,19 +235,25 @@ getname_kernel(const char * filename)
memcpy((char *)result->name, filename, len);
result->uptr = NULL;
result->aname = NULL;
+   result->refcnt = 1;
audit_getname(result);
 
return result;
 }
 
-#ifdef CONFIG_AUDITSYSCALL
 void putname(struct filename *name)
 {
-   if (unlikely(!audit_dummy_context()))
-   return audit_putname(name);
-   final_putname(name);
+   BUG_ON(name->refcnt <= 0);
+
+   if (--name->refcnt > 0)
+   return;
+
+   if (name->separate) {
+   __putname(name->name);
+   kfree(name);
+   } else
+   __putname(name);
 }
-#endif
 
 static int check_acl(struct inode *inode, int mask)
 {
diff --git a/include/linux/audit.h b/include/linux/audit.h
index b481779..5f2ad5f 100644
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -127,7 +127,6 @@ extern void __audit_syscall_entry(int major, unsigned long 
a0, unsigned long a1,
 extern void __audit_syscall_exit(int ret_success, long ret_value);
 extern struct filename *__audit_reusename(const __user char *uptr);
 extern void __audit_getname(struct filename *name);
-extern void audit_putname(struct filename *name);
 
 #define AUDIT_INODE_PARENT 1   /* dentry represents the parent */
 #define AUDIT_INODE_HIDDEN 2   /* audit record should be hidden */
@@ -346,8 +345,6 @@ static inline struct filename *audit_reusename(const __user 
char *name)
 }
 static inline void audit_getname(struct filename *name)
 { }
-static inline void audit_putname(struct filename *name)
-{ }
 static inline void __audit_inode(struct filename *name,
const struct dentry *dentry,
unsigned int flags)
diff --git a/include/linux/fs.h b/include/linux/fs.h
index e11d60c..df7a047 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -2017,6 +2017,7 @@ struct filename {
const char  *name;  /* pointer to actual string */
const __user char   *uptr;  /* original userland pointer */
struct audit_names  *aname;
+   int refcnt;
boolseparate; /* should "name" be freed? */
 };
 
@@ -2036,6 +2037,7 @@ extern int filp_close(struct file *, fl_owner_t id);
 
 extern struct filename *getname(const char __user *);
 extern struct filename *getname_kernel(const char *);
+extern void putname(struct filename *name);
 
 enum {
FILE_CREATED = 1,
@@ -2056,15 +2058,8 @@ extern void __init vfs_caches_init(unsigned long);
 
 extern struct kmem_cache *names_cachep;
 
-extern void final_putname(struct filename *name);
-
 #define __getname()kmem_cache_alloc(names_cachep, GFP_KERNEL)
 #define __putname(name)

[PATCH v2 1/5] fs: rework getname_kernel to handle up to PATH_MAX sized filenames

2015-01-21 Thread Paul Moore
In preparation for expanded use in the kernel, make getname_kernel()
more useful by allowing it to handle any legal filename length.

Thanks to Guenter Roeck for his suggestion to substitute memcpy() for
strlcpy().

CC: li...@roeck-us.net
CC: v...@zeniv.linux.org.uk
CC: linux-fsde...@vger.kernel.org
Signed-off-by: Paul Moore 
---
 fs/namei.c |   34 --
 1 file changed, 20 insertions(+), 14 deletions(-)

diff --git a/fs/namei.c b/fs/namei.c
index 9eb787e..63eaaf6 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -211,32 +211,38 @@ getname(const char __user * filename)
return getname_flags(filename, 0, NULL);
 }
 
-/*
- * The "getname_kernel()" interface doesn't do pathnames longer
- * than EMBEDDED_NAME_MAX. Deal with it - you're a kernel user.
- */
 struct filename *
 getname_kernel(const char * filename)
 {
struct filename *result;
-   char *kname;
-   int len;
-
-   len = strlen(filename);
-   if (len >= EMBEDDED_NAME_MAX)
-   return ERR_PTR(-ENAMETOOLONG);
+   int len = strlen(filename) + 1;
 
result = __getname();
if (unlikely(!result))
return ERR_PTR(-ENOMEM);
 
-   kname = (char *)result + sizeof(*result);
-   result->name = kname;
+   if (len <= EMBEDDED_NAME_MAX) {
+   result->name = (char *)(result) + sizeof(*result);
+   result->separate = false;
+   } else if (len <= PATH_MAX) {
+   struct filename *tmp;
+
+   tmp = kmalloc(sizeof(*tmp), GFP_KERNEL);
+   if (unlikely(!tmp)) {
+   __putname(result);
+   return ERR_PTR(-ENOMEM);
+   }
+   tmp->name = (char *)result;
+   tmp->separate = true;
+   result = tmp;
+   } else {
+   __putname(result);
+   return ERR_PTR(-ENAMETOOLONG);
+   }
+   memcpy((char *)result->name, filename, len);
result->uptr = NULL;
result->aname = NULL;
-   result->separate = false;
 
-   strlcpy(kname, filename, EMBEDDED_NAME_MAX);
return result;
 }
 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 2/5] fs: create proper filename objects using getname_kernel()

2015-01-21 Thread Paul Moore
There are several areas in the kernel that create temporary filename
objects using the following pattern:

int func(const char *name)
{
struct filename *file = { .name = name };
...
return 0;
}

... which for the most part works okay, but it causes havoc within the
audit subsystem as the filename object does not persist beyond the
lifetime of the function.  This patch converts all of these temporary
filename objects into proper filename objects using getname_kernel()
and putname() which ensure that the filename object persists until the
audit subsystem is finished with it.

Also, a special thanks to Al Viro, Guenter Roeck, and Sabrina Dubroca
for helping resolve a difficult kernel panic on boot related to a
use-after-free problem in kern_path_create(); the thread can be seen
at the link below:

 * https://lkml.org/lkml/2015/1/20/710

This patch includes code that was either based on, or directly written
by Al in the above thread.

CC: v...@zeniv.linux.org.uk
CC: li...@roeck-us.net
CC: s...@queasysnail.net
CC: linux-fsde...@vger.kernel.org
Signed-off-by: Paul Moore 
---
 fs/exec.c  |   11 +++-
 fs/namei.c |   80 +++-
 fs/open.c  |   11 +++-
 3 files changed, 81 insertions(+), 21 deletions(-)

diff --git a/fs/exec.c b/fs/exec.c
index a3d33fe..d067771 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -789,8 +789,15 @@ exit:
 
 struct file *open_exec(const char *name)
 {
-   struct filename tmp = { .name = name };
-   return do_open_exec();
+   struct file *file;
+   struct filename *tmp;
+
+   tmp = getname_kernel(name);
+   if (unlikely(IS_ERR(tmp)))
+   return (void *)tmp;
+   file = do_open_exec(tmp);
+   putname(tmp);
+   return file;
 }
 EXPORT_SYMBOL(open_exec);
 
diff --git a/fs/namei.c b/fs/namei.c
index 63eaaf6..f793fe4 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -2001,31 +2001,50 @@ static int filename_lookup(int dfd, struct filename 
*name,
 static int do_path_lookup(int dfd, const char *name,
unsigned int flags, struct nameidata *nd)
 {
-   struct filename filename = { .name = name };
+   int retval;
+   struct filename *filename;
 
-   return filename_lookup(dfd, , flags, nd);
+   filename = getname_kernel(name);
+   if (unlikely(IS_ERR(filename)))
+   return PTR_ERR(filename);
+   retval = filename_lookup(dfd, filename, flags, nd);
+   putname(filename);
+   return retval;
 }
 
 /* does lookup, returns the object with parent locked */
 struct dentry *kern_path_locked(const char *name, struct path *path)
 {
+   struct filename *filename;
struct nameidata nd;
struct dentry *d;
-   int err = do_path_lookup(AT_FDCWD, name, LOOKUP_PARENT, );
-   if (err)
-   return ERR_PTR(err);
+   int err;
+
+   filename = getname_kernel(name);
+   if (IS_ERR(filename))
+   return ERR_CAST(filename);
+
+   err = filename_lookup(AT_FDCWD, filename, LOOKUP_PARENT, );
+   if (err) {
+   d = ERR_PTR(err);
+   goto out;
+   }
if (nd.last_type != LAST_NORM) {
path_put();
-   return ERR_PTR(-EINVAL);
+   d = ERR_PTR(-EINVAL);
+   goto out;
}
mutex_lock_nested(>d_inode->i_mutex, I_MUTEX_PARENT);
d = __lookup_hash(, nd.path.dentry, 0);
if (IS_ERR(d)) {
mutex_unlock(>d_inode->i_mutex);
path_put();
-   return d;
+   goto out;
}
*path = nd.path;
+
+out:
+   putname(filename);
return d;
 }
 
@@ -2368,8 +2387,15 @@ int
 kern_path_mountpoint(int dfd, const char *name, struct path *path,
unsigned int flags)
 {
-   struct filename s = {.name = name};
-   return filename_mountpoint(dfd, , path, flags);
+   int retval;
+   struct filename *s;
+
+   s = getname_kernel(name);
+   if (unlikely(IS_ERR(s)))
+   return PTR_ERR(s);
+   retval = filename_mountpoint(dfd, s, path, flags);
+   putname(s);
+   return retval;
 }
 EXPORT_SYMBOL(kern_path_mountpoint);
 
@@ -3259,7 +3285,7 @@ struct file *do_file_open_root(struct dentry *dentry, 
struct vfsmount *mnt,
 {
struct nameidata nd;
struct file *file;
-   struct filename filename = { .name = name };
+   struct filename *filename;
int flags = op->lookup_flags | LOOKUP_ROOT;
 
nd.root.mnt = mnt;
@@ -3268,16 +3294,22 @@ struct file *do_file_open_root(struct dentry *dentry, 
struct vfsmount *mnt,
if (d_is_symlink(dentry) && op->intent & LOOKUP_OPEN)
return ERR_PTR(-ELOOP);
 
-   file = path_openat(-1, , , op, flags | LOOKUP_RCU);
+   filename = getname_kernel(name);
+   if (unlikely(IS_ERR(filename)))
+   return 

Re: [PATCH v3] thermal: rockchip: make temperature reporting much more accurate

2015-01-21 Thread Caesar Wang


在 2015年01月22日 12:25, Daniel Kurtz 写道:

On Thu, Jan 22, 2015 at 12:21 PM, Caesar Wang
 wrote:

在 2015年01月22日 12:01, Daniel Kurtz 写道:


On Thu, Jan 22, 2015 at 1:29 AM, Caesar Wang  wrote:

In general, the kernel should report temperature readings exactly as
reported by the hardware. The cpu / gpu thermal driver works in 5 degree
increments,but we ought to do more accurate. The temperature will do
linear interpolation between the entries in the table.

Test= $md5sum /dev/zero &
$while true; do grep "" /sys/class/thermal/thermal_zone[1-2]/temp;
sleep .5; done

e.g. We can get the result as follows:
  /sys/class/thermal/thermal_zone1/temp:39994
  /sys/class/thermal/thermal_zone2/temp:39086
  /sys/class/thermal/thermal_zone1/temp:39994
  /sys/class/thermal/thermal_zone2/temp:39540
  /sys/class/thermal/thermal_zone1/temp:39540
  /sys/class/thermal/thermal_zone2/temp:39540
  /sys/class/thermal/thermal_zone1/temp:39540
  /sys/class/thermal/thermal_zone2/temp:39994

Signed-off-by: Caesar Wang 
Reviewed-by: Dmitry Torokhov 

---

Changes in v3:
Suggested-by Daniel Kurtz,
the check doesn't reject "code == 0xfff"
Fixed in rk_tsadcv2_code_to_temp(u32 code)

Changes in v2:
Reviewed-by: Dmitry Torokhov 

   drivers/thermal/rockchip_thermal.c | 32
++--
   1 file changed, 22 insertions(+), 10 deletions(-)

diff --git a/drivers/thermal/rockchip_thermal.c
b/drivers/thermal/rockchip_thermal.c
index 1bcddfc..ce18007 100644
--- a/drivers/thermal/rockchip_thermal.c
+++ b/drivers/thermal/rockchip_thermal.c
@@ -193,19 +193,22 @@ static u32 rk_tsadcv2_temp_to_code(long temp)

   static long rk_tsadcv2_code_to_temp(u32 code)
   {
-   int high, low, mid;
-
-   low = 0;
-   high = ARRAY_SIZE(v2_code_table) - 1;
-   mid = (high + low) / 2;
+   unsigned int low = 0;
+   unsigned int high = ARRAY_SIZE(v2_code_table) - 1;
+   unsigned int mid = (low + high) / 2;
+   unsigned int num;
+   unsigned long denom;

+   /* No code available, return callback */
  if (code > v2_code_table[low].code || code <
v2_code_table[high].code)
-   return 125000; /* No code available, return max
temperature */
+   return rk_tsadcv2_code_to_temp(code);

Isn't this an infinite recursion?


No, I think we can try check if it  is happened.
Maybe we can return a warning/error for it.

I mean, if the 'if' condition is true, then this will just call the
same function again with the same code, and again, and again...
Just return an error code here, -ENOENT maybe?
I am not sure what error code is appropriate.


Maybe "return -EAGAIN"



  while (low <= high) {
-   if (code >= v2_code_table[mid].code && code <
-   v2_code_table[mid - 1].code)
-   return v2_code_table[mid].temp;
+   if (code >= v2_code_table[mid].code &&
+   code < v2_code_table[mid - 1].code)
+   break;
+   else if (code == TSADCV2_DATA_MASK)
+   break;
  else if (code < v2_code_table[mid].code)
  low = mid + 1;
  else
@@ -213,7 +216,16 @@ static long rk_tsadcv2_code_to_temp(u32 code)
  mid = (low + high) / 2;
  }

-   return 125000;
+   /*
+* The 5C granularity provided by the table is too much. Let's
+* assume that the relationship between sensor readings and
+* temperature between 2 table entries is linear and interpolate
+* to produce less granular result.
+*/
+   num = v2_code_table[mid].temp - v2_code_table[mid - 1].temp;
+   num *= v2_code_table[mid - 1].code - code;
+   denom = v2_code_table[mid - 1].code - v2_code_table[mid].code;
+   return v2_code_table[mid - 1].temp + (num / denom);
   }

   /**
--
1.9.1





--
Best regards
Caesar Wang (王晓腾)
福州瑞芯微电子有限公司
Fuzhou Rockchip Electronics Co.Ltd
福建省福州市铜盘路软件大道89号软件园A区18号楼(350003)
Addr:No.18 Building, A District, No.89, software Boulevard Fuzhou,
Fujian,PRC
Email:w...@rock-chips.com
Tel:+86-591-83991906/07->8221



___
Linux-rockchip mailing list
linux-rockc...@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 4/5] audit: fix filename matching in __audit_inode() and __audit_inode_child()

2015-01-21 Thread Paul Moore
In all likelihood there were some subtle, and perhaps not so subtle,
bugs with filename matching in audit_inode() and audit_inode_child()
for some time, however, recent changes to the audit filename code have
definitely broken the filename matching code.  The breakage could
result in duplicate filenames in the audit log and other odd audit
record entries.  This patch fixes the filename matching code and
restores some sanity to the filename audit records.

CC: v...@zeniv.linux.org.uk
CC: linux-fsde...@vger.kernel.org
Signed-off-by: Paul Moore 
---
 kernel/auditsc.c |   34 +-
 1 file changed, 25 insertions(+), 9 deletions(-)

diff --git a/kernel/auditsc.c b/kernel/auditsc.c
index c967ffc..c54b5f0 100644
--- a/kernel/auditsc.c
+++ b/kernel/auditsc.c
@@ -1846,6 +1846,7 @@ void __audit_inode(struct filename *name, const struct 
dentry *dentry,
/* The struct filename _must_ have a populated ->name */
BUG_ON(!name->name);
 #endif
+
/*
 * If we have a pointer to an audit_names entry already, then we can
 * just use it directly if the type is correct.
@@ -1863,7 +1864,17 @@ void __audit_inode(struct filename *name, const struct 
dentry *dentry,
}
 
list_for_each_entry_reverse(n, >names_list, list) {
-   if (!n->name || strcmp(n->name->name, name->name))
+   if (n->ino) {
+   /* valid inode number, use that for the comparison */
+   if (n->ino != inode->i_ino ||
+   n->dev != inode->i_sb->s_dev)
+   continue;
+   } else if (n->name) {
+   /* inode number has not been set, check the name */
+   if (strcmp(n->name->name, name->name))
+   continue;
+   } else
+   /* no inode and no name (?!) ... this is odd ... */
continue;
 
/* match the correct record type */
@@ -1931,11 +1942,16 @@ void __audit_inode_child(const struct inode *parent,
 
/* look for a parent entry first */
list_for_each_entry(n, >names_list, list) {
-   if (!n->name || n->type != AUDIT_TYPE_PARENT)
+   if (!n->name ||
+   (n->type != AUDIT_TYPE_PARENT &&
+n->type != AUDIT_TYPE_UNKNOWN))
continue;
 
-   if (n->ino == parent->i_ino &&
-   !audit_compare_dname_path(dname, n->name->name, 
n->name_len)) {
+   if (n->ino == parent->i_ino && n->dev == parent->i_sb->s_dev &&
+   !audit_compare_dname_path(dname,
+ n->name->name, n->name_len)) {
+   if (n->type == AUDIT_TYPE_UNKNOWN)
+   n->type = AUDIT_TYPE_PARENT;
found_parent = n;
break;
}
@@ -1944,11 +1960,8 @@ void __audit_inode_child(const struct inode *parent,
/* is there a matching child entry? */
list_for_each_entry(n, >names_list, list) {
/* can only match entries that have a name */
-   if (!n->name || n->type != type)
-   continue;
-
-   /* if we found a parent, make sure this one is a child of it */
-   if (found_parent && (n->name != found_parent->name))
+   if (!n->name ||
+   (n->type != type && n->type != AUDIT_TYPE_UNKNOWN))
continue;
 
if (!strcmp(dname, n->name->name) ||
@@ -1956,6 +1969,8 @@ void __audit_inode_child(const struct inode *parent,
found_parent ?
found_parent->name_len :
AUDIT_NAME_FULL)) {
+   if (n->type == AUDIT_TYPE_UNKNOWN)
+   n->type = type;
found_child = n;
break;
}
@@ -1984,6 +1999,7 @@ void __audit_inode_child(const struct inode *parent,
found_child->name_put = false;
}
}
+
if (inode)
audit_copy_inode(found_child, dentry, inode);
else

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [alsa-devel][PATCH 2/3] ASoC: fsl_sai: Add support for tdm slots operation

2015-01-21 Thread Zidan Wang
On Wed, Jan 21, 2015 at 10:08:03AM -0800, Nicolin Chen wrote:
> On Tue, Jan 20, 2015 at 08:21:19PM +0800, Zidan Wang wrote:
> > @@ -369,10 +380,25 @@ static int fsl_sai_hw_params(struct snd_pcm_substream 
> > *substream,
> > u32 word_width = snd_pcm_format_width(params_format(params));
> > u32 val_cr4 = 0, val_cr5 = 0;
> > int ret;
> > +   u32 bclk;
> > +
> > +   if (channels == 1)
> > +   channels = 2;
> > +
> > +   if (!sai->slots || sai->slots % channels)
> > +   sai->slots = channels;
> > +
> > +   sai->slots = sai->slots / channels;
> > +
> > +   if (sai->slot_width < word_width || sai->is_dsp_mode)
> > +   sai->slot_width = word_width;
> 
> Could you pls explain a bit what's this overriding for?
> Or it might be better to put into a comment.
>
In machine driver, we should use snd_soc_dai_set_tdm_slot to set slots
and slot width. In my opinion, slots in machine driver means the slot
number of all channels. But in sai driver, the slots means the slot number
of one channel. So snd_soc_calc_bclk use fs*sample_size*channels*tdm_slots
to caculate bclk.

So i use "sai->slots = sai->slots / channels" to calculate slots per channel. 
If we missing set slots, use channel number to set slots and get one slot per 
channel. If we missing set slot width, set default slot width to word width. 

If slot width is 32 and wrod width is 16, for 2 channels and one slot
per channel, it will be 64 bit clock for one frame.

val_cr5 |= FSL_SAI_CR5_WNW(sai->slot_width).
val_cr5 |= FSL_SAI_CR5_W0W(sai->slot_width);

So sai word length is 32, it will trans 32 bit data per channel. But dma only
trans 16 bit data to fifo, the continues 16 bit will be 0. So for 16 bit data 
formate, it will just one channel has data. When it is dsp mode, let slot
width equal to word width can fix the issue.


> Nicolin
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH V2 1/3] perf symbols: Ignore mapping symbols on aarch64

2015-01-21 Thread Victor Kamensky
Aarch64 ELF files use mapping symbols with special names $x, $d
to identify regions of Aarch64 code (see Aarch64 ELF ABI - "ARM
IHI 0056B", section "4.5.4 Mapping symbols").

The patch filters out these symbols at load time, similar to
"696b97a perf symbols: Ignore mapping symbols on ARM" changes
done for ARM before V8.

Signed-off-by: Victor Kamensky 
Cc: Peter Zijlstra 
Cc: Paul Mackerras 
Cc: Ingo Molnar 
Cc: Arnaldo Carvalho de Melo 
Cc: Adrian Hunter 
Cc: Jiri Olsa 
Cc: Namhyung Kim 
Cc: Avi Kivity 
Cc: Masami Hiramatsu 
Cc: Anton Blanchard 
Cc: David Ahern 
Cc: Will Deacon 
Cc: Dave Martin 
Acked-by: Will Deacon 
---
 tools/perf/util/symbol-elf.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c
index 06fcd1b..1e188dd 100644
--- a/tools/perf/util/symbol-elf.c
+++ b/tools/perf/util/symbol-elf.c
@@ -862,6 +862,14 @@ int dso__load_sym(struct dso *dso, struct map *map,
!strcmp(elf_name, "$t"))
continue;
}
+   /* Reject Aarch64 ELF "mapping symbols": these aren't unique and
+* don't identify functions, so will confuse the profile
+* output: */
+   if (ehdr.e_machine == EM_AARCH64) {
+   if (!strcmp(elf_name, "$x") ||
+   !strcmp(elf_name, "$d"))
+   continue;
+   }
 
if (runtime_ss->opdsec && sym.st_shndx == runtime_ss->opdidx) {
u32 offset = sym.st_value - syms_ss->opdshdr.sh_addr;
-- 
1.9.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH V2 2/3] perf symbols: improve abi compliance in arm mapping symbols handling

2015-01-21 Thread Victor Kamensky
Both Arm and Aarch64 ELF ABI allow mapping symbols be in from
either "$d" or "$d.". But current code that handles mapping
symbols only deals with the first, dollar character and a single
letter, case.

The patch adds handling of the second case with period
followed by any characters.

Suggested-by: Russell King 
Suggested-by: Will Deacon 
Signed-off-by: Victor Kamensky 
Acked-by: Will Deacon 
Cc: Peter Zijlstra 
Cc: Paul Mackerras 
Cc: Ingo Molnar 
Cc: Arnaldo Carvalho de Melo 
Cc: Adrian Hunter 
Cc: Jiri Olsa 
Cc: Namhyung Kim 
Cc: Avi Kivity 
Cc: Masami Hiramatsu 
Cc: Anton Blanchard 
Cc: David Ahern 
Cc: Dave Martin 
---
 tools/perf/util/symbol-elf.c | 9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c
index 1e188dd..7fd35d6 100644
--- a/tools/perf/util/symbol-elf.c
+++ b/tools/perf/util/symbol-elf.c
@@ -857,17 +857,16 @@ int dso__load_sym(struct dso *dso, struct map *map,
 * don't identify functions, so will confuse the profile
 * output: */
if (ehdr.e_machine == EM_ARM) {
-   if (!strcmp(elf_name, "$a") ||
-   !strcmp(elf_name, "$d") ||
-   !strcmp(elf_name, "$t"))
+   if (elf_name[0] == '$' && strchr("adt", elf_name[1])
+   && (elf_name[2] == '\0' || elf_name[2] == '.'))
continue;
}
/* Reject Aarch64 ELF "mapping symbols": these aren't unique and
 * don't identify functions, so will confuse the profile
 * output: */
if (ehdr.e_machine == EM_AARCH64) {
-   if (!strcmp(elf_name, "$x") ||
-   !strcmp(elf_name, "$d"))
+   if (elf_name[0] == '$' && strchr("dx", elf_name[1])
+   && (elf_name[2] == '\0' || elf_name[2] == '.'))
continue;
}
 
-- 
1.9.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH V2 3/3] perf symbols: debuglink should take symfs option into account

2015-01-21 Thread Victor Kamensky
Currently code that tries to read corresponding debug symbol
file from .gnu_debuglink section (DSO_BINARY_TYPE__DEBUGLINK)
does not take in account symfs option, so filename__read_debuglink
function cannot open ELF file, if symfs option is used.

Fix is to add proper handling of symfs as it is done in other
places: use __symbol__join_symfs function to get real file name
of target ELF file.

Signed-off-by: Victor Kamensky 
Cc: Peter Zijlstra 
Cc: Paul Mackerras 
Cc: Ingo Molnar 
Cc: Arnaldo Carvalho de Melo 
Cc: Jiri Olsa 
Cc: Namhyung Kim 
Cc: Adrian Hunter 
Cc: Waiman Long 
Cc: David Ahern 
Acked-and-tested-by: David Ahern 
---
 tools/perf/util/dso.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c
index 45be944..ca8d8d5 100644
--- a/tools/perf/util/dso.c
+++ b/tools/perf/util/dso.c
@@ -45,13 +45,13 @@ int dso__read_binary_type_filename(const struct dso *dso,
case DSO_BINARY_TYPE__DEBUGLINK: {
char *debuglink;
 
-   strncpy(filename, dso->long_name, size);
-   debuglink = filename + dso->long_name_len;
+   len = __symbol__join_symfs(filename, size, dso->long_name);
+   debuglink = filename + len;
while (debuglink != filename && *debuglink != '/')
debuglink--;
if (*debuglink == '/')
debuglink++;
-   ret = filename__read_debuglink(dso->long_name, debuglink,
+   ret = filename__read_debuglink(filename, debuglink,
   size - (debuglink - filename));
}
break;
-- 
1.9.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH V2 0/3] perf symbols: debuglink and arm mapping symbols changes

2015-01-21 Thread Victor Kamensky
Hi Folks,

Here is second version of mini-series that addresses couple issues
in perf symbols handling.

Changes since V1:

o 'perf symbols: Ignore mapping symbols on aarch64': based on feedback
from Will Deacon and Russell King [1] added code that handles ARM/Aarch64
mapping symbols like "$d.". Code uses similar snipet to handle
ARM mapping symbols as in another places in kernel, but it has its
own version of the code. Added proper Acked-by.

o 'perf symbols: debuglink should take symfs option into account':
based on feedback from David Ahern [2] picked more simple version that
does not make malloced copy of 'filename', that makes patch simpler.
Added proper 'Acked-and-tested-by'.

[1] https://lkml.org/lkml/2015/1/13/507

[2] https://lkml.org/lkml/2015/1/13/508

Victor Kamensky (3):
  perf symbols: Ignore mapping symbols on aarch64
  perf symbols: improve abi compliance in arm mapping symbols handling
  perf symbols: debuglink should take symfs option into account

 tools/perf/util/dso.c|  6 +++---
 tools/perf/util/symbol-elf.c | 13 ++---
 2 files changed, 13 insertions(+), 6 deletions(-)

-- 
1.9.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: linux-next: Tree for Jan 20 -- Kernel panic - Unable to mount root fs

2015-01-21 Thread Paul Moore
On Thursday, January 22, 2015 04:12:41 AM Al Viro wrote:
> On Wed, Jan 21, 2015 at 09:28:51PM -0500, Paul Moore wrote:
> > Al, do you mind if I fold your patch below into the existing patches?
> 
> No problem, but I'd probably prefer to put this series through vfs.git.
> With the following as the first step:

I just finished fixing up the patchset and giving it a quick sanity test on my 
system, some additional testing is still needed to verify that all the audit 
stuff is still okay (I did change the __audit_inode() as discussed and bumped 
the refcount in __audit_reusename()) but I think as things stand the boot 
panic problems should be resolved - thanks again for your help.

I'm going to (re)post what I've currently got for a patchset and call it a 
day.  Tomorrow I'll add your below patch and finish up my testing, if all goes 
well I'll repost the whole set.  If you would prefer it to go via the VFS 
tree, that's fine with me, as long as it hits Linus' tree at some point I'm 
happy.

> Cut down on do_path_lookup() callers
> 
> Use filename_lookup() instead.  And don't bother with creating new
> struct filename when caller already has one.
> 
> Signed-off-by: Al Viro 
> ---
> diff --git a/fs/namei.c b/fs/namei.c
> index bc35b02..73fcf42 100644
> --- a/fs/namei.c
> +++ b/fs/namei.c
> @@ -2046,7 +2046,8 @@ struct dentry *kern_path_locked(const char *name,
> struct path *path) {
>   struct nameidata nd;
>   struct dentry *d;
> - int err = do_path_lookup(AT_FDCWD, name, LOOKUP_PARENT, );
> + struct filename filename = {.name = name};
> + int err = filename_lookup(AT_FDCWD, , LOOKUP_PARENT, );
>   if (err)
>   return ERR_PTR(err);
>   if (nd.last_type != LAST_NORM) {
> @@ -3290,7 +3291,7 @@ struct file *do_file_open_root(struct dentry *dentry,
> struct vfsmount *mnt, return file;
>  }
> 
> -struct dentry *kern_path_create(int dfd, const char *pathname,
> +static struct dentry *filename_create(int dfd, struct filename *name,
>   struct path *path, unsigned int lookup_flags)
>  {
>   struct dentry *dentry = ERR_PTR(-EEXIST);
> @@ -3305,7 +3306,7 @@ struct dentry *kern_path_create(int dfd, const char
> *pathname, */
>   lookup_flags &= LOOKUP_REVAL;
> 
> - error = do_path_lookup(dfd, pathname, LOOKUP_PARENT|lookup_flags, );
> + error = filename_lookup(dfd, name, LOOKUP_PARENT|lookup_flags, );
>   if (error)
>   return ERR_PTR(error);
> 
> @@ -3359,6 +3360,13 @@ out:
>   path_put();
>   return dentry;
>  }
> +
> +struct dentry *kern_path_create(int dfd, const char *pathname,
> + struct path *path, unsigned int lookup_flags)
> +{
> + struct filename filename = {.name = pathname};
> + return filename_create(dfd, , path, lookup_flags);
> +}
>  EXPORT_SYMBOL(kern_path_create);
> 
>  void done_path_create(struct path *path, struct dentry *dentry)
> @@ -3377,7 +3385,7 @@ struct dentry *user_path_create(int dfd, const char
> __user *pathname, struct dentry *res;
>   if (IS_ERR(tmp))
>   return ERR_CAST(tmp);
> - res = kern_path_create(dfd, tmp->name, path, lookup_flags);
> + res = filename_create(dfd, tmp, path, lookup_flags);
>   putname(tmp);
>   return res;
>  }

-- 
paul moore
security @ redhat

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] MAINTAINERS: update Qualcomm support entry

2015-01-21 Thread Joe Perches
On Wed, 2015-01-21 at 22:39 -0600, Andy Gross wrote:
> Added myself as a co-maintainer.  Updated the files to include the Qualcomm 
> SoC
> directory.  Added linux-soc mailing list.
[]
> diff --git a/MAINTAINERS b/MAINTAINERS
[]
> @@ -1284,9 +1284,12 @@ S: Maintained
>  ARM/QUALCOMM SUPPORT
>  M:   Kumar Gala 
>  M:   David Brown 
> +M:   Andy Gross 
>  L:   linux-arm-...@vger.kernel.org
> +L:   linux-...@vger.kernel.org
>  S:   Maintained
>  F:   arch/arm/mach-qcom/
> +F:   drivers/soc/qcom

Please add a terminating /

F:  drivers/soc/qcom/


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] ARM: DMA: Fix kzalloc flags in __iommu_alloc_buffer()

2015-01-21 Thread Alexandre Courbot
On Tue, Jan 13, 2015 at 8:20 PM, Marek Szyprowski
 wrote:
> Hello,
>
> On 2015-01-13 09:45, Alexandre Courbot wrote:
>>
>> Ping? This patch still seems to be needed as of today...
>
>
> Arnd, could you take this patch together with your other pending
> dma-mapping.h changes?

Arnd, gentle ping on this?

>
>
>> On Thu, Dec 11, 2014 at 8:12 PM, Marek Szyprowski
>>  wrote:
>>>
>>> On 2014-12-08 09:39, Alexandre Courbot wrote:

 There doesn't seem to be any valid reason to allocate the pages array
 with the same flags as the buffer itself. Doing so can eventually lead
 to the following safeguard in mm/slab.c to be hit:

 BUG_ON(flags & GFP_SLAB_BUG_MASK);

 This happens when buffers are allocated with __GFP_DMA32 or
 __GFP_HIGHMEM.

 Fix this by allocating the pages array with GFP_KERNEL to follow what is
 done elsewhere in this file. Using GFP_KERNEL in __iommu_alloc_buffer()
 is safe because atomic allocations are handled by
 __iommu_alloc_atomic().

 Signed-off-by: Alexandre Courbot 
 Cc: Russell King 
 Cc: Marek Szyprowski 
 Cc: Arnd Bergmann 
 Cc: Thierry Reding 
 Cc: Konrad Rzeszutek Wilk 
>>>
>>> Acked-by: Marek Szyprowski 
>>>
 ---
arch/arm/mm/dma-mapping.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

 diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
 index e8907117861e..bc495354c802 100644
 --- a/arch/arm/mm/dma-mapping.c
 +++ b/arch/arm/mm/dma-mapping.c
 @@ -1106,7 +1106,7 @@ static struct page **__iommu_alloc_buffer(struct
 device *dev, size_t size,
  int i = 0;
  if (array_size <= PAGE_SIZE)
 -   pages = kzalloc(array_size, gfp);
 +   pages = kzalloc(array_size, GFP_KERNEL);
  else
  pages = vzalloc(array_size);
  if (!pages)

>
> Best regards
> --
> Marek Szyprowski, PhD
> Samsung R Institute Poland
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] MAINTAINERS: update Qualcomm support entry

2015-01-21 Thread Andy Gross
Added myself as a co-maintainer.  Updated the files to include the Qualcomm SoC
directory.  Added linux-soc mailing list.

Signed-off-by: Andy Gross 
---
 MAINTAINERS |3 +++
 1 file changed, 3 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 93409ad..2af6e23 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1284,9 +1284,12 @@ S:   Maintained
 ARM/QUALCOMM SUPPORT
 M: Kumar Gala 
 M: David Brown 
+M: Andy Gross 
 L: linux-arm-...@vger.kernel.org
+L: linux-...@vger.kernel.org
 S: Maintained
 F: arch/arm/mach-qcom/
+F: drivers/soc/qcom
 T: git git://git.kernel.org/pub/scm/linux/kernel/git/galak/linux-qcom.git
 
 ARM/RADISYS ENP2611 MACHINE SUPPORT
-- 
Qualcomm Innovation Center, Inc
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC][PATCH 0/5] tracing: Add new file system tracefs

2015-01-21 Thread Steven Rostedt
On Thu, 22 Jan 2015 04:23:30 +
Al Viro  wrote:

> I would recommend against that - kernfs is overburdened by their need
> to accomodate cgroup weirdness.  IMO it's not a good model for
> anything, other than an anti-hard-drugs poster ("don't shoot that
> shit, or you might end up hallucinating _this_").

OK, I'm not the only one that thought kernfs seemed to go all over the
place. I guess I now know why. It was more of a hook for cgroups. I can
understand why cgroups needed it, as I found that creating files from a
mkdir and removing them with rmdir causes some pain in vfs with
handling of locking. As that's what I'm working on overcoming now.

But I think I solved my issues (testing it now), and hopefully by
tomorrow, I'll have a V2 out.

-- Steve
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


  1   2   3   4   5   6   7   8   9   10   >