ppc/85xx: Add a structure defn for PIXIS registers
PATCH 1/1 ppc/85xx: Add a structure defn for PIXIS registers
The various boards that have PIXIS FPGAs have slightly different register definitions, however there is some common functionality (like reset, ICS307 clk control, etc) that can be shared.
The struct definition exists for MPC8536DS, MPC8544DS, MPC8572DS, MPC8610HPCD, and MPC8641HPCN boards.
--- board/freescale/common/pixis.h | 182 ++++++++++++++++++++++++++++++++++++++++ 1 files changed, 182 insertions(+), 0 deletions(-) create mode 100644 board/freescale/common/pixis.h
board/freescale/common/pixis.h new file +182 -0
@@ -0,0 +1,182 @@ +/* +* Copyright 2010 Freescale Semiconductor, Inc. +* +* See file CREDITS for list of people who contributed to this +* project. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; either version 2 of +* the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA +*/ +#ifndef __PIXIS_H_ +#define __PIXIS_H_ 1 + +/* PIXIS register set. */ +#if defined(CONFIG_MPC8536DS ) +typedef struct pixis { +u8 id; +u8 ver; +u8 pver; +u8 csr; +u8 rst; +u8 rst2; +u8 aux1; +u8 spd; +u8 aux2; +u8 csr2; +u8 watch; +u8 led; +u8 pwr; +u8 res[3 ]; +u8 vctl; +u8 vstat; +u8 vcfgen0; +u8 vcfgen1; +u8 vcore0; +u8 res1; +u8 vboot; +u8 vspeed[3 ]; +u8 sclk[3 ]; +u8 dclk[3 ]; +u8 i2cdacr; +u8 vcoreacc[4 ]; +u8 vcorecnt[3 ]; +u8 vcoremax[2 ]; +u8 vplatacc[4 ]; +u8 vplatcnt[3 ]; +u8 vplatmax[2 ]; +u8 vtempacc[4 ]; +u8 vtempcnt[3 ]; +u8 vtempmax[2 ]; +u8 res2[4 ]; +}pixis_t __attribute__ ((aligned (1 ))); + +#elif defined(CONFIG_MPC8544DS ) +typedef struct pixis { +u8 id; +u8 ver; +u8 pver; +u8 csr; +u8 rst; +u8 pwr; +u8 aux1; +u8 spd; +u8 res[8 ]; +u8 vctl; +u8 vstat; +u8 vcfgen0; +u8 vcfgen1; +u8 vcore0; +u8 res1; +u8 vboot; +u8 vspeed[2 ]; +u8 vclkh; +u8 vclkl; +u8 watch; +u8 led; +u8 vspeed2; +u8 res2[34 ]; +}pixis_t __attribute__ ((aligned (1 ))); + +#elif defined(CONFIG_MPC8572DS ) +typedef struct pixis { +u8 id; +u8 ver; +u8 pver; +u8 csr; +u8 rst; +u8 pwr1; +u8 aux1; +u8 spd; +u8 aux2; +u8 res[7 ]; +u8 vctl; +u8 vstat; +u8 vcfgen0; +u8 vcfgen1; +u8 vcore0; +u8 res1; +u8 vboot; +u8 vspeed[3 ]; +u8 res2[2 ]; +u8 sclk[3 ]; +u8 dclk[3 ]; +u8 res3[2 ]; +u8 watch; +u8 led; +u8 res4[25 ]; +}pixis_t __attribute__ ((aligned (1 ))); + +#elif defined(CONFIG_MPC8610HPCD ) +typedef struct pixis { +u8 id; +u8 ver;/* also called arch */ +u8 pver; +u8 csr; +u8 rst; +u8 pwr; +u8 aux; +u8 spd; +u8 brdcfg0; +u8 brdcfg1; +u8 res[4 ]; +u8 led; +u8 serno; +u8 vctl; +u8 vstat; +u8 vcfgen0; +u8 vcfgen1; +u8 vcore0; +u8 res1; +u8 vboot; +u8 vspeed[2 ]; +u8 res2; +u8 sclk[3 ]; +u8 res3; +u8 watch; +u8 res4[33 ]; +}pixis_t __attribute__ ((aligned (1 ))); + +#elif defined(CONFIG_MPC8641HPCN ) +typedef struct pixis { +u8 id; +u8 ver; +u8 pver; +u8 csr; +u8 rst; +u8 pwr; +u8 aux; +u8 spd; +u8 res[8 ]; +u8 vctl; +u8 vstat; +u8 vcfgen0; +u8 vcfgen1; +u8 vcore0; +u8 res1; +u8 vboot; +u8 vspeed[2 ]; +u8 vclkh; +u8 vclkl; +u8 watch; +u8 res3[36 ]; +}pixis_t __attribute__ ((aligned (1 ))); +#else +#error Need to define pixis_t for this board +#endif + +/* Pointer to the PIXIS register set */ +#define pixis ((pixis_t *)PIXIS_BASE) + +#endif /* __PIXIS_H_ */
Signature · 1 line
1.6.0.6
PATCH 1/1 ppc/85xx: Add a structure defn for PIXIS registers
Review
Quoted 13 lines · Kumar Gala
(quoted diff) +13
-0+#if defined(CONFIG_MPC8536DS) +typedef struct pixis { + ? ? ? u8 id; + ? ? ? u8 ver; + ? ? ? u8 pver; + ? ? ? u8 csr; + ? ? ? u8 rst; + ? ? ? u8 rst2; + ? ? ? u8 aux1; + ? ? ? u8 spd; + u8 aux2; + u8 csr2; + u8 watch;
May I suggest this instead:
typedef struct pixis {
u8 id;
u8 ver;
u8 pver;
u8 csr;
u8 rst;#ifdef CONFIG_MPC8536DS
...
#elsif CONFIG_MPC8544DS
...
and so on.
Besides being more compact, my editor has built-in cscope functionality, and it gets confused if there's more than one "typedef struct pixis" in the file.
You don't have to worry about any more boards using these structures. Gary M. said that all future boards will use ngpixis.
Signature · 2 lines
Timur Tabi Linux kernel developer at Freescale
PATCH 1/1 ppc/85xx: Add a structure defn for PIXIS registers
Quoted 28 lines · Timur Tabi
board/freescale/common/pixis.h line 38
Quoted 13 lines · Kumar Gala
board/freescale/common/pixis.h new file +13
-0+#if defined(CONFIG_MPC8536DS) +typedef struct pixis { + u8 id; + u8 ver; + u8 pver; + u8 csr; + u8 rst; + u8 rst2; + u8 aux1; + u8 spd; + u8 aux2; + u8 csr2; + u8 watch;May I suggest this instead:
typedef struct pixis { u8 id; u8 ver; u8 pver; u8 csr; u8 rst;#ifdef
CONFIG_MPC8536DS
...
#elsifCONFIG_MPC8544DS
...
Quoted 8 lines
and so on.
Besides being more compact, my editor has built-in cscope functionality, and it gets confused if there's more than one "typedef struct pixis" in the file.
You don't have to worry about any more boards using these structures. Gary M. said that all future boards will use ngpixis.
I'm leaving them as is. Its too much noise in the file to deal with the differences and is not worth it to me.
- k
PATCH 1/1 ppc/85xx: Add a structure defn for PIXIS registers
In reply to Kumar GalaQuoted 29 lines · Kumar Gala
board/freescale/common/pixis.h new file +29
-0+/* PIXIS register set. */ +#if defined(CONFIG_MPC8536DS) +typedef struct pixis { + u8 id; + u8 ver; + u8 pver; + u8 csr; + u8 rst; + u8 rst2; + u8 aux1; + u8 spd; + u8 aux2; + u8 csr2; + u8 watch; + u8 led; + u8 pwr; + u8 res[3]; + u8 vctl; + u8 vstat; + u8 vcfgen0; + u8 vcfgen1; + u8 vcore0; + u8 res1; + u8 vboot; + u8 vspeed[3]; + u8 sclk[3]; + u8 dclk[3]; + u8 i2cdacr; + u8 vcoreacc[4];
board/freescale/common/pixis.h line 63
Quoted 10 lines
board/freescale/common/pixis.h new file +10
-0+u8 vcorecnt[3 ]; +u8 vcoremax[2 ]; +u8 vplatacc[4 ]; +u8 vplatcnt[3 ]; +u8 vplatmax[2 ]; +u8 vtempacc[4 ]; +u8 vtempcnt[3 ]; +u8 vtempmax[2 ]; +u8 res2[4 ]; +} pixis_t __attribute__ ((aligned(1)));
What's the aligned(1) for?
-Scott
PATCH 1/1 ppc/85xx: Add a structure defn for PIXIS registers
Quoted 34 lines · Scott Wood
Quoted 33 lines · Kumar Gala
board/freescale/common/pixis.h new file +33
-0+/* PIXIS register set. */ +#if defined(CONFIG_MPC8536DS) +typedef struct pixis { + u8 id; + u8 ver; + u8 pver; + u8 csr; + u8 rst; + u8 rst2; + u8 aux1; + u8 spd; + u8 aux2; + u8 csr2; + u8 watch; + u8 led; + u8 pwr; + u8 res[3]; + u8 vctl; + u8 vstat; + u8 vcfgen0; + u8 vcfgen1; + u8 vcore0; + u8 res1; + u8 vboot; + u8 vspeed[3]; + u8 sclk[3]; + u8 dclk[3]; + u8 i2cdacr; + u8 vcoreacc[4]; + u8 vcorecnt[3]; + u8 vcoremax[2]; + u8 vplatacc[4]; + u8 vplatcnt[3];
Quoted 8 lines
board/freescale/common/pixis.h line 63
Quoted 6 lines
board/freescale/common/pixis.h new file +6
-0+u8 vplatmax[2 ]; +u8 vtempacc[4 ]; +u8 vtempcnt[3 ]; +u8 vtempmax[2 ]; +u8 res2[4 ]; +} pixis_t __attribute__ ((aligned(1)));What's the aligned(1) for?
Asked Timur, I copied it from the ngpixis.h header
- k
PATCH 1/1 ppc/85xx: Add a structure defn for PIXIS registers
Quoted 5 lines · Kumar Gala
Quoted 3 lines
Quoted 1 line
+}
pixis_t?__attribute__ ((aligned(1)));What's the aligned(1) for?
Asked Timur, I copied it from the
ngpixis.hheader
Hmmm... I think I might have meant __packed__ instead of aligned(1).
Signature · 2 lines
Timur Tabi Linux kernel developer at Freescale
PATCH 1/1 ppc/85xx: Add a structure defn for PIXIS registers
Quoted 9 lines · Timur Tabi
Quoted 5 lines · Kumar Gala
Quoted 3 lines
Quoted 1 line
+}
pixis_t__attribute__((aligned(1)));What's the aligned(1) for?
Asked Timur, I copied it from the
ngpixis.hheaderHmmm... I think I might have meant
__packed__instead of aligned(1).
I'll fix ngpixis as well in updated patch.
- k
PATCH v2 1/1 ppc/85xx: Add a structure defn for PIXIS registers
In reply to Kumar GalaThe various boards that have PIXIS FPGAs have slightly different register definitions, however there is some common functionality (like reset, ICS307 clk control, etc) that can be shared.
The struct definition exists for MPC8536DS, MPC8544DS, MPC8572DS, MPC8610HPCD, and MPC8641HPCN boards.
Also fixed ngpixis to be __packed__ instead of aligned.
---
* Changed alignged attribute to packed
* Fixed ngpixis as well
- k
board/freescale/common/ngpixis.h | 2 +- board/freescale/common/pixis.h | 182 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 183 insertions(+), 1 deletions(-) create mode 100644 board/freescale/common/pixis.h
board/freescale/common/ngpixis.h +1 -1
@@ -45,7 +45,7 @@ typedef struct ngpixis {u8 sw;u8 en; } s[8 ]; -} ngpixis_t __attribute__ ((aligned(1))); +} __attribute__ ((packed)) ngpixis_t;/* Pointer to the PIXIS register set */ #define pixis ((ngpixis_t *)PIXIS_BASE)
board/freescale/common/pixis.h new file +182 -0
182 lines not on this page · raw message
Signature · 1 line
1.6.0.6
Kumar Gala
AppliedPATCH v2 1/1 ppc/85xx: Add a structure defn for PIXIS registers
Quoted 7 lines · Kumar Gala
The various boards that have PIXIS FPGAs have slightly different register definitions, however there is some common functionality (like reset, ICS307 clk control, etc) that can be shared.
The struct definition exists for MPC8536DS, MPC8544DS, MPC8572DS, MPC8610HPCD, and MPC8641HPCN boards.
Quoted 8 lines
Also fixed ngpixis to be
__packed__instead of aligned.Signed-off-by Kumar Gala <[email protected]>---
* Changed alignged attribute to packed
* Fixed ngpixis as well- k
applied to 85xx
- k