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.

Linux/AM3352: SPI interface with MCP23S18

Part Number: AM3352
Other Parts Discussed in Thread: TPS65217

Tool/software: Linux

I am new to embedded linux. I am not using the sitara sdk, the linux build directory is from yocto build system. 

I am trying to get the MCP23S18 working with the am3352. The MCP23S18 is an SPI gpio port expander.

I have the CONFIG_SPI_SPIDEV and CONFIG_GPIO_MCP23S08 enabled in .config. The relevant extracts from my device tree:

&am33xx_pinmux {
pinctrl-names = "default";

spi0_pins: pinmux_spi0_pins {
pinctrl-single,pins = <
AM33XX_IOPAD(0x150, PIN_OUTPUT | MUX_MODE0 ) // (A18) spi0_sclk.spi0_sclk
AM33XX_IOPAD(0x154, PIN_INPUT | MUX_MODE0 ) // (B18) spi0_d0.spi0_d0
AM33XX_IOPAD(0x158, PIN_OUTPUT | MUX_MODE0 ) // (B17) spi0_d1.spi0_d1
AM33XX_IOPAD(0x15c, PIN_OUTPUT_PULLUP | MUX_MODE0 ) // (A17) spi0_cs0.spi0_cs0
AM33XX_IOPAD(0x160, PIN_OUTPUT_PULLUP | MUX_MODE0 ) // (B16) spi0_cs1.spi0_cs1
>;
};

};

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

&spi0 {
gpiom1: gpiom1@1 {
compatible = "microchip,mcp23s18";
reg = <1>;
gpio-controller;
#gpio-cells = <2>;
spi-present-mask = <0x01>;
spi-max-frequency = <1000000>;
};
nvram: nvram {
address-cells = <1>;
#size-cells = <1>;
compatible = "spansion,mr25h10"; //may need to change spansion.
reg = <0>;
spi-max-frequency = <40000000>;
m25p,fast-read;
};
};

Now I am unsure  how the driver should be interfaced  from the user space. Should there be file node in /dev or somewhere in /sys? On my target there is nothing new relating too the port expander, gpios etc

I can see some device relevant files extracted form the device tree but I don't think they can be used for control of the device:

root@am335x-evm:/sys/class/spi_master/spi1/spi1.1/of_node# ls
#gpio-cells gpio-controller reg spi-present-mask
compatible name spi-max-frequency

I can access the device through the spidev driver so i know the hardware is correct. To do this i have to include spidev  in the device file.

compatible = "microchip,mcp23s18"; > compatible = "linux,spidev";

So does anyone know how this device should be accessed from user space and is my device tree/ configuration correct?

Thanks

  • The software team have been notified. They will respond here.
  • Hi David,

    There is an ongoing discussion in the linux forum:
    e2e.ti.com/.../2321156

    Please have a look at it and try the suggestions I've given.  This is for SPI RTC, but it should work for your gpio expander as well. 

    Now I am unsure  how the driver should be interfaced  from the user space. Should there be file node in /dev or somewhere in /sys?

    You should see it in /dev.

    Best Regards,
    Yordan

  • Hi Yordan,

    I have tried installing the driver as a module but it still does not register in the dev/ directory.

    When i loaded the module with insmod gpio-mcp23s08.ko I got an error from the driver reporting that there was no spi-present-mask. I have fixed that now with : microchip,spi-present-mask = <1>;

    I have also probed the spi physical interface while running insmod gpio-mcp23s08.ko , there is nothing on the signals. Since I have successfully used this bus with spidev i know that to some extent the  interface is configured correctly. 

    to use with spidev i use the following in the device tree:

    &spi0 {
    spidev@1 {
    address-cells = <1>;
    reg = <1>;
    gpio-controller;
    #gpio-cells = <2>;
    spi-max-frequency = <1000000>;
    compatible = "linux,spidev";
    };
    };

    and my device tree with the mcp23s18 now looks like:

    &spi0 {
    gpiom1: gpiom1@1 {
    compatible = "mcp,mcp23s18";
    #gpio-cells = <2>;
    gpio-controller;
    reg = <1>;
    microchip,spi-present-mask = <1>;
    spi-max-frequency = <1000000>;
    #interrupt-cells = <2>;
    };
    /*
    nvram: nvram {
    address-cells = <1>;
    #size-cells = <1>;
    compatible = "spansion,mr25h10"; //may need to change spansion.
    reg = <0>;
    spi-max-frequency = <40000000>;
    m25p,fast-read;
    };
    */
    };

    it looks as though the device tree has passed some data to sysfs: 

    root@am335x-evm:/sys/class/spi_master/spi1/spi1.1/of_node# ls
    #gpio-cells microchip,spi-present-mask
    #interrupt-cells name
    compatible reg
    gpio-controller spi-max-frequency

    i have put some debug printk's  in the driver and it seems that pdata = dev_get_platdata(&spi->dev); does not return anything. The driver exits the mcp23s08_probe function at 

    if (!chips){
    return -ENODEV;
    }

  • Hi,

    Do you have the following in your &spi0 node:
    status = "okay";
    pinctrl-names = "default";
    pinctrl-0 = <&spi0_pins>;

    As I see you just use:
    &spi0 {
    gpiom1: gpiom1@1 {
    compatible = "mcp,mcp23s18";
    #gpio-cells = <2>;
    gpio-controller;
    reg = <1>;
    microchip,spi-present-mask = <1>;
    spi-max-frequency = <1000000>;
    #interrupt-cells = <2>;
    };
    /*
    nvram: nvram {
    address-cells = <1>;
    #size-cells = <1>;
    compatible = "spansion,mr25h10"; //may need to change spansion.
    reg = <0>;
    spi-max-frequency = <40000000>;
    m25p,fast-read;
    };
    */
    };

    How did you assign the corresponding spi0 pins? How did you actually enable the SPI0 ? Your dts node should look something like:
    &spi0 {
    + status = "okay";
    + pinctrl-names = "default";
    + pinctrl-0 = <&spi0_pins>;
    gpiom1: gpiom1@1 {
    compatible = "mcp,mcp23s18";
    #gpio-cells = <2>;
    gpio-controller;
    reg = <1>;
    microchip,spi-present-mask = <1>;
    spi-max-frequency = <1000000>;
    #interrupt-cells = <2>;
    };
    /*
    nvram: nvram {
    address-cells = <1>;
    #size-cells = <1>;
    compatible = "spansion,mr25h10"; //may need to change spansion.
    reg = <0>;
    spi-max-frequency = <40000000>;
    m25p,fast-read;
    };
    */
    };

    Best Regards,
    Yordan
  • Also can you show your bootlog (dmesg)? Do you see anything related to the MCP23S18?

    Best Regards,
    Yordan
  • Hi Yordan, 

    Yes I have it in a separate .dtsi file along with the pinmux data.

    In .dtsi file:

    &am33xx_pinmux {
    pinctrl-names = "default";

    spi0_pins: pinmux_spi0_pins {
    pinctrl-single,pins = <
    AM33XX_IOPAD(0x150, PIN_OUTPUT | MUX_MODE0 ) // (A18) spi0_sclk.spi0_sclk
    AM33XX_IOPAD(0x154, PIN_INPUT | MUX_MODE0 ) // (B18) spi0_d0.spi0_d0
    AM33XX_IOPAD(0x158, PIN_OUTPUT | MUX_MODE0 ) // (B17) spi0_d1.spi0_d1
    AM33XX_IOPAD(0x15c, PIN_OUTPUT_PULLUP | MUX_MODE0 ) // (A17) spi0_cs0.spi0_cs0
    AM33XX_IOPAD(0x160, PIN_OUTPUT_PULLUP | MUX_MODE0 ) // (B16) spi0_cs1.spi0_cs1
    >;
    };

    };

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

    and in the .dts file:


    &spi0 {
    gpiom1: gpiom1@1 {
    compatible = "mcp,mcp23s18";
    #gpio-cells = <2>;
    gpio-controller;
    reg = <1>;
    microchip,spi-present-mask = <1>;
    spi-max-frequency = <1000000>;
    #interrupt-cells = <2>;
    };
    /*
    nvram: nvram {
    address-cells = <1>;
    #size-cells = <1>;
    compatible = "spansion,mr25h10"; //may need to change spansion.
    reg = <0>;
    spi-max-frequency = <40000000>;
    m25p,fast-read;
    };
    */
    };

    I can see the spi bus under sys/class/spi_master/spi1/spi1.1 and I can access it with spidev so I think it's correct. 

    As for dmesg. If I re-enable it as a built in driver with the MCP23S08=y. Then the boot log is:


    Starting kernel ...
    [ 0.000000] Booting Linux on physical CPU 0x0
    [ 0.000000] Linux version 4.9.0-00013-g3dc39d9ca875-dirty (dave@UKN0101) (gcc version 7
    [ 0.000000] CPU: ARMv7 Processor [413fc082] revision 2 (ARMv7), cr=10c5387d
    [ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
    [ 0.000000] OF: fdt:Machine model: TI AM335x MKT DP48H
    [ 0.000000] cma: Reserved 24 MiB at 0x9e800000
    [ 0.000000] Memory policy: Data cache writeback
    [ 0.000000] CPU: All CPU(s) started in SVC mode.
    [ 0.000000] AM335X ES2.1 (neon)
    [ 0.000000] Built 1 zonelists in Zone order, mobility grouping on. Total pages: 129920
    [ 0.000000] Kernel command line: console=ttyO0,115200n8 root=PARTUUID=b6170066-02 rw rt
    [ 0.000000] PID hash table entries: 2048 (order: 1, 8192 bytes)
    [ 0.000000] Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
    [ 0.000000] Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
    [ 0.000000] Memory: 481592K/524288K available (8192K kernel code, 298K rwdata, 2492K r)
    [ 0.000000] Virtual kernel memory layout:
    [ 0.000000] vector : 0xffff0000 - 0xffff1000 ( 4 kB)
    [ 0.000000] fixmap : 0xffc00000 - 0xfff00000 (3072 kB)
    [ 0.000000] vmalloc : 0xe0800000 - 0xff800000 ( 496 MB)
    [ 0.000000] lowmem : 0xc0000000 - 0xe0000000 ( 512 MB)
    [ 0.000000] pkmap : 0xbfe00000 - 0xc0000000 ( 2 MB)
    [ 0.000000] modules : 0xbf000000 - 0xbfe00000 ( 14 MB)
    [ 0.000000] .text : 0xc0008000 - 0xc0900000 (9184 kB)
    [ 0.000000] .init : 0xc0c00000 - 0xc0d00000 (1024 kB)
    [ 0.000000] .data : 0xc0d00000 - 0xc0d4aa78 ( 299 kB)
    [ 0.000000] .bss : 0xc0d4c000 - 0xc0d8e658 ( 266 kB)
    [ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
    [ 0.000000] Preemptible hierarchical RCU implementation.
    [ 0.000000] Build-time adjustment of leaf fanout to 32.
    [ 0.000000] NR_IRQS:16 nr_irqs:16 16
    [ 0.000000] IRQ: Found an INTC at 0xfa200000 (revision 5.0) with 128 interrupts
    [ 0.000000] OMAP clockevent source: timer2 at 24000000 Hz
    [ 0.000019] sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 89478484971ns
    [ 0.000047] clocksource: timer1: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns:s
    [ 0.000062] OMAP clocksource: timer1 at 24000000 Hz
    [ 0.000556] clocksource_probe: no matching clocksources found
    [ 0.000781] Console: colour dummy device 80x30
    [ 0.000814] WARNING: Your 'console=ttyO0' has been replaced by 'ttyS0'
    [ 0.000823] This ensures that you still see kernel messages. Please
    [ 0.000832] update your kernel commandline.
    [ 0.000860] Calibrating delay loop... 548.86 BogoMIPS (lpj=2744320)
    [ 0.048868] pid_max: default: 32768 minimum: 301
    [ 0.049050] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
    [ 0.049065] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
    [ 0.050134] CPU: Testing write buffer coherency: ok
    [ 0.050612] Setting up static identity map for 0x80100000 - 0x80100058
    [ 0.053640] devtmpfs: initialized
    [ 0.067006] VFP support v0.3: implementor 41 architecture 3 part 30 variant c rev 3
    [ 0.067496] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_nss
    [ 0.070150] pinctrl core: initialized pinctrl subsystem
    [ 0.071812] NET: Registered protocol family 16
    [ 0.074551] DMA: preallocated 256 KiB pool for atomic coherent allocations
    [ 0.092915] omap_hwmod: debugss: _wait_target_disable failed
    [ 0.178852] cpuidle: using governor ladder
    [ 0.208837] cpuidle: using governor menu
    [ 0.217116] OMAP GPIO hardware version 0.1
    [ 0.236788] hw-breakpoint: debug architecture 0x4 unsupported.
    [ 0.280709] edma 49000000.edma: TI EDMA DMA engine driver
    [ 0.284218] vgaarb: loaded
    [ 0.284912] SCSI subsystem initialized
    [ 0.285303] usbcore: registered new interface driver usbfs
    [ 0.285403] usbcore: registered new interface driver hub
    [ 0.285535] usbcore: registered new device driver usb
    [ 0.286023] omap_i2c 44e0b000.i2c: could not find pctldev for node /ocp/l4_wkup@44c000e
    [ 0.286098] omap_i2c 4802a000.i2c: could not find pctldev for node /ocp/l4_wkup@44c000e
    [ 0.286225] media: Linux media interface: v0.10
    [ 0.286301] Linux video capture interface: v2.00
    [ 0.286361] pps_core: LinuxPPS API ver. 1 registered
    [ 0.286373] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giom>
    [ 0.286407] PTP clock support registered
    [ 0.286630] EDAC MC: Ver: 3.0.0
    [ 0.287825] omap-mailbox 480c8000.mailbox: omap mailbox rev 0x400
    [ 0.288230] Advanced Linux Sound Architecture Driver Initialized.
    [ 0.290015] clocksource: Switched to clocksource timer1
    [ 0.305014] NET: Registered protocol family 2
    [ 0.306082] TCP established hash table entries: 4096 (order: 2, 16384 bytes)
    [ 0.306160] TCP bind hash table entries: 4096 (order: 2, 16384 bytes)
    [ 0.306227] TCP: Hash tables configured (established 4096 bind 4096)
    [ 0.306321] UDP hash table entries: 256 (order: 0, 4096 bytes)
    [ 0.306349] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
    [ 0.306540] NET: Registered protocol family 1
    [ 0.307083] RPC: Registered named UNIX socket transport module.
    [ 0.307102] RPC: Registered udp transport module.
    [ 0.307112] RPC: Registered tcp transport module.
    [ 0.307121] RPC: Registered tcp NFSv4.1 backchannel transport module.
    [ 0.308308] hw perfevents: enabled with armv7_cortex_a8 PMU driver, 5 counters availabe
    [ 0.310743] futex hash table entries: 256 (order: -1, 3072 bytes)
    [ 0.311691] workingset: timestamp_bits=14 max_order=17 bucket_order=3
    [ 0.322966] squashfs: version 4.0 (2009/01/31) Phillip Lougher
    [ 0.324237] NFS: Registering the id_resolver key type
    [ 0.324296] Key type id_resolver registered
    [ 0.324308] Key type id_legacy registered
    [ 0.324373] ntfs: driver 2.1.32 [Flags: R/O].
    [ 0.326879] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 247)
    [ 0.326906] io scheduler noop registered
    [ 0.326917] io scheduler deadline registered
    [ 0.327127] io scheduler cfq registered (default)
    [ 0.328917] pinctrl-single 44e10800.pinmux: 142 pins at pa f9e10800 size 568
    [ 0.418628] Serial: 8250/16550 driver, 10 ports, IRQ sharing disabled
    [ 0.424354] 44e09000.serial: ttyS0 at MMIO 0x44e09000 (irq = 158, base_baud = 3000000)0
    [ 1.027773] console [ttyS0] enabled
    [ 1.032491] [drm] Initialized
    [ 1.046401] loop: module loaded
    [ 1.051620] pinctrl-single 44e10800.pinmux: mux offset out of range: 0xfffff950 (0x238)
    [ 1.059681] pinctrl-single 44e10800.pinmux: could not add functions for pinmux_spi0_pix
    [ 1.070389] spi device match success
    [ 1.073994] type4
    [ 1.075928] &spi->dev=ddbb5970
    [ 1.078992] !pdata
    [ 1.081074] !chips
    [ 1.084284] libphy: Fixed MDIO Bus: probed
    [ 1.090705] pinctrl-single 44e10800.pinmux: mux offset out of range: 0xfffff90c (0x238)
    [ 1.098763] pinctrl-single 44e10800.pinmux: could not add functions for cpsw_default 4x
    [ 1.107672] pinctrl-single 44e10800.pinmux: mux offset out of range: 0xfffff90c (0x238)
    [ 1.115742] pinctrl-single 44e10800.pinmux: could not add functions for cpsw_sleep 429x
    [ 1.190123] davinci_mdio 4a101000.mdio: davinci mdio revision 1.6
    [ 1.196269] davinci_mdio 4a101000.mdio: detected phy mask fffffffe
    [ 1.203673] libphy: 4a101000.mdio: probed
    [ 1.207729] davinci_mdio 4a101000.mdio: phy[0]: device 4a101000.mdio:00, driver SMSC L0
    [ 1.218004] cpsw 4a100000.ethernet: Detected MACID = a0:f6:fd:37:e7:94
    [ 1.226484] pegasus: v0.9.3 (2013/04/25), Pegasus/Pegasus II USB Ethernet driver
    [ 1.234230] usbcore: registered new interface driver pegasus
    [ 1.240097] usbcore: registered new interface driver asix
    [ 1.245594] usbcore: registered new interface driver ax88179_178a
    [ 1.251839] usbcore: registered new interface driver cdc_ether
    [ 1.257793] usbcore: registered new interface driver smsc75xx
    [ 1.263687] usbcore: registered new interface driver smsc95xx
    [ 1.269524] usbcore: registered new interface driver net1080
    [ 1.275300] usbcore: registered new interface driver cdc_subset
    [ 1.281336] usbcore: registered new interface driver zaurus
    [ 1.287050] usbcore: registered new interface driver cdc_ncm
    [ 1.293271] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
    [ 1.299835] ehci-pci: EHCI PCI platform driver
    [ 1.304426] ehci-platform: EHCI generic platform driver
    [ 1.309882] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
    [ 1.316327] ohci-pci: OHCI PCI platform driver
    [ 1.320924] ohci-platform: OHCI generic platform driver
    [ 1.326870] usbcore: registered new interface driver usb-storage
    [ 1.333546] mousedev: PS/2 mouse device common for all mice
    [ 1.339947] i2c /dev entries driver
    [ 1.346034] sdhci: Secure Digital Host Controller Interface driver
    [ 1.352385] sdhci: Copyright(c) Pierre Ossman
    [ 1.357136] pinctrl-single 44e10800.pinmux: mux offset out of range: 0xfffff900 (0x238)
    [ 1.365269] pinctrl-single 44e10800.pinmux: could not add functions for pinmux_emmc_pix
    [ 1.430319] Synopsys Designware Multimedia Card Interface Driver
    [ 1.440090] sdhci-pltfm: SDHCI platform and OF driver helper
    [ 1.446572] ledtrig-cpu: registered to indicate activity on CPUs
    [ 1.453096] usbcore: registered new interface driver usbhid
    [ 1.458725] usbhid: USB HID core driver
    [ 1.468400] NET: Registered protocol family 10
    [ 1.474861] sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver
    [ 1.482224] NET: Registered protocol family 17
    [ 1.487042] Key type dns_resolver registered
    [ 1.491761] omap_voltage_late_init: Voltage driver support not added
    [ 1.498428] ThumbEE CPU extension supported.
    [ 1.502822] Registering SWP/SWPB emulation handler
    [ 1.518121] mmc0: host does not support reading read-only switch, assuming write-enable
    [ 1.532281] mmc0: new high speed SDHC card at address e624
    [ 1.538679] mmcblk0: mmc0:e624 SL32G 29.7 GiB
    [ 1.549089] random: fast init done
    [ 1.552926] mmcblk0: p1 p2
    [ 1.559173] tps65217 0-0024: TPS65217 ID 0x7 version 1.2
    [ 1.566630] omap_i2c 44e0b000.i2c: bus 0 rev0.11 at 400 kHz
    [ 1.574697] omap_i2c 4802a000.i2c: bus 1 rev0.11 at 400 kHz
    [ 1.581933] core: _opp_supported_by_regulators: OPP minuV: 1259300 maxuV: 1310700, notr
    [ 1.592021] cpu cpu0: _opp_add: OPP not supported by regulators (720000000)
    [ 1.599271] core: _opp_supported_by_regulators: OPP minuV: 1200500 maxuV: 1249500, notr
    [ 1.609297] cpu cpu0: _opp_add: OPP not supported by regulators (600000000)
    [ 1.616862] cpufreq: cpufreq_online: CPU0: Running at unlisted freq: 550000 KHz
    [ 1.624284] cpu cpu0: dev_pm_opp_set_rate: failed to find current OPP for freq 5500000)
    [ 1.633274] cpufreq: cpufreq_online: CPU0: Unlisted initial frequency changed to: 5000z
    [ 1.643372] ALSA device list:
    [ 1.646377] No soundcards found.
    [ 1.726471] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (nul)
    [ 1.734797] VFS: Mounted root (ext4 filesystem) on device 179:2.
    [ 1.748556] devtmpfs: mounted
    [ 1.754268] Freeing unused kernel memory: 1024K (c0c00000 - c0d00000)
    [ 2.130886] systemd[1]: System time before build time, advancing clock.
    [ 2.243099] systemd[1]: systemd 230 running in system mode. (+PAM -AUDIT -SELINUX +IMA)
    [ 2.262750] systemd[1]: Detected architecture arm.
    Welcome to Arago 2017.05!
    [ 2.304989] systemd[1]: Set hostname to <am335x-evm>.
    [ 2.667142] systemd[1]: [/lib/systemd/system/gadget-init.service:15] Unknown lvalue 'E'
    [ 3.032621] systemd[1]: sysinit.target: Found ordering cycle on sysinit.target/start
    [ 3.040658] systemd[1]: sysinit.target: Found dependency on alignment.service/start
    [ 3.048406] systemd[1]: sysinit.target: Found dependency on basic.target/start
    [ 3.055804] systemd[1]: sysinit.target: Found dependency on sockets.target/start
    [ 3.063300] systemd[1]: sysinit.target: Found dependency on dropbear.socket/stop
    [ 3.070780] systemd[1]: sysinit.target: Found dependency on sysinit.target/start
    [ SKIP ] Ordering cycle found, skipping alignment.service
    [ OK ] Listening on udev Control Socket.
    [ OK ] Listening on Network Service Netlink Socket.
    [ OK ] Listening on Syslog Socket.
    [ OK ] Listening on Journal Socket.
    [ OK ] Reached target Remote File Systems.
    [ OK ] Listening on Journal Socket (/dev/log).
    [ OK ] Started Forward Password Requests to Wall Directory Watch.
    [ OK ] Reached target Swap.
    [ OK ] Listening on /dev/initctl Compatibility Named Pipe.
    [ OK ] Listening on udev Kernel Socket.
    [ OK ] Created slice System Slice.
    [ OK ] Created slice system-getty.slice.
    Starting Setup Virtual Console...
    Mounting POSIX Message Queue File System...
    Mounting Debug File System...
    Mounting Temporary Directory...
    [ OK ] Created slice User and Session Slice.
    [ OK ] Reached target Slices.
    [ OK ] Started Dispatch Password Requests to Console Directory Watch.
    [ OK ] Reached target Paths.
    Starting Journal Service...
    Starting Load Kernel Modules...
    Starting Remount Root and Kernel File Systems...
    [ OK ] Created slice system-serial\x2dgetty.slice.
    [ 3.978810] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
    Starting Create Static Device Nodes in /dev...
    [ OK ] Mounted Debug File System.
    [ OK ] Mounted POSIX Message Queue File System.
    [ OK ] Mounted Temporary Directory.
    [ OK ] Started Journal Service.
    [ OK ] Started Setup Virtual Console.
    [FAILED] Failed to start Load Kernel Modules.
    See 'systemctl status systemd-modules-load.service' for details.
    [ OK ] Started Remount Root and Kernel File Systems.
    [ OK ] Started Create Static Device Nodes in /dev.
    Starting udev Kernel Device Manager...
    [ OK ] Reached target Local File Systems (Pre).
    Mounting /var/volatile...
    Mounting /media/ram...
    Starting udev Coldplug all Devices...
    Starting Apply Kernel Variables...
    Starting Flush Journal to Persistent Storage...
    [ OK ] Mounted /var/volatile.
    [ OK ] Mounted /media/ram.
    [ OK ] Started Apply Kernel Variables.
    [ OK ] Started udev Kernel Device Manager.
    [ 4.992567] systemd-journald[72]: Received request to flush runtime journal from PID 1
    [ OK ] Reached target Local File Systems.
    Starting Load/Save Random Seed...
    [ OK ] Started Flush Journal to Persistent Storage.
    [ OK ] Started Load/Save Random Seed.
    Starting Create Volatile Files and Directories...
    [ OK ] Started Create Volatile Files and Directories.
    Starting Network Time Synchronization...
    Starting Update UTMP about System Boot/Shutdown...
    [ OK ] Started Update UTMP about System Boot/Shutdown.
    [ OK ] Started Network Time Synchronization.
    [ OK ] Reached target System Time Synchronized.
    Starting Synchronize System and HW clocks...
    [FAILED] Failed to start Synchronize System and HW clocks.
    See 'systemctl status sync-clocks.service' for details.
    [ OK ] Found device /dev/ttyS0.
    [ OK ] Started udev Coldplug all Devices.
    [ OK ] Reached target System Initialization.
    [ OK ] Started Daily Cleanup of Temporary Directories.
    [ OK ] Reached target Timers.
    [ OK ] Listening on Avahi mDNS/DNS-SD Stack Activation Socket.
    [ OK ] Listening on D-Bus System Message Bus Socket.
    [ OK ] Listening on RPCbind Server Activation Socket.
    [ OK ] Listening on dropbear.socket.
    [ OK ] Reached target Sockets.
    [ OK ] Reached target Basic System.
    Starting Print notice about GPLv3 packages...
    [ OK ] Started System Logging Service.
    Starting Avahi mDNS/DNS-SD Stack...
    [ OK ] Started Kernel Logging Service.
    [ OK ] Started D-Bus System Message Bus.
    [ OK ] Started Avahi mDNS/DNS-SD Stack.
    Starting Network Service...
    Starting Login Service...
    Starting uim-sysfs.service...
    Starting Telephony service...
    [ OK ] Found device /dev/ttyS3.
    [ OK ] Started Network Service.
    [ 11.900873] net eth0: initializing cpsw version 1.12 (0)
    [ 12.030903] SMSC LAN8710/LAN8720 4a101000.mdio:00: attached PHY driver [SMSC LAN8710/L)
    [ 12.274627] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
    [ OK ] Started Telephony service.
    [ OK ] Listening on Load/Save RF Kill Switch Status /dev/rfkill Watch.
    [ OK ] Reached target Network.
    Starting Network Name Resolution...
    Starting Permit User Sessions...
    [ OK ] Started strongSwan IPsec IKEv1/IKEv2 daemon using ipsec.conf.
    Starting Enable and configure wl18xx bluetooth stack...
    Starting Simple Network Management Protocol (SNMP) Daemon....
    Starting Lightning Fast Webserver With Light System Requirements...
    [ OK ] Started Permit User Sessions.
    [ OK ] Started Login Service.
    [ OK ] Started Getty on tty1.
    [ OK ] Started Serial Getty on ttyS3.
    [ 13.866418] FAT-fs (mmcblk0p1): Volume was not properly unmounted. Some data may be co.
    [ OK ] Started Serial Getty on ttyS0.
    [ 14.240977] cpsw 4a100000.ethernet eth0: Link is Up - 100Mbps/Full - flow control rx/tx
    [ 14.307362] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
    [ OK ] Started Network Name Resolution.
    [ OK ] Started Enable and configure wl18xx bluetooth stack.
    [ OK ] Started Lightning Fast Webserver With Light System Requirements.
    [ OK ] Found device /dev/mmcblk0p1.
    [ OK ] Started Simple Network Management Protocol (SNMP) Daemon..
    [ 19.901808] random: crng init done

    I can't see anything to do with the mcp23s18. The driver is definitely being built. I can see output files in the driver directory and there used to be a warning in the bootlog when the spi-present-mask wrong. 

  • Hi Yordan, 

    I have made some progress with this. If I change 

    compatible = "mcp,mcp23s18";

    to

    compatible = "mcp,mcp23s17";

    then the driver recognises the device and I can see the device in dev and in sys/class/gpio/gpiochip496. 

    What is interesting is that with "mcp,mcp23s18", the driver doesn't even try and connect with the physical device. It's as if the driver thinks that the mcp23s18 isn't a valid part, when it clearly is defined in the driver:

    static const struct spi_device_id mcp23s08_ids[] = {
    { "mcp23s08", MCP_TYPE_S08 },
    { "mcp23s17", MCP_TYPE_S17 },
    { "mcp23s18", MCP_TYPE_S18 },
    { },
    };

    It doesn't look as if there is any difference in driver operation for mcp23s18 and mcp23s17 so either the driver will function correctly with the mcp23s18 or the driver has never been tested with the mcp23s18. i will update the thread with my findings when I get there .....

    Thanks for your help.

  • Hi,

    Sorry for the delay. I was OoO.
    The driver should work correctly for mcp23s18. I am not sure why kernel won't recognize .compatible = "microchip,mcp23s18".
    Anyway, please post the result of using compatible = "mcp,mcp23s17";

    Best Regards,
    Yordan