Re: [PATCH v2 2/2] powerpc/mpic: add global timer support
On 08/13/2012 09:32 PM, Wang Dongsheng-B40534 wrote: -Original Message- From: Wood Scott-B07421 Sent: Tuesday, August 14, 2012 10:19 AM To: Wang Dongsheng-B40534 Cc: Wood Scott-B07421; b...@kernel.crashing.org; pau...@samba.org; linuxppc-dev@lists.ozlabs.org; Gala Kumar-B11780; Li Yang-R58472 Subject: Re: [PATCH v2 2/2] powerpc/mpic: add global timer support On 08/13/2012 09:15 PM, Wang Dongsheng-B40534 wrote: -Original Message- From: Wood Scott-B07421 Sent: Tuesday, August 14, 2012 10:05 AM To: Wang Dongsheng-B40534 Cc: Wood Scott-B07421; b...@kernel.crashing.org; pau...@samba.org; linuxppc-dev@lists.ozlabs.org; Gala Kumar-B11780; Li Yang-R58472 Subject: Re: [PATCH v2 2/2] powerpc/mpic: add global timer support On 08/13/2012 09:00 PM, Wang Dongsheng-B40534 wrote: -Original Message- From: Wood Scott-B07421 Sent: Tuesday, August 14, 2012 1:37 AM To: Wang Dongsheng-B40534 Cc: Wood Scott-B07421; b...@kernel.crashing.org; pau...@samba.org; linuxppc-dev@lists.ozlabs.org; Gala Kumar-B11780; Li Yang-R58472 Subject: Re: [PATCH v2 2/2] powerpc/mpic: add global timer support On 08/13/2012 01:18 AM, Wang Dongsheng-B40534 wrote: + p = of_get_property(np, available-ranges, len); + if (p len % (2 * sizeof(u32)) != 0) { + pr_err(%s: malformed fsl,available-ranges property.\n, + np-full_name); + return -EINVAL; + } You need to support fsl,available-ranges since that's in an accepted binding and people could have partitioned setups already using it. [Wang Dongsheng] FSL chip or OPEN-PIC specification(Only a group) in each group only four timer. This is unified. So i use a generic name. I think there is not compatible with existing mpic timer nodes. We need to be compatible with existing trees, so you'd need to check for both -- but I think any further discussion of the details is premature until we decide whether this is worthwhile to begin with (both the support of non-FSL timers, and the creation of a new device tree binding which will not be implemented by many of the machines that have non-FSL openpic because they run real Open Firmware). [Wang Dongsheng] p = of_get_property(np, available-ranges, len); if (!p) p = of_get_property(np, fsl,available-ranges, len); this code be compatible with existing trees. Yes, that's what I meant by checking both. I still think we need to discuss why we're doing this first. What specific machines are going to have these new openpic timer nodes? [Wang Dongsheng] It's support to power management awakening. At present, the power management more and more important. This way is important to wake up machine. At least need support power management of machine still needs such a driver. I mean specifically for the non-Freescale openpic nodes. [Wang Dongsheng] I think non-Freescale chips can also use this function to wake up the machine. Maybe (it's very machine-specific what can be used as a wake source), but what I asked was what specific machines could make use of this. Name *one* machine for which these new openpic timer nodes will actually be created. And There is also an important feature, It can periodically generate an interrupt. That's not important at all. We already have a way to do that using the decrementer. For example, the network periodically check the hardware device(link status). And it uses standard Linux software timers to do it. -Scott ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
RE: [PATCH v2 2/2] powerpc/mpic: add global timer support
-Original Message- From: Wang Dongsheng-B40534 Sent: Monday, August 13, 2012 1:54 PM To: Wood Scott-B07421 Cc: b...@kernel.crashing.org; pau...@samba.org; linuxppc- d...@lists.ozlabs.org; Gala Kumar-B11780; Li Yang-R58472 Subject: RE: [PATCH v2 2/2] powerpc/mpic: add global timer support -Original Message- From: Wood Scott-B07421 Sent: Saturday, August 11, 2012 3:40 AM To: Wang Dongsheng-B40534 Cc: b...@kernel.crashing.org; pau...@samba.org; linuxppc- d...@lists.ozlabs.org; Gala Kumar-B11780; Li Yang-R58472 Subject: Re: [PATCH v2 2/2] powerpc/mpic: add global timer support On 08/10/2012 12:54 AM, dongsheng.w...@freescale.com wrote: +static const struct of_device_id mpic_timer_ids[] = { + { .compatible = open-pic,global-timer, }, + { .compatible = fsl,global-timer, }, + {}, +}; + +static int __init mpic_timer_init(void) { + struct device_node *np = NULL; + + for_each_node_by_type(np, open-pic) + if (of_match_node(mpic_timer_ids, np)) + group_init(np); + + if (list_empty(group_list)) + return -ENODEV; + + return 0; +} +arch_initcall(mpic_timer_init); Oh, and don't probe by device_type. Actually it does match the compatible. The device_type is just to speed up the search. I don't think it's a problem unless the device type is not mandatory any more for defined types. - Leo ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
RE: [PATCH v2 2/2] powerpc/mpic: add global timer support
-Original Message- From: Wood Scott-B07421 Sent: Saturday, August 11, 2012 4:38 AM To: Wang Dongsheng-B40534 Cc: b...@kernel.crashing.org; pau...@samba.org; linuxppc- d...@lists.ozlabs.org; Gala Kumar-B11780; Li Yang-R58472 Subject: Re: [PATCH v2 2/2] powerpc/mpic: add global timer support On 08/10/2012 12:54 AM, dongsheng.w...@freescale.com wrote: +static int group_get_freq(struct group_priv *priv) { + if (priv-flags FSL_GLOBAL_TIMER) { + ccbfreq = fsl_get_sys_freq(); + priv-timerfreq = ccbfreq; + } else { + priv-timerfreq = in_be32(priv-group_tfrr); + } FSL MPICs have TFRR too. I'm not sure that the lack of fsl,mpic is a good indication that TFRR is being set (e.g. we have old device trees for FSL chips with U-Boot that are labelled as ordinary openpics). [Wang Dongsheng] yes, we have. But we do not used it. The TFRR register value is zero. + + if (priv-timerfreq = 0) + return -EINVAL; + + return 0; +} timerfreq is unsigned. It can never be 0. [Wang Dongsheng] Yeah. Thanks. + +static int group_init_regmap(struct device_node *np, struct +group_priv *priv) { + priv-group_tfrr = of_iomap(np, 0); + if (!priv-group_tfrr) { + pr_err(%s: cannot ioremap tfrr address.\n, + np-full_name); + return -EINVAL; + } + + priv-regs = of_iomap(np, 1); + if (!priv-regs) { + pr_err(%s: cannot ioremap timer register address.\n, + np-full_name); + return -EINVAL; + } + + if (!(priv-flags FSL_GLOBAL_TIMER)) + return 0; + + priv-group_tcr = of_iomap(np, 2); + if (!priv-group_tcr) { + pr_err(%s: cannot ioremap tcr address.\n, np-full_name); + return -EINVAL; + } This is not compatible with existing mpic timer nodes. [Wang Dongsheng] Yeah, next patch to support that. + p = of_get_property(np, available-ranges, len); + if (p len % (2 * sizeof(u32)) != 0) { + pr_err(%s: malformed fsl,available-ranges property.\n, + np-full_name); + return -EINVAL; + } You need to support fsl,available-ranges since that's in an accepted binding and people could have partitioned setups already using it. [Wang Dongsheng] FSL chip or OPEN-PIC specification(Only a group) in each group only four timer. This is unified. So i use a generic name. I think there is not compatible with existing mpic timer nodes. p = of_get_property(np, available-ranges, len); if (!p) p = of_get_property(np, fsl,available-ranges, len); if (p len % (2 * sizeof(u32)) != 0) { pr_err(%s: malformed fsl,available-ranges property.\n, np-full_name); return -EINVAL; } You also have a mismatch between the property you check and the error string. [Wang Dongsheng] Yeah. :-(. -Scott ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
RE: [PATCH v2 2/2] powerpc/mpic: add global timer support
-Original Message- From: Tabi Timur-B04825 Sent: Saturday, August 11, 2012 9:10 PM To: Wang Dongsheng-B40534 Cc: b...@kernel.crashing.org; pau...@samba.org; Wood Scott-B07421; Gala Kumar-B11780; linuxppc-dev@lists.ozlabs.org Subject: Re: [PATCH v2 2/2] powerpc/mpic: add global timer support On Fri, Aug 10, 2012 at 12:54 AM, dongsheng.w...@freescale.com wrote: From: Wang Dongsheng dongsheng.w...@freescale.com +EXPORT_SYMBOL_GPL(mpic_request_timer); Make these EXPORT_SYMBOL. No need for a GPL restriction. [Wang Dongsheng] Why? -- Timur Tabi Linux kernel developer at Freescale ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
RE: [PATCH v2 2/2] powerpc/mpic: add global timer support
-Original Message- From: Linuxppc-dev [mailto:linuxppc-dev- bounces+b40534=freescale@lists.ozlabs.org] On Behalf Of Wang Dongsheng-B40534 Sent: Monday, August 13, 2012 2:21 PM To: Tabi Timur-B04825 Cc: Gala Kumar-B11780; pau...@samba.org; linuxppc-dev@lists.ozlabs.org; Wood Scott-B07421 Subject: RE: [PATCH v2 2/2] powerpc/mpic: add global timer support -Original Message- From: Tabi Timur-B04825 Sent: Saturday, August 11, 2012 9:10 PM To: Wang Dongsheng-B40534 Cc: b...@kernel.crashing.org; pau...@samba.org; Wood Scott-B07421; Gala Kumar-B11780; linuxppc-dev@lists.ozlabs.org Subject: Re: [PATCH v2 2/2] powerpc/mpic: add global timer support On Fri, Aug 10, 2012 at 12:54 AM, dongsheng.w...@freescale.com wrote: From: Wang Dongsheng dongsheng.w...@freescale.com +EXPORT_SYMBOL_GPL(mpic_request_timer); Make these EXPORT_SYMBOL. No need for a GPL restriction. [Wang Dongsheng] Why? [Wang Dongsheng] Sorry, I just see the mail. Thanks. -- Timur Tabi Linux kernel developer at Freescale ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH v2 2/2] powerpc/mpic: add global timer support
On 08/13/2012 12:53 AM, Wang Dongsheng-B40534 wrote: -Original Message- From: Wood Scott-B07421 Sent: Saturday, August 11, 2012 3:40 AM To: Wang Dongsheng-B40534 Cc: b...@kernel.crashing.org; pau...@samba.org; linuxppc- d...@lists.ozlabs.org; Gala Kumar-B11780; Li Yang-R58472 Subject: Re: [PATCH v2 2/2] powerpc/mpic: add global timer support On 08/10/2012 12:54 AM, dongsheng.w...@freescale.com wrote: +static const struct of_device_id mpic_timer_ids[] = { + { .compatible = open-pic,global-timer, }, + { .compatible = fsl,global-timer, }, + {}, +}; + +static int __init mpic_timer_init(void) { + struct device_node *np = NULL; + + for_each_node_by_type(np, open-pic) + if (of_match_node(mpic_timer_ids, np)) + group_init(np); + + if (list_empty(group_list)) + return -ENODEV; + + return 0; +} +arch_initcall(mpic_timer_init); Oh, and don't probe by device_type. [Wang Dongsheng] fine. for_each_node_by_name. No. Probe by compatible only. -Scott ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH v2 2/2] powerpc/mpic: add global timer support
On 08/13/2012 01:17 AM, Li Yang-R58472 wrote: -Original Message- From: Wang Dongsheng-B40534 Sent: Monday, August 13, 2012 1:54 PM To: Wood Scott-B07421 Cc: b...@kernel.crashing.org; pau...@samba.org; linuxppc- d...@lists.ozlabs.org; Gala Kumar-B11780; Li Yang-R58472 Subject: RE: [PATCH v2 2/2] powerpc/mpic: add global timer support -Original Message- From: Wood Scott-B07421 Sent: Saturday, August 11, 2012 3:40 AM To: Wang Dongsheng-B40534 Cc: b...@kernel.crashing.org; pau...@samba.org; linuxppc- d...@lists.ozlabs.org; Gala Kumar-B11780; Li Yang-R58472 Subject: Re: [PATCH v2 2/2] powerpc/mpic: add global timer support On 08/10/2012 12:54 AM, dongsheng.w...@freescale.com wrote: +static const struct of_device_id mpic_timer_ids[] = { + { .compatible = open-pic,global-timer, }, + { .compatible = fsl,global-timer, }, + {}, +}; + +static int __init mpic_timer_init(void) { + struct device_node *np = NULL; + + for_each_node_by_type(np, open-pic) + if (of_match_node(mpic_timer_ids, np)) + group_init(np); + + if (list_empty(group_list)) + return -ENODEV; + + return 0; +} +arch_initcall(mpic_timer_init); Oh, and don't probe by device_type. Actually it does match the compatible. The device_type is just to speed up the search. I don't think it's a problem unless the device type is not mandatory any more for defined types. Doesn't matter (and I doubt it provides any significant speed up compared to a search by compatible, and in any case this is not performance critical). device_type is deprecated outside certain specific legacy uses. Get rid of it. -Scott ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH v2 2/2] powerpc/mpic: add global timer support
On 08/13/2012 01:18 AM, Wang Dongsheng-B40534 wrote: + p = of_get_property(np, available-ranges, len); + if (p len % (2 * sizeof(u32)) != 0) { + pr_err(%s: malformed fsl,available-ranges property.\n, + np-full_name); + return -EINVAL; + } You need to support fsl,available-ranges since that's in an accepted binding and people could have partitioned setups already using it. [Wang Dongsheng] FSL chip or OPEN-PIC specification(Only a group) in each group only four timer. This is unified. So i use a generic name. I think there is not compatible with existing mpic timer nodes. We need to be compatible with existing trees, so you'd need to check for both -- but I think any further discussion of the details is premature until we decide whether this is worthwhile to begin with (both the support of non-FSL timers, and the creation of a new device tree binding which will not be implemented by many of the machines that have non-FSL openpic because they run real Open Firmware). -Scott ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
RE: [PATCH v2 2/2] powerpc/mpic: add global timer support
-Original Message- From: Wood Scott-B07421 Sent: Tuesday, August 14, 2012 1:37 AM To: Wang Dongsheng-B40534 Cc: Wood Scott-B07421; b...@kernel.crashing.org; pau...@samba.org; linuxppc-dev@lists.ozlabs.org; Gala Kumar-B11780; Li Yang-R58472 Subject: Re: [PATCH v2 2/2] powerpc/mpic: add global timer support On 08/13/2012 01:18 AM, Wang Dongsheng-B40534 wrote: + p = of_get_property(np, available-ranges, len); + if (p len % (2 * sizeof(u32)) != 0) { + pr_err(%s: malformed fsl,available-ranges property.\n, + np-full_name); + return -EINVAL; + } You need to support fsl,available-ranges since that's in an accepted binding and people could have partitioned setups already using it. [Wang Dongsheng] FSL chip or OPEN-PIC specification(Only a group) in each group only four timer. This is unified. So i use a generic name. I think there is not compatible with existing mpic timer nodes. We need to be compatible with existing trees, so you'd need to check for both -- but I think any further discussion of the details is premature until we decide whether this is worthwhile to begin with (both the support of non-FSL timers, and the creation of a new device tree binding which will not be implemented by many of the machines that have non-FSL openpic because they run real Open Firmware). [Wang Dongsheng] p = of_get_property(np, available-ranges, len); if (!p) p = of_get_property(np, fsl,available-ranges, len); this code be compatible with existing trees. -Scott ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH v2 2/2] powerpc/mpic: add global timer support
On 08/13/2012 09:00 PM, Wang Dongsheng-B40534 wrote: -Original Message- From: Wood Scott-B07421 Sent: Tuesday, August 14, 2012 1:37 AM To: Wang Dongsheng-B40534 Cc: Wood Scott-B07421; b...@kernel.crashing.org; pau...@samba.org; linuxppc-dev@lists.ozlabs.org; Gala Kumar-B11780; Li Yang-R58472 Subject: Re: [PATCH v2 2/2] powerpc/mpic: add global timer support On 08/13/2012 01:18 AM, Wang Dongsheng-B40534 wrote: + p = of_get_property(np, available-ranges, len); + if (p len % (2 * sizeof(u32)) != 0) { + pr_err(%s: malformed fsl,available-ranges property.\n, + np-full_name); + return -EINVAL; + } You need to support fsl,available-ranges since that's in an accepted binding and people could have partitioned setups already using it. [Wang Dongsheng] FSL chip or OPEN-PIC specification(Only a group) in each group only four timer. This is unified. So i use a generic name. I think there is not compatible with existing mpic timer nodes. We need to be compatible with existing trees, so you'd need to check for both -- but I think any further discussion of the details is premature until we decide whether this is worthwhile to begin with (both the support of non-FSL timers, and the creation of a new device tree binding which will not be implemented by many of the machines that have non-FSL openpic because they run real Open Firmware). [Wang Dongsheng] p = of_get_property(np, available-ranges, len); if (!p) p = of_get_property(np, fsl,available-ranges, len); this code be compatible with existing trees. Yes, that's what I meant by checking both. I still think we need to discuss why we're doing this first. What specific machines are going to have these new openpic timer nodes? -Scott ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
RE: [PATCH v2 2/2] powerpc/mpic: add global timer support
-Original Message- From: Wood Scott-B07421 Sent: Tuesday, August 14, 2012 10:05 AM To: Wang Dongsheng-B40534 Cc: Wood Scott-B07421; b...@kernel.crashing.org; pau...@samba.org; linuxppc-dev@lists.ozlabs.org; Gala Kumar-B11780; Li Yang-R58472 Subject: Re: [PATCH v2 2/2] powerpc/mpic: add global timer support On 08/13/2012 09:00 PM, Wang Dongsheng-B40534 wrote: -Original Message- From: Wood Scott-B07421 Sent: Tuesday, August 14, 2012 1:37 AM To: Wang Dongsheng-B40534 Cc: Wood Scott-B07421; b...@kernel.crashing.org; pau...@samba.org; linuxppc-dev@lists.ozlabs.org; Gala Kumar-B11780; Li Yang-R58472 Subject: Re: [PATCH v2 2/2] powerpc/mpic: add global timer support On 08/13/2012 01:18 AM, Wang Dongsheng-B40534 wrote: + p = of_get_property(np, available-ranges, len); + if (p len % (2 * sizeof(u32)) != 0) { + pr_err(%s: malformed fsl,available-ranges property.\n, + np-full_name); + return -EINVAL; + } You need to support fsl,available-ranges since that's in an accepted binding and people could have partitioned setups already using it. [Wang Dongsheng] FSL chip or OPEN-PIC specification(Only a group) in each group only four timer. This is unified. So i use a generic name. I think there is not compatible with existing mpic timer nodes. We need to be compatible with existing trees, so you'd need to check for both -- but I think any further discussion of the details is premature until we decide whether this is worthwhile to begin with (both the support of non-FSL timers, and the creation of a new device tree binding which will not be implemented by many of the machines that have non-FSL openpic because they run real Open Firmware). [Wang Dongsheng] p = of_get_property(np, available-ranges, len); if (!p) p = of_get_property(np, fsl,available-ranges, len); this code be compatible with existing trees. Yes, that's what I meant by checking both. I still think we need to discuss why we're doing this first. What specific machines are going to have these new openpic timer nodes? [Wang Dongsheng] It's support to power management awakening. At present, the power management more and more important. This way is important to wake up machine. At least need support power management of machine still needs such a driver. -Scott ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH v2 2/2] powerpc/mpic: add global timer support
On 08/13/2012 09:15 PM, Wang Dongsheng-B40534 wrote: -Original Message- From: Wood Scott-B07421 Sent: Tuesday, August 14, 2012 10:05 AM To: Wang Dongsheng-B40534 Cc: Wood Scott-B07421; b...@kernel.crashing.org; pau...@samba.org; linuxppc-dev@lists.ozlabs.org; Gala Kumar-B11780; Li Yang-R58472 Subject: Re: [PATCH v2 2/2] powerpc/mpic: add global timer support On 08/13/2012 09:00 PM, Wang Dongsheng-B40534 wrote: -Original Message- From: Wood Scott-B07421 Sent: Tuesday, August 14, 2012 1:37 AM To: Wang Dongsheng-B40534 Cc: Wood Scott-B07421; b...@kernel.crashing.org; pau...@samba.org; linuxppc-dev@lists.ozlabs.org; Gala Kumar-B11780; Li Yang-R58472 Subject: Re: [PATCH v2 2/2] powerpc/mpic: add global timer support On 08/13/2012 01:18 AM, Wang Dongsheng-B40534 wrote: + p = of_get_property(np, available-ranges, len); + if (p len % (2 * sizeof(u32)) != 0) { + pr_err(%s: malformed fsl,available-ranges property.\n, + np-full_name); + return -EINVAL; + } You need to support fsl,available-ranges since that's in an accepted binding and people could have partitioned setups already using it. [Wang Dongsheng] FSL chip or OPEN-PIC specification(Only a group) in each group only four timer. This is unified. So i use a generic name. I think there is not compatible with existing mpic timer nodes. We need to be compatible with existing trees, so you'd need to check for both -- but I think any further discussion of the details is premature until we decide whether this is worthwhile to begin with (both the support of non-FSL timers, and the creation of a new device tree binding which will not be implemented by many of the machines that have non-FSL openpic because they run real Open Firmware). [Wang Dongsheng] p = of_get_property(np, available-ranges, len); if (!p) p = of_get_property(np, fsl,available-ranges, len); this code be compatible with existing trees. Yes, that's what I meant by checking both. I still think we need to discuss why we're doing this first. What specific machines are going to have these new openpic timer nodes? [Wang Dongsheng] It's support to power management awakening. At present, the power management more and more important. This way is important to wake up machine. At least need support power management of machine still needs such a driver. I mean specifically for the non-Freescale openpic nodes. -Scott ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
RE: [PATCH v2 2/2] powerpc/mpic: add global timer support
-Original Message- From: Wood Scott-B07421 Sent: Tuesday, August 14, 2012 10:19 AM To: Wang Dongsheng-B40534 Cc: Wood Scott-B07421; b...@kernel.crashing.org; pau...@samba.org; linuxppc-dev@lists.ozlabs.org; Gala Kumar-B11780; Li Yang-R58472 Subject: Re: [PATCH v2 2/2] powerpc/mpic: add global timer support On 08/13/2012 09:15 PM, Wang Dongsheng-B40534 wrote: -Original Message- From: Wood Scott-B07421 Sent: Tuesday, August 14, 2012 10:05 AM To: Wang Dongsheng-B40534 Cc: Wood Scott-B07421; b...@kernel.crashing.org; pau...@samba.org; linuxppc-dev@lists.ozlabs.org; Gala Kumar-B11780; Li Yang-R58472 Subject: Re: [PATCH v2 2/2] powerpc/mpic: add global timer support On 08/13/2012 09:00 PM, Wang Dongsheng-B40534 wrote: -Original Message- From: Wood Scott-B07421 Sent: Tuesday, August 14, 2012 1:37 AM To: Wang Dongsheng-B40534 Cc: Wood Scott-B07421; b...@kernel.crashing.org; pau...@samba.org; linuxppc-dev@lists.ozlabs.org; Gala Kumar-B11780; Li Yang-R58472 Subject: Re: [PATCH v2 2/2] powerpc/mpic: add global timer support On 08/13/2012 01:18 AM, Wang Dongsheng-B40534 wrote: + p = of_get_property(np, available-ranges, len); + if (p len % (2 * sizeof(u32)) != 0) { + pr_err(%s: malformed fsl,available-ranges property.\n, + np-full_name); + return -EINVAL; + } You need to support fsl,available-ranges since that's in an accepted binding and people could have partitioned setups already using it. [Wang Dongsheng] FSL chip or OPEN-PIC specification(Only a group) in each group only four timer. This is unified. So i use a generic name. I think there is not compatible with existing mpic timer nodes. We need to be compatible with existing trees, so you'd need to check for both -- but I think any further discussion of the details is premature until we decide whether this is worthwhile to begin with (both the support of non-FSL timers, and the creation of a new device tree binding which will not be implemented by many of the machines that have non-FSL openpic because they run real Open Firmware). [Wang Dongsheng] p = of_get_property(np, available-ranges, len); if (!p) p = of_get_property(np, fsl,available-ranges, len); this code be compatible with existing trees. Yes, that's what I meant by checking both. I still think we need to discuss why we're doing this first. What specific machines are going to have these new openpic timer nodes? [Wang Dongsheng] It's support to power management awakening. At present, the power management more and more important. This way is important to wake up machine. At least need support power management of machine still needs such a driver. I mean specifically for the non-Freescale openpic nodes. [Wang Dongsheng] I think non-Freescale chips can also use this function to wake up the machine. And There is also an important feature, It can periodically generate an interrupt. For example, the network periodically check the hardware device(link status). -Scott ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
RE: [PATCH v2 2/2] powerpc/mpic: add global timer support
-Original Message- From: Wood Scott-B07421 Sent: Saturday, August 11, 2012 3:40 AM To: Wang Dongsheng-B40534 Cc: b...@kernel.crashing.org; pau...@samba.org; linuxppc- d...@lists.ozlabs.org; Gala Kumar-B11780; Li Yang-R58472 Subject: Re: [PATCH v2 2/2] powerpc/mpic: add global timer support On 08/10/2012 12:54 AM, dongsheng.w...@freescale.com wrote: +static const struct of_device_id mpic_timer_ids[] = { + { .compatible = open-pic,global-timer, }, + { .compatible = fsl,global-timer, }, + {}, +}; + +static int __init mpic_timer_init(void) { + struct device_node *np = NULL; + + for_each_node_by_type(np, open-pic) + if (of_match_node(mpic_timer_ids, np)) + group_init(np); + + if (list_empty(group_list)) + return -ENODEV; + + return 0; +} +arch_initcall(mpic_timer_init); Oh, and don't probe by device_type. [Wang Dongsheng] fine. for_each_node_by_name. -Scott ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH v2 2/2] powerpc/mpic: add global timer support
On Fri, Aug 10, 2012 at 12:54 AM, dongsheng.w...@freescale.com wrote: From: Wang Dongsheng dongsheng.w...@freescale.com +EXPORT_SYMBOL_GPL(mpic_request_timer); Make these EXPORT_SYMBOL. No need for a GPL restriction. -- Timur Tabi Linux kernel developer at Freescale ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH v2 2/2] powerpc/mpic: add global timer support
On 08/10/2012 12:54 AM, dongsheng.w...@freescale.com wrote: +static const struct of_device_id mpic_timer_ids[] = { + { .compatible = open-pic,global-timer, }, + { .compatible = fsl,global-timer, }, + {}, +}; + +static int __init mpic_timer_init(void) +{ + struct device_node *np = NULL; + + for_each_node_by_type(np, open-pic) + if (of_match_node(mpic_timer_ids, np)) + group_init(np); + + if (list_empty(group_list)) + return -ENODEV; + + return 0; +} +arch_initcall(mpic_timer_init); Where do you distinguish an FSL timer from an openpic timer? I thought openpic timers didn't support cascading. Oh, and don't probe by device_type. -Scott ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH v2 2/2] powerpc/mpic: add global timer support
On Aug 10, 2012, at 2:40 PM, Scott Wood wrote: On 08/10/2012 12:54 AM, dongsheng.w...@freescale.com wrote: +static const struct of_device_id mpic_timer_ids[] = { +{ .compatible = open-pic,global-timer, }, +{ .compatible = fsl,global-timer, }, +{}, +}; + +static int __init mpic_timer_init(void) +{ +struct device_node *np = NULL; + +for_each_node_by_type(np, open-pic) +if (of_match_node(mpic_timer_ids, np)) +group_init(np); + +if (list_empty(group_list)) +return -ENODEV; + +return 0; +} +arch_initcall(mpic_timer_init); Where do you distinguish an FSL timer from an openpic timer? I thought openpic timers didn't support cascading. in group_init() + if (of_device_is_compatible(np, fsl,global-timer)) + priv-flags |= FSL_GLOBAL_TIMER; + - k ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH v2 2/2] powerpc/mpic: add global timer support
On 08/10/2012 12:54 AM, dongsheng.w...@freescale.com wrote: +static int group_get_freq(struct group_priv *priv) +{ + if (priv-flags FSL_GLOBAL_TIMER) { + ccbfreq = fsl_get_sys_freq(); + priv-timerfreq = ccbfreq; + } else { + priv-timerfreq = in_be32(priv-group_tfrr); + } FSL MPICs have TFRR too. I'm not sure that the lack of fsl,mpic is a good indication that TFRR is being set (e.g. we have old device trees for FSL chips with U-Boot that are labelled as ordinary openpics). + + if (priv-timerfreq = 0) + return -EINVAL; + + return 0; +} timerfreq is unsigned. It can never be 0. + +static int group_init_regmap(struct device_node *np, struct group_priv *priv) +{ + priv-group_tfrr = of_iomap(np, 0); + if (!priv-group_tfrr) { + pr_err(%s: cannot ioremap tfrr address.\n, + np-full_name); + return -EINVAL; + } + + priv-regs = of_iomap(np, 1); + if (!priv-regs) { + pr_err(%s: cannot ioremap timer register address.\n, + np-full_name); + return -EINVAL; + } + + if (!(priv-flags FSL_GLOBAL_TIMER)) + return 0; + + priv-group_tcr = of_iomap(np, 2); + if (!priv-group_tcr) { + pr_err(%s: cannot ioremap tcr address.\n, np-full_name); + return -EINVAL; + } This is not compatible with existing mpic timer nodes. + p = of_get_property(np, available-ranges, len); + if (p len % (2 * sizeof(u32)) != 0) { + pr_err(%s: malformed fsl,available-ranges property.\n, + np-full_name); + return -EINVAL; + } You need to support fsl,available-ranges since that's in an accepted binding and people could have partitioned setups already using it. You also have a mismatch between the property you check and the error string. -Scott ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev