Skip to content

Adding driver M25P80 to bcmrpi_config #1781

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

Closed
Naegolus opened this issue Jan 7, 2017 · 10 comments
Closed

Adding driver M25P80 to bcmrpi_config #1781

Naegolus opened this issue Jan 7, 2017 · 10 comments

Comments

@Naegolus
Copy link

Naegolus commented Jan 7, 2017

Hello,

we (a little open source hardware startup) would like to add an existing driver in the bcmrpi_config.

Motivation:
Our first product is an extension board for the Raspberry Pi Zero and Raspberry Pi A+.
The extension board adds an ethernet interface (driver situation ok) and optionally connects the Raspberry Pi with a FPGA Board which has a M25P80 compatible SPI flash on it. If the M25P80 driver is activated the FPGA can be programmed via the flash tools from the package mtd_utils.
The users of our extension board should be able to install it by just adding a device tree overlay. Unfortunately the needed M25P80 driver isn't included in the official Raspbian image.

Specific changes:
--- a/arch/arm/configs/bcmrpi_defconfig
+++ b/arch/arm/configs/bcmrpi_defconfig
@@ -400,7 +400,10 @@ CONFIG_DMA_CMA=y
CONFIG_CMA_SIZE_MBYTES=5
CONFIG_MTD=m
CONFIG_MTD_BLOCK=m
+CONFIG_MTD_M25P80=m
CONFIG_MTD_NAND=m
+CONFIG_MTD_SPI_NOR=m
+# CONFIG_MTD_SPI_NOR_USE_4K_SECTORS is not set
CONFIG_MTD_UBI=m
CONFIG_OF_CONFIGFS=y
CONFIG_ZRAM=m

May we activate this?

Joe

@pelwell
Copy link
Contributor

pelwell commented Jan 17, 2017

Enabling those options causes two modules to be built: spi-nor.ko (19kB) and m25p80.ko (13kB). There are no

@popcornmix Are you happy for me to proceed?

@popcornmix
Copy link
Collaborator

Okay.

pelwell pushed a commit that referenced this issue Jan 17, 2017
pelwell pushed a commit that referenced this issue Jan 17, 2017
pelwell pushed a commit that referenced this issue Jan 17, 2017
@pelwell
Copy link
Contributor

pelwell commented Jan 17, 2017

Those options are now enabled in rpi-4.4.y, rpi-4.9.y and rpi-4.10.y, and will be included in future builds.

@Naegolus
Copy link
Author

Thank you very much!

popcornmix pushed a commit that referenced this issue Jan 18, 2017
popcornmix pushed a commit that referenced this issue Jan 21, 2017
popcornmix added a commit to raspberrypi/firmware that referenced this issue Jan 22, 2017
kernel: config: More USB config options for bcm2709_defconfig
See: raspberrypi/linux#1805

kernel: config: Add CONFIG_MD_M25P80 and CONFIG_MD_SPI_NOR
See: raspberrypi/linux#1781

kernel: BCM270X_DT: Enable UART0 on CM3

kernel: BCM270X_DT: Add spi0-cs overlay

kernel: Revert bcm2835-i2s: Changes for allowing asymmetric sample formats
See: raspberrypi/linux#1783
popcornmix added a commit to Hexxeh/rpi-firmware that referenced this issue Jan 22, 2017
kernel: config: More USB config options for bcm2709_defconfig
See: raspberrypi/linux#1805

kernel: config: Add CONFIG_MD_M25P80 and CONFIG_MD_SPI_NOR
See: raspberrypi/linux#1781

kernel: BCM270X_DT: Enable UART0 on CM3

kernel: BCM270X_DT: Add spi0-cs overlay

kernel: Revert bcm2835-i2s: Changes for allowing asymmetric sample formats
See: raspberrypi/linux#1783
popcornmix pushed a commit that referenced this issue Jan 23, 2017
popcornmix pushed a commit that referenced this issue Jan 30, 2017
popcornmix pushed a commit that referenced this issue Jan 30, 2017
popcornmix pushed a commit that referenced this issue Feb 1, 2017
popcornmix pushed a commit that referenced this issue Feb 4, 2017
Noltari pushed a commit to Noltari/linux that referenced this issue Feb 6, 2017
popcornmix pushed a commit that referenced this issue Feb 6, 2017
popcornmix pushed a commit that referenced this issue Feb 10, 2017
popcornmix pushed a commit that referenced this issue Feb 13, 2017
popcornmix pushed a commit that referenced this issue Feb 16, 2017
popcornmix pushed a commit that referenced this issue Feb 20, 2017
popcornmix pushed a commit that referenced this issue Feb 20, 2017
popcornmix pushed a commit that referenced this issue Feb 20, 2017
@meerd
Copy link

meerd commented Feb 23, 2017

Hello @Naegolus,

Do you have working overlay (dts) file for m25p80?

Thanks.

@Naegolus
Copy link
Author

@meerd
Copy link

meerd commented Feb 23, 2017

Hello @Naegolus!

Thanks for your reply. I have w25q128 connected to my board (based on compute module) and I have been trying to integrate it with raspberry pi. Electrically, w25q128 is OK but for some reason the kernel does not recognize it. (no console logs regarding spi2, mtd drivers
don't get loaded etc.) Please see my overlay file below. Is it possible for you to review it?

`
/dts-v1/;
/plugin/;

/ {
compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709";

fragment@0 {
	target = <&gpio>;
	__overlay__ {
		spi2_pins: spi2_pins {
			brcm,pins = <40 41 42>;
			brcm,function = <3>; /* alt4 */
		};

		spi2_cs_pins: spi2_cs_pins {
			brcm,pins = <43>;
			brcm,function = <1>; /* out */
		};
	};
};

fragment@1 {
	target = <&spi2>;
	__overlay__ {
		/* needed to avoid dtc warning */
		#address-cells = <1>;
		#size-cells = <0>;
		pinctrl-0 = <&spi2_pins &spi2_cs_pins>;
		cs-gpios = <&gpio 43 1>;
		status = "okay";

		flash0: w25q128@0 {
			compatible = "w25q128, m25p128-nonjedec", "spi-nor";
			reg = <0>; /* CE0 */
			#address-cells = <1>;
			#size-cells = <0>;
			spi-max-frequency = <12000000>;
			status = "okay";

			partition@0 {
				label = "data";
				reg = <0x0 0x8000000>;
			}; 
		};
	};
};

};
`

@meerd
Copy link

meerd commented Feb 24, 2017

After many unsuccessful attempts, it is working now! I am aiming to add this to the kernel repository after a few improvements. For now, the example needs to be used with spi2-1cs overlay.

dtoverlay=spi2-1cs,cs0_spidev=disabled
dtoverlay=w25q128

`/dts-v1/;
/plugin/;

/ {
compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709", "brcm,bcm2710";

fragment@0 {
	target = <&spi2>;
	__overlay__ {
		#address-cells = <1>;
		#size-cells = <0>;
		status = "okay";

		flash: m25p80@0 {
			#address-cells = <1>;
			#size-cells = <1>;
			compatible = "w25q128","spi-nor";
                            reg = <0 0x800000>;
                            linux,modalias = "m25p80", "w25q128";
			spi-max-frequency = <1000000>;
			m25p,fast-read;

			partition@0 {
				label = "data";
				reg = <0x0 0x8000000>;
			}; 
		};
	};
};

};`

fuzeman pushed a commit to fuzeman/linux-ubuntu-zesty that referenced this issue Mar 30, 2017
popcornmix pushed a commit that referenced this issue Mar 31, 2017
popcornmix pushed a commit that referenced this issue Apr 2, 2017
popcornmix pushed a commit that referenced this issue Apr 10, 2017
popcornmix pushed a commit that referenced this issue Apr 13, 2017
popcornmix pushed a commit that referenced this issue Apr 18, 2017
popcornmix pushed a commit that referenced this issue Apr 22, 2017
popcornmix pushed a commit that referenced this issue Apr 24, 2017
popcornmix pushed a commit that referenced this issue Apr 27, 2017
popcornmix pushed a commit that referenced this issue May 5, 2017
popcornmix pushed a commit that referenced this issue May 9, 2017
popcornmix pushed a commit that referenced this issue May 15, 2017
popcornmix pushed a commit that referenced this issue May 21, 2017
popcornmix pushed a commit that referenced this issue May 24, 2017
popcornmix pushed a commit that referenced this issue Jul 12, 2017
@RadekHvizdos
Copy link

RadekHvizdos commented Jul 30, 2017

Sorry for bringing this thread up from the dead, but it just got me excited to see that someone has already worked on attaching M25P80 class of devices to raspberry pi.

@meerd Were you able to finalize the DTS and is it ready for mainlining?

Thanks!

popcornmix pushed a commit that referenced this issue Aug 10, 2017
popcornmix pushed a commit that referenced this issue Aug 13, 2017
woshihuangzhijie pushed a commit to woshihuangzhijie/linuxcode that referenced this issue Sep 20, 2017
BugLink: https://bugs.launchpad.net/bugs/1691407

See: raspberrypi/linux#1781

Signed-off-by: Phil Elwell <[email protected]>

(cherry picked from commit 17ca1c930978a9ea6ddfec61fd0e2043e8ab3b17)
Signed-off-by: Paolo Pisati <[email protected]>
Acked-by: Colin King <[email protected]>
Acked-by: Stefan Bader <[email protected]>
Signed-off-by: Thadeu Lima de Souza Cascardo <[email protected]>
amichelotti pushed a commit to amichelotti/ubuntu-vme-xenial that referenced this issue Oct 19, 2017
BugLink: https://bugs.launchpad.net/bugs/1691407

See: raspberrypi/linux#1781

Signed-off-by: Phil Elwell <[email protected]>

(cherry picked from commit 17ca1c930978a9ea6ddfec61fd0e2043e8ab3b17)
Signed-off-by: Paolo Pisati <[email protected]>
Acked-by: Colin King <[email protected]>
Acked-by: Stefan Bader <[email protected]>
Signed-off-by: Thadeu Lima de Souza Cascardo <[email protected]>
popcornmix pushed a commit that referenced this issue Oct 29, 2017
raspbian-autopush pushed a commit to raspbian-packages/linux-4.9 that referenced this issue Nov 2, 2017
commit 856f413
Author: Phil Elwell <[email protected]>
Date:   Tue Jan 17 14:39:39 2017 +0000

    config: Add CONFIG_MD_M25P80 and CONFIG_MD_SPI_NOR
    
    See: raspberrypi/linux#1781
    
    Signed-off-by: Phil Elwell <[email protected]>


Gbp-Pq: Topic rpi
Gbp-Pq: Name rpi_1126_856f413c4544f81f38cf21af6537cbea94d0729e.patch
lianhaidong pushed a commit to lianhaidong/ubuntu-xenial that referenced this issue Nov 6, 2017
BugLink: https://bugs.launchpad.net/bugs/1691407

See: raspberrypi/linux#1781

Signed-off-by: Phil Elwell <[email protected]>

(cherry picked from commit 17ca1c930978a9ea6ddfec61fd0e2043e8ab3b17)
Signed-off-by: Paolo Pisati <[email protected]>
Acked-by: Colin King <[email protected]>
Acked-by: Stefan Bader <[email protected]>
Signed-off-by: Thadeu Lima de Souza Cascardo <[email protected]>
ryncsn pushed a commit to ryncsn/linux-rasp that referenced this issue Nov 21, 2017
liuqun pushed a commit to liuqun/linux-raspi2 that referenced this issue Dec 14, 2017
BugLink: https://bugs.launchpad.net/bugs/1691407

See: raspberrypi/linux#1781

Signed-off-by: Phil Elwell <[email protected]>

(cherry picked from commit 17ca1c930978a9ea6ddfec61fd0e2043e8ab3b17)
Signed-off-by: Paolo Pisati <[email protected]>
Acked-by: Colin King <[email protected]>
Acked-by: Stefan Bader <[email protected]>
Signed-off-by: Thadeu Lima de Souza Cascardo <[email protected]>
liuqun pushed a commit to liuqun/linux-raspi2 that referenced this issue Dec 20, 2017
BugLink: https://bugs.launchpad.net/bugs/1691407

See: raspberrypi/linux#1781

Signed-off-by: Phil Elwell <[email protected]>

(cherry picked from commit 17ca1c930978a9ea6ddfec61fd0e2043e8ab3b17)
Signed-off-by: Paolo Pisati <[email protected]>
Acked-by: Colin King <[email protected]>
Acked-by: Stefan Bader <[email protected]>
Signed-off-by: Thadeu Lima de Souza Cascardo <[email protected]>
polceanum pushed a commit to polceanum/ubuntu-xenial that referenced this issue Feb 6, 2018
BugLink: https://bugs.launchpad.net/bugs/1691407

See: raspberrypi/linux#1781

Signed-off-by: Phil Elwell <[email protected]>

(cherry picked from commit 17ca1c930978a9ea6ddfec61fd0e2043e8ab3b17)
Signed-off-by: Paolo Pisati <[email protected]>
Acked-by: Colin King <[email protected]>
Acked-by: Stefan Bader <[email protected]>
Signed-off-by: Thadeu Lima de Souza Cascardo <[email protected]>
raspbian-autopush pushed a commit to raspbian-packages/linux-4.9 that referenced this issue Apr 7, 2018
commit 7a4dcb5
Author: Phil Elwell <[email protected]>
Date:   Tue Jan 17 14:39:39 2017 +0000

    config: Add CONFIG_MD_M25P80 and CONFIG_MD_SPI_NOR
    
    See: raspberrypi/linux#1781
    
    Signed-off-by: Phil Elwell <[email protected]>


Gbp-Pq: Topic rpi
Gbp-Pq: Name rpi_1125_7a4dcb58285ee46d97ab4b47027eb50124929934.patch
APokorny pushed a commit to ubports/ubuntu_kernel_xenial that referenced this issue Oct 11, 2018
BugLink: https://bugs.launchpad.net/bugs/1691407

See: raspberrypi/linux#1781

Signed-off-by: Phil Elwell <[email protected]>

(cherry picked from commit 17ca1c930978a9ea6ddfec61fd0e2043e8ab3b17)
Signed-off-by: Paolo Pisati <[email protected]>
Acked-by: Colin King <[email protected]>
Acked-by: Stefan Bader <[email protected]>
Signed-off-by: Thadeu Lima de Souza Cascardo <[email protected]>
raspbian-autopush pushed a commit to raspbian-packages/linux-4.9 that referenced this issue Nov 11, 2018
commit 7a4dcb5
Author: Phil Elwell <[email protected]>
Date:   Tue Jan 17 14:39:39 2017 +0000

    config: Add CONFIG_MD_M25P80 and CONFIG_MD_SPI_NOR
    
    See: raspberrypi/linux#1781
    
    Signed-off-by: Phil Elwell <[email protected]>


Gbp-Pq: Topic rpi
Gbp-Pq: Name rpi_1125_7a4dcb58285ee46d97ab4b47027eb50124929934.patch
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

5 participants