https://redmine.replicant.us/https://redmine.replicant.us/favicon.ico?15984615062021-01-09T00:42:22ZReplicantReplicant - Feature #2206: Note 2 LTE modem on mainline kernelhttps://redmine.replicant.us/issues/2206?journal_id=85152021-01-09T00:42:22ZJoey Hewitt
<ul></ul><p>P.S. Credit to <a class="external" href="https://github.com/fourkbomb/linux/tree/modem">https://github.com/fourkbomb/linux/tree/modem</a> for the HSIC devicetree code.</p> Replicant - Feature #2206: Note 2 LTE modem on mainline kernelhttps://redmine.replicant.us/issues/2206?journal_id=85412021-01-24T16:53:51ZKurtis HannaKurtis@riseup.net
<ul></ul><p>Denis is doing some upstream modem work in this repo that continues on the work forkbomb was doing at the link above: <a class="external" href="https://git.replicant.us/contrib/GNUtoo/kernel_replicant_linux/log/?h=replicant-11-i9300-modem">https://git.replicant.us/contrib/GNUtoo/kernel_replicant_linux/log/?h=replicant-11-i9300-modem</a></p> Replicant - Feature #2206: Note 2 LTE modem on mainline kernelhttps://redmine.replicant.us/issues/2206?journal_id=90142021-03-26T20:59:08Z_I3^ RELATIVISM
<ul><li><strong>Type of work</strong> <i>C programming</i> added</li></ul> Replicant - Feature #2206: Note 2 LTE modem on mainline kernelhttps://redmine.replicant.us/issues/2206?journal_id=93572022-06-09T22:06:46ZJack K
<ul></ul><p>Joey Hewitt wrote:</p>
<blockquote>
<p>I'll track work on LTE modems on mainline kernel. The attached patch goes in the kernel. Build and install <a class="external" href="https://github.com/technexion-android/platform_external_libgpiod">https://github.com/technexion-android/platform_external_libgpiod</a>, then run the following script:</p>
<p>[...]</p>
<p>The modem should now appear in lsusb, in QDL mode. I am trying to figure out how to boot it. I'm using <a class="external" href="https://git.replicant.us/contrib/scintill/external_modem-boot/">https://git.replicant.us/contrib/scintill/external_modem-boot/</a> with some obsolete pieces stripped out, but now the modem sends a non-existent command 0. I don't know why, but some guesses are that the HSIC is buggy in this kernel, or the old kernel does something I don't know about to get the modem in the right state.</p>
</blockquote>
<p>Hi Joey - have you done any more work? I am interested in getting LTE up and running, and would appreciate liaising with you over this - are you on IRC at all?</p>
<p>Many thanks,</p>
<p>Jack K</p> Replicant - Feature #2206: Note 2 LTE modem on mainline kernelhttps://redmine.replicant.us/issues/2206?journal_id=93592022-06-22T13:19:37ZJack K
<ul></ul><p>I added a couple of USB IDs from smdk4412 kernel in qcserial driver:</p>
<pre>
diff --git a/drivers/usb/serial/qcserial.c b/drivers/usb/serial/qcserial.c
index c18bf8164bc2..e20443289df6 100644
--- a/drivers/usb/serial/qcserial.c
+++ b/drivers/usb/serial/qcserial.c
@@ -116,6 +116,8 @@ static const struct usb_device_id id_table[] = {
{USB_DEVICE(0x03f0, 0x371d)}, /* HP un2430 Gobi 3000 QDL */
{USB_DEVICE(0x05c6, 0x920c)}, /* Gobi 3000 QDL */
{USB_DEVICE(0x05c6, 0x920d)}, /* Gobi 3000 Composite */
+ {USB_DEVICE(0x05c6, 0x9048)}, /* MDM9x15 device */
+ {USB_DEVICE(0x05c6, 0x904C)}, /* MDM9x15 device */
{USB_DEVICE(0x1410, 0xa020)}, /* Novatel Gobi 3000 QDL */
{USB_DEVICE(0x1410, 0xa021)}, /* Novatel Gobi 3000 Composite */
{USB_DEVICE(0x413c, 0x8193)}, /* Dell Gobi 3000 QDL */
</pre>
<p>And got this in dmesg:</p>
<pre>
[ 82.194645] qcserial 1-2:1.0: Qualcomm USB modem converter detected
[ 82.194939] usb 1-2: Qualcomm USB modem converter now attached to ttyUSB0
</pre>
<p>I think this might be a step in the right direction.</p> Replicant - Feature #2206: Note 2 LTE modem on mainline kernelhttps://redmine.replicant.us/issues/2206?journal_id=93912023-12-01T19:22:38ZJosh Branninglovell.joshyyy@gmail.com
<ul></ul><p>I can confirm I was able to get the modem showing with lsusb and dmesg using the patches provided.</p>
<p>Thank you everyone.</p>
<p>I was, however, unable to 'list' the modem using postmarketos on the device (which was an i9305 with the same modem, not the note), be it either using ofono or network manager. Perhaps I need modem boot code?</p>
<p>Either way I reproduced the results, see here:</p>
<p><a class="external" href="https://github.com/publicsite/i9305-modem-postmarketos">https://github.com/publicsite/i9305-modem-postmarketos</a></p> Replicant - Feature #2206: Note 2 LTE modem on mainline kernelhttps://redmine.replicant.us/issues/2206?journal_id=93922023-12-02T17:53:29ZJosh Branninglovell.joshyyy@gmail.com
<ul></ul><p>Josh Branning wrote in <a href="#note-6">#note-6</a>:</p>
<blockquote>
<p>I can confirm I was able to get the modem showing with lsusb and dmesg using the patches provided.</p>
<p>Thank you everyone.</p>
<p>I was, however, unable to 'list' the modem using postmarketos on the device (which was an i9305 with the same modem, not the note), be it either using ofono or network manager. Perhaps I need modem boot code?</p>
<p>Either way I reproduced the results, see here:</p>
<p><a class="external" href="https://github.com/publicsite/i9305-modem-postmarketos">https://github.com/publicsite/i9305-modem-postmarketos</a></p>
</blockquote>
<p>I since addded external_modem-boot package to the repository.</p>
<p>Despite the modem showing with lsusb and dmesg, when I run "mdm9k-boot" command, I get:</p>
<p>failed to open modem device</p>
<p>Looking at the external_modem_boot code it seems it requires /dev/mdm and /dev/ttyUSB0 nodes which aren't present (ie. with these patches).</p> Replicant - Feature #2206: Note 2 LTE modem on mainline kernelhttps://redmine.replicant.us/issues/2206?journal_id=93932023-12-02T19:37:09ZJosh Branninglovell.joshyyy@gmail.com
<ul></ul><p>I tried adding the following udev rules to /etc/udev/rules.d/90-mdm9k-modem.rules</p>
<p>ACTION=="add", KERNEL=="mdm", OWNER="root", GROUP="root", MODE="0660" <br />ACTION=="add", KERNEL=="ttyUSB0", OWNER="root", GROUP="root", MODE="0660"</p>
<p>but it didn't make a difference: I was still <strong>unable</strong> to see a node at /dev/mdm</p> Replicant - Feature #2206: Note 2 LTE modem on mainline kernelhttps://redmine.replicant.us/issues/2206?journal_id=93942023-12-09T17:05:06ZJosh Branninglovell.joshyyy@gmail.com
<ul></ul><p>Josh Branning wrote in <a href="#note-8">#note-8</a>:</p>
<blockquote>
<p>I tried adding the following udev rules to /etc/udev/rules.d/90-mdm9k-modem.rules</p>
<p>ACTION=="add", KERNEL=="mdm", OWNER="root", GROUP="root", MODE="0660" <br />ACTION=="add", KERNEL=="ttyUSB0", OWNER="root", GROUP="root", MODE="0660"</p>
<p>but it didn't make a difference: I was still <strong>unable</strong> to see a node at /dev/mdm</p>
</blockquote>
<p>I made an external_modem-boot package for pmos. I found out that because of a patch to external_modem-boot, I might be able to do without a /dev/mdm node by setting CFLAGS="-DSKIP_MDM_DEVICE_IOCTL=1" whilst compiling this package.</p>
<p>I noticed that the pins in the patch that Joey provided are for the t0 only, so I looked in the smdk4412 kernel and created this table for the devices with the pins. <a class="external" href="https://raw.githubusercontent.com/publicsite/i9305-modem-postmarketos/main/doc/porting-matrix.txt">https://raw.githubusercontent.com/publicsite/i9305-modem-postmarketos/main/doc/porting-matrix.txt</a></p>
<p>I then created some modem dtbs <a class="external" href="https://github.com/publicsite/i9305-modem-postmarketos/tree/main/mainline-patches/modem_configs">https://github.com/publicsite/i9305-modem-postmarketos/tree/main/mainline-patches/modem_configs</a></p>
<p>After testing the modified i9305 dtb, I was still unable to get the gpio set to work, although the pins looked as if they were correctly shown at /sys/firmware/devicetree/base/soc/pinctrl@*</p>
<p>I believe it is possible because libgpiod in alpine linux is old and the package hasn't been updated recently, and pmos inherits the libgpiod package from alpine.</p>
<p>I am yet to test with an updated version of libgpiod to see if I can get a /dev/ttyUSB0 node by running gpioset and then boot the modem with external_modem-boot but I have updated the repository (<a class="external" href="https://github.com/publicsite/i9305-modem-postmarketos">https://github.com/publicsite/i9305-modem-postmarketos</a>) in the mean time.</p> Replicant - Feature #2206: Note 2 LTE modem on mainline kernelhttps://redmine.replicant.us/issues/2206?journal_id=93952023-12-17T21:42:35ZJosh Branninglovell.joshyyy@gmail.com
<ul></ul><p>I updated a libgpiod package to v2.1 within the i9305-modem-postmarketos repository. Unfortunately I can't get gpioset to go.</p>
<blockquote>
<p>#using libgpiod v2.1...<br />$ gpioset gpl2 5=1<br />gpioset: invalid line value: 'gpl2'</p>
<p>#looking at gpioinfo I see that 'gpl2' corresponds to gpiochip19<br />$ gpioset gpiochip19 5=1<br />gpioset: invalid line value: 'gpiochip19'</p>
<p>#I try prefixing with /dev/<br />$ gpioset /dev/gpiochip19 5=1<br />gpioset: invalid line value: '/dev/gpiochip19'</p>
<p>#I try just the number<br />$ gpioset 19 5=1<br />gpioset: invalid line value: '/dev/gpiochip19'</p>
</blockquote>
<p>EDIT: RESULT IS THE SAME USING SUDO</p> Replicant - Feature #2206: Note 2 LTE modem on mainline kernelhttps://redmine.replicant.us/issues/2206?journal_id=93962023-12-20T10:32:18ZJosh Branninglovell.joshyyy@gmail.com
<ul></ul><p>Josh Branning wrote in <a href="#note-10">#note-10</a>:</p>
<blockquote>
<p>I updated a libgpiod package to v2.1 within the i9305-modem-postmarketos repository. Unfortunately I can't get gpioset to go.</p>
<blockquote>
<p>#using libgpiod v2.1...<br />$ gpioset gpl2 5=1<br />gpioset: invalid line value: 'gpl2'</p>
<p>#looking at gpioinfo I see that 'gpl2' corresponds to gpiochip19<br />$ gpioset gpiochip19 5=1<br />gpioset: invalid line value: 'gpiochip19'</p>
<p>#I try prefixing with /dev/<br />$ gpioset /dev/gpiochip19 5=1<br />gpioset: invalid line value: '/dev/gpiochip19'</p>
<p>#I try just the number<br />$ gpioset 19 5=1<br />gpioset: invalid line value: '/dev/gpiochip19'</p>
</blockquote>
<p>EDIT: RESULT IS THE SAME USING SUDO</p>
</blockquote>
<p>The syntax changed in v2.0=<, the following seems to work setting some of the gpio pin:</p>
<pre>
pin_name() {
thePin="$(cat /sys/firmware/devicetree/base/soc/pinctrl@*/$1/samsung,pins)"
theBankName="$(printf "%s" "$thePin" | cut -d '-' -f 1)"
theRelativePin="$(printf "%s" "$thePin" | cut -d '-' -f 2)"
theBankNumber="$(sudo gpiodetect | grep ".* \[${theBankName}\].*" | head -n 1 | cut -d ' ' -f 1)"
printf "%s %s" "${theBankNumber}" "${theRelativePin}"
}
echo "Starting modem ..."
echo "Running gpioset -z -c $(pin_name ap2mdm-soft-reset-n)=0 ..."
gpioset -z -c $(pin_name ap2mdm-soft-reset-n)=0
sleep .005
echo "Running gpioset -z -c $(pin_name ap2mdm-soft-reset-n)=1 ..."
gpioset -z -c $(pin_name ap2mdm-soft-reset-n)=1
sleep .010
echo "Running gpioset -z -c $(pin_name ap2mdm-status)=1 ..."
gpioset -z -c $(pin_name ap2mdm-status)=1
sleep .010
</pre>
<p>With the following output:</p>
<pre>
Starting modem ...
Running gpioset -z -c gpiochip19 5=0 ...
Running gpioset -z -c gpiochip19 5=1 ...
gpioset: unable to request lines on chip '/dev/gpiochip19': Resource busy
Running gpioset -z -c gpiochip8 6=1 ...
</pre>
<p>I still don't see a /dev/ttyUSB0 node.</p>
<p>mdm9k-boot doesn't work I guess because I don't got a /dev/ttyUSB0 node.</p>
<p>EDIT: A longer sleep does not solve the "Resource busy" problem</p> Replicant - Feature #2206: Note 2 LTE modem on mainline kernelhttps://redmine.replicant.us/issues/2206?journal_id=93972024-01-04T00:32:45ZJosh Branninglovell.joshyyy@gmail.com
<ul></ul><p>I reverted the libgpiod package to v1.6</p>
<p>The gpioset commands now <ins>work</ins> using the modified pinname function.</p>
<p>I run lsusb and I now get:</p>
<blockquote>
<p>Bus 001 Device 002: ID 05c6:9008</p>
</blockquote>
<p>appear, however, this is different from the device ids in Jack K's patch.</p>
<p>There is a node at /dev/ttyUSB0</p>
<p>When I run:</p>
<blockquote>
<p>sudo mdm9k-boot</p>
</blockquote>
<p>I get:</p>
<blockquote>
<p>error receiving hello, received command 4<br />failed to do hello handshake<br />error while sending files</p>
</blockquote>
<p>If I run mkm9k-boot more than once, I get:</p>
<blockquote>
<p>opened modem tty device<br />failed waiting to read<br />failed to configure serial interface</p>
</blockquote>
<p>I will try to consult on IRC.</p>