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

Get spiflash driver working #12

Open
mithro opened this issue Apr 15, 2017 · 1 comment
Open

Get spiflash driver working #12

mithro opened this issue Apr 15, 2017 · 1 comment

Comments

@mithro
Copy link
Member

mithro commented Apr 15, 2017

Be able to read the SPI flash...

@mithro
Copy link
Member Author

mithro commented Apr 15, 2017

The following device tree was needed to get the spiflash bitbanging working;

	spiflash_bitbang_out: gpio-controller@e0005000 {
		compatible = "basic-mmio-gpio", "wd,mbl-gpio";
		reg = <0xe0005000 0x4>;
		#gpio-cells = <2>;
		gpio-controller;
		reg-names = "dat";
		big-endian;
	};
	spiflash_bitbang_in: gpio-controller@e0005004 {
		compatible = "basic-mmio-gpio", "wd,mbl-gpio";
		reg = <0xe0005004 0x4>;
		#gpio-cells = <2>;
		gpio-controller;
		reg-names = "dat";
		no-output;
		big-endian;
	};

        spi {
                compatible = "spi-gpio";
                #address-cells = <0x1>;
                ranges;

                gpio-mosi =	<&spiflash_bitbang_out 0 0>;	// 0x01 on reg0
                gpio-sck =	<&spiflash_bitbang_out 1 0>;	// 0x02 on reg0
                cs-gpios = 	<&spiflash_bitbang_out 2 0>;	// 0x03 on reg0
                gpio-miso = 	<&spiflash_bitbang_in  0 0>;	// 0x01 on reg1
                num-chipselects = <1>;

                /* clients */
		m25p16@0 {
			#address-cells = <1>;
			#size-cells = <1>;
			compatible = "spansion,m25p16", "jedec,spi-nor";
			spi-max-frequency = <40000000>;
			reg = <0>;
			//m25p,fast-read;

			// Values in the partition table should be relative to the
			// flash start address...
			partitions {
				compatible = "fixed-partitions";
				#address-cells = <1>;
				#size-cells = <1>;

				/* FPGA gateware */
				partition@0 {
					label = "gateware";
					reg = <0x0000000 0x80000>;
					read-only;
				};

				/* MiSoC / LiteX BIOS */
				partition@80000 {
					label = "bios";
					reg = <0x00080000 0x8000>;
					read-only;
				};

				/* HDMI2USB Firmware (or Linux Kernel?) */
				partition@88000 {
					label = "firmware";
					reg = <0x00088000 0x178000>;
					read-only;
				};
			};
		};
        };
	/************************************************************************/

You then get the following dmesg output;

m25p80 spi32766.0: m25p16 (2048 Kbytes)
3 ofpart partitions found on MTD device spi32766.0
Creating 3 MTD partitions on "spi32766.0":
0x000000000000-0x000000080000 : "gateware"
0x000000080000-0x000000088000 : "bios"
0x000000088000-0x000000200000 : "firmware"
spi_gpio spi: registered child spi32766.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant