diff mbox

[01/27] ARM: EXYNOS: Add Exynos3250 SoC ID

Message ID 1397122658-16013-2-git-send-email-cw00.choi@samsung.com (mailing list archive)
State New, archived
Headers show

Commit Message

Chanwoo Choi April 10, 2014, 9:37 a.m. UTC
This patch add Exynos3250's SoC ID. Exynos 3250 is System-On-Chip(SoC) that
is based on the 32-bit RISC processor for Smartphone. Exynos3250 uses Cortex-A7
dual cores and has a target speed of 1.0GHz.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
 arch/arm/mach-exynos/Kconfig             | 22 ++++++++++++++++++++++
 arch/arm/mach-exynos/exynos.c            |  1 +
 arch/arm/plat-samsung/include/plat/cpu.h | 10 ++++++++++
 3 files changed, 33 insertions(+)

Comments

Olof Johansson April 11, 2014, 1:46 a.m. UTC | #1
On Thu, Apr 10, 2014 at 06:37:12PM +0900, Chanwoo Choi wrote:
> This patch add Exynos3250's SoC ID. Exynos 3250 is System-On-Chip(SoC) that
> is based on the 32-bit RISC processor for Smartphone. Exynos3250 uses Cortex-A7
> dual cores and has a target speed of 1.0GHz.
> 
> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> ---
>  arch/arm/mach-exynos/Kconfig             | 22 ++++++++++++++++++++++
>  arch/arm/mach-exynos/exynos.c            |  1 +
>  arch/arm/plat-samsung/include/plat/cpu.h | 10 ++++++++++
>  3 files changed, 33 insertions(+)
> 
> diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig
> index fc8bf18..6da8a68 100644
> --- a/arch/arm/mach-exynos/Kconfig
> +++ b/arch/arm/mach-exynos/Kconfig
> @@ -11,6 +11,17 @@ if ARCH_EXYNOS
>  
>  menu "SAMSUNG EXYNOS SoCs Support"
>  
> +config ARCH_EXYNOS3
> +	bool "SAMSUNG EXYNOS3"
> +	select ARM_AMBA
> +	select CLKSRC_OF
> +	select HAVE_ARM_SCU if SMP
> +	select HAVE_SMP
> +	select PINCTRL
> +	select PM_GENERIC_DOMAINS if PM_RUNTIME
> +	help
> +	  Samsung EXYNOS3 SoCs based systems
> +
>  config ARCH_EXYNOS4
>  	bool "SAMSUNG EXYNOS4"
>  	default y
> @@ -41,6 +52,17 @@ config ARCH_EXYNOS5
>  
>  comment "EXYNOS SoCs"
>  
> +config SOC_EXYNOS3250
> +	bool "SAMSUNG EXYNOS3250"
> +	default y
> +	depends on ARCH_EXYNOS3
> +	select ARCH_HAS_BANDGAP
> +	select ARM_CPU_SUSPEND if PM
> +	select PINCTRL_EXYNOS
> +	select SAMSUNG_DMADEV
> +	help
> +	  Enable EXYNOS3250 CPU support
> +
>  config CPU_EXYNOS4210
>  	bool "SAMSUNG EXYNOS4210"
>  	default y
> diff --git a/arch/arm/mach-exynos/exynos.c b/arch/arm/mach-exynos/exynos.c
> index b32a907..b134868 100644
> --- a/arch/arm/mach-exynos/exynos.c
> +++ b/arch/arm/mach-exynos/exynos.c
> @@ -370,6 +370,7 @@ static void __init exynos_dt_machine_init(void)
>  }
>  
>  static char const *exynos_dt_compat[] __initconst = {
> +	"samsung,exynos3250",

Please consider samsung,exynos3 instead, so you don't have to update this table
for every SoC. We've talked about this before..

>  	"samsung,exynos4",
>  	"samsung,exynos4210",
>  	"samsung,exynos4212",
> diff --git a/arch/arm/plat-samsung/include/plat/cpu.h b/arch/arm/plat-samsung/include/plat/cpu.h
> index 5992b8d..3d808f6b 100644
> --- a/arch/arm/plat-samsung/include/plat/cpu.h
> +++ b/arch/arm/plat-samsung/include/plat/cpu.h
> @@ -43,6 +43,9 @@ extern unsigned long samsung_cpu_id;
>  #define S5PV210_CPU_ID		0x43110000
>  #define S5PV210_CPU_MASK	0xFFFFF000
>  
> +#define EXYNOS3250_SOC_ID       0xE3472000
> +#define EXYNOS3_SOC_MASK        0xFFFFF000
> +
>  #define EXYNOS4210_CPU_ID	0x43210000
>  #define EXYNOS4212_CPU_ID	0x43220000
>  #define EXYNOS4412_CPU_ID	0xE4412200
> @@ -68,6 +71,7 @@ IS_SAMSUNG_CPU(s5p6440, S5P6440_CPU_ID, S5P64XX_CPU_MASK)
>  IS_SAMSUNG_CPU(s5p6450, S5P6450_CPU_ID, S5P64XX_CPU_MASK)
>  IS_SAMSUNG_CPU(s5pc100, S5PC100_CPU_ID, S5PC100_CPU_MASK)
>  IS_SAMSUNG_CPU(s5pv210, S5PV210_CPU_ID, S5PV210_CPU_MASK)
> +IS_SAMSUNG_CPU(exynos3250, EXYNOS3250_SOC_ID, EXYNOS3_SOC_MASK)
>  IS_SAMSUNG_CPU(exynos4210, EXYNOS4210_CPU_ID, EXYNOS4_CPU_MASK)
>  IS_SAMSUNG_CPU(exynos4212, EXYNOS4212_CPU_ID, EXYNOS4_CPU_MASK)
>  IS_SAMSUNG_CPU(exynos4412, EXYNOS4412_CPU_ID, EXYNOS4_CPU_MASK)
> @@ -126,6 +130,12 @@ IS_SAMSUNG_CPU(exynos5440, EXYNOS5440_SOC_ID, EXYNOS5_SOC_MASK)
>  # define soc_is_s5pv210()	0
>  #endif
>  
> +#if defined(CONFIG_SOC_EXYNOS3250)
> +# define soc_is_exynos3250()    is_samsung_exynos3250()
> +#else
> +# define soc_is_exynos3250()    0
> +#endif

In general, I think we have too much code littered with soc_is_<foo>() going
on, so please try to avoid adding more for this SoC. Especially in cases where
you just want to bail out of certain features where we might already have
function pointers to control if a function is called or not, such as the
firmware interfaces.


-Olof
Sachin Kamat April 11, 2014, 3:56 a.m. UTC | #2
Hi Chanwoo,

On 10 April 2014 15:07, Chanwoo Choi <cw00.choi@samsung.com> wrote:
> This patch add Exynos3250's SoC ID. Exynos 3250 is System-On-Chip(SoC) that
> is based on the 32-bit RISC processor for Smartphone. Exynos3250 uses Cortex-A7
> dual cores and has a target speed of 1.0GHz.
>
> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> ---
>  arch/arm/mach-exynos/Kconfig             | 22 ++++++++++++++++++++++
>  arch/arm/mach-exynos/exynos.c            |  1 +
>  arch/arm/plat-samsung/include/plat/cpu.h | 10 ++++++++++
>  3 files changed, 33 insertions(+)
>
> diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig
> index fc8bf18..6da8a68 100644
> --- a/arch/arm/mach-exynos/Kconfig
> +++ b/arch/arm/mach-exynos/Kconfig
> @@ -11,6 +11,17 @@ if ARCH_EXYNOS
>
>  menu "SAMSUNG EXYNOS SoCs Support"
>
> +config ARCH_EXYNOS3
> +       bool "SAMSUNG EXYNOS3"
> +       select ARM_AMBA
> +       select CLKSRC_OF
> +       select HAVE_ARM_SCU if SMP
> +       select HAVE_SMP
> +       select PINCTRL
> +       select PM_GENERIC_DOMAINS if PM_RUNTIME
> +       help
> +         Samsung EXYNOS3 SoCs based systems
> +
>  config ARCH_EXYNOS4
>         bool "SAMSUNG EXYNOS4"
>         default y
> @@ -41,6 +52,17 @@ config ARCH_EXYNOS5
>
>  comment "EXYNOS SoCs"
>
> +config SOC_EXYNOS3250
> +       bool "SAMSUNG EXYNOS3250"
> +       default y
> +       depends on ARCH_EXYNOS3
> +       select ARCH_HAS_BANDGAP
> +       select ARM_CPU_SUSPEND if PM
> +       select PINCTRL_EXYNOS
> +       select SAMSUNG_DMADEV
> +       help
> +         Enable EXYNOS3250 CPU support

There is a Kconfig consolidation patch submitted by me [1]. Please base your
code on that one to avoid merge conflicts.

[1] http://article.gmane.org/gmane.linux.kernel.samsung-soc/28642
Chanwoo Choi April 11, 2014, 5:54 a.m. UTC | #3
Hi Sachin,

On 04/11/2014 12:56 PM, Sachin Kamat wrote:
> Hi Chanwoo,
> 
> On 10 April 2014 15:07, Chanwoo Choi <cw00.choi@samsung.com> wrote:
>> This patch add Exynos3250's SoC ID. Exynos 3250 is System-On-Chip(SoC) that
>> is based on the 32-bit RISC processor for Smartphone. Exynos3250 uses Cortex-A7
>> dual cores and has a target speed of 1.0GHz.
>>
>> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
>> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
>> ---
>>  arch/arm/mach-exynos/Kconfig             | 22 ++++++++++++++++++++++
>>  arch/arm/mach-exynos/exynos.c            |  1 +
>>  arch/arm/plat-samsung/include/plat/cpu.h | 10 ++++++++++
>>  3 files changed, 33 insertions(+)
>>
>> diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig
>> index fc8bf18..6da8a68 100644
>> --- a/arch/arm/mach-exynos/Kconfig
>> +++ b/arch/arm/mach-exynos/Kconfig
>> @@ -11,6 +11,17 @@ if ARCH_EXYNOS
>>
>>  menu "SAMSUNG EXYNOS SoCs Support"
>>
>> +config ARCH_EXYNOS3
>> +       bool "SAMSUNG EXYNOS3"
>> +       select ARM_AMBA
>> +       select CLKSRC_OF
>> +       select HAVE_ARM_SCU if SMP
>> +       select HAVE_SMP
>> +       select PINCTRL
>> +       select PM_GENERIC_DOMAINS if PM_RUNTIME
>> +       help
>> +         Samsung EXYNOS3 SoCs based systems
>> +
>>  config ARCH_EXYNOS4
>>         bool "SAMSUNG EXYNOS4"
>>         default y
>> @@ -41,6 +52,17 @@ config ARCH_EXYNOS5
>>
>>  comment "EXYNOS SoCs"
>>
>> +config SOC_EXYNOS3250
>> +       bool "SAMSUNG EXYNOS3250"
>> +       default y
>> +       depends on ARCH_EXYNOS3
>> +       select ARCH_HAS_BANDGAP
>> +       select ARM_CPU_SUSPEND if PM
>> +       select PINCTRL_EXYNOS
>> +       select SAMSUNG_DMADEV
>> +       help
>> +         Enable EXYNOS3250 CPU support
> 
> There is a Kconfig consolidation patch submitted by me [1]. Please base your
> code on that one to avoid merge conflicts.
> 
> [1] http://article.gmane.org/gmane.linux.kernel.samsung-soc/28642
> 

Your patch is applied? I can't find merged patch on linux-samsung.git and arm-soc.git.
If this patch is applied, I will rebase this patchset. Thanks.

Best Regards,
Chanwoo Choi
Sachin Kamat April 11, 2014, 5:56 a.m. UTC | #4
Hi Chanwoo,

On 11 April 2014 11:24, Chanwoo Choi <cw00.choi@samsung.com> wrote:
> Hi Sachin,
>
> On 04/11/2014 12:56 PM, Sachin Kamat wrote:
>> Hi Chanwoo,
>>
>> On 10 April 2014 15:07, Chanwoo Choi <cw00.choi@samsung.com> wrote:
>>> This patch add Exynos3250's SoC ID. Exynos 3250 is System-On-Chip(SoC) that
>>> is based on the 32-bit RISC processor for Smartphone. Exynos3250 uses Cortex-A7
>>> dual cores and has a target speed of 1.0GHz.
>>>
>>> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
>>> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
>>> ---
>>>  arch/arm/mach-exynos/Kconfig             | 22 ++++++++++++++++++++++
>>>  arch/arm/mach-exynos/exynos.c            |  1 +
>>>  arch/arm/plat-samsung/include/plat/cpu.h | 10 ++++++++++
>>>  3 files changed, 33 insertions(+)
>>>
>>> diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig
>>> index fc8bf18..6da8a68 100644
>>> --- a/arch/arm/mach-exynos/Kconfig
>>> +++ b/arch/arm/mach-exynos/Kconfig
>>> @@ -11,6 +11,17 @@ if ARCH_EXYNOS
>>>
>>>  menu "SAMSUNG EXYNOS SoCs Support"
>>>
>>> +config ARCH_EXYNOS3
>>> +       bool "SAMSUNG EXYNOS3"
>>> +       select ARM_AMBA
>>> +       select CLKSRC_OF
>>> +       select HAVE_ARM_SCU if SMP
>>> +       select HAVE_SMP
>>> +       select PINCTRL
>>> +       select PM_GENERIC_DOMAINS if PM_RUNTIME
>>> +       help
>>> +         Samsung EXYNOS3 SoCs based systems
>>> +
>>>  config ARCH_EXYNOS4
>>>         bool "SAMSUNG EXYNOS4"
>>>         default y
>>> @@ -41,6 +52,17 @@ config ARCH_EXYNOS5
>>>
>>>  comment "EXYNOS SoCs"
>>>
>>> +config SOC_EXYNOS3250
>>> +       bool "SAMSUNG EXYNOS3250"
>>> +       default y
>>> +       depends on ARCH_EXYNOS3
>>> +       select ARCH_HAS_BANDGAP
>>> +       select ARM_CPU_SUSPEND if PM
>>> +       select PINCTRL_EXYNOS
>>> +       select SAMSUNG_DMADEV
>>> +       help
>>> +         Enable EXYNOS3250 CPU support
>>
>> There is a Kconfig consolidation patch submitted by me [1]. Please base your
>> code on that one to avoid merge conflicts.
>>
>> [1] http://article.gmane.org/gmane.linux.kernel.samsung-soc/28642
>>
>
> Your patch is applied? I can't find merged patch on linux-samsung.git and arm-soc.git.
> If this patch is applied, I will rebase this patchset. Thanks.

This patch hasn't been merged yet but has been agreed upon by Kukjin,
Tomasz and others.
You may follow the mailing list for details.
Chanwoo Choi April 11, 2014, 6:07 a.m. UTC | #5
Hi Sachin,

On 04/11/2014 02:56 PM, Sachin Kamat wrote:
> Hi Chanwoo,
> 
> On 11 April 2014 11:24, Chanwoo Choi <cw00.choi@samsung.com> wrote:
>> Hi Sachin,
>>
>> On 04/11/2014 12:56 PM, Sachin Kamat wrote:
>>> Hi Chanwoo,
>>>
>>> On 10 April 2014 15:07, Chanwoo Choi <cw00.choi@samsung.com> wrote:
>>>> This patch add Exynos3250's SoC ID. Exynos 3250 is System-On-Chip(SoC) that
>>>> is based on the 32-bit RISC processor for Smartphone. Exynos3250 uses Cortex-A7
>>>> dual cores and has a target speed of 1.0GHz.
>>>>
>>>> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
>>>> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
>>>> ---
>>>>  arch/arm/mach-exynos/Kconfig             | 22 ++++++++++++++++++++++
>>>>  arch/arm/mach-exynos/exynos.c            |  1 +
>>>>  arch/arm/plat-samsung/include/plat/cpu.h | 10 ++++++++++
>>>>  3 files changed, 33 insertions(+)
>>>>
>>>> diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig
>>>> index fc8bf18..6da8a68 100644
>>>> --- a/arch/arm/mach-exynos/Kconfig
>>>> +++ b/arch/arm/mach-exynos/Kconfig
>>>> @@ -11,6 +11,17 @@ if ARCH_EXYNOS
>>>>
>>>>  menu "SAMSUNG EXYNOS SoCs Support"
>>>>
>>>> +config ARCH_EXYNOS3
>>>> +       bool "SAMSUNG EXYNOS3"
>>>> +       select ARM_AMBA
>>>> +       select CLKSRC_OF
>>>> +       select HAVE_ARM_SCU if SMP
>>>> +       select HAVE_SMP
>>>> +       select PINCTRL
>>>> +       select PM_GENERIC_DOMAINS if PM_RUNTIME
>>>> +       help
>>>> +         Samsung EXYNOS3 SoCs based systems
>>>> +
>>>>  config ARCH_EXYNOS4
>>>>         bool "SAMSUNG EXYNOS4"
>>>>         default y
>>>> @@ -41,6 +52,17 @@ config ARCH_EXYNOS5
>>>>
>>>>  comment "EXYNOS SoCs"
>>>>
>>>> +config SOC_EXYNOS3250
>>>> +       bool "SAMSUNG EXYNOS3250"
>>>> +       default y
>>>> +       depends on ARCH_EXYNOS3
>>>> +       select ARCH_HAS_BANDGAP
>>>> +       select ARM_CPU_SUSPEND if PM
>>>> +       select PINCTRL_EXYNOS
>>>> +       select SAMSUNG_DMADEV
>>>> +       help
>>>> +         Enable EXYNOS3250 CPU support
>>>
>>> There is a Kconfig consolidation patch submitted by me [1]. Please base your
>>> code on that one to avoid merge conflicts.
>>>
>>> [1] http://article.gmane.org/gmane.linux.kernel.samsung-soc/28642
>>>
>>
>> Your patch is applied? I can't find merged patch on linux-samsung.git and arm-soc.git.
>> If this patch is applied, I will rebase this patchset. Thanks.
> 
> This patch hasn't been merged yet but has been agreed upon by Kukjin,
> Tomasz and others.
> You may follow the mailing list for details.
> 

OK, I checked mailied list for your patch.
As my previous reply, if your patch is merged, I'll rebase it.

Thanks,
Chanwoo Choi
Chanwoo Choi April 11, 2014, 6:32 a.m. UTC | #6
Hi,

On 04/11/2014 10:46 AM, Olof Johansson wrote:
> On Thu, Apr 10, 2014 at 06:37:12PM +0900, Chanwoo Choi wrote:
>> This patch add Exynos3250's SoC ID. Exynos 3250 is System-On-Chip(SoC) that
>> is based on the 32-bit RISC processor for Smartphone. Exynos3250 uses Cortex-A7
>> dual cores and has a target speed of 1.0GHz.
>>
>> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
>> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
>> ---
>>  arch/arm/mach-exynos/Kconfig             | 22 ++++++++++++++++++++++
>>  arch/arm/mach-exynos/exynos.c            |  1 +
>>  arch/arm/plat-samsung/include/plat/cpu.h | 10 ++++++++++
>>  3 files changed, 33 insertions(+)
>>
>> diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig
>> index fc8bf18..6da8a68 100644
>> --- a/arch/arm/mach-exynos/Kconfig
>> +++ b/arch/arm/mach-exynos/Kconfig
>> @@ -11,6 +11,17 @@ if ARCH_EXYNOS
>>  
>>  menu "SAMSUNG EXYNOS SoCs Support"
>>  
>> +config ARCH_EXYNOS3
>> +	bool "SAMSUNG EXYNOS3"
>> +	select ARM_AMBA
>> +	select CLKSRC_OF
>> +	select HAVE_ARM_SCU if SMP
>> +	select HAVE_SMP
>> +	select PINCTRL
>> +	select PM_GENERIC_DOMAINS if PM_RUNTIME
>> +	help
>> +	  Samsung EXYNOS3 SoCs based systems
>> +
>>  config ARCH_EXYNOS4
>>  	bool "SAMSUNG EXYNOS4"
>>  	default y
>> @@ -41,6 +52,17 @@ config ARCH_EXYNOS5
>>  
>>  comment "EXYNOS SoCs"
>>  
>> +config SOC_EXYNOS3250
>> +	bool "SAMSUNG EXYNOS3250"
>> +	default y
>> +	depends on ARCH_EXYNOS3
>> +	select ARCH_HAS_BANDGAP
>> +	select ARM_CPU_SUSPEND if PM
>> +	select PINCTRL_EXYNOS
>> +	select SAMSUNG_DMADEV
>> +	help
>> +	  Enable EXYNOS3250 CPU support
>> +
>>  config CPU_EXYNOS4210
>>  	bool "SAMSUNG EXYNOS4210"
>>  	default y
>> diff --git a/arch/arm/mach-exynos/exynos.c b/arch/arm/mach-exynos/exynos.c
>> index b32a907..b134868 100644
>> --- a/arch/arm/mach-exynos/exynos.c
>> +++ b/arch/arm/mach-exynos/exynos.c
>> @@ -370,6 +370,7 @@ static void __init exynos_dt_machine_init(void)
>>  }
>>  
>>  static char const *exynos_dt_compat[] __initconst = {
>> +	"samsung,exynos3250",
> 
> Please consider samsung,exynos3 instead, so you don't have to update this table
> for every SoC. We've talked about this before..

This patchset included only exynos3250.dtsi without exynos3.dtsi.
So, I added only "samsung,exynos3250" compatible name.

Do you prefer to add SoC version as following?
+       "samsung,exynos3",
+       "samsung,exynos3250",

or ?
+       "samsung,exynos3",

> 
>>  	"samsung,exynos4",
>>  	"samsung,exynos4210",
>>  	"samsung,exynos4212",
>> diff --git a/arch/arm/plat-samsung/include/plat/cpu.h b/arch/arm/plat-samsung/include/plat/cpu.h
>> index 5992b8d..3d808f6b 100644
>> --- a/arch/arm/plat-samsung/include/plat/cpu.h
>> +++ b/arch/arm/plat-samsung/include/plat/cpu.h
>> @@ -43,6 +43,9 @@ extern unsigned long samsung_cpu_id;
>>  #define S5PV210_CPU_ID		0x43110000
>>  #define S5PV210_CPU_MASK	0xFFFFF000
>>  
>> +#define EXYNOS3250_SOC_ID       0xE3472000
>> +#define EXYNOS3_SOC_MASK        0xFFFFF000
>> +
>>  #define EXYNOS4210_CPU_ID	0x43210000
>>  #define EXYNOS4212_CPU_ID	0x43220000
>>  #define EXYNOS4412_CPU_ID	0xE4412200
>> @@ -68,6 +71,7 @@ IS_SAMSUNG_CPU(s5p6440, S5P6440_CPU_ID, S5P64XX_CPU_MASK)
>>  IS_SAMSUNG_CPU(s5p6450, S5P6450_CPU_ID, S5P64XX_CPU_MASK)
>>  IS_SAMSUNG_CPU(s5pc100, S5PC100_CPU_ID, S5PC100_CPU_MASK)
>>  IS_SAMSUNG_CPU(s5pv210, S5PV210_CPU_ID, S5PV210_CPU_MASK)
>> +IS_SAMSUNG_CPU(exynos3250, EXYNOS3250_SOC_ID, EXYNOS3_SOC_MASK)
>>  IS_SAMSUNG_CPU(exynos4210, EXYNOS4210_CPU_ID, EXYNOS4_CPU_MASK)
>>  IS_SAMSUNG_CPU(exynos4212, EXYNOS4212_CPU_ID, EXYNOS4_CPU_MASK)
>>  IS_SAMSUNG_CPU(exynos4412, EXYNOS4412_CPU_ID, EXYNOS4_CPU_MASK)
>> @@ -126,6 +130,12 @@ IS_SAMSUNG_CPU(exynos5440, EXYNOS5440_SOC_ID, EXYNOS5_SOC_MASK)
>>  # define soc_is_s5pv210()	0
>>  #endif
>>  
>> +#if defined(CONFIG_SOC_EXYNOS3250)
>> +# define soc_is_exynos3250()    is_samsung_exynos3250()
>> +#else
>> +# define soc_is_exynos3250()    0
>> +#endif
> 
> In general, I think we have too much code littered with soc_is_<foo>() going
> on, so please try to avoid adding more for this SoC. Especially in cases where
> you just want to bail out of certain features where we might already have
> function pointers to control if a function is called or not, such as the
> firmware interfaces.
> 

Do you prefer dt helper function such as following function instead of new soc_is_xx() ?
- of_machine_is_compatible("samsung,exynos3250")

If you are OK, I'll use of_machine_is_compatible() instead of soc_is_xx().

Best Regards,
Chanwoo Choi
Chanwoo Choi April 11, 2014, 7:09 a.m. UTC | #7
On 04/11/2014 03:32 PM, Chanwoo Choi wrote:
> Hi,
> 
> On 04/11/2014 10:46 AM, Olof Johansson wrote:
>> On Thu, Apr 10, 2014 at 06:37:12PM +0900, Chanwoo Choi wrote:
>>> This patch add Exynos3250's SoC ID. Exynos 3250 is System-On-Chip(SoC) that
>>> is based on the 32-bit RISC processor for Smartphone. Exynos3250 uses Cortex-A7
>>> dual cores and has a target speed of 1.0GHz.
>>>
>>> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
>>> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
>>> ---
>>>  arch/arm/mach-exynos/Kconfig             | 22 ++++++++++++++++++++++
>>>  arch/arm/mach-exynos/exynos.c            |  1 +
>>>  arch/arm/plat-samsung/include/plat/cpu.h | 10 ++++++++++
>>>  3 files changed, 33 insertions(+)
>>>
>>> diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig
>>> index fc8bf18..6da8a68 100644
>>> --- a/arch/arm/mach-exynos/Kconfig
>>> +++ b/arch/arm/mach-exynos/Kconfig
>>> @@ -11,6 +11,17 @@ if ARCH_EXYNOS
>>>  
>>>  menu "SAMSUNG EXYNOS SoCs Support"
>>>  
>>> +config ARCH_EXYNOS3
>>> +	bool "SAMSUNG EXYNOS3"
>>> +	select ARM_AMBA
>>> +	select CLKSRC_OF
>>> +	select HAVE_ARM_SCU if SMP
>>> +	select HAVE_SMP
>>> +	select PINCTRL
>>> +	select PM_GENERIC_DOMAINS if PM_RUNTIME
>>> +	help
>>> +	  Samsung EXYNOS3 SoCs based systems
>>> +
>>>  config ARCH_EXYNOS4
>>>  	bool "SAMSUNG EXYNOS4"
>>>  	default y
>>> @@ -41,6 +52,17 @@ config ARCH_EXYNOS5
>>>  
>>>  comment "EXYNOS SoCs"
>>>  
>>> +config SOC_EXYNOS3250
>>> +	bool "SAMSUNG EXYNOS3250"
>>> +	default y
>>> +	depends on ARCH_EXYNOS3
>>> +	select ARCH_HAS_BANDGAP
>>> +	select ARM_CPU_SUSPEND if PM
>>> +	select PINCTRL_EXYNOS
>>> +	select SAMSUNG_DMADEV
>>> +	help
>>> +	  Enable EXYNOS3250 CPU support
>>> +
>>>  config CPU_EXYNOS4210
>>>  	bool "SAMSUNG EXYNOS4210"
>>>  	default y
>>> diff --git a/arch/arm/mach-exynos/exynos.c b/arch/arm/mach-exynos/exynos.c
>>> index b32a907..b134868 100644
>>> --- a/arch/arm/mach-exynos/exynos.c
>>> +++ b/arch/arm/mach-exynos/exynos.c
>>> @@ -370,6 +370,7 @@ static void __init exynos_dt_machine_init(void)
>>>  }
>>>  
>>>  static char const *exynos_dt_compat[] __initconst = {
>>> +	"samsung,exynos3250",
>>
>> Please consider samsung,exynos3 instead, so you don't have to update this table
>> for every SoC. We've talked about this before..
> 
> This patchset included only exynos3250.dtsi without exynos3.dtsi.
> So, I added only "samsung,exynos3250" compatible name.
> 
> Do you prefer to add SoC version as following?
> +       "samsung,exynos3",
> +       "samsung,exynos3250",
> 
> or ?
> +       "samsung,exynos3",
> 
>>
>>>  	"samsung,exynos4",
>>>  	"samsung,exynos4210",
>>>  	"samsung,exynos4212",
>>> diff --git a/arch/arm/plat-samsung/include/plat/cpu.h b/arch/arm/plat-samsung/include/plat/cpu.h
>>> index 5992b8d..3d808f6b 100644
>>> --- a/arch/arm/plat-samsung/include/plat/cpu.h
>>> +++ b/arch/arm/plat-samsung/include/plat/cpu.h
>>> @@ -43,6 +43,9 @@ extern unsigned long samsung_cpu_id;
>>>  #define S5PV210_CPU_ID		0x43110000
>>>  #define S5PV210_CPU_MASK	0xFFFFF000
>>>  
>>> +#define EXYNOS3250_SOC_ID       0xE3472000
>>> +#define EXYNOS3_SOC_MASK        0xFFFFF000
>>> +
>>>  #define EXYNOS4210_CPU_ID	0x43210000
>>>  #define EXYNOS4212_CPU_ID	0x43220000
>>>  #define EXYNOS4412_CPU_ID	0xE4412200
>>> @@ -68,6 +71,7 @@ IS_SAMSUNG_CPU(s5p6440, S5P6440_CPU_ID, S5P64XX_CPU_MASK)
>>>  IS_SAMSUNG_CPU(s5p6450, S5P6450_CPU_ID, S5P64XX_CPU_MASK)
>>>  IS_SAMSUNG_CPU(s5pc100, S5PC100_CPU_ID, S5PC100_CPU_MASK)
>>>  IS_SAMSUNG_CPU(s5pv210, S5PV210_CPU_ID, S5PV210_CPU_MASK)
>>> +IS_SAMSUNG_CPU(exynos3250, EXYNOS3250_SOC_ID, EXYNOS3_SOC_MASK)
>>>  IS_SAMSUNG_CPU(exynos4210, EXYNOS4210_CPU_ID, EXYNOS4_CPU_MASK)
>>>  IS_SAMSUNG_CPU(exynos4212, EXYNOS4212_CPU_ID, EXYNOS4_CPU_MASK)
>>>  IS_SAMSUNG_CPU(exynos4412, EXYNOS4412_CPU_ID, EXYNOS4_CPU_MASK)
>>> @@ -126,6 +130,12 @@ IS_SAMSUNG_CPU(exynos5440, EXYNOS5440_SOC_ID, EXYNOS5_SOC_MASK)
>>>  # define soc_is_s5pv210()	0
>>>  #endif
>>>  
>>> +#if defined(CONFIG_SOC_EXYNOS3250)
>>> +# define soc_is_exynos3250()    is_samsung_exynos3250()
>>> +#else
>>> +# define soc_is_exynos3250()    0
>>> +#endif
>>
>> In general, I think we have too much code littered with soc_is_<foo>() going
>> on, so please try to avoid adding more for this SoC. Especially in cases where
>> you just want to bail out of certain features where we might already have
>> function pointers to control if a function is called or not, such as the
>> firmware interfaces.
>>
> 
> Do you prefer dt helper function such as following function instead of new soc_is_xx() ?
> - of_machine_is_compatible("samsung,exynos3250")
> 

I think of_machine_is_compatible() is not proper alternative method.
of_machine_is_compatible can be only used if CONFIG_OF is enabled.

Best Regards,
Chanwoo Choi
Arnd Bergmann April 11, 2014, 8:12 a.m. UTC | #8
On Friday 11 April 2014 16:09:57 Chanwoo Choi wrote:
> On 04/11/2014 03:32 PM, Chanwoo Choi wrote:
> >>>  
> >>> +#if defined(CONFIG_SOC_EXYNOS3250)
> >>> +# define soc_is_exynos3250()    is_samsung_exynos3250()
> >>> +#else
> >>> +# define soc_is_exynos3250()    0
> >>> +#endif
> >>
> >> In general, I think we have too much code littered with soc_is_<foo>() going
> >> on, so please try to avoid adding more for this SoC. Especially in cases where
> >> you just want to bail out of certain features where we might already have
> >> function pointers to control if a function is called or not, such as the
> >> firmware interfaces.
> >>
> > 
> > Do you prefer dt helper function such as following function instead of new soc_is_xx() ?
> > - of_machine_is_compatible("samsung,exynos3250")
> > 
> 
> I think of_machine_is_compatible() is not proper alternative method.
> of_machine_is_compatible can be only used if CONFIG_OF is enabled.
> 

CONFIG_OF is enabled by definition, that wouldn't be a problem. However,
of_machine_is_compatible() doesn't solve the problem that Olof mentioned,
you still make runtime-decisions based on the SoC ID, which you should not.

Instead, the code should be restructured so it doesn't have to know which
SoC is being used. If some machines work differently from others, that should
be local knowledge within the device driver, and it can use for instance
a DT property of the device node that describes the register set the driver
is using.

	Arnd
Tomasz Figa April 11, 2014, 8:39 a.m. UTC | #9
On 11.04.2014 08:32, Chanwoo Choi wrote:
> Hi,
>
> On 04/11/2014 10:46 AM, Olof Johansson wrote:
>> On Thu, Apr 10, 2014 at 06:37:12PM +0900, Chanwoo Choi wrote:
>>> This patch add Exynos3250's SoC ID. Exynos 3250 is System-On-Chip(SoC) that
>>> is based on the 32-bit RISC processor for Smartphone. Exynos3250 uses Cortex-A7
>>> dual cores and has a target speed of 1.0GHz.
>>>
>>> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
>>> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
>>> ---
>>>   arch/arm/mach-exynos/Kconfig             | 22 ++++++++++++++++++++++
>>>   arch/arm/mach-exynos/exynos.c            |  1 +
>>>   arch/arm/plat-samsung/include/plat/cpu.h | 10 ++++++++++
>>>   3 files changed, 33 insertions(+)
>>>
>>> diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig
>>> index fc8bf18..6da8a68 100644
>>> --- a/arch/arm/mach-exynos/Kconfig
>>> +++ b/arch/arm/mach-exynos/Kconfig
>>> @@ -11,6 +11,17 @@ if ARCH_EXYNOS
>>>
>>>   menu "SAMSUNG EXYNOS SoCs Support"
>>>
>>> +config ARCH_EXYNOS3
>>> +	bool "SAMSUNG EXYNOS3"
>>> +	select ARM_AMBA
>>> +	select CLKSRC_OF
>>> +	select HAVE_ARM_SCU if SMP
>>> +	select HAVE_SMP
>>> +	select PINCTRL
>>> +	select PM_GENERIC_DOMAINS if PM_RUNTIME
>>> +	help
>>> +	  Samsung EXYNOS3 SoCs based systems
>>> +
>>>   config ARCH_EXYNOS4
>>>   	bool "SAMSUNG EXYNOS4"
>>>   	default y
>>> @@ -41,6 +52,17 @@ config ARCH_EXYNOS5
>>>
>>>   comment "EXYNOS SoCs"
>>>
>>> +config SOC_EXYNOS3250
>>> +	bool "SAMSUNG EXYNOS3250"
>>> +	default y
>>> +	depends on ARCH_EXYNOS3
>>> +	select ARCH_HAS_BANDGAP
>>> +	select ARM_CPU_SUSPEND if PM
>>> +	select PINCTRL_EXYNOS
>>> +	select SAMSUNG_DMADEV
>>> +	help
>>> +	  Enable EXYNOS3250 CPU support
>>> +
>>>   config CPU_EXYNOS4210
>>>   	bool "SAMSUNG EXYNOS4210"
>>>   	default y
>>> diff --git a/arch/arm/mach-exynos/exynos.c b/arch/arm/mach-exynos/exynos.c
>>> index b32a907..b134868 100644
>>> --- a/arch/arm/mach-exynos/exynos.c
>>> +++ b/arch/arm/mach-exynos/exynos.c
>>> @@ -370,6 +370,7 @@ static void __init exynos_dt_machine_init(void)
>>>   }
>>>
>>>   static char const *exynos_dt_compat[] __initconst = {
>>> +	"samsung,exynos3250",
>>
>> Please consider samsung,exynos3 instead, so you don't have to update this table
>> for every SoC. We've talked about this before..
>
> This patchset included only exynos3250.dtsi without exynos3.dtsi.
> So, I added only "samsung,exynos3250" compatible name.

There is no direct relation between dts file names and compatible string 
(although usually they correspond). You don't need exynos3.dtsi (at 
least until another SoC from this family shows up).

>
> Do you prefer to add SoC version as following?
> +       "samsung,exynos3",
> +       "samsung,exynos3250",
>
> or ?
> +       "samsung,exynos3",

This is actually a good question. If adding exynos3 anyway, it probably 
wouldn't hurt to add exynos3250 anyway, to avoid adding it in future if 
some SoC specific quirks show up, especially when both of compatible 
strings need to be documented anyway.

>
>>
>>>   	"samsung,exynos4",
>>>   	"samsung,exynos4210",
>>>   	"samsung,exynos4212",
>>> diff --git a/arch/arm/plat-samsung/include/plat/cpu.h b/arch/arm/plat-samsung/include/plat/cpu.h
>>> index 5992b8d..3d808f6b 100644
>>> --- a/arch/arm/plat-samsung/include/plat/cpu.h
>>> +++ b/arch/arm/plat-samsung/include/plat/cpu.h
>>> @@ -43,6 +43,9 @@ extern unsigned long samsung_cpu_id;
>>>   #define S5PV210_CPU_ID		0x43110000
>>>   #define S5PV210_CPU_MASK	0xFFFFF000
>>>
>>> +#define EXYNOS3250_SOC_ID       0xE3472000
>>> +#define EXYNOS3_SOC_MASK        0xFFFFF000
>>> +
>>>   #define EXYNOS4210_CPU_ID	0x43210000
>>>   #define EXYNOS4212_CPU_ID	0x43220000
>>>   #define EXYNOS4412_CPU_ID	0xE4412200
>>> @@ -68,6 +71,7 @@ IS_SAMSUNG_CPU(s5p6440, S5P6440_CPU_ID, S5P64XX_CPU_MASK)
>>>   IS_SAMSUNG_CPU(s5p6450, S5P6450_CPU_ID, S5P64XX_CPU_MASK)
>>>   IS_SAMSUNG_CPU(s5pc100, S5PC100_CPU_ID, S5PC100_CPU_MASK)
>>>   IS_SAMSUNG_CPU(s5pv210, S5PV210_CPU_ID, S5PV210_CPU_MASK)
>>> +IS_SAMSUNG_CPU(exynos3250, EXYNOS3250_SOC_ID, EXYNOS3_SOC_MASK)
>>>   IS_SAMSUNG_CPU(exynos4210, EXYNOS4210_CPU_ID, EXYNOS4_CPU_MASK)
>>>   IS_SAMSUNG_CPU(exynos4212, EXYNOS4212_CPU_ID, EXYNOS4_CPU_MASK)
>>>   IS_SAMSUNG_CPU(exynos4412, EXYNOS4412_CPU_ID, EXYNOS4_CPU_MASK)
>>> @@ -126,6 +130,12 @@ IS_SAMSUNG_CPU(exynos5440, EXYNOS5440_SOC_ID, EXYNOS5_SOC_MASK)
>>>   # define soc_is_s5pv210()	0
>>>   #endif
>>>
>>> +#if defined(CONFIG_SOC_EXYNOS3250)
>>> +# define soc_is_exynos3250()    is_samsung_exynos3250()
>>> +#else
>>> +# define soc_is_exynos3250()    0
>>> +#endif
>>
>> In general, I think we have too much code littered with soc_is_<foo>() going
>> on, so please try to avoid adding more for this SoC. Especially in cases where
>> you just want to bail out of certain features where we might already have
>> function pointers to control if a function is called or not, such as the
>> firmware interfaces.
>>
>
> Do you prefer dt helper function such as following function instead of new soc_is_xx() ?
> - of_machine_is_compatible("samsung,exynos3250")
>
> If you are OK, I'll use of_machine_is_compatible() instead of soc_is_xx().

First of all, there is still a lot of code in mach-exynos/ using the 
soc_is_xx() macros, so having some SoCs use them and other SoCs use 
of_machine_is_compatible() wouldn't make the code cleaner.

For now, I wouldn't mind adding soc_is_exynos3250(), but in general such 
code surrounded with if (soc_is_xx()) blocks should be reworked to use 
something better, for example function pointers, as Olof suggested.

Best regards,
Tomasz
Chanwoo Choi April 14, 2014, 5:13 a.m. UTC | #10
Dear Olof and Tomasz,

On 04/11/2014 05:39 PM, Tomasz Figa wrote:
> On 11.04.2014 08:32, Chanwoo Choi wrote:
>> Hi,
>>
>> On 04/11/2014 10:46 AM, Olof Johansson wrote:
>>> On Thu, Apr 10, 2014 at 06:37:12PM +0900, Chanwoo Choi wrote:
>>>> This patch add Exynos3250's SoC ID. Exynos 3250 is System-On-Chip(SoC) that
>>>> is based on the 32-bit RISC processor for Smartphone. Exynos3250 uses Cortex-A7
>>>> dual cores and has a target speed of 1.0GHz.
>>>>
>>>> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
>>>> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
>>>> ---
>>>>   arch/arm/mach-exynos/Kconfig             | 22 ++++++++++++++++++++++
>>>>   arch/arm/mach-exynos/exynos.c            |  1 +
>>>>   arch/arm/plat-samsung/include/plat/cpu.h | 10 ++++++++++
>>>>   3 files changed, 33 insertions(+)
>>>>
>>>> diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig
>>>> index fc8bf18..6da8a68 100644
>>>> --- a/arch/arm/mach-exynos/Kconfig
>>>> +++ b/arch/arm/mach-exynos/Kconfig
>>>> @@ -11,6 +11,17 @@ if ARCH_EXYNOS
>>>>
>>>>   menu "SAMSUNG EXYNOS SoCs Support"
>>>>
>>>> +config ARCH_EXYNOS3
>>>> +    bool "SAMSUNG EXYNOS3"
>>>> +    select ARM_AMBA
>>>> +    select CLKSRC_OF
>>>> +    select HAVE_ARM_SCU if SMP
>>>> +    select HAVE_SMP
>>>> +    select PINCTRL
>>>> +    select PM_GENERIC_DOMAINS if PM_RUNTIME
>>>> +    help
>>>> +      Samsung EXYNOS3 SoCs based systems
>>>> +
>>>>   config ARCH_EXYNOS4
>>>>       bool "SAMSUNG EXYNOS4"
>>>>       default y
>>>> @@ -41,6 +52,17 @@ config ARCH_EXYNOS5
>>>>
>>>>   comment "EXYNOS SoCs"
>>>>
>>>> +config SOC_EXYNOS3250
>>>> +    bool "SAMSUNG EXYNOS3250"
>>>> +    default y
>>>> +    depends on ARCH_EXYNOS3
>>>> +    select ARCH_HAS_BANDGAP
>>>> +    select ARM_CPU_SUSPEND if PM
>>>> +    select PINCTRL_EXYNOS
>>>> +    select SAMSUNG_DMADEV
>>>> +    help
>>>> +      Enable EXYNOS3250 CPU support
>>>> +
>>>>   config CPU_EXYNOS4210
>>>>       bool "SAMSUNG EXYNOS4210"
>>>>       default y
>>>> diff --git a/arch/arm/mach-exynos/exynos.c b/arch/arm/mach-exynos/exynos.c
>>>> index b32a907..b134868 100644
>>>> --- a/arch/arm/mach-exynos/exynos.c
>>>> +++ b/arch/arm/mach-exynos/exynos.c
>>>> @@ -370,6 +370,7 @@ static void __init exynos_dt_machine_init(void)
>>>>   }
>>>>
>>>>   static char const *exynos_dt_compat[] __initconst = {
>>>> +    "samsung,exynos3250",
>>>
>>> Please consider samsung,exynos3 instead, so you don't have to update this table
>>> for every SoC. We've talked about this before..
>>
>> This patchset included only exynos3250.dtsi without exynos3.dtsi.
>> So, I added only "samsung,exynos3250" compatible name.
> 
> There is no direct relation between dts file names and compatible string (although usually they correspond). You don't need exynos3.dtsi (at least until another SoC from this family shows up).
> 
>>
>> Do you prefer to add SoC version as following?
>> +       "samsung,exynos3",
>> +       "samsung,exynos3250",
>>
>> or ?
>> +       "samsung,exynos3",
> 
> This is actually a good question. If adding exynos3 anyway, it probably wouldn't hurt to add exynos3250 anyway, to avoid adding it in future if some SoC specific quirks show up, especially when both of compatible strings need to be documented anyway.
> 
>>
>>>
>>>>       "samsung,exynos4",
>>>>       "samsung,exynos4210",
>>>>       "samsung,exynos4212",
>>>> diff --git a/arch/arm/plat-samsung/include/plat/cpu.h b/arch/arm/plat-samsung/include/plat/cpu.h
>>>> index 5992b8d..3d808f6b 100644
>>>> --- a/arch/arm/plat-samsung/include/plat/cpu.h
>>>> +++ b/arch/arm/plat-samsung/include/plat/cpu.h
>>>> @@ -43,6 +43,9 @@ extern unsigned long samsung_cpu_id;
>>>>   #define S5PV210_CPU_ID        0x43110000
>>>>   #define S5PV210_CPU_MASK    0xFFFFF000
>>>>
>>>> +#define EXYNOS3250_SOC_ID       0xE3472000
>>>> +#define EXYNOS3_SOC_MASK        0xFFFFF000
>>>> +
>>>>   #define EXYNOS4210_CPU_ID    0x43210000
>>>>   #define EXYNOS4212_CPU_ID    0x43220000
>>>>   #define EXYNOS4412_CPU_ID    0xE4412200
>>>> @@ -68,6 +71,7 @@ IS_SAMSUNG_CPU(s5p6440, S5P6440_CPU_ID, S5P64XX_CPU_MASK)
>>>>   IS_SAMSUNG_CPU(s5p6450, S5P6450_CPU_ID, S5P64XX_CPU_MASK)
>>>>   IS_SAMSUNG_CPU(s5pc100, S5PC100_CPU_ID, S5PC100_CPU_MASK)
>>>>   IS_SAMSUNG_CPU(s5pv210, S5PV210_CPU_ID, S5PV210_CPU_MASK)
>>>> +IS_SAMSUNG_CPU(exynos3250, EXYNOS3250_SOC_ID, EXYNOS3_SOC_MASK)
>>>>   IS_SAMSUNG_CPU(exynos4210, EXYNOS4210_CPU_ID, EXYNOS4_CPU_MASK)
>>>>   IS_SAMSUNG_CPU(exynos4212, EXYNOS4212_CPU_ID, EXYNOS4_CPU_MASK)
>>>>   IS_SAMSUNG_CPU(exynos4412, EXYNOS4412_CPU_ID, EXYNOS4_CPU_MASK)
>>>> @@ -126,6 +130,12 @@ IS_SAMSUNG_CPU(exynos5440, EXYNOS5440_SOC_ID, EXYNOS5_SOC_MASK)
>>>>   # define soc_is_s5pv210()    0
>>>>   #endif
>>>>
>>>> +#if defined(CONFIG_SOC_EXYNOS3250)
>>>> +# define soc_is_exynos3250()    is_samsung_exynos3250()
>>>> +#else
>>>> +# define soc_is_exynos3250()    0
>>>> +#endif
>>>
>>> In general, I think we have too much code littered with soc_is_<foo>() going
>>> on, so please try to avoid adding more for this SoC. Especially in cases where
>>> you just want to bail out of certain features where we might already have
>>> function pointers to control if a function is called or not, such as the
>>> firmware interfaces.
>>>
>>
>> Do you prefer dt helper function such as following function instead of new soc_is_xx() ?
>> - of_machine_is_compatible("samsung,exynos3250")
>>
>> If you are OK, I'll use of_machine_is_compatible() instead of soc_is_xx().
> 
> First of all, there is still a lot of code in mach-exynos/ using the soc_is_xx() macros, so having some SoCs use them and other SoCs use of_machine_is_compatible() wouldn't make the code cleaner.
> 
> For now, I wouldn't mind adding soc_is_exynos3250(), but in general such code surrounded with if (soc_is_xx()) blocks should be reworked to use something better, for example function pointers, as Olof suggested.

I thought 'function pointers' method instead of soc_is_xxx() macro as following two case:
I need more detailed explanation/example of "for example function pointers, as Olof suggested." sentence.

[case 1]
Each Exynos SoC has other function pointers according to compatible name of DT.

For example, arch/arm/mach-exynos/firmware.c

static const struct firmware_ops exynos_firmware_ops = {
	.do_idle		= exynos_do_idle,
	.set_cpu_boot_addr	= exynos_set_cpu_boot_addr,
	.cpu_boot		= exynos_cpu_boot,
};
static const struct firmware_ops exynos3250_firmware_ops = {
	.do_idle		= exynos_do_idle,
	.set_cpu_boot_addr	= exynos4212_set_cpu_boot_addr,
	.cpu_boot		= exynos3250_cpu_boot,
};

static const struct firmware_ops exynos4212_firmware_ops = {
	.do_idle		= exynos_do_idle,
	.set_cpu_boot_addr	= exynos4212_set_cpu_boot_addr,
	.cpu_boot		= exynos4212_cpu_boot,
};

struct secure_firmware {
	char *name;
	const struct firmware_ops *ops;
} exynos_secure_firmware[] __initconst = {
	{ "samsung,secure-firmware",		&exynos_firmware_ops },
	{ "samsung,exynos3250-secure-firmware", &exynos3250_firmware_ops },
	{ "samsung,exynos4212-secure-firmware", &exynos4212_firmware_ops },
};


[case 2]
Delete all the soc_is_xxx() macro and then
use only get_samsung_soc_id() function as following:
	 
	switch (get_samsung_soc_id()) {
	case EXYNOS3250_SOC_ID:
		// ...
		break;
	case EXYNOS4210_CPU_ID:
		// ...
		break;
	case EXYNOS4212_CPU_ID:
		// ...
		break;
	case EXYNOS4412_CPU_ID:
		// ...
		break;
	case EXYNOS5250_SOC_ID:
		// ...
		break;
	case EXYNOS5420_SOC_ID:
		// ...
		break;
	case EXYNOS5440_SOC_ID:
		// ...
		break;
	};

Best Regards,
Chanwoo Choi
Tomasz Figa April 16, 2014, 3:53 p.m. UTC | #11
Hi Chanwoo,

On 14.04.2014 07:13, Chanwoo Choi wrote:
> On 04/11/2014 05:39 PM, Tomasz Figa wrote:
>> On 11.04.2014 08:32, Chanwoo Choi wrote:
>>> On 04/11/2014 10:46 AM, Olof Johansson wrote:
>>>> On Thu, Apr 10, 2014 at 06:37:12PM +0900, Chanwoo Choi wrote:
>>>>> diff --git a/arch/arm/plat-samsung/include/plat/cpu.h b/arch/arm/plat-samsung/include/plat/cpu.h
>>>>> index 5992b8d..3d808f6b 100644
>>>>> --- a/arch/arm/plat-samsung/include/plat/cpu.h
>>>>> +++ b/arch/arm/plat-samsung/include/plat/cpu.h
>>>>> @@ -43,6 +43,9 @@ extern unsigned long samsung_cpu_id;
>>>>>    #define S5PV210_CPU_ID        0x43110000
>>>>>    #define S5PV210_CPU_MASK    0xFFFFF000
>>>>>
>>>>> +#define EXYNOS3250_SOC_ID       0xE3472000
>>>>> +#define EXYNOS3_SOC_MASK        0xFFFFF000
>>>>> +
>>>>>    #define EXYNOS4210_CPU_ID    0x43210000
>>>>>    #define EXYNOS4212_CPU_ID    0x43220000
>>>>>    #define EXYNOS4412_CPU_ID    0xE4412200
>>>>> @@ -68,6 +71,7 @@ IS_SAMSUNG_CPU(s5p6440, S5P6440_CPU_ID, S5P64XX_CPU_MASK)
>>>>>    IS_SAMSUNG_CPU(s5p6450, S5P6450_CPU_ID, S5P64XX_CPU_MASK)
>>>>>    IS_SAMSUNG_CPU(s5pc100, S5PC100_CPU_ID, S5PC100_CPU_MASK)
>>>>>    IS_SAMSUNG_CPU(s5pv210, S5PV210_CPU_ID, S5PV210_CPU_MASK)
>>>>> +IS_SAMSUNG_CPU(exynos3250, EXYNOS3250_SOC_ID, EXYNOS3_SOC_MASK)
>>>>>    IS_SAMSUNG_CPU(exynos4210, EXYNOS4210_CPU_ID, EXYNOS4_CPU_MASK)
>>>>>    IS_SAMSUNG_CPU(exynos4212, EXYNOS4212_CPU_ID, EXYNOS4_CPU_MASK)
>>>>>    IS_SAMSUNG_CPU(exynos4412, EXYNOS4412_CPU_ID, EXYNOS4_CPU_MASK)
>>>>> @@ -126,6 +130,12 @@ IS_SAMSUNG_CPU(exynos5440, EXYNOS5440_SOC_ID, EXYNOS5_SOC_MASK)
>>>>>    # define soc_is_s5pv210()    0
>>>>>    #endif
>>>>>
>>>>> +#if defined(CONFIG_SOC_EXYNOS3250)
>>>>> +# define soc_is_exynos3250()    is_samsung_exynos3250()
>>>>> +#else
>>>>> +# define soc_is_exynos3250()    0
>>>>> +#endif
>>>>
>>>> In general, I think we have too much code littered with soc_is_<foo>() going
>>>> on, so please try to avoid adding more for this SoC. Especially in cases where
>>>> you just want to bail out of certain features where we might already have
>>>> function pointers to control if a function is called or not, such as the
>>>> firmware interfaces.
>>>>
>>>
>>> Do you prefer dt helper function such as following function instead of new soc_is_xx() ?
>>> - of_machine_is_compatible("samsung,exynos3250")
>>>
>>> If you are OK, I'll use of_machine_is_compatible() instead of soc_is_xx().
>>
>> First of all, there is still a lot of code in mach-exynos/ using the soc_is_xx() macros, so having some SoCs use them and other SoCs use of_machine_is_compatible() wouldn't make the code cleaner.
>>
>> For now, I wouldn't mind adding soc_is_exynos3250(), but in general such code surrounded with if (soc_is_xx()) blocks should be reworked to use something better, for example function pointers, as Olof suggested.
>
> I thought 'function pointers' method instead of soc_is_xxx() macro as following two case:
> I need more detailed explanation/example of "for example function pointers, as Olof suggested." sentence.
>
> [case 1]
> Each Exynos SoC has other function pointers according to compatible name of DT.
>
> For example, arch/arm/mach-exynos/firmware.c
>
> static const struct firmware_ops exynos_firmware_ops = {
> 	.do_idle		= exynos_do_idle,
> 	.set_cpu_boot_addr	= exynos_set_cpu_boot_addr,
> 	.cpu_boot		= exynos_cpu_boot,
> };
> static const struct firmware_ops exynos3250_firmware_ops = {
> 	.do_idle		= exynos_do_idle,
> 	.set_cpu_boot_addr	= exynos4212_set_cpu_boot_addr,
> 	.cpu_boot		= exynos3250_cpu_boot,
> };
>
> static const struct firmware_ops exynos4212_firmware_ops = {
> 	.do_idle		= exynos_do_idle,
> 	.set_cpu_boot_addr	= exynos4212_set_cpu_boot_addr,
> 	.cpu_boot		= exynos4212_cpu_boot,
> };
>
> struct secure_firmware {
> 	char *name;
> 	const struct firmware_ops *ops;
> } exynos_secure_firmware[] __initconst = {
> 	{ "samsung,secure-firmware",		&exynos_firmware_ops },
> 	{ "samsung,exynos3250-secure-firmware", &exynos3250_firmware_ops },
> 	{ "samsung,exynos4212-secure-firmware", &exynos4212_firmware_ops },
> };
>

This is probably the right solution. Another would be to detect which 
firmware ops to use by matching root node with particular SoC compatible 
strings.

Best regards,
Tomasz
Chanwoo Choi April 17, 2014, 1:37 a.m. UTC | #12
Hi Tomasz,

On 04/17/2014 12:53 AM, Tomasz Figa wrote:
> Hi Chanwoo,
> 
> On 14.04.2014 07:13, Chanwoo Choi wrote:
>> On 04/11/2014 05:39 PM, Tomasz Figa wrote:
>>> On 11.04.2014 08:32, Chanwoo Choi wrote:
>>>> On 04/11/2014 10:46 AM, Olof Johansson wrote:
>>>>> On Thu, Apr 10, 2014 at 06:37:12PM +0900, Chanwoo Choi wrote:
>>>>>> diff --git a/arch/arm/plat-samsung/include/plat/cpu.h b/arch/arm/plat-samsung/include/plat/cpu.h
>>>>>> index 5992b8d..3d808f6b 100644
>>>>>> --- a/arch/arm/plat-samsung/include/plat/cpu.h
>>>>>> +++ b/arch/arm/plat-samsung/include/plat/cpu.h
>>>>>> @@ -43,6 +43,9 @@ extern unsigned long samsung_cpu_id;
>>>>>>    #define S5PV210_CPU_ID        0x43110000
>>>>>>    #define S5PV210_CPU_MASK    0xFFFFF000
>>>>>>
>>>>>> +#define EXYNOS3250_SOC_ID       0xE3472000
>>>>>> +#define EXYNOS3_SOC_MASK        0xFFFFF000
>>>>>> +
>>>>>>    #define EXYNOS4210_CPU_ID    0x43210000
>>>>>>    #define EXYNOS4212_CPU_ID    0x43220000
>>>>>>    #define EXYNOS4412_CPU_ID    0xE4412200
>>>>>> @@ -68,6 +71,7 @@ IS_SAMSUNG_CPU(s5p6440, S5P6440_CPU_ID, S5P64XX_CPU_MASK)
>>>>>>    IS_SAMSUNG_CPU(s5p6450, S5P6450_CPU_ID, S5P64XX_CPU_MASK)
>>>>>>    IS_SAMSUNG_CPU(s5pc100, S5PC100_CPU_ID, S5PC100_CPU_MASK)
>>>>>>    IS_SAMSUNG_CPU(s5pv210, S5PV210_CPU_ID, S5PV210_CPU_MASK)
>>>>>> +IS_SAMSUNG_CPU(exynos3250, EXYNOS3250_SOC_ID, EXYNOS3_SOC_MASK)
>>>>>>    IS_SAMSUNG_CPU(exynos4210, EXYNOS4210_CPU_ID, EXYNOS4_CPU_MASK)
>>>>>>    IS_SAMSUNG_CPU(exynos4212, EXYNOS4212_CPU_ID, EXYNOS4_CPU_MASK)
>>>>>>    IS_SAMSUNG_CPU(exynos4412, EXYNOS4412_CPU_ID, EXYNOS4_CPU_MASK)
>>>>>> @@ -126,6 +130,12 @@ IS_SAMSUNG_CPU(exynos5440, EXYNOS5440_SOC_ID, EXYNOS5_SOC_MASK)
>>>>>>    # define soc_is_s5pv210()    0
>>>>>>    #endif
>>>>>>
>>>>>> +#if defined(CONFIG_SOC_EXYNOS3250)
>>>>>> +# define soc_is_exynos3250()    is_samsung_exynos3250()
>>>>>> +#else
>>>>>> +# define soc_is_exynos3250()    0
>>>>>> +#endif
>>>>>
>>>>> In general, I think we have too much code littered with soc_is_<foo>() going
>>>>> on, so please try to avoid adding more for this SoC. Especially in cases where
>>>>> you just want to bail out of certain features where we might already have
>>>>> function pointers to control if a function is called or not, such as the
>>>>> firmware interfaces.
>>>>>
>>>>
>>>> Do you prefer dt helper function such as following function instead of new soc_is_xx() ?
>>>> - of_machine_is_compatible("samsung,exynos3250")
>>>>
>>>> If you are OK, I'll use of_machine_is_compatible() instead of soc_is_xx().
>>>
>>> First of all, there is still a lot of code in mach-exynos/ using the soc_is_xx() macros, so having some SoCs use them and other SoCs use of_machine_is_compatible() wouldn't make the code cleaner.
>>>
>>> For now, I wouldn't mind adding soc_is_exynos3250(), but in general such code surrounded with if (soc_is_xx()) blocks should be reworked to use something better, for example function pointers, as Olof suggested.
>>
>> I thought 'function pointers' method instead of soc_is_xxx() macro as following two case:
>> I need more detailed explanation/example of "for example function pointers, as Olof suggested." sentence.
>>
>> [case 1]
>> Each Exynos SoC has other function pointers according to compatible name of DT.
>>
>> For example, arch/arm/mach-exynos/firmware.c
>>
>> static const struct firmware_ops exynos_firmware_ops = {
>>     .do_idle        = exynos_do_idle,
>>     .set_cpu_boot_addr    = exynos_set_cpu_boot_addr,
>>     .cpu_boot        = exynos_cpu_boot,
>> };
>> static const struct firmware_ops exynos3250_firmware_ops = {
>>     .do_idle        = exynos_do_idle,
>>     .set_cpu_boot_addr    = exynos4212_set_cpu_boot_addr,
>>     .cpu_boot        = exynos3250_cpu_boot,
>> };
>>
>> static const struct firmware_ops exynos4212_firmware_ops = {
>>     .do_idle        = exynos_do_idle,
>>     .set_cpu_boot_addr    = exynos4212_set_cpu_boot_addr,
>>     .cpu_boot        = exynos4212_cpu_boot,
>> };
>>
>> struct secure_firmware {
>>     char *name;
>>     const struct firmware_ops *ops;
>> } exynos_secure_firmware[] __initconst = {
>>     { "samsung,secure-firmware",        &exynos_firmware_ops },
>>     { "samsung,exynos3250-secure-firmware", &exynos3250_firmware_ops },
>>     { "samsung,exynos4212-secure-firmware", &exynos4212_firmware_ops },
>> };
>>
> 
> This is probably the right solution. Another would be to detect which firmware ops to use by matching root node with particular SoC compatible strings.
> 

OK, I'll modify firmware.c using this method on separated patch apart from Exynos3250 patchset.
But, I want to implment it after completed Exynos3250 patchset.
Because Exynos3250 patchset needs other patch such as following patch:
Following patches has not yet to be confirmed or merged.

[PATCH Resend] ARM: EXYNOS: Map SYSRAM address through DT
- http://www.spinics.net/lists/arm-kernel/msg323011.html

[PATCH v2 1/3] ARM: EXYNOS: Map PMU address through DT
- http://www.spinics.net/lists/arm-kernel/msg316013.html
 
Thanks for your review.

Best regards,
Chanwoo Choi
diff mbox

Patch

diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig
index fc8bf18..6da8a68 100644
--- a/arch/arm/mach-exynos/Kconfig
+++ b/arch/arm/mach-exynos/Kconfig
@@ -11,6 +11,17 @@  if ARCH_EXYNOS
 
 menu "SAMSUNG EXYNOS SoCs Support"
 
+config ARCH_EXYNOS3
+	bool "SAMSUNG EXYNOS3"
+	select ARM_AMBA
+	select CLKSRC_OF
+	select HAVE_ARM_SCU if SMP
+	select HAVE_SMP
+	select PINCTRL
+	select PM_GENERIC_DOMAINS if PM_RUNTIME
+	help
+	  Samsung EXYNOS3 SoCs based systems
+
 config ARCH_EXYNOS4
 	bool "SAMSUNG EXYNOS4"
 	default y
@@ -41,6 +52,17 @@  config ARCH_EXYNOS5
 
 comment "EXYNOS SoCs"
 
+config SOC_EXYNOS3250
+	bool "SAMSUNG EXYNOS3250"
+	default y
+	depends on ARCH_EXYNOS3
+	select ARCH_HAS_BANDGAP
+	select ARM_CPU_SUSPEND if PM
+	select PINCTRL_EXYNOS
+	select SAMSUNG_DMADEV
+	help
+	  Enable EXYNOS3250 CPU support
+
 config CPU_EXYNOS4210
 	bool "SAMSUNG EXYNOS4210"
 	default y
diff --git a/arch/arm/mach-exynos/exynos.c b/arch/arm/mach-exynos/exynos.c
index b32a907..b134868 100644
--- a/arch/arm/mach-exynos/exynos.c
+++ b/arch/arm/mach-exynos/exynos.c
@@ -370,6 +370,7 @@  static void __init exynos_dt_machine_init(void)
 }
 
 static char const *exynos_dt_compat[] __initconst = {
+	"samsung,exynos3250",
 	"samsung,exynos4",
 	"samsung,exynos4210",
 	"samsung,exynos4212",
diff --git a/arch/arm/plat-samsung/include/plat/cpu.h b/arch/arm/plat-samsung/include/plat/cpu.h
index 5992b8d..3d808f6b 100644
--- a/arch/arm/plat-samsung/include/plat/cpu.h
+++ b/arch/arm/plat-samsung/include/plat/cpu.h
@@ -43,6 +43,9 @@  extern unsigned long samsung_cpu_id;
 #define S5PV210_CPU_ID		0x43110000
 #define S5PV210_CPU_MASK	0xFFFFF000
 
+#define EXYNOS3250_SOC_ID       0xE3472000
+#define EXYNOS3_SOC_MASK        0xFFFFF000
+
 #define EXYNOS4210_CPU_ID	0x43210000
 #define EXYNOS4212_CPU_ID	0x43220000
 #define EXYNOS4412_CPU_ID	0xE4412200
@@ -68,6 +71,7 @@  IS_SAMSUNG_CPU(s5p6440, S5P6440_CPU_ID, S5P64XX_CPU_MASK)
 IS_SAMSUNG_CPU(s5p6450, S5P6450_CPU_ID, S5P64XX_CPU_MASK)
 IS_SAMSUNG_CPU(s5pc100, S5PC100_CPU_ID, S5PC100_CPU_MASK)
 IS_SAMSUNG_CPU(s5pv210, S5PV210_CPU_ID, S5PV210_CPU_MASK)
+IS_SAMSUNG_CPU(exynos3250, EXYNOS3250_SOC_ID, EXYNOS3_SOC_MASK)
 IS_SAMSUNG_CPU(exynos4210, EXYNOS4210_CPU_ID, EXYNOS4_CPU_MASK)
 IS_SAMSUNG_CPU(exynos4212, EXYNOS4212_CPU_ID, EXYNOS4_CPU_MASK)
 IS_SAMSUNG_CPU(exynos4412, EXYNOS4412_CPU_ID, EXYNOS4_CPU_MASK)
@@ -126,6 +130,12 @@  IS_SAMSUNG_CPU(exynos5440, EXYNOS5440_SOC_ID, EXYNOS5_SOC_MASK)
 # define soc_is_s5pv210()	0
 #endif
 
+#if defined(CONFIG_SOC_EXYNOS3250)
+# define soc_is_exynos3250()    is_samsung_exynos3250()
+#else
+# define soc_is_exynos3250()    0
+#endif
+
 #if defined(CONFIG_CPU_EXYNOS4210)
 # define soc_is_exynos4210()	is_samsung_exynos4210()
 #else