Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Panologic: Added SPI flash support. Successfully boots Linux from flash. #410

Merged
merged 3 commits into from
Apr 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions platforms/pano_logic_g2.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,14 @@
# NET "DDR2B_ODT" LOC = J6 | IOSTANDARD = LVCMOS18;
Subsignal("odt", Pins("J6"), IOStandard("SSTL18_II")),
),
## onBoard SPI Flash
("spiflash", 0,
Subsignal("cs_n", Pins("T5"), IOStandard("LVCMOS33")),
Subsignal("clk", Pins("Y21"), IOStandard("LVCMOS33")),
Subsignal("mosi", Pins("AB20"), IOStandard("LVCMOS33")),
Subsignal("miso", Pins("AA20"), IOStandard("LVCMOS33"))
),

]

_hdmi_serial = (
Expand All @@ -181,6 +189,17 @@ class Platform(XilinxPlatform):
default_clk_name = "clk125"
default_clk_period = 1e9/125e6

# actual .bit file size rounded up to next flash erase boundary
gateware_size = 0x420000

# Micron M25P128
spiflash_model = "m25p128"
spiflash_read_dummy_bits = 8
spiflash_clock_div = 4
spiflash_total_size = int((128/8)*1024*1024) # 128Mbit/16Mbyte
spiflash_page_size = 256
spiflash_sector_size = 0x20000

def __init__(self, programmer="impact", device="xc6slx150", uart_connection="dvi"):
if uart_connection == 'dvi':
_io.append(_dvi_serial)
Expand Down
21 changes: 20 additions & 1 deletion targets/pano_logic_g2/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,26 @@ def __init__(self, platform, **kwargs):
interface=self.cpu.debug_bus,
size=0x100)

# ??????
# Memory mapped SPI Flash ------------------------------------------------------------------
self.submodules.spiflash = spi_flash.SpiFlash(
platform.request("spiflash"),
dummy=platform.spiflash_read_dummy_bits,
div=platform.spiflash_clock_div,
endianness=self.cpu.endianness)
self.add_csr("spiflash")
self.add_constant("SPIFLASH_PAGE_SIZE", platform.spiflash_page_size)
self.add_constant("SPIFLASH_SECTOR_SIZE", platform.spiflash_sector_size)
self.add_constant("SPIFLASH_TOTAL_SIZE", platform.spiflash_total_size)
self.register_mem("spiflash", self.mem_map["spiflash"],
self.spiflash.bus, size=platform.spiflash_total_size)
self.flash_boot_address = self.mem_map["spiflash"]+platform.gateware_size
self.add_constant("FLASH_BOOT_ADDRESS", self.flash_boot_address)
mateusz-holenko marked this conversation as resolved.
Show resolved Hide resolved
self.add_constant("DEVICE_TREE_IMAGE_FLASH_OFFSET",0x00000000)
self.add_constant("EMULATOR_IMAGE_FLASH_OFFSET",0x20000)
self.add_constant("KERNEL_IMAGE_FLASH_OFFSET",0x40000)
self.add_constant("ROOTFS_IMAGE_FLASH_OFFSET",0x5c0000)

# Take Ethernet Phy out of reset for SYSCLK of 125 Mhz
gmii_rst_n = platform.request("gmii_rst_n")
self.comb += [
gmii_rst_n.eq(1)
Expand Down