Re: [UrJTAG-dev] Adding support for Freescale QorIQ P1020 (help needed)

2020-09-21 Thread Damien Mascord

On 21/09/2020 17:17, Geert Stappers wrote:

On Mon, Sep 21, 2020 at 04:37:59PM +1000, Damien Mascord wrote:

Hi guys,

I am attempting to add support for the Freescale QorIQ P1020, as you can see
in the attached diff, and even though it can connect to the target (tested
using cable jlink), initbus can start, I am not able to peek or detectflash
from that point on.

I have most probably done something incorrect in regards to the bus
configuration, as my understanding of that part is quite minimal.

UrJTAG output is below during my attempts to get it working.

The reference manual can be found at 
https://www.element14.com/community/docs/DOC-39744/l/freescale-reference-manual-for-p1020-qoriq-integrated-processor

Any idea of what could be wrong?

 :-)

  

Cheers,
Damien


diff --git a/urjtag/configure.ac b/urjtag/configure.ac
index 95d1d743..e1a5ae8a 100644
--- a/urjtag/configure.ac
+++ b/urjtag/configure.ac
@@ -637,6 +637,7 @@ URJ_DRIVER_SET([bus], [
mpc824x
mpc8313
mpc837x
+   p1020
ppc405ep
ppc440gx_ebc8
prototype
diff --git a/urjtag/data/Makefile.am b/urjtag/data/Makefile.am
index 7fb82f0f..62e916d7 100644
--- a/urjtag/data/Makefile.am
+++ b/urjtag/data/Makefile.am
@@ -126,6 +126,8 @@ nobase_dist_pkgdata_DATA = \
freescale/mpc8378/mpc8378 \
freescale/mpc8379/STEPPINGS \
freescale/mpc8379/mpc8379 \
+   freescale/p1020/STEPPINGS \
+   freescale/p1020/p1020 \
ibm/PARTS \
ibm/ppc440gx/STEPPINGS \
ibm/ppc440gx/ppc440gx \
diff --git a/urjtag/data/bsdl/STD_1149_1_2001 b/urjtag/data/bsdl/STD_1149_1_2001
index a0e1c3e0..21a82f18 100644
--- a/urjtag/data/bsdl/STD_1149_1_2001
+++ b/urjtag/data/bsdl/STD_1149_1_2001
@@ -1,259 +1,173 @@

Why?
The main reason was the missing PORT_GROUPING definition, but I added 
the whole file just in case.

+if ENABLE_BUS_P1020
+libbus_la_SOURCES += p1020.c

Where is the p1020.c  ?
Apologies for not including the p1020.c in the diff, I must've missed it 
with the git add.   Please see attached.




+endif
+
  if ENABLE_BUS_PPC405EP
  libbus_la_SOURCES += ppc405ep.c
  endif
diff --git a/urjtag/src/bus/buses_list.h b/urjtag/src/bus/buses_list.h
index cc91..87728ef9 100644
--- a/urjtag/src/bus/buses_list.h
+++ b/urjtag/src/bus/buses_list.h
@@ -98,6 +98,9 @@ _URJ_BUS(mpc8313)
  #ifdef ENABLE_BUS_MPC837X
  _URJ_BUS(mpc837x)
  #endif
+#ifdef ENABLE_BUS_P1020
+_URJ_BUS(p1020)
+#endif
  #ifdef ENABLE_BUS_PPC405EP
  _URJ_BUS(ppc405ep)
  #endif




My conclustion for now:

   Original poster is on a trail where two new components were
   encountered.
Not just two new components, I'll eventually have to add in flash 
support for the NAND SLC flash on the device :)




I hope the next patches are better.
If I can get it functional, I'll make the patches cleaner.  This is 
really a call for help, not something I expect to be included in urjtag 
as is,  since I can't see any IRC channel or active forum where I can post.





Groeten
Geert Stappers

trail: path not often travelled
/*
 * Freescale P1020 compatible bus driver via BSR
 * Copyright (C) 2010 Andrzej Jalowiecki, Damien Mascord
 *
 * 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.
 *
 *
 * Documentation:
 * [1] Freescale, "Freescale P1020 Reference Manual"
 *
 */

#include "sysdep.h"

#include 
#include 
#include 

#include 
#include 
#include 
#include 

#include "buses.h"
#include "generic_bus.h"

#define LBC_NUM_LCS 8
#define LBC_NUM_LWE 2
#define LBC_NUM_LAD 16
#define LBC_NUM_LA 16

typedef struct {
uint32_t last_adr;
urj_part_signal_t *nlcs[LBC_NUM_LCS];
urj_part_signal_t *lad[LBC_NUM_LAD];
urj_part_signal_t *la[LBC_NUM_LA];
urj_part_signal_t *nlwe[LBC_NUM_LWE];
urj_part_signal_t *nloe;
urj_part_signal_t *ale;
urj_part_signal_t *lbctl;
int lbc_muxed;
int lbc_num_ad;
int lbc_num_d;
} bus_params_t;

#define LAST_ADR ((bus_params_t *) bus->params)->last_adr /* Last used address */
#define nCS  ((bus_params_t *) bus->params)->nlcs /* Chipselect# */
#define nWE  ((bus_params_t *) bus->params)->nlwe /* Write enable# */
#define nOE  ((bus_params_t *) bus->params)->nloe /* Output enable# */
#define ALE  ((bus_params_t *) bus->params)->ale  /* Addres strobe */
#define BCTL ((bus_params_t *) 

Re: [UrJTAG-dev] Adding support for Freescale QorIQ P1020 (help needed)

2020-09-21 Thread Geert Stappers
On Mon, Sep 21, 2020 at 04:37:59PM +1000, Damien Mascord wrote:
> Hi guys,
> 
> I am attempting to add support for the Freescale QorIQ P1020, as you can see
> in the attached diff, and even though it can connect to the target (tested
> using cable jlink), initbus can start, I am not able to peek or detectflash
> from that point on.
> 
> I have most probably done something incorrect in regards to the bus
> configuration, as my understanding of that part is quite minimal.
> 
> UrJTAG output is below during my attempts to get it working.
> 
> The reference manual can be found at 
> https://www.element14.com/community/docs/DOC-39744/l/freescale-reference-manual-for-p1020-qoriq-integrated-processor
> 
> Any idea of what could be wrong?

:-)

 
> Cheers,
> Damien
> 
> 

> diff --git a/urjtag/configure.ac b/urjtag/configure.ac
> index 95d1d743..e1a5ae8a 100644
> --- a/urjtag/configure.ac
> +++ b/urjtag/configure.ac
> @@ -637,6 +637,7 @@ URJ_DRIVER_SET([bus], [
>   mpc824x
>   mpc8313
>   mpc837x
> + p1020
>   ppc405ep
>   ppc440gx_ebc8
>   prototype
> diff --git a/urjtag/data/Makefile.am b/urjtag/data/Makefile.am
> index 7fb82f0f..62e916d7 100644
> --- a/urjtag/data/Makefile.am
> +++ b/urjtag/data/Makefile.am
> @@ -126,6 +126,8 @@ nobase_dist_pkgdata_DATA = \
>   freescale/mpc8378/mpc8378 \
>   freescale/mpc8379/STEPPINGS \
>   freescale/mpc8379/mpc8379 \
> + freescale/p1020/STEPPINGS \
> + freescale/p1020/p1020 \
>   ibm/PARTS \
>   ibm/ppc440gx/STEPPINGS \
>   ibm/ppc440gx/ppc440gx \
> diff --git a/urjtag/data/bsdl/STD_1149_1_2001 
> b/urjtag/data/bsdl/STD_1149_1_2001
> index a0e1c3e0..21a82f18 100644
> --- a/urjtag/data/bsdl/STD_1149_1_2001
> +++ b/urjtag/data/bsdl/STD_1149_1_2001
> @@ -1,259 +1,173 @@

Why?
> diff --git a/urjtag/data/freescale/PARTS b/urjtag/data/freescale/PARTS
> index 2f5adc77..eeb7f690 100644
> --- a/urjtag/data/freescale/PARTS
> +++ b/urjtag/data/freescale/PARTS
> @@ -27,5 +27,6 @@
>  0001100011100100 mpc8378 mpc8378e
>  0001100011100011 mpc8379 mpc8379
>  0001100011100010 mpc8379 mpc8379e
> +0110100011100010 p1020   p1020
>  
>  
> diff --git a/urjtag/po/fr.po b/urjtag/po/fr.po
> index bb858551..353c6a47 100644
> --- a/urjtag/po/fr.po
> +++ b/urjtag/po/fr.po
...  
> diff --git a/urjtag/po/rw.po b/urjtag/po/rw.po
> index 0899750a..60023848 100644
> --- a/urjtag/po/rw.po
> +++ b/urjtag/po/rw.po
...  
> diff --git a/urjtag/po/sk.po b/urjtag/po/sk.po
> index db8e..44bbcd60 100644
> --- a/urjtag/po/sk.po
> +++ b/urjtag/po/sk.po
...



> diff --git a/urjtag/src/bsdl/bsdl_bison.y b/urjtag/src/bsdl/bsdl_bison.y
> index c00d3fd7..6f7be147 100644
> --- a/urjtag/src/bsdl/bsdl_bison.y
> +++ b/urjtag/src/bsdl/bsdl_bison.y
> @@ -192,6 +192,7 @@ void yyerror (urj_bsdl_parser_priv_t *, const char *);
>  
>  
>  %token CONSTANT PIN_MAP
> +%token PORT_GROUPING DIFFERENTIAL_CURRENT DIFFERENTIAL_VOLTAGE
>  %token PHYSICAL_PIN_MAP PIN_MAP_STRING
>  %token TAP_SCAN_IN TAP_SCAN_OUT TAP_SCAN_MODE TAP_SCAN_RESET
>  %token TAP_SCAN_CLOCK
> @@ -239,6 +240,8 @@ void yyerror (urj_bsdl_parser_priv_t *, const char *);
>  %type  Disable_Value
>  %type  Standard_Reg
>  %type  Instruction_Name
> +%type  Port_Grouping_Type
> +%type  Port_Grouping
>  
>  %start BSDL_Statement
>  
> @@ -258,6 +261,7 @@ BSDL_Statement   : BSDL_Pin_Map
>   | BSDL_Inst_Guard
>   | BSDL_Inst_Private
>   | BSDL_Idcode_Register
> + | BSDL_Port_Grouping
>   | BSDL_Usercode_Register
>   | BSDL_Register_Access
>   | BSDL_Boundary_Length
> @@ -388,6 +392,31 @@ BSDL_Idcode_Register : IDCODE_REGISTER BIN_X_PATTERN
> { priv_data->jtag_ctrl->idcode = $2; }
>  ;
>  
> +//
> +BSDL_Port_Grouping : PORT_GROUPING Port_Grouping_Mapping
> +;
> +
> +Port_Grouping_Mapping : IDENTIFIER LPAREN Port_Grouping_List RPAREN
> +;
> +
> +Port_Grouping_Type : DIFFERENTIAL_VOLTAGE 
> + | DIFFERENTIAL_CURRENT
> +;
> +
> +Port_Grouping_List : LPAREN Port_Grouping RPAREN
> +| Port_Grouping_List COMMA LPAREN Port_Grouping RPAREN
> +| error
> +  {
> +Print_Error (priv_data, _("Error in Port Grouping 
> List"));
> +BUMP_ERROR;
> +YYABORT;
> +  }
> +;
> +Port_Grouping  : IDENTIFIER LPAREN DECIMAL_NUMBER RPAREN COMMA 
> IDENTIFIER LPAREN DECIMAL_NUMBER RPAREN
> + | IDENTIFIER COMMA IDENTIFIER
> +  { free ($1); }
> +;
> +
>  
> //
>  BSDL_Usercode_Register : USERCODE_REGISTER BIN_X_PATTERN
>   {