Skip to content

Commit

Permalink
Update to allow dynamic eMMC and SD card switching
Browse files Browse the repository at this point in the history
Updated readme and block diagram
  • Loading branch information
hughbreslin committed Nov 12, 2020
1 parent 25ce91f commit 7e17c9a
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 22 deletions.
22 changes: 19 additions & 3 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
# PolarFire SoC Icicle Kit Sample Design scripts Libero v12.5

## Description

This repository can be used to generate a reference design for the PolarFire SoC Icicle Kit, this reference design will have the same or increased functionality compared to the factory default image programmed onto each kit.
The provided scripts have been tested using Libero SoC v12.5 and Libero SoC v12.5 SP1.

## Using the scripts

A script is provided for both eMMC and SD card configurations, previously eMMC and SD could only be used exclusivly but updates now permit dynamic switching between eMMC and SD card. Both scripts now connect the SDIO SEL signals to MSS GPIO_2 bit 0, by default this bit is low which selects the eMMC MUX conifguration, setting this bit selects the SD card MUX configuraion. Each script will enable its respective configuration in the PolarFire SoC MSS while allowing for dynamic switching, to use the SD card ensure that GPIO_2 bit 0 is set. See the section titled "eMMC and SD card switching" for more information.

1. Clone the repository - note the path to this repository must not contain any spaces
2. Open Libero v12.5
3. Open the execute script dialog (CTRL + U)
Expand All @@ -13,6 +17,7 @@ The provided scripts have been tested using Libero SoC v12.5 and Libero SoC v12.
6. Configure if required and run the flow to program a device

## Programming the FPGA

The scripts will automatically import IO constraints and generate timing constraints for the design. The flow can be run by double clicking on a stage in the design flow - selecting an option requiring previous steps to be completed will run the full flow, i.e double clicking "Run Program Action" will run synthesis, place and route, etc and then program the device.

## MSS Configuration
Expand All @@ -24,16 +29,19 @@ The MSS component file can be imported into a Libero design and used in the FPGA
A saved configuration for the PolarFire SoC MSS Configurator is available for both the eMMC and SD card designs in the "script_support" folder. These configurations will match the MSS configuration used in the design and can be used to regenerate XML and a Libero component.

## XML

The Microprocessor Subsystem (MSS) configuration is captured in an XML file that is then used by the PolarFire SoC Configuration Generator to generate configuration header files. These header files are compiled as part of the MPFS HAL startup code to configure the system on startup.

XML generated by both of the configurations provided is available in the "XML" folder.

## Programming the eNVM and setting the boot mode

If the eNVM is to be used (for example to store the HSS or a bare metal application) it can be programmed using SoftConsole v6.4 or later.

Build the application using the reference XML provided (XML will also be generated in the script_support/components/[target] folder when an MSS component is generated as part of the flow) and run the "PolarFire SoC program non secure boot mode 1" external tool in SoftConsole.

## Board configuration

