Open bm16ton opened 2 years ago
I haven't looked at this in 10 months so I don't know if it still works with the latest kernel. I don't know when I can get the time to look at it. Sorry.
I found a folder with some notes and put it into a wiki page: Device Tree I don't know if it will be of any help, but at least I know where my notes are now :-)
ha! no problems good, Someone at my level really shouldnt be pesturing those so far above us anyway, i just get excited and forget myself. Again thank you for this project and all the others i use. Been having fun trying to get gud ported up to my stm32f4 and boy the excitement i got with the blury wrong colored picture on my tft is what we live for! Thank you!
On Sun, 30 Oct 2022, 4:11 pm Noralf Trønnes, @.***> wrote:
I haven't looked at this in 10 months so I don't know if it still works with the latest kernel. I don't know when I can get the time to look at it. Sorry.
I found a folder with some notes and put it into a wiki page: Device Tree https://github.com/notro/pico-usb-io-board/wiki/Device-Tree I don't know if it will be of any help, but at least I know where my notes are now :-)
— Reply to this email directly, view it on GitHub https://github.com/notro/pico-usb-io-board/issues/1#issuecomment-1296340939, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADAWMPZ45UMBIPVQLABDPR3WF3B5JANCNFSM6AAAAAARMRFSG4 . You are receiving this because you authored the thread.Message ID: @.***>
Just a quick update the spi now works fine on the more recent kernels ive tried (Sorry was a gap in kernel versions between when i set it down and forgot about it and remembered to try it again) Kernel devs are my heros but i assume they want some nonsense way to pass board info/platform data. They probly expect edited acpi tables or similiar. But I simply added board- info struct and module parameter for changing the modalias. This works as expected. I have a couple usb-spi/i2c devices/firmwares now i really need to comeup with a goodway to pass platform data on the fly.. Well again this is an amazing project like most/all of yours. Stay talented my friend!
Hi,
Thank you for this great project. I'm currently using a Raspberry Pi 4 with a new kernel (6.1.50). When I plug in the Pico IO board, I can see that Linux detects the DLN2 device.
However, I'm encountering two issues:
SPI: I've attempted to configure the device tree overlay without success. My Linux system doesn't create /dev/spidevX.X.
GPIO: The 'gpioset' command doesn't seem to work for setting a particular line. I can successfully execute 'gpioset dln2 25=1' (green led), but when I try to use another line, it doesn't have any effect on setting that line. I always read it as 0.
Please let me know if you have any insights or solutions for these problems.
Thanks !!
ha I haven't tried it in a while, switched to a homebrew stm32h7 option but. if spidev is all you need then a simple few lines in the kernel driver could load/setup that. When I get home today ill post one here for yeah. I have the latest kernel installed already so ill throw a pico-usb-io-board on my pc check the gpio and an spidev patch. Device tree stuff (for me anyway) seems to either fall into super easy or very ruff, seldom if ever in the middle ground. I have done some work towards usb spi/gpio/i2c devicetree easing. I added a new root device overlay and had it build inside the kernel module and autoload/setup on enumeration. It all seemed good, with handles and all, but never got around to figuring out the next overlays needed. If your interested ill post it on my github and send a link. Yeah what Notro did here is truely breath taking. He actually made his so good in fact that he found issues in the kernel driver for the real dln2 and submitted the patches. Mind blown.
On Mon, Sep 4, 2023, 8:55 AM Isaac Maia Pessoa @.***> wrote:
Hi,
Thank you for this great project. I'm currently using a Raspberry Pi 4 with a new kernel (6.1.50). When I plug in the Pico IO board, I can see that Linux detects the DLN2 device.
However, I'm encountering two issues:
SPI: I've attempted to configure the device tree overlay without success. My Linux system doesn't create /dev/spidevX.X.
GPIO: The 'gpioset' command doesn't seem to work for setting a particular line. I can successfully execute 'gpioset dln2 25=1' (green led), but when I try to use another line, it doesn't have any effect on setting that line. I always read it as 0.
Please let me know if you have any insights or solutions for these problems.
Thanks !!
— Reply to this email directly, view it on GitHub https://github.com/notro/pico-usb-io-board/issues/1#issuecomment-1705226881, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADAWMP7GRWK3PNJBXXX3QLLXYXFU3ANCNFSM6AAAAAARMRFSG4 . You are receiving this because you authored the thread.Message ID: @.***>
Thank you for the quick response. I'm very interested in your post because I'm working on a project, and having SPI functionality with all the components would be extremely useful. Regarding the GPIOs that are never set(ex. gpioset dln2 22=1 has no effect), do you have any idea why?
I don't I'm actually looking forward to checking that! Will hopefully be home soonish..So just double checking you just need spidev? no specific platform data or whatnot? If so well get yeah going quick...if you do need platform data its a much mucb longer darker road lol.
On Mon, Sep 4, 2023, 3:20 PM Isaac Maia Pessoa @.***> wrote:
Thank you for the quick response. I'm very interested in your post because I'm working on a project, and having SPI functionality with all the components would be extremely useful. Regarding the GPIOs that are never set(ex. gpioset dln2 22=1 has no effect), do you have any idea why?
— Reply to this email directly, view it on GitHub https://github.com/notro/pico-usb-io-board/issues/1#issuecomment-1705637172, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADAWMP534EQRU223OXHDDNTXYYSXLANCNFSM6AAAAAARMRFSG4 . You are receiving this because you authored the thread.Message ID: @.***>
just spidev will be enough. Thanks a lot!
ok so finished the tiny patch rebooted, gpios work fine with old ver 1 method using sysfs files, for some reason at least gpioset is broken but gpiohammer works just fine...it'll take further investigation. But the gpios do work with old and new jhst gpioset, oh crap I think I may know just came to me..25is led and preset output that's probly why gpioset could use it not the others cuz it for sum reason switch it to output. anywho having issues finding female2female cables to hookup spi flash and test but ill send the patch now..gotta switch to pc just a sec
On Mon, Sep 4, 2023, 3:31 PM Isaac Maia Pessoa @.***> wrote:
just spidev will be enough. Thanks a lot!
— Reply to this email directly, view it on GitHub https://github.com/notro/pico-usb-io-board/issues/1#issuecomment-1705644275, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADAWMP264WBFDG3NLQXGYXTXYYUAVANCNFSM6AAAAAARMRFSG4 . You are receiving this because you authored the thread.Message ID: @.***>
ok here it is
diff --git a/drivers/spi/spi-dln2.c b/drivers/spi/spi-dln2.c index d319dc357fef..c706199b116c 100644 --- a/drivers/spi/spi-dln2.c +++ b/drivers/spi/spi-dln2.c @@ -77,9 +77,16 @@
+static char *name; +module_param(name, charp, 0000); +MODULE_PARM_DESC(name,
struct dln2_spi { struct platform_device pdev; struct spi_controller host;
struct spi_board_info spiinfo; u8 port;
/ @@ -766,7 +773,20 @@ static int dln2_spi_probe(struct platform_device pdev) dev_err(&pdev->dev, "Failed to register host\n"); goto exit_register; }
dln2->spidev = spi_new_device(dln2->host, &dln2->spiinfo); return ret;
exit_register:
This will simply autoload and create spidev in /dev, or if you want to use a different spi driver that doesnt need platform data it adds a module param so run "sudo modprobe spi-dln2 name:somedriver" before plugging the pico in. The spi flash driver works great like this I left the line commented in case you wanted to switch the default driver. Damn these cables hundreds of them and never the ones I need to be found anywhere.
On Mon, Sep 4, 2023 at 5:04 PM benjamin maddocks @.***> wrote:
ok so finished the tiny patch rebooted, gpios work fine with old ver 1 method using sysfs files, for some reason at least gpioset is broken but gpiohammer works just fine...it'll take further investigation. But the gpios do work with old and new jhst gpioset, oh crap I think I may know just came to me..25is led and preset output that's probly why gpioset could use it not the others cuz it for sum reason switch it to output. anywho having issues finding female2female cables to hookup spi flash and test but ill send the patch now..gotta switch to pc just a sec
On Mon, Sep 4, 2023, 3:31 PM Isaac Maia Pessoa @.***> wrote:
just spidev will be enough. Thanks a lot!
— Reply to this email directly, view it on GitHub https://github.com/notro/pico-usb-io-board/issues/1#issuecomment-1705644275, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADAWMP264WBFDG3NLQXGYXTXYYUAVANCNFSM6AAAAAARMRFSG4 . You are receiving this because you authored the thread.Message ID: @.***>
crap forgot to mention if you get a compile error about the word "host" switch it to "master" just means your running a slightly older kernel. Also have i2c/spi/gpio drivers for ftdi mpsse with much faster usb links, and a working but kinda crappy way of adding platform data. Also have them for the stm32h7.
On Mon, Sep 4, 2023 at 5:10 PM benjamin maddocks @.***> wrote:
ok here it is
diff --git a/drivers/spi/spi-dln2.c b/drivers/spi/spi-dln2.c index d319dc357fef..c706199b116c 100644 --- a/drivers/spi/spi-dln2.c +++ b/drivers/spi/spi-dln2.c @@ -77,9 +77,16 @@
define DLN2_TRANSFERS_CANCEL 0
define DLN2_RPM_AUTOSUSPEND_TIMEOUT 2000
+static char *name; +module_param(name, charp, 0000); +MODULE_PARM_DESC(name,
- "Devicename modalias");
struct dln2_spi { struct platform_device pdev; struct spi_controller host;
- struct spi_device *spidev;
struct spi_board_info spiinfo; u8 port;
/ @@ -766,7 +773,20 @@ static int dln2_spi_probe(struct platform_device pdev) dev_err(&pdev->dev, "Failed to register host\n"); goto exit_register; }
- if (name) {
- strcpy(dln2->spiinfo.modalias, name);
- } else { +// strcpy(dln2->spiinfo.modalias, "w25q32");
- strcpy(dln2->spiinfo.modalias, "spi-petra");
- }
- dln2->spiinfo.max_speed_hz = 40000000;
- dln2->spiinfo.chip_select = 0;
- dln2->spiinfo.mode = SPI_MODE_0;
- dln2->spiinfo.controller_data = dln2;
dln2->spidev = spi_new_device(dln2->host, &dln2->spiinfo); return ret;
exit_register:
This will simply autoload and create spidev in /dev, or if you want to use a different spi driver that doesnt need platform data it adds a module param so run "sudo modprobe spi-dln2 name:somedriver" before plugging the pico in. The spi flash driver works great like this I left the line commented in case you wanted to switch the default driver. Damn these cables hundreds of them and never the ones I need to be found anywhere.
On Mon, Sep 4, 2023 at 5:04 PM benjamin maddocks @.***> wrote:
ok so finished the tiny patch rebooted, gpios work fine with old ver 1 method using sysfs files, for some reason at least gpioset is broken but gpiohammer works just fine...it'll take further investigation. But the gpios do work with old and new jhst gpioset, oh crap I think I may know just came to me..25is led and preset output that's probly why gpioset could use it not the others cuz it for sum reason switch it to output. anywho having issues finding female2female cables to hookup spi flash and test but ill send the patch now..gotta switch to pc just a sec
On Mon, Sep 4, 2023, 3:31 PM Isaac Maia Pessoa @.***> wrote:
just spidev will be enough. Thanks a lot!
— Reply to this email directly, view it on GitHub https://github.com/notro/pico-usb-io-board/issues/1#issuecomment-1705644275, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADAWMP264WBFDG3NLQXGYXTXYYUAVANCNFSM6AAAAAARMRFSG4 . You are receiving this because you authored the thread.Message ID: @.***>
Great! I'll try it! Thanks !
Hello, god i love and use all your projects! Simply amazing thank you! So i assumed i would have to add a device tree section for the spi mode to work but plugged it in anyway to see. It gave a couldnt shutdown or turn off spi controller error (cant remember the exact warning) and depending if it needed platform data to perform that task that maybe the expected outcome...(it gave that error first half dozen times now its, failed to enable spi module, dunno why the change)Can you confirm? Im very very green at programming but have been gaining a little experience with usb to spi/i2c/gpio devices and kernel drivers(nice to see a new example). i have a working usb to i2c (uses tiny-usb driver) and gpio with irq (my kernel drivers) on stm32f1/f4 but havent tackled spi except with ftdi mpsse devices. Ive found the official device tree method cumbersome, time consuming and irritating. Ive come to prefer a platform driver passing the required platform info and init method. I was wondering if you have been using the device tree etc? Very interested in what/how someone as talented as yourself goes about it. Ill be tackling adding the spi platform data via sysfs for "on the fly enumeration" on mpsse driver soon but havent flushed out what methadology to use yet. I may use this firmware and a new platform/edit mfd, as a second testbed as well. Again thank you!