public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Chanwoo Choi <cw00.choi@samsung.com>
To: Tomasz Figa <t.figa@samsung.com>
Cc: Olof Johansson <olof@lixom.net>,
	kgene.kim@samsung.com, linux-samsung-soc@vger.kernel.org,
	kyungmin.park@samsung.com, inki.dae@samsung.com,
	sw0312.kim@samsung.com, hyunhee.kim@samsung.com,
	yj44.cho@samsung.com, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	Rob Herring <robh+dt@kernel.org>,
	Mark Rutland <Mark.Rutland@arm.com>,
	Grant Likely <grant.likely@secretlab.ca>
Subject: Re: [PATCH 01/27] ARM: EXYNOS: Add Exynos3250 SoC ID
Date: Thu, 17 Apr 2014 10:37:32 +0900	[thread overview]
Message-ID: <534F305C.2050407@samsung.com> (raw)
In-Reply-To: <534EA773.30006@samsung.com>

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


  reply	other threads:[~2014-04-17  1:37 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-10  9:37 [PATCH 00/27] Support new Exynos3250 SoC based on Cortex-A7 dual core Chanwoo Choi
2014-04-10  9:37 ` [PATCH 01/27] ARM: EXYNOS: Add Exynos3250 SoC ID Chanwoo Choi
2014-04-11  1:46   ` Olof Johansson
2014-04-11  6:32     ` Chanwoo Choi
2014-04-11  7:09       ` Chanwoo Choi
2014-04-11  8:12         ` Arnd Bergmann
2014-04-11  8:39       ` Tomasz Figa
2014-04-14  5:13         ` Chanwoo Choi
2014-04-16 15:53           ` Tomasz Figa
2014-04-17  1:37             ` Chanwoo Choi [this message]
2014-04-11  3:56   ` Sachin Kamat
2014-04-11  5:54     ` Chanwoo Choi
2014-04-11  5:56       ` Sachin Kamat
2014-04-11  6:07         ` Chanwoo Choi
2014-04-10  9:37 ` [PATCH 02/27] ARM: EXYNOS: Add IO mapping for non-secure SYSRAM of Exynos3250 Chanwoo Choi
2014-04-10  9:37 ` [PATCH 03/27] ARM: EXYNOS: Add IO mapping for PMU " Chanwoo Choi
2014-04-11  1:48   ` Olof Johansson
2014-04-11  2:03     ` Chanwoo Choi
2014-04-11  8:41       ` Arnd Bergmann
2014-04-11 22:39         ` 최찬우
2014-04-10  9:37 ` [PATCH 04/27] ARM: EXYNOS: Support secondary CPU boot of Exynos4212 Chanwoo Choi
2014-04-11  1:44   ` Olof Johansson
2014-04-11  5:14     ` Chanwoo Choi
2014-04-11  6:04       ` Sangbeom Kim
2014-04-11  7:14         ` Tomasz Figa
2014-04-10  9:37 ` [PATCH 05/27] ARM: EXYNOS: Support secondary CPU boot of Exynos3250 Chanwoo Choi
2014-04-10  9:37 ` [PATCH 06/27] ARM: EXYNOS:: Enter a15 lowpower mode for Exynos3250 based on Cortex-a7 Chanwoo Choi
2014-04-10  9:37 ` [PATCH 07/27] irqchip: Declare cortex-a7's irqchip to initialize gic from dt Chanwoo Choi
2014-04-10  9:37 ` [PATCH 08/27] pinctrl: exynos: Add driver data for Exynos3250 Chanwoo Choi
2014-04-10 10:05 ` [PATCH 09/27] clk: samsung: exynos3250: Add clocks using common clock framework Chanwoo Choi
2014-04-10 10:06 ` [PATCH 10/27] ARM: dts: exynos3250: Add new exynos3250.dtsi file Chanwoo Choi
2014-04-11  4:01   ` Sachin Kamat
2014-04-11  4:46     ` Chanwoo Choi
2014-04-10 10:06 ` [PATCH 11/27] ARM: dts: exynos3250: Add GIC dt node for Exynos3250 Chanwoo Choi
2014-04-10 10:06 ` [PATCH 12/27] ARM: dts: exynos3250: Add default interrupt-parent connected with GIC Chanwoo Choi
2014-04-11  4:00   ` Olof Johansson
2014-04-11  4:44     ` Chanwoo Choi
2014-04-11  8:51       ` Tomasz Figa
2014-04-11 22:30         ` 최찬우
2014-04-10 10:06 ` [PATCH 13/27] ARM: dts: exynos3250: Add pin control device tree data Chanwoo Choi
2014-04-10 10:06 ` [PATCH 14/27] ARM: dts: exynos3250: Add device tree nodes for clock controllers Chanwoo Choi
2014-04-10 10:06 ` [PATCH 15/27] ARM: dts: exynos3250: Add uart dt node to support seiral ports Chanwoo Choi
2014-04-11  4:03   ` Sachin Kamat
2014-04-11  4:50     ` Chanwoo Choi
2014-04-10 10:06 ` [PATCH 16/27] ARM: dts: exynos3250: Add MCT dt node Chanwoo Choi
2014-04-10 10:06 ` [PATCH 17/27] ARM: dts: exynos3250: Add ADC dt node to read analog raw data Chanwoo Choi
2014-04-10 10:06 ` [PATCH 18/27] ARM: dts: exynos3250: Add i2c dt node Chanwoo Choi
2014-04-10 10:06 ` [PATCH 19/27] ARM: dts: exynos3250: Add Mobile Storage Host Card Chanwoo Choi
2014-04-10 10:06 ` [PATCH 20/27] ARM: dts: exynos3250: Move definitions of external clocks to SoC dtsi Chanwoo Choi
2014-04-10 10:06 ` [PATCH 21/27] ARM: dts: exynos3250: Add PMU dt data Chanwoo Choi
2014-04-10 10:23   ` Chanho Park
2014-04-10 11:20     ` Chanwoo Choi
2014-04-10 10:06 ` [PATCH 22/27] ARM: dts: exynos3250: Add amba and pdma dt node Chanwoo Choi
2014-04-10 10:06 ` [PATCH 23/27] ARM: dts: exynos3250: Add spi dt node to support spi bus Chanwoo Choi
2014-04-10 10:06 ` [PATCH 24/27] ARM: dts: exynos3250: Add pwm dt node to support PWM Timer Chanwoo Choi
2014-04-10 10:06 ` [PATCH 25/27] ARM: dts: exynos3250: Add RTC dt node Chanwoo Choi
2014-04-10 10:06 ` [PATCH 26/27] ARM: dts: exynos3250: Add power domain dt nodes Chanwoo Choi
2014-04-10 10:06 ` [PATCH 27/27] ARM: dts: exynos3250: Add CPUs dt node for Exynos3250 Chanwoo Choi
  -- strict thread matches above, loose matches on Subject: below --
2014-04-10  9:28 [PATCH 00/27] Support new Exynos3250 SoC based on Cortex-A7 dual core Chanwoo Choi
2014-04-10  9:28 ` [PATCH 01/27] ARM: EXYNOS: Add Exynos3250 SoC ID Chanwoo Choi
2014-04-10  9:43   ` Arnd Bergmann
2014-04-11  1:31     ` Chanwoo Choi
2014-04-14  6:20       ` Chanwoo Choi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=534F305C.2050407@samsung.com \
    --to=cw00.choi@samsung.com \
    --cc=Mark.Rutland@arm.com \
    --cc=grant.likely@secretlab.ca \
    --cc=hyunhee.kim@samsung.com \
    --cc=inki.dae@samsung.com \
    --cc=kgene.kim@samsung.com \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=olof@lixom.net \
    --cc=robh+dt@kernel.org \
    --cc=sw0312.kim@samsung.com \
    --cc=t.figa@samsung.com \
    --cc=yj44.cho@samsung.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox