linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Michael Ellerman <michael@ellerman.id.au>
Cc: linuxppc-dev@ozlabs.org
Subject: Re: [PATCH 2/7] Update mpic to use dcr_host_t.base
Date: Tue, 02 Oct 2007 15:12:41 +1000	[thread overview]
Message-ID: <1191301961.6310.68.camel@pasglop> (raw)
In-Reply-To: <59ba66469e13b37eddf4e2423ed0540cce2e1079.1190009070.git.michael@ellerman.id.au>


On Mon, 2007-09-17 at 16:05 +1000, Michael Ellerman wrote:
> Now that dcr_host_t contains the base address, we can use that in the mpic
> code, rather than storing it separately.
> 
> Signed-off-by: Michael Ellerman <michael@ellerman.id.au>

Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

> ---
>  arch/powerpc/sysdev/mpic.c |   28 +++++++++++-----------------
>  include/asm-powerpc/mpic.h |    6 ------
>  2 files changed, 11 insertions(+), 23 deletions(-)
> 
> diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
> index 8de29f2..16b1f4b 100644
> --- a/arch/powerpc/sysdev/mpic.c
> +++ b/arch/powerpc/sysdev/mpic.c
> @@ -156,8 +156,7 @@ static inline u32 _mpic_read(enum mpic_reg_type type,
>  	switch(type) {
>  #ifdef CONFIG_PPC_DCR
>  	case mpic_access_dcr:
> -		return dcr_read(rb->dhost,
> -				rb->dbase + reg + rb->doff);
> +		return dcr_read(rb->dhost, rb->dhost.base + reg);
>  #endif
>  	case mpic_access_mmio_be:
>  		return in_be32(rb->base + (reg >> 2));
> @@ -174,8 +173,7 @@ static inline void _mpic_write(enum mpic_reg_type type,
>  	switch(type) {
>  #ifdef CONFIG_PPC_DCR
>  	case mpic_access_dcr:
> -		return dcr_write(rb->dhost,
> -				 rb->dbase + reg + rb->doff, value);
> +		return dcr_write(rb->dhost, rb->dhost.base + reg, value);
>  #endif
>  	case mpic_access_mmio_be:
>  		return out_be32(rb->base + (reg >> 2), value);
> @@ -279,9 +277,11 @@ static void _mpic_map_mmio(struct mpic *mpic, unsigned long phys_addr,
>  static void _mpic_map_dcr(struct mpic *mpic, struct mpic_reg_bank *rb,
>  			  unsigned int offset, unsigned int size)
>  {
> -	rb->dbase = mpic->dcr_base;
> -	rb->doff = offset;
> -	rb->dhost = dcr_map(mpic->irqhost->of_node, rb->dbase + rb->doff, size);
> +	const u32 *dbasep;
> +
> +	dbasep = of_get_property(mpic->irqhost->of_node, "dcr-reg", NULL);
> +
> +	rb->dhost = dcr_map(mpic->irqhost->of_node, *dbasep + offset, size);
>  	BUG_ON(!DCR_MAP_OK(rb->dhost));
>  }
>  
> @@ -1075,20 +1075,14 @@ struct mpic * __init mpic_alloc(struct device_node *node,
>  	BUG_ON(paddr == 0 && node == NULL);
>  
>  	/* If no physical address passed in, check if it's dcr based */
> -	if (paddr == 0 && of_get_property(node, "dcr-reg", NULL) != NULL)
> -		mpic->flags |= MPIC_USES_DCR;
> -
> +	if (paddr == 0 && of_get_property(node, "dcr-reg", NULL) != NULL) {
>  #ifdef CONFIG_PPC_DCR
> -	if (mpic->flags & MPIC_USES_DCR) {
> -		const u32 *dbasep;
> -		dbasep = of_get_property(node, "dcr-reg", NULL);
> -		BUG_ON(dbasep == NULL);
> -		mpic->dcr_base = *dbasep;
> +		mpic->flags |= MPIC_USES_DCR;
>  		mpic->reg_type = mpic_access_dcr;
> -	}
>  #else
> -	BUG_ON (mpic->flags & MPIC_USES_DCR);
> +		BUG();
>  #endif /* CONFIG_PPC_DCR */
> +	}
>  
>  	/* If the MPIC is not DCR based, and no physical address was passed
>  	 * in, try to obtain one
> diff --git a/include/asm-powerpc/mpic.h b/include/asm-powerpc/mpic.h
> index edb4a7c..ae84dde 100644
> --- a/include/asm-powerpc/mpic.h
> +++ b/include/asm-powerpc/mpic.h
> @@ -224,8 +224,6 @@ struct mpic_reg_bank {
>  	u32 __iomem	*base;
>  #ifdef CONFIG_PPC_DCR
>  	dcr_host_t	dhost;
> -	unsigned int	dbase;
> -	unsigned int	doff;
>  #endif /* CONFIG_PPC_DCR */
>  };
>  
> @@ -289,10 +287,6 @@ struct mpic
>  	struct mpic_reg_bank	cpuregs[MPIC_MAX_CPUS];
>  	struct mpic_reg_bank	isus[MPIC_MAX_ISU];
>  
> -#ifdef CONFIG_PPC_DCR
> -	unsigned int		dcr_base;
> -#endif
> -
>  	/* Protected sources */
>  	unsigned long		*protected;
>  

  reply	other threads:[~2007-10-02  5:12 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-17  6:05 [PATCH 1/7] Store the base address in dcr_host_t Michael Ellerman
2007-09-17  6:05 ` [PATCH 3/7] Use dcr_host_t.base in ibm_emac_mal Michael Ellerman
2007-10-02  5:13   ` Benjamin Herrenschmidt
2007-10-02  6:06     ` Michael Ellerman
2007-09-17  6:05 ` [PATCH 2/7] Update mpic to use dcr_host_t.base Michael Ellerman
2007-10-02  5:12   ` Benjamin Herrenschmidt [this message]
2007-09-17  6:05 ` [PATCH 4/7] Update axon_msi " Michael Ellerman
2007-10-02  5:14   ` Benjamin Herrenschmidt
2007-09-17  6:05 ` [PATCH 5/7] Add dcr_host_t.base in dcr_read()/dcr_write() Michael Ellerman
2007-10-02  5:17   ` Benjamin Herrenschmidt
2007-09-17  6:05 ` [PATCH 6/7] Add dcr_map_reg() helper Michael Ellerman
2007-10-02  5:19   ` Benjamin Herrenschmidt
2007-10-02  5:51     ` Michael Ellerman
2007-10-02  6:22       ` Benjamin Herrenschmidt
2007-09-17  6:05 ` [PATCH 7/7] Remove msic_dcr_read() and use dcr_map_reg() in axon_msi.c Michael Ellerman
2007-10-02  5:20   ` Benjamin Herrenschmidt
2007-10-02  5:10 ` [PATCH 1/7] Store the base address in dcr_host_t Benjamin Herrenschmidt

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=1191301961.6310.68.camel@pasglop \
    --to=benh@kernel.crashing.org \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=michael@ellerman.id.au \
    /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;
as well as URLs for NNTP newsgroup(s).