Re: [PATCH v4] hwrng: exynos - add Samsung Exynos True RNG driver

2017-12-27 Thread Philippe Ombredanne
Łukasz,

On Wed, Dec 27, 2017 at 11:12 AM, Łukasz Stelmach
 wrote:
> It was <2017-12-22 pią 19:30>, when Philippe Ombredanne wrote:
>> On Fri, Dec 22, 2017 at 5:38 PM, Łukasz Stelmach  
>> wrote:
>>> It was <2017-12-22 pią 14:34>, when Philippe Ombredanne wrote:
 Łukasz,

 On Fri, Dec 22, 2017 at 2:23 PM, Łukasz Stelmach  
 wrote:
> Add support for True Random Number Generator found in Samsung Exynos
> 5250+ SoCs.
>
> Signed-off-by: Łukasz Stelmach 
> Reviewed-by: Krzysztof Kozlowski 

 

> --- /dev/null
> +++ b/drivers/char/hw_random/exynos-trng.c
> @@ -0,0 +1,245 @@
> +/*
> + * RNG driver for Exynos TRNGs
> + *
> + * Author: Łukasz Stelmach 
> + *
> + * Copyright 2017 (c) Samsung Electronics Software, Inc.
> + *
> + * Based on the Exynos PRNG driver drivers/crypto/exynos-rng by
> + * Krzysztof Kozłowski 
> + *
> + * 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;
> + *
> + * 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.
> + */


 Would you mind using the new SPDX tags documented in Thomas patch set
 [1] rather than this fine but longer legalese?

 And if you could spread the word to others in your team this would be very 
 nice.
 See also this fine article posted by Mauro on the Samsung Open Source
 Group Blog [2]
 Thank you!
>>>
>>> Cool! We've been using SPDX to tag RPM packages in Tizen for three years or
>>> more. ;-)
>>
>> Very nice! any pubic pointers?
>  ^
>
> I assume you request an URL of a publicly available web-page ;-)
>
> https://wiki.tizen.org/Packaging/Guidelines#License_Tag

Thank you!
I reckon it took me a minute to figure why you were making a somewhat
cryptic URL related comment.
Then I realized that I had made a rather unfortunate typo, or may be
it was a freudian slip of sorts :D

-- 
Cordially
Philippe Ombredanne


Re: [PATCH v4] hwrng: exynos - add Samsung Exynos True RNG driver

2017-12-27 Thread Philippe Ombredanne
Łukasz,

On Wed, Dec 27, 2017 at 11:12 AM, Łukasz Stelmach
 wrote:
> It was <2017-12-22 pią 19:30>, when Philippe Ombredanne wrote:
>> On Fri, Dec 22, 2017 at 5:38 PM, Łukasz Stelmach  
>> wrote:
>>> It was <2017-12-22 pią 14:34>, when Philippe Ombredanne wrote:
 Łukasz,

 On Fri, Dec 22, 2017 at 2:23 PM, Łukasz Stelmach  
 wrote:
> Add support for True Random Number Generator found in Samsung Exynos
> 5250+ SoCs.
>
> Signed-off-by: Łukasz Stelmach 
> Reviewed-by: Krzysztof Kozlowski 

 

> --- /dev/null
> +++ b/drivers/char/hw_random/exynos-trng.c
> @@ -0,0 +1,245 @@
> +/*
> + * RNG driver for Exynos TRNGs
> + *
> + * Author: Łukasz Stelmach 
> + *
> + * Copyright 2017 (c) Samsung Electronics Software, Inc.
> + *
> + * Based on the Exynos PRNG driver drivers/crypto/exynos-rng by
> + * Krzysztof Kozłowski 
> + *
> + * 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;
> + *
> + * 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.
> + */


 Would you mind using the new SPDX tags documented in Thomas patch set
 [1] rather than this fine but longer legalese?

 And if you could spread the word to others in your team this would be very 
 nice.
 See also this fine article posted by Mauro on the Samsung Open Source
 Group Blog [2]
 Thank you!
>>>
>>> Cool! We've been using SPDX to tag RPM packages in Tizen for three years or
>>> more. ;-)
>>
>> Very nice! any pubic pointers?
>  ^
>
> I assume you request an URL of a publicly available web-page ;-)
>
> https://wiki.tizen.org/Packaging/Guidelines#License_Tag

Thank you!
I reckon it took me a minute to figure why you were making a somewhat
cryptic URL related comment.
Then I realized that I had made a rather unfortunate typo, or may be
it was a freudian slip of sorts :D

-- 
Cordially
Philippe Ombredanne


Re: [PATCH v4] hwrng: exynos - add Samsung Exynos True RNG driver

2017-12-27 Thread Łukasz Stelmach
It was <2017-12-22 pią 19:30>, when Philippe Ombredanne wrote:
> On Fri, Dec 22, 2017 at 5:38 PM, Łukasz Stelmach  
> wrote:
>> It was <2017-12-22 pią 14:34>, when Philippe Ombredanne wrote:
>>> Łukasz,
>>>
>>> On Fri, Dec 22, 2017 at 2:23 PM, Łukasz Stelmach  
>>> wrote:
 Add support for True Random Number Generator found in Samsung Exynos
 5250+ SoCs.

 Signed-off-by: Łukasz Stelmach 
 Reviewed-by: Krzysztof Kozlowski 
>>>
>>> 
>>>
 --- /dev/null
 +++ b/drivers/char/hw_random/exynos-trng.c
 @@ -0,0 +1,245 @@
 +/*
 + * RNG driver for Exynos TRNGs
 + *
 + * Author: Łukasz Stelmach 
 + *
 + * Copyright 2017 (c) Samsung Electronics Software, Inc.
 + *
 + * Based on the Exynos PRNG driver drivers/crypto/exynos-rng by
 + * Krzysztof Kozłowski 
 + *
 + * 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;
 + *
 + * 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.
 + */
>>>
>>>
>>> Would you mind using the new SPDX tags documented in Thomas patch set
>>> [1] rather than this fine but longer legalese?
>>>
>>> And if you could spread the word to others in your team this would be very 
>>> nice.
>>> See also this fine article posted by Mauro on the Samsung Open Source
>>> Group Blog [2]
>>> Thank you!
>>
>> Cool! We've been using SPDX to tag RPM packages in Tizen for three years or
>> more. ;-)
>
> Very nice! any pubic pointers?
 ^

I assume you request an URL of a publicly available web-page ;-)

https://wiki.tizen.org/Packaging/Guidelines#License_Tag

-- 
Łukasz Stelmach
Samsung R Institute Poland
Samsung Electronics


signature.asc
Description: PGP signature


Re: [PATCH v4] hwrng: exynos - add Samsung Exynos True RNG driver

2017-12-27 Thread Łukasz Stelmach
It was <2017-12-22 pią 19:30>, when Philippe Ombredanne wrote:
> On Fri, Dec 22, 2017 at 5:38 PM, Łukasz Stelmach  
> wrote:
>> It was <2017-12-22 pią 14:34>, when Philippe Ombredanne wrote:
>>> Łukasz,
>>>
>>> On Fri, Dec 22, 2017 at 2:23 PM, Łukasz Stelmach  
>>> wrote:
 Add support for True Random Number Generator found in Samsung Exynos
 5250+ SoCs.

 Signed-off-by: Łukasz Stelmach 
 Reviewed-by: Krzysztof Kozlowski 
>>>
>>> 
>>>
 --- /dev/null
 +++ b/drivers/char/hw_random/exynos-trng.c
 @@ -0,0 +1,245 @@
 +/*
 + * RNG driver for Exynos TRNGs
 + *
 + * Author: Łukasz Stelmach 
 + *
 + * Copyright 2017 (c) Samsung Electronics Software, Inc.
 + *
 + * Based on the Exynos PRNG driver drivers/crypto/exynos-rng by
 + * Krzysztof Kozłowski 
 + *
 + * 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;
 + *
 + * 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.
 + */
>>>
>>>
>>> Would you mind using the new SPDX tags documented in Thomas patch set
>>> [1] rather than this fine but longer legalese?
>>>
>>> And if you could spread the word to others in your team this would be very 
>>> nice.
>>> See also this fine article posted by Mauro on the Samsung Open Source
>>> Group Blog [2]
>>> Thank you!
>>
>> Cool! We've been using SPDX to tag RPM packages in Tizen for three years or
>> more. ;-)
>
> Very nice! any pubic pointers?
 ^

I assume you request an URL of a publicly available web-page ;-)

https://wiki.tizen.org/Packaging/Guidelines#License_Tag

-- 
Łukasz Stelmach
Samsung R Institute Poland
Samsung Electronics


signature.asc
Description: PGP signature


Re: [PATCH v4] hwrng: exynos - add Samsung Exynos True RNG driver

2017-12-22 Thread Philippe Ombredanne
On Fri, Dec 22, 2017 at 5:38 PM, Łukasz Stelmach  wrote:
> It was <2017-12-22 pią 14:34>, when Philippe Ombredanne wrote:
>> Łukasz,
>>
>> On Fri, Dec 22, 2017 at 2:23 PM, Łukasz Stelmach  
>> wrote:
>>> Add support for True Random Number Generator found in Samsung Exynos
>>> 5250+ SoCs.
>>>
>>> Signed-off-by: Łukasz Stelmach 
>>> Reviewed-by: Krzysztof Kozlowski 
>>
>> 
>>
>>> --- /dev/null
>>> +++ b/drivers/char/hw_random/exynos-trng.c
>>> @@ -0,0 +1,245 @@
>>> +/*
>>> + * RNG driver for Exynos TRNGs
>>> + *
>>> + * Author: Łukasz Stelmach 
>>> + *
>>> + * Copyright 2017 (c) Samsung Electronics Software, Inc.
>>> + *
>>> + * Based on the Exynos PRNG driver drivers/crypto/exynos-rng by
>>> + * Krzysztof Kozłowski 
>>> + *
>>> + * 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;
>>> + *
>>> + * 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.
>>> + */
>>
>>
>> Would you mind using the new SPDX tags documented in Thomas patch set
>> [1] rather than this fine but longer legalese?
>>
>> And if you could spread the word to others in your team this would be very 
>> nice.
>> See also this fine article posted by Mauro on the Samsung Open Source
>> Group Blog [2]
>> Thank you!
>
> Cool! We've been using SPDX to tag RPM packages in Tizen for three years or
> more. ;-)

Very nice! any pubic pointers?


>>> +MODULE_LICENSE("GPL");
>>
>> Per module.h this means GPL2 or later. This is not matching your
>> license above which does not state any version and therefore would
>> mean GPL1 or later,
>
> Thanks for spotting. My intention is GPL-2.0.
>
>> Please make sure you use something and common rather than this and
>> make sure your MODULE_LICENSE is consistent with the top level
>> license.
>>
>> Was it this way in the code from Krzysztof?
>
> Yes. And omap-rng, the second of my sources of reference, too. Actually,
> the majority of modules still specify "GPL".
>
>  281 | "Dual */*"
> 2082 | "GPL v2"
> 6359 | "GPL"
>  +-
> 8784 | Total
>
> Fixing.


Sigh. That's a lot! Now I have the tool to spot all these differences.
I need to run this and review.
As a first pass aligning the MODULE_LICENSE with the top level would
be something that requires minimal discussion I guess.

>> [1] https://lkml.org/lkml/2017/12/4/934
>> [2] https://blogs.s-osg.org/linux-kernel-license-practices-revisited-spdx/
>
> --
> Łukasz Stelmach
> Samsung R Institute Poland
> Samsung Electronics

-- 
Cordially
Philippe Ombredanne


Re: [PATCH v4] hwrng: exynos - add Samsung Exynos True RNG driver

2017-12-22 Thread Philippe Ombredanne
On Fri, Dec 22, 2017 at 5:38 PM, Łukasz Stelmach  wrote:
> It was <2017-12-22 pią 14:34>, when Philippe Ombredanne wrote:
>> Łukasz,
>>
>> On Fri, Dec 22, 2017 at 2:23 PM, Łukasz Stelmach  
>> wrote:
>>> Add support for True Random Number Generator found in Samsung Exynos
>>> 5250+ SoCs.
>>>
>>> Signed-off-by: Łukasz Stelmach 
>>> Reviewed-by: Krzysztof Kozlowski 
>>
>> 
>>
>>> --- /dev/null
>>> +++ b/drivers/char/hw_random/exynos-trng.c
>>> @@ -0,0 +1,245 @@
>>> +/*
>>> + * RNG driver for Exynos TRNGs
>>> + *
>>> + * Author: Łukasz Stelmach 
>>> + *
>>> + * Copyright 2017 (c) Samsung Electronics Software, Inc.
>>> + *
>>> + * Based on the Exynos PRNG driver drivers/crypto/exynos-rng by
>>> + * Krzysztof Kozłowski 
>>> + *
>>> + * 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;
>>> + *
>>> + * 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.
>>> + */
>>
>>
>> Would you mind using the new SPDX tags documented in Thomas patch set
>> [1] rather than this fine but longer legalese?
>>
>> And if you could spread the word to others in your team this would be very 
>> nice.
>> See also this fine article posted by Mauro on the Samsung Open Source
>> Group Blog [2]
>> Thank you!
>
> Cool! We've been using SPDX to tag RPM packages in Tizen for three years or
> more. ;-)

Very nice! any pubic pointers?


>>> +MODULE_LICENSE("GPL");
>>
>> Per module.h this means GPL2 or later. This is not matching your
>> license above which does not state any version and therefore would
>> mean GPL1 or later,
>
> Thanks for spotting. My intention is GPL-2.0.
>
>> Please make sure you use something and common rather than this and
>> make sure your MODULE_LICENSE is consistent with the top level
>> license.
>>
>> Was it this way in the code from Krzysztof?
>
> Yes. And omap-rng, the second of my sources of reference, too. Actually,
> the majority of modules still specify "GPL".
>
>  281 | "Dual */*"
> 2082 | "GPL v2"
> 6359 | "GPL"
>  +-
> 8784 | Total
>
> Fixing.


Sigh. That's a lot! Now I have the tool to spot all these differences.
I need to run this and review.
As a first pass aligning the MODULE_LICENSE with the top level would
be something that requires minimal discussion I guess.

>> [1] https://lkml.org/lkml/2017/12/4/934
>> [2] https://blogs.s-osg.org/linux-kernel-license-practices-revisited-spdx/
>
> --
> Łukasz Stelmach
> Samsung R Institute Poland
> Samsung Electronics

-- 
Cordially
Philippe Ombredanne


Re: [PATCH v4] hwrng: exynos - add Samsung Exynos True RNG driver

2017-12-22 Thread Łukasz Stelmach
It was <2017-12-22 pią 14:34>, when Philippe Ombredanne wrote:
> Łukasz,
>
> On Fri, Dec 22, 2017 at 2:23 PM, Łukasz Stelmach  
> wrote:
>> Add support for True Random Number Generator found in Samsung Exynos
>> 5250+ SoCs.
>>
>> Signed-off-by: Łukasz Stelmach 
>> Reviewed-by: Krzysztof Kozlowski 
>
> 
>
>> --- /dev/null
>> +++ b/drivers/char/hw_random/exynos-trng.c
>> @@ -0,0 +1,245 @@
>> +/*
>> + * RNG driver for Exynos TRNGs
>> + *
>> + * Author: Łukasz Stelmach 
>> + *
>> + * Copyright 2017 (c) Samsung Electronics Software, Inc.
>> + *
>> + * Based on the Exynos PRNG driver drivers/crypto/exynos-rng by
>> + * Krzysztof Kozłowski 
>> + *
>> + * 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;
>> + *
>> + * 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.
>> + */
>
>
> Would you mind using the new SPDX tags documented in Thomas patch set
> [1] rather than this fine but longer legalese?
>
> And if you could spread the word to others in your team this would be very 
> nice.
> See also this fine article posted by Mauro on the Samsung Open Source
> Group Blog [2]
> Thank you!

Cool! We've been using SPDX to tag RPM packages in Tizen for three years or
more. ;-)

>> +MODULE_LICENSE("GPL");
>
> Per module.h this means GPL2 or later. This is not matching your
> license above which does not state any version and therefore would
> mean GPL1 or later,

Thanks for spotting. My intention is GPL-2.0.

> Please make sure you use something and common rather than this and
> make sure your MODULE_LICENSE is consistent with the top level
> license.
>
> Was it this way in the code from Krzysztof?

Yes. And omap-rng, the second of my sources of reference, too. Actually,
the majority of modules still specify "GPL".

 281 | "Dual */*"
2082 | "GPL v2"
6359 | "GPL"
 +-
8784 | Total

Fixing.

> [1] https://lkml.org/lkml/2017/12/4/934
> [2] https://blogs.s-osg.org/linux-kernel-license-practices-revisited-spdx/

-- 
Łukasz Stelmach
Samsung R Institute Poland
Samsung Electronics


signature.asc
Description: PGP signature


Re: [PATCH v4] hwrng: exynos - add Samsung Exynos True RNG driver