For jumper configurations to use this design and Linux images for eMMC and SD Cards see: [Updating PolarFire SoC Icicle-Kit FPGA Design and Linux Image](https://github.com/polarfire-soc/polarfire-soc-documentation/blob/master/boards/mpfs-icicle-kit-es/updating-icicle-kit/updating-icicle-kit-design-and-linux.md)

## Design description
Expand All @@ -49,9 +57,9 @@ MSS peripherals are not shown above, for both the eMMC and SD configurations the

| Peripheral | Routing | Notes |
|------------ |------------------- |------------------------------------------- |
| eMMC | MSS I/Os BANK 4 | Only enabled using the eMMC configuration |
| eMMC | MSS I/Os BANK 4 | See "eMMC and SD card switching" |
| USB | MSS I/Os BANK 2 | |
| SD/SDIO | MSS I/Os BANK 4 | Only enabled using the SD configuration |
| SD/SDIO | MSS I/Os BANK 4 | See "eMMC and SD card switching" |
| GEM 0 | SGMII I/Os BANK 5 | |
| GEM 1 | SGMII I/Os BANK 5 | Management through MSS I/Os BANK 2 B |
| SPI 1 | MSS I/Os BANK 2 B | |
Expand All @@ -75,4 +83,12 @@ MSS peripherals are not shown above, for both the eMMC and SD configurations the
| MSS: FIC3 | APBmslave3 | PF_DRI_C0_0 | 0x4300_0000 -> 0x43ff_ffff |
| PF_PCIE_C0_0 | AXI4_mslave0 | MSS: FIC0 | 0x6000_0000 -> 0xbfff_ffff |
| PF_PCIE_C0_0 | AXI4_mslave1 | LSRAM_1 | 0x0 -> 0xfff |
| COREAXI4DMACONTROLLER_0 | AXI4_mslave0 | MSS: FIC1 | 0xc000_0000 -> 0xcfff_ffff |
| COREAXI4DMACONTROLLER_0 | AXI4_mslave0 | MSS: FIC1 | 0xc000_0000 -> 0xcfff_ffff |

### eMMC and SD card switching

In previous versions of this design the SDIO SEL signals were tied low to enable eMMC or tied high to enable the SD card. The Icicle Kit reference design and MPFS HAL have been updated to support dynamically switching between these configurations without having to re-program the FPGA.

The SDIO SEL signals are now driven by MSS GPIO_2 bit 0 - this bit resets to output 0 selecting the eMMC configuration, to select an SD card configuration set GPIO_2 bit 0 high.

**Note:** currently these updates are not fully supported by the Libero SoC design suite - to accomidate this the MPFS HAL has been updated with a define to allow dynamic switching - which will support the MPFS250T part on the Icicle Kit only and no other PolarFire SoC parts. As a result of this we will continue to provide separte eMMC and SD card scripts to generate MSS XML for each configuration until Libero SoC has full support for these updates.
2 changes: 1 addition & 1 deletion block_diagram.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion script_support/PF_SoC_MSS_Icicle_SD.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ GPIO_1_8_15_RESET_SOURCE MSS
GPIO_1_8_DIR IN
GPIO_1_9 UNUSED
GPIO_1_9_DIR IN
GPIO_2_0 UNUSED
GPIO_2_0 FABRIC
GPIO_2_0_7_RESET_SOURCE MSS
GPIO_2_0_DIR OUT
GPIO_2_1 UNUSED
Expand Down
2 changes: 1 addition & 1 deletion script_support/PF_SoC_MSS_Icicle_eMMC.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ GPIO_1_8_15_RESET_SOURCE MSS
GPIO_1_8_DIR IN
GPIO_1_9 UNUSED
GPIO_1_9_DIR IN
GPIO_2_0 UNUSED
GPIO_2_0 FABRIC
GPIO_2_0_7_RESET_SOURCE MSS
GPIO_2_0_DIR OUT
GPIO_2_1 UNUSED
Expand Down
5 changes: 5 additions & 0 deletions script_support/components/MPFS_ICICLE_BASE_DESIGN.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ sd_create_scalar_port -sd_name ${sd_name} -port_name {CAN_0_TXBUS_M2F} -port_dir
sd_create_scalar_port -sd_name ${sd_name} -port_name {CAN_1_RXBUS} -port_direction {IN}
sd_create_scalar_port -sd_name ${sd_name} -port_name {CAN_1_TX_EBL_N} -port_direction {OUT}
sd_create_scalar_port -sd_name ${sd_name} -port_name {CAN_1_TXBUS} -port_direction {OUT}
sd_create_scalar_port -sd_name ${sd_name} -port_name {SDIO_SW_SEL0} -port_direction {OUT}
sd_create_scalar_port -sd_name ${sd_name} -port_name {SDIO_SW_SEL1} -port_direction {OUT}
sd_create_scalar_port -sd_name ${sd_name} -port_name {SDIO_SW_EN_N} -port_direction {OUT}

sd_create_bus_port -sd_name ${sd_name} -port_name {CA} -port_direction {OUT} -port_range {[5:0]}
sd_create_bus_port -sd_name ${sd_name} -port_name {DQ} -port_direction {INOUT} -port_range {[31:0]}
Expand Down Expand Up @@ -288,6 +291,8 @@ sd_connect_pins -sd_name ${sd_name} -pin_names {"CAN_1_RXBUS" "MSS:CAN_1_RXBUS"
sd_connect_pins -sd_name ${sd_name} -pin_names {"CAN_1_TX_EBL_N" "MSS:CAN_1_TX_EBL_N" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"CAN_1_TXBUS" "MSS:CAN_1_TXBUS" }
sd_invert_pins -sd_name ${sd_name} -pin_names {"MSS:CAN_0_TX_EBL_M2F"}
sd_connect_pins -sd_name ${sd_name} -pin_names {"SDIO_SW_SEL0" "SDIO_SW_SEL1" "MSS:GPIO_2_M2F_0" }
sd_connect_pins_to_constant -sd_name ${sd_name} -pin_names {SDIO_SW_EN_N} -value {GND}

sd_connect_pins -sd_name ${sd_name} -pin_names {"COREAXI4DMACONTROLLER_0:INTERRUPT" "MSS:MSS_INT_F2M[2]" }
sd_connect_pins_to_constant -sd_name ${sd_name} -pin_names {VSC_8662_CMODE3} -value {GND}
Expand Down
7 changes: 0 additions & 7 deletions script_support/components/MPFS_ICICLE_SD_CARD.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ auto_promote_pad_pins -promote_all 0
source script_support/components/MPFS_ICICLE_BASE_DESIGN.tcl

# Create top level Ports
sd_create_scalar_port -sd_name ${sd_name} -port_name {SDIO_SW_SEL0} -port_direction {OUT}
sd_create_scalar_port -sd_name ${sd_name} -port_name {SDIO_SW_SEL1} -port_direction {OUT}
sd_create_scalar_port -sd_name ${sd_name} -port_name {SD_CLK} -port_direction {OUT}
sd_create_scalar_port -sd_name ${sd_name} -port_name {SD_CMD} -port_direction {INOUT}
sd_create_scalar_port -sd_name ${sd_name} -port_name {SD_DATA0} -port_direction {INOUT}
Expand All @@ -24,11 +22,6 @@ sd_create_scalar_port -sd_name ${sd_name} -port_name {SD_VOLT_EN} -port_directio
sd_create_scalar_port -sd_name ${sd_name} -port_name {SD_VOLT_SEL} -port_direction {OUT}
sd_create_scalar_port -sd_name ${sd_name} -port_name {SD_CD} -port_direction {IN}
sd_create_scalar_port -sd_name ${sd_name} -port_name {SD_WP} -port_direction {IN}
sd_create_scalar_port -sd_name ${sd_name} -port_name {SDIO_SW_EN_N} -port_direction {OUT}

sd_connect_pins_to_constant -sd_name ${sd_name} -pin_names {SDIO_SW_SEL0} -value {VCC}
sd_connect_pins_to_constant -sd_name ${sd_name} -pin_names {SDIO_SW_SEL1} -value {VCC}
sd_connect_pins_to_constant -sd_name ${sd_name} -pin_names {SDIO_SW_EN_N} -value {GND}

# Add scalar net connections
sd_connect_pins -sd_name ${sd_name} -pin_names {"SD_CLK" "MSS:SD_CLK" }
Expand Down
9 changes: 0 additions & 9 deletions script_support/components/MPFS_ICICLE_eMMC.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ source script_support/components/MPFS_ICICLE_BASE_DESIGN.tcl

# Create top level Ports

sd_create_scalar_port -sd_name ${sd_name} -port_name {SDIO_SW_SEL0} -port_direction {OUT}
sd_create_scalar_port -sd_name ${sd_name} -port_name {SDIO_SW_SEL1} -port_direction {OUT}
sd_create_scalar_port -sd_name ${sd_name} -port_name {EMMC_CLK} -port_direction {OUT}
sd_create_scalar_port -sd_name ${sd_name} -port_name {EMMC_CMD} -port_direction {INOUT}
sd_create_scalar_port -sd_name ${sd_name} -port_name {EMMC_DATA0} -port_direction {INOUT}
Expand All @@ -24,13 +22,6 @@ sd_create_scalar_port -sd_name ${sd_name} -port_name {EMMC_DATA7} -port_directio
sd_create_scalar_port -sd_name ${sd_name} -port_name {EMMC_STRB} -port_direction {IN}
sd_create_scalar_port -sd_name ${sd_name} -port_name {EMMC_RSTN} -port_direction {OUT}

#
sd_create_scalar_port -sd_name ${sd_name} -port_name {SDIO_SW_EN_N} -port_direction {OUT}

sd_connect_pins_to_constant -sd_name ${sd_name} -pin_names {SDIO_SW_SEL0} -value {GND}
sd_connect_pins_to_constant -sd_name ${sd_name} -pin_names {SDIO_SW_SEL1} -value {GND}
sd_connect_pins_to_constant -sd_name ${sd_name} -pin_names {SDIO_SW_EN_N} -value {GND}

sd_connect_pins -sd_name ${sd_name} -pin_names {"EMMC_CLK" "MSS:EMMC_CLK" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"EMMC_CMD" "MSS:EMMC_CMD" }
sd_connect_pins -sd_name ${sd_name} -pin_names {"EMMC_DATA0" "MSS:EMMC_DATA0" }
Expand Down

0 comments on commit 7e17c9a

Please sign in to comment.