This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM3358: Enabling SPI Nor Flash(W25Q64CV) Partitions on am335x-evm with yocto build system.

Part Number: AM3358

I am trying to enable SPI NOR flash (W25Q64) and partitioning it and trying to access it from linux userspace.  I had gone through the wiki page available

I am using yocto warrior with meta-ti for am335x GP EVM board. The image is booted with sd card.

As mentioned i am unable to find source file arch/arm/mach-omap2/board-am35xevm.c to change the list of partitions.

Cat /proc/mtd does not show any partions.

 cat /proc/mtd
dev:    size   erasesize  name.

Let me know any set of changes i have to do from yocto build? DO i need to tweek u-boot.  No device file found after loading spi-dev.ko.

  • Hi,

    I'm sorry, we don't have an example with AM335x, but AM437x has a good example below:

    https://git.ti.com/cgit/ti-linux-kernel/ti-linux-kernel/tree/arch/arm/boot/dts/am437x-sk-evm.dts

    While this is QSPI, the partition setup for it should be very similar. 

    If you only want userspace access, setting it up for the Linux DTS file should be enough. If you need to access it from the bootloader, then you'll need to add support there as well.

    I hope this is helpful to you.

  • Apart from dtb changes any other config flags need to be enabled?

  • You'll need to walk through menuconfig to do some checking. The one's we provide with the SDKs are pretty comprehensive and would serve as a good starting point. I'm sorry, I don't know the specific configs needed as we don't build SPI NOR support for AM335x.

  • How to enable SPI NOR Flash device?

  • Siva, 

    I'm sorry, I don't understand your question. If this is about the config, you'll need to do some searching in menuconfig to enable the dependencies for NOR flash, if they are not enabled. I'm sorry, I don't have a specific list available for you.

    If you meant something else, can you please be more specific? The config enablement and proper entries in your DT files as discussed above should get the needed support added.

  • ok dts changes to enable spi device. I verified with ti sdk image also i am not seeing /dev/spidev afer loading spidev.ko manually.

  • Here is my changes added to am335x-evm.dtb file for spi flash partition.

    spi0_pins: spi0_pins {
                    pinctrl-single,pins = <
                            AM33XX_IOPAD(0x950, PIN_OUTPUT | MUX_MODE0)     /* spi0_sclk.spi0_sclk */
                            AM33XX_IOPAD(0x954, PIN_OUTPUT_PULLUP | MUX_MODE0)      /* spi0_d0.spi0_d0 */
                            AM33XX_IOPAD(0x958, PIN_INPUT | MUX_MODE0)      /* spi0_d1.spi0_d1 */
                            AM33XX_IOPAD(0x95c, PIN_OUTPUT | MUX_MODE0)     /* spi0_cs0.spi0_cs0 */
                    >;
            };

    &spi0 {
            status = "okay";
            pinctrl-names = "default";
            pinctrl-0 = <&spi0_pins>;

            spi-flash@0 {
                    compatible = "winbond,w25q64cv", "m25p80";
                    spi-max-frequency = <24000000>;
                    reg = <0>;
                    #address-cells = <1>;
                    #size-cells = <1>;
                    partition@0 {
                    label = "SPL";
                    reg = <0x00000000 0x00020000>;
                    };
                    partition@20000 {
                    label = "u-boot";
                    reg = <0x00020000 0x00060000>;
                    };
                    partition@80000 {
                    label = "kernel";
                    reg = <0x00080000 0x00500000>;
                    };
            };
    };

    I am getting error in dmesg.

    [    1.088071] pinctrl-single 44e10800.pinmux: pin PIN84 already requested by 44e10800.pinmux; cannot claim for 48030000.spi
    [    1.099257] pinctrl-single 44e10800.pinmux: pin-84 (48030000.spi) status -22
    [    1.106341] pinctrl-single 44e10800.pinmux: could not request pin 84 (PIN84) from group spi0_pins  on device pinctrl-single
    [    1.117549] omap2_mcspi 48030000.spi: Error applying setting, reverse things back
    [    1.125088] omap2_mcspi: probe of 48030000.spi failed with error -22.

    I am totally struck. please any help appreciate.

  • In the EVM DTS file, all four of these pins are used for something else. Did you remove those configurations? If not, that would explain the conflicts you are seeing. 

    Here are two of the conflicts:

    	volume_keys_s0: volume_keys_s0 {
    		pinctrl-single,pins = <
    			AM33XX_IOPAD(0x950, PIN_INPUT_PULLDOWN | MUX_MODE7)	/* spi0_sclk.gpio0_2 */
    			AM33XX_IOPAD(0x954, PIN_INPUT_PULLDOWN | MUX_MODE7)	/* spi0_d0.gpio0_3 */
    		>;
    	};

    and the other two:

    	i2c1_pins: pinmux_i2c1_pins {
    		pinctrl-single,pins = <
    			AM33XX_IOPAD(0x958, PIN_INPUT_PULLUP | MUX_MODE2)	/* spi0_d1.i2c1_sda */
    			AM33XX_IOPAD(0x95c, PIN_INPUT_PULLUP | MUX_MODE2)	/* spi0_cs0.i2c1_scl */
    		>;
    	};
    

    I recommend using the PinMux tool  to make changes like this and develop an overall pinmux plan for your board and software.

    I hope this is helpful.