2017-12-22 Thread Łukasz Stelmach
It was <2017-12-22 pią 14:34>, when Philippe Ombredanne wrote:
> Łukasz,
>
> On Fri, Dec 22, 2017 at 2:23 PM, Łukasz Stelmach  
> wrote:
>> Add support for True Random Number Generator found in Samsung Exynos
>> 5250+ SoCs.
>>
>> Signed-off-by: Łukasz Stelmach 
>> Reviewed-by: Krzysztof Kozlowski 
>
> 
>
>> --- /dev/null
>> +++ b/drivers/char/hw_random/exynos-trng.c
>> @@ -0,0 +1,245 @@
>> +/*
>> + * RNG driver for Exynos TRNGs
>> + *
>> + * Author: Łukasz Stelmach 
>> + *
>> + * Copyright 2017 (c) Samsung Electronics Software, Inc.
>> + *
>> + * Based on the Exynos PRNG driver drivers/crypto/exynos-rng by
>> + * Krzysztof Kozłowski 
>> + *
>> + * 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;
>> + *
>> + * 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.
>> + */
>
>
> Would you mind using the new SPDX tags documented in Thomas patch set
> [1] rather than this fine but longer legalese?
>
> And if you could spread the word to others in your team this would be very 
> nice.
> See also this fine article posted by Mauro on the Samsung Open Source
> Group Blog [2]
> Thank you!

Cool! We've been using SPDX to tag RPM packages in Tizen for three years or
more. ;-)

>> +MODULE_LICENSE("GPL");
>
> Per module.h this means GPL2 or later. This is not matching your
> license above which does not state any version and therefore would
> mean GPL1 or later,

Thanks for spotting. My intention is GPL-2.0.

> Please make sure you use something and common rather than this and
> make sure your MODULE_LICENSE is consistent with the top level
> license.
>
> Was it this way in the code from Krzysztof?

Yes. And omap-rng, the second of my sources of reference, too. Actually,
the majority of modules still specify "GPL".

 281 | "Dual */*"
2082 | "GPL v2"
6359 | "GPL"
 +-
8784 | Total

Fixing.

> [1] https://lkml.org/lkml/2017/12/4/934
> [2] https://blogs.s-osg.org/linux-kernel-license-practices-revisited-spdx/

-- 
Łukasz Stelmach
Samsung R Institute Poland
Samsung Electronics


signature.asc
Description: PGP signature


Re: [PATCH v4] hwrng: exynos - add Samsung Exynos True RNG driver

2017-12-22 Thread Philippe Ombredanne
Łukasz,

On Fri, Dec 22, 2017 at 2:23 PM, Łukasz Stelmach  wrote:
> Add support for True Random Number Generator found in Samsung Exynos
> 5250+ SoCs.
>
> Signed-off-by: Łukasz Stelmach 
> Reviewed-by: Krzysztof Kozlowski 



> --- /dev/null
> +++ b/drivers/char/hw_random/exynos-trng.c
> @@ -0,0 +1,245 @@
> +/*
> + * RNG driver for Exynos TRNGs
> + *
> + * Author: Łukasz Stelmach 
> + *
> + * Copyright 2017 (c) Samsung Electronics Software, Inc.
> + *
> + * Based on the Exynos PRNG driver drivers/crypto/exynos-rng by
> + * Krzysztof Kozłowski 
> + *
> + * 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;
> + *
> + * 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.
> + */


Would you mind using the new SPDX tags documented in Thomas patch set
[1] rather than this fine but longer legalese?

And if you could spread the word to others in your team this would be very nice.
See also this fine article posted by Mauro on the Samsung Open Source
Group Blog [2]
Thank you!

> +MODULE_LICENSE("GPL");

Per module.h this means GPL2 or later. This is not matching your
license above which does not state any version and therefore would
mean GPL1 or later,
Please make sure you use something and common rather than this and
make sure your MODULE_LICENSE is consistent with the top level
license.

Was it this way in the code from Krzysztof?


[1] https://lkml.org/lkml/2017/12/4/934
[2] https://blogs.s-osg.org/linux-kernel-license-practices-revisited-spdx/

--
Cordially
Philippe Ombredanne


Re: [PATCH v4] hwrng: exynos - add Samsung Exynos True RNG driver

2017-12-22 Thread Philippe Ombredanne
Łukasz,

On Fri, Dec 22, 2017 at 2:23 PM, Łukasz Stelmach  wrote:
> Add support for True Random Number Generator found in Samsung Exynos
> 5250+ SoCs.
>
> Signed-off-by: Łukasz Stelmach 
> Reviewed-by: Krzysztof Kozlowski 



> --- /dev/null
> +++ b/drivers/char/hw_random/exynos-trng.c
> @@ -0,0 +1,245 @@
> +/*
> + * RNG driver for Exynos TRNGs
> + *
> + * Author: Łukasz Stelmach 
> + *
> + * Copyright 2017 (c) Samsung Electronics Software, Inc.
> + *
> + * Based on the Exynos PRNG driver drivers/crypto/exynos-rng by
> + * Krzysztof Kozłowski 
> + *
> + * 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;
> + *
> + * 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.
> + */


Would you mind using the new SPDX tags documented in Thomas patch set
[1] rather than this fine but longer legalese?

And if you could spread the word to others in your team this would be very nice.
See also this fine article posted by Mauro on the Samsung Open Source
Group Blog [2]
Thank you!

> +MODULE_LICENSE("GPL");

Per module.h this means GPL2 or later. This is not matching your
license above which does not state any version and therefore would
mean GPL1 or later,
Please make sure you use something and common rather than this and
make sure your MODULE_LICENSE is consistent with the top level
license.

Was it this way in the code from Krzysztof?


[1] https://lkml.org/lkml/2017/12/4/934
[2] https://blogs.s-osg.org/linux-kernel-license-practices-revisited-spdx/

--
Cordially
Philippe Ombredanne


[PATCH v4] hwrng: exynos - add Samsung Exynos True RNG driver

2017-12-22 Thread Łukasz Stelmach
Add support for True Random Number Generator found in Samsung Exynos
5250+ SoCs.

Signed-off-by: Łukasz Stelmach 
Reviewed-by: Krzysztof Kozlowski 
---
Changes since v3:

- Fixed typo in the secongd argument of MODULE_DEVICE_TABLE
  (Thanks, Herbert Xu)

 MAINTAINERS  |   7 +
 drivers/char/hw_random/Kconfig   |  12 ++
 drivers/char/hw_random/Makefile  |   1 +
 drivers/char/hw_random/exynos-trng.c | 245 +++
 4 files changed, 265 insertions(+)
 create mode 100644 drivers/char/hw_random/exynos-trng.c

diff --git a/MAINTAINERS b/MAINTAINERS
index e6d849d0d153..1082846edb9b 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -11933,6 +11933,13 @@ S: Maintained
 F: drivers/crypto/exynos-rng.c
 F: Documentation/devicetree/bindings/crypto/samsung,exynos-rng4.txt
 
+SAMSUNG EXYNOS TRUE RANDOM NUMBER GENERATOR (TRNG) DRIVER
+M: Łukasz Stelmach 
+L: linux-samsung-...@vger.kernel.org
+S: Maintained
+F: drivers/char/hw_random/exynos-trng.c
+F: Documentation/devicetree/bindings/rng/samsung,exynos5250-trng.txt
+
 SAMSUNG FRAMEBUFFER DRIVER
 M: Jingoo Han 
 L: linux-fb...@vger.kernel.org
diff --git a/drivers/char/hw_random/Kconfig b/drivers/char/hw_random/Kconfig
index 90e4bb24819e..32f715394904 100644
--- a/drivers/char/hw_random/Kconfig
+++ b/drivers/char/hw_random/Kconfig
@@ -437,6 +437,18 @@ config HW_RANDOM_S390
 
  If unsure, say Y.
 
+config HW_RANDOM_EXYNOS
+   tristate "Samsung Exynos True Random Number Generator support"
+   depends on ARCH_EXYNOS || COMPILE_TEST
+   default HW_RANDOM
+   ---help---
+ This driver provides support for the True Random Number
+ Generator available in Exynos SoCs.
+
+ To compile this driver as a module, choose M here: the module
+ will be called exynos-trng.
+
+ If unsure, say Y.
 endif # HW_RANDOM
 
 config UML_RANDOM
diff --git a/drivers/char/hw_random/Makefile b/drivers/char/hw_random/Makefile
index e7146a84d44a..7c8a66fe8cf6 100644
--- a/drivers/char/hw_random/Makefile
+++ b/drivers/char/hw_random/Makefile
@@ -13,6 +13,7 @@ obj-$(CONFIG_HW_RANDOM_GEODE) += geode-rng.o
 obj-$(CONFIG_HW_RANDOM_N2RNG) += n2-rng.o
 n2-rng-y := n2-drv.o n2-asm.o
 obj-$(CONFIG_HW_RANDOM_VIA) += via-rng.o
+obj-$(CONFIG_HW_RANDOM_EXYNOS) += exynos-trng.o
 obj-$(CONFIG_HW_RANDOM_IXP4XX) += ixp4xx-rng.o
 obj-$(CONFIG_HW_RANDOM_OMAP) += omap-rng.o
 obj-$(CONFIG_HW_RANDOM_OMAP3_ROM) += omap3-rom-rng.o
diff --git a/drivers/char/hw_random/exynos-trng.c 
b/drivers/char/hw_random/exynos-trng.c
new file mode 100644
index ..175708f9aa1d
--- /dev/null
+++ b/drivers/char/hw_random/exynos-trng.c
@@ -0,0 +1,245 @@
+/*
+ * RNG driver for Exynos TRNGs
+ *
+ * Author: Łukasz Stelmach 
+ *
+ * Copyright 2017 (c) Samsung Electronics Software, Inc.
+ *
+ * Based on the Exynos PRNG driver drivers/crypto/exynos-rng by
+ * Krzysztof Kozłowski 
+ *
+ * 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;
+ *
+ * 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.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define EXYNOS_TRNG_CLKDIV (0x0)
+
+#define EXYNOS_TRNG_CTRL   (0x20)
+#define EXYNOS_TRNG_CTRL_RNGEN BIT(31)
+
+#define EXYNOS_TRNG_POST_CTRL  (0x30)
+#define EXYNOS_TRNG_ONLINE_CTRL(0x40)
+#define EXYNOS_TRNG_ONLINE_STAT(0x44)
+#define EXYNOS_TRNG_ONLINE_MAXCHI2 (0x48)
+#define EXYNOS_TRNG_FIFO_CTRL  (0x50)
+#define EXYNOS_TRNG_FIFO_0 (0x80)
+#define EXYNOS_TRNG_FIFO_1 (0x84)
+#define EXYNOS_TRNG_FIFO_2 (0x88)
+#define EXYNOS_TRNG_FIFO_3 (0x8c)
+#define EXYNOS_TRNG_FIFO_4 (0x90)
+#define EXYNOS_TRNG_FIFO_5 (0x94)
+#define EXYNOS_TRNG_FIFO_6 (0x98)
+#define EXYNOS_TRNG_FIFO_7 (0x9c)
+#define EXYNOS_TRNG_FIFO_LEN   (8)
+#define EXYNOS_TRNG_CLOCK_RATE (50)
+
+
+struct exynos_trng_dev {
+   struct device*dev;
+   void __iomem *mem;
+   struct clk   *clk;
+   struct hwrng rng;
+};
+
+static int exynos_trng_do_read(struct hwrng *rng, void *data, size_t max,
+  bool wait)
+{
+   struct exynos_trng_dev *trng;
+   u32 val;
+
+   max = min_t(size_t, max, (EXYNOS_TRNG_FIFO_LEN * 4));
+
+   trng = (struct exynos_trng_dev *)rng->priv;
+
+   writel_relaxed(max * 8, trng->mem + EXYNOS_TRNG_FIFO_CTRL);
+   val = readl_poll_timeout(trng->mem + 

[PATCH v4] hwrng: exynos - add Samsung Exynos True RNG driver

2017-12-22 Thread Łukasz Stelmach
Add support for True Random Number Generator found in Samsung Exynos
5250+ SoCs.

Signed-off-by: Łukasz Stelmach 
Reviewed-by: Krzysztof Kozlowski 
---
Changes since v3:

- Fixed typo in the secongd argument of MODULE_DEVICE_TABLE
  (Thanks, Herbert Xu)

 MAINTAINERS  |   7 +
 drivers/char/hw_random/Kconfig   |  12 ++
 drivers/char/hw_random/Makefile  |   1 +
 drivers/char/hw_random/exynos-trng.c | 245 +++
 4 files changed, 265 insertions(+)
 create mode 100644 drivers/char/hw_random/exynos-trng.c

diff --git a/MAINTAINERS b/MAINTAINERS
index e6d849d0d153..1082846edb9b 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -11933,6 +11933,13 @@ S: Maintained
 F: drivers/crypto/exynos-rng.c
 F: Documentation/devicetree/bindings/crypto/samsung,exynos-rng4.txt
 
+SAMSUNG EXYNOS TRUE RANDOM NUMBER GENERATOR (TRNG) DRIVER
+M: Łukasz Stelmach 
+L: linux-samsung-...@vger.kernel.org
+S: Maintained
+F: drivers/char/hw_random/exynos-trng.c
+F: Documentation/devicetree/bindings/rng/samsung,exynos5250-trng.txt
+
 SAMSUNG FRAMEBUFFER DRIVER
 M: Jingoo Han 
 L: linux-fb...@vger.kernel.org
diff --git a/drivers/char/hw_random/Kconfig b/drivers/char/hw_random/Kconfig
index 90e4bb24819e..32f715394904 100644
--- a/drivers/char/hw_random/Kconfig
+++ b/drivers/char/hw_random/Kconfig
@@ -437,6 +437,18 @@ config HW_RANDOM_S390
 
  If unsure, say Y.
 
+config HW_RANDOM_EXYNOS
+   tristate "Samsung Exynos True Random Number Generator support"
+   depends on ARCH_EXYNOS || COMPILE_TEST
+   default HW_RANDOM
+   ---help---
+ This driver provides support for the True Random Number
+ Generator available in Exynos SoCs.
+
+ To compile this driver as a module, choose M here: the module
+ will be called exynos-trng.
+
+ If unsure, say Y.
 endif # HW_RANDOM
 
 config UML_RANDOM
diff --git a/drivers/char/hw_random/Makefile b/drivers/char/hw_random/Makefile
index e7146a84d44a..7c8a66fe8cf6 100644
--- a/drivers/char/hw_random/Makefile
+++ b/drivers/char/hw_random/Makefile
@@ -13,6 +13,7 @@ obj-$(CONFIG_HW_RANDOM_GEODE) += geode-rng.o
 obj-$(CONFIG_HW_RANDOM_N2RNG) += n2-rng.o
 n2-rng-y := n2-drv.o n2-asm.o
 obj-$(CONFIG_HW_RANDOM_VIA) += via-rng.o
+obj-$(CONFIG_HW_RANDOM_EXYNOS) += exynos-trng.o
 obj-$(CONFIG_HW_RANDOM_IXP4XX) += ixp4xx-rng.o
 obj-$(CONFIG_HW_RANDOM_OMAP) += omap-rng.o
 obj-$(CONFIG_HW_RANDOM_OMAP3_ROM) += omap3-rom-rng.o
diff --git a/drivers/char/hw_random/exynos-trng.c 
b/drivers/char/hw_random/exynos-trng.c
new file mode 100644
index ..175708f9aa1d
--- /dev/null
+++ b/drivers/char/hw_random/exynos-trng.c
@@ -0,0 +1,245 @@
+/*
+ * RNG driver for Exynos TRNGs
+ *
+ * Author: Łukasz Stelmach 
+ *
+ * Copyright 2017 (c) Samsung Electronics Software, Inc.
+ *
+ * Based on the Exynos PRNG driver drivers/crypto/exynos-rng by
+ * Krzysztof Kozłowski 
+ *
+ * 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;
+ *
+ * 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.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define EXYNOS_TRNG_CLKDIV (0x0)
+
+#define EXYNOS_TRNG_CTRL   (0x20)
+#define EXYNOS_TRNG_CTRL_RNGEN BIT(31)
+
+#define EXYNOS_TRNG_POST_CTRL  (0x30)
+#define EXYNOS_TRNG_ONLINE_CTRL(0x40)
+#define EXYNOS_TRNG_ONLINE_STAT(0x44)
+#define EXYNOS_TRNG_ONLINE_MAXCHI2 (0x48)
+#define EXYNOS_TRNG_FIFO_CTRL  (0x50)
+#define EXYNOS_TRNG_FIFO_0 (0x80)
+#define EXYNOS_TRNG_FIFO_1 (0x84)
+#define EXYNOS_TRNG_FIFO_2 (0x88)
+#define EXYNOS_TRNG_FIFO_3 (0x8c)
+#define EXYNOS_TRNG_FIFO_4 (0x90)
+#define EXYNOS_TRNG_FIFO_5 (0x94)
+#define EXYNOS_TRNG_FIFO_6 (0x98)
+#define EXYNOS_TRNG_FIFO_7 (0x9c)
+#define EXYNOS_TRNG_FIFO_LEN   (8)
+#define EXYNOS_TRNG_CLOCK_RATE (50)
+
+
+struct exynos_trng_dev {
+   struct device*dev;
+   void __iomem *mem;
+   struct clk   *clk;
+   struct hwrng rng;
+};
+
+static int exynos_trng_do_read(struct hwrng *rng, void *data, size_t max,
+  bool wait)
+{
+   struct exynos_trng_dev *trng;
+   u32 val;
+
+   max = min_t(size_t, max, (EXYNOS_TRNG_FIFO_LEN * 4));
+
+   trng = (struct exynos_trng_dev *)rng->priv;
+
+   writel_relaxed(max * 8, trng->mem + EXYNOS_TRNG_FIFO_CTRL);
+   val = readl_poll_timeout(trng->mem + EXYNOS_TRNG_FIFO_CTRL, val,
+val == 0, 200, 100);
+   if (val < 0)
+   return val;
+
+