6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 8673
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Moving Linux Kernel to 5.4

Thu Apr 16, 2020 12:34 pm

dom wrote:
Thu Apr 16, 2020 11:43 am
DougieLawson wrote:
Wed Apr 15, 2020 7:27 pm
Is there any progress with fixing the TV HAT SPI problems in today's update?
It's on the list. Working from home makes testing hardware more complicated.
I appear to have grabbed the TV HAT from my desk, and have a convenient aerial feed.
Any guesses what we're looking for? I'm guessing clocking.
For clarity, it worked on 4.19, and just switching to the 5.4 kernel breaks it? It's kernel related, not common firmware related?
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

User avatar
DougieLawson
Posts: 38784
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Moving Linux Kernel to 5.4

Thu Apr 16, 2020 12:53 pm

dom wrote:
Thu Apr 16, 2020 11:43 am
DougieLawson wrote:
Wed Apr 15, 2020 7:27 pm
Is there any progress with fixing the TV HAT SPI problems in today's update?
It's on the list. Working from home makes testing hardware more complicated.
Thanks. I'll not bother doing the rounds of my 5.4 machines with this weeks changes in that case.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2869
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: Moving Linux Kernel to 5.4

Thu Apr 16, 2020 12:55 pm

So you're trusting us not to have broken anything this week?

User avatar
DougieLawson
Posts: 38784
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Moving Linux Kernel to 5.4

Thu Apr 16, 2020 12:59 pm

PhilE wrote:
Thu Apr 16, 2020 12:55 pm
So you're trusting us not to have broken anything this week?
I meant the ones where broken SPI breaks things.
Broken software things make me happy, that's what paid my mortgage off.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2869
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: Moving Linux Kernel to 5.4

Thu Apr 16, 2020 1:06 pm

Yes, but if you don't test the non-SPI stuff this week, who's to say that the non-SPI stuff won't still be broken next week and stop you testing the fixed SPI stuff?

User avatar
DougieLawson
Posts: 38784
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Moving Linux Kernel to 5.4

Thu Apr 16, 2020 1:11 pm

PhilE wrote:
Thu Apr 16, 2020 1:06 pm
Yes, but if you don't test the non-SPI stuff this week, who's to say that the non-SPI stuff won't still be broken next week and stop you testing the fixed SPI stuff?
I'm doing an update on all the machines except the two where SPI breaks the application. Three of them are left testing the common firmware. One is running Stretch with a 5.4 kernel (because I've not yet worked out how to upgrade the VoiceHAT stuff).
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2869
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: Moving Linux Kernel to 5.4

Thu Apr 16, 2020 1:25 pm

I'm without any SPI hardware at the moment, but I can read drivers and traces. If you have a moment to capture a trace log while running your MAX7219 it would be appreciated. To enable SPI event logging, add "trace_event=spi:*" to cmdline.txt (or you can enable it at runtime with the rather unwieldy:

Code: Select all

sudo sh -c "echo 1 >/sys/kernel/debug/tracing/events/spi/enable"
You can grab the trace output at any time with a cat or cp:

Code: Select all

sudo cat /sys/kernel/debug/tracing/trace

HiassofT
Posts: 282
Joined: Fri Jun 30, 2017 10:07 pm
Location: Salzburg, Austria
Contact: Website

Re: Moving Linux Kernel to 5.4

Thu Apr 16, 2020 1:31 pm

FWIW: my cirrus logic audio card, which uses SPI for communication with the WM5102, is working fine with the 5.4 kernel (both on LibreELEC and Raspbian). Haven't checked with the TV hat though, but at least SPI is not completely broken :)

so long,

Hias

User avatar
DougieLawson
Posts: 38784
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Moving Linux Kernel to 5.4

Thu Apr 16, 2020 1:34 pm

PhilE wrote:
Thu Apr 16, 2020 1:25 pm
I'm without any SPI hardware at the moment, but I can read drivers and traces. If you have a moment to capture a trace log while running your MAX7219 it would be appreciated. To enable SPI event logging, add "trace_event=spi:*" to cmdline.txt (or you can enable it at runtime with the rather unwieldy:

Code: Select all

sudo sh -c "echo 1 >/sys/kernel/debug/tracing/events/spi/enable"
You can grab the trace output at any time with a cat or cp:

Code: Select all

sudo cat /sys/kernel/debug/tracing/trace
OK. I'll see what I can do. I'll shove the output on pastebin.
Do you want a matching trace from 4.19.114+ to compare?
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2869
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: Moving Linux Kernel to 5.4

Thu Apr 16, 2020 1:37 pm

A comparison trace might be helpful, but I'm pretty sure the 4.19 kernel doesn't include the data bytes in the output (5.4 definitely does), just the counts.

User avatar
DougieLawson
Posts: 38784
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Moving Linux Kernel to 5.4

Thu Apr 16, 2020 2:33 pm

It was too big for Pastebin. So it's a gist.

https://gist.github.com/DougieLawson/b5 ... 9eea0477fb
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2869
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: Moving Linux Kernel to 5.4

Thu Apr 16, 2020 2:45 pm

Thanks - it seems to be reading back all zeroes, which matches another trace.

User avatar
DougieLawson
Posts: 38784
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Moving Linux Kernel to 5.4

Thu Apr 16, 2020 3:08 pm

I do have a trace from 4.19.114 as I did a test to be sure pastebin would work and when it didn't I switched to gist (and learned a new trick - thus achieving my "learn something new everyday" achievement for today).
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2869
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: Moving Linux Kernel to 5.4

Fri Apr 17, 2020 8:12 am

Dougie - The immediate cause of the SPI failure is that the Chip Select lines are inverted. The change has been triggered by the switch to using gpio descriptors in the spi-bcm2835 driver, but the developer responsible for these changes is a heavy user of SPI on the Pi so it must clearly be working for him and many others.

In trying to figure out where the blame lies it would help to know how you are controlling the MAX7219. I couldn't find a Linux driver, so are you driving it from userspace through a library of some kind, and if so, which one? SPI-Py?

User avatar
DougieLawson
Posts: 38784
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Moving Linux Kernel to 5.4

Fri Apr 17, 2020 8:35 am

This is the code that runs that doodah

sqlF.c

Code: Select all

// (C) Copyright 2016, 2017, Dougie Lawson. All rights reserved.
#include <stdio.h>
#include <stdlib.h>
#include <sqlite3.h>
#include <string.h>
#include <unistd.h>
#include <stdint.h>
#include <math.h>
#include <signal.h>
#include "max7219.h"
#include "spiLED.h"
#define ALTITUDE 122.5
#define DATABASE "/srv/bmp180/sensordata.db"
//#define DATABASE "/home/pi_f/python/sensordata.db"

const char *spaces4 = "    ";
const char *spaces2 = "  ";
const char *space = " ";
max7219 header;
struct sigaction act;

void sig_handler(int signum, siginfo_t *info, void *ptr)
{
   clearDisplay(&header);
   printf("Received signal %d\n", signum);
   printf("Signal originated from process %lu\n",
     (unsigned long)info->si_pid);
   exit(0);
}

static int callback(void *data, int argc, char **argv, char **azColName){
   int i;
   char chars[30];
   char chars1[9];
   char *token1;
   char *token2;
   char *stringp = chars;
   const char *delim = " ";
   float tempC;
   float tempF;
   float pressureMSL;

   for(i=0; i<argc; i++){
      if (strcmp(azColName[i], "tstamp") == 0)
      {
        // Date & time format is yyyy-mm-dd hh:mm:ss
        // Split that into
        // Date (token1): yy-mm-dd
        // Time (token2): hh:mm:ss
        clearDisplay(&header);
        sprintf(chars, "%s", argv[i]);
        token1 = strsep(&stringp, delim);
        token2 = strsep(&stringp, delim);

        // Ugly use of memcpy to strip off century digits
        memcpy(chars1, &token1[2], 8);
        chars1[8] = '\0';
        writeDigits(&header, chars1);
        sleep(4);
        clearDisplay(&header);
        sprintf(chars1, "%2s%8s", spaces2, token2);
        writeDigits(&header, chars1);
        sleep(4);
      }
      else if (strcmp(azColName[i], "temp") == 0)
      {
        clearDisplay(&header);
        tempC = atof(argv[i]);
        sprintf(chars,"%5s%2.1f", spaces4, tempC );
        writeDigits(&header, chars);
        sleep(8);
        clearDisplay(&header);
        tempF = (9 * ( atof(chars) / 5) + 32);
        sprintf(chars,"%5s%2.1f", spaces4, tempF);
        writeDigits(&header, chars);
        sleep(4);
      }
      else if (strcmp(azColName[i], "pressure") == 0)
      {
        clearDisplay(&header);
        sprintf(chars,"%8s",argv[i]);
        writeDigits(&header, chars);
        sleep(4);
        clearDisplay(&header);
        // Database holds pressure at local altitude
        // Correct pressure for mean sea level
        pressureMSL = atof(chars) / powf(1 - ( ALTITUDE / 44330.0) , 5.255);
        sprintf(chars,"%2s%4.2f", space, pressureMSL);
        writeDigits(&header, chars);
        sleep(4);
      }
      else
      {
        printf("Unknown column: %s\r\n", azColName[i]);
      }
   }
   return 0;
}

int main(int argc, char* argv[])
{
   memset(&act, 0, sizeof(act));

   act.sa_sigaction = sig_handler;
   act.sa_flags = SA_SIGINFO;
   sigaction(SIGTERM, &act, NULL);

   sqlite3 *db;
   FILE *fp;
   int rc;
   int bright;
   char lightordark[40];
   char *zErrMsg = 0;
   char *sql;
   char *LoDstringp = lightordark;
   char *LoDtoken;
   char *LoDtime;
   char charst[30];

   const char filename[21] = "/var/run/lightordark";
   const char *delim = " ";
   const char* data = "Callback function called";

   initialiseDisplay(&header);
   clearDisplay(&header);

   while (1==1)
   {
   /* Open database */
     rc = sqlite3_open(DATABASE, &db);
     if( rc ){
        fprintf(stderr, "Can't open database: %s\n", sqlite3_errmsg(db));
        exit(0);
     }

     /* Create SQL statement */
     sql = "SELECT datetime(a.date_time,'localtime') as tstamp, a.temp, a.pressure from bmp_data a where a.date_time in (select max(b.date_time) from bmp_data b);";

     /* Execute SQL statement */
     rc = sqlite3_exec(db, sql, callback, (void*)data, &zErrMsg);
     if( rc != SQLITE_OK ){
        fprintf(stderr, "SQL error: %s\n", zErrMsg);
        sqlite3_free(zErrMsg);
     }
     sqlite3_close(db);


     /* Set the display brightness at dawn / dusk */
     fp = fopen(filename,"r");
     fgets(lightordark, sizeof lightordark, fp);
     LoDtoken = strsep(&LoDstringp, delim);
     LoDtime = strsep(&LoDstringp, delim); /* skip @ */
     LoDtime = strsep(&LoDstringp, delim); /* got Time */
     sprintf(charst,"%2s%8s", spaces2, LoDtime);
     writeDigits(&header, charst);
     sleep(4);

     if (strcmp(LoDtoken, "dark") == 0) bright = 7;
     else bright = 3;

     setBrightness(&header, bright);
     fclose(fp);
     LoDstringp = lightordark;

   }
   return 0;
}
spiLED.c

Code: Select all

// (C) Copyright 2016, Dougie Lawson. All rights reserved.
#include <fcntl.h>
#include <string.h>
#include <stdio.h>
#include <stdint.h>
#include <time.h>
#include <sys/ioctl.h>
#include <linux/spi/spidev.h>
#include "max7219.h"
#include "spiLED.h"

static char *spiDevice = "/dev/spidev0.1";
static uint8_t spiBPW = 8;
static uint32_t spiSpeed = 5000000;
static uint16_t spiDelay = 0;

int spiOpen(char* dev)
{
  if((spi_fd = open(dev, O_RDWR)) < 0)
  {
    printf("error opening %s\n",dev);
    return -1;
  }
  return 0;
}

void writeByte(uint8_t reg, uint8_t data)
{
  uint8_t spiBufTx [3];
  uint8_t spiBufRx [3];
  struct spi_ioc_transfer spi;
  memset (&spi, 0, sizeof(spi));
  spiBufTx [0] = CMD_WRITE;
  spiBufTx [1] = reg;
  spiBufTx [2] = data;
  spi.tx_buf =(unsigned long)spiBufTx;
  spi.rx_buf =(unsigned long)spiBufRx;
  spi.len = 3;
  spi.delay_usecs = spiDelay;
  spi.speed_hz = spiSpeed;
  spi.bits_per_word = spiBPW;
  ioctl(spi_fd, SPI_IOC_MESSAGE(1), &spi);
}

void initialiseDisplay(max7219 *header)
{
  spiOpen(spiDevice);

  writeBytes(header, MAX7219_REG_SCANLIMIT, 7);
  writeBytes(header, MAX7219_REG_DECODEMODE, 0xff);
  writeBytes(header, MAX7219_REG_SHUTDOWN, 1);
  writeBytes(header, MAX7219_REG_DISPLAYTEST, 0);
  setBrightness(header, 5);
}

void writeBytes(max7219 *header, int cmd, int data)
{
  if(!header) return;
  writeByte(cmd, data);
}

void byte_to_binary(int x)
{
    static char b[9];
    b[0] = '\0';

    int z;
    for (z = 128; z > 0; z >>= 1)
    {
        strcat(b, ((x & z) == z) ? "1" : "0");
    }
    printf("%s", b);
}

void clearDisplay(max7219 *header)
{
  int i;
  if(!header) return;
  for (i=0; i<8; i++) {
    header->digits[i] = 0x0F;
  }
  digitDisplay(header);
}

void writeDigits(max7219 *header, char chars[12])
{
  int i,j;
  if (!header) return;
  i = 7;
  j = 0;
  while (j <= 11 && i >= 0)
  {
    switch ((int)chars[j]) {
    case '0':
    case '1':
    case '2':
    case '3':
    case '4':
    case '5':
    case '6':
    case '7':
    case '8':
    case '9':

      header->digits[i] = asciiToBCD(chars[j]);
      j++;
      i--;
      break;
    case ' ':
      header->digits[i] = 0x0F;
      j++;
      i--;
      break;
    case '-':
      header->digits[i] = 0x0a;
      j++;
      i--;
      break;
    case ':':
//      header->digits[i] = 0x8f;
//      j++;
//      i--;
//      break;
    case '.':
      header->digits[i+1] = header->digits[i+1] + 0x80;
      j++;
      break;
    case 0x00:
      j = 12;
      i = -1;
      break;
    default:
      j++;
      break;
    }
  }
  digitDisplay(header);
}

void digitDisplay(max7219 *header)
{
  int i;
  if(!header) return;
  for (i=0; i<8; i++)
  {
    writeBytes(header, i+1, header->digits[i]);
  }
}

void setBrightness(max7219 *header, int bright)
{
  if(!header) return;
  if (bright < 0) bright = 0;
  if (bright > 15) bright = 15;

  writeBytes(header, MAX7219_REG_INTENSITY, bright);
}

uint8_t asciiToBCD (uint8_t chr)
{
  uint8_t bcd_value;
  bcd_value = (chr - 48);
  return bcd_value;
}
max7219.h

Code: Select all

// (C) Copyright 2016, Dougie Lawson. All rights reserved.
#ifndef MAX7219_H
#define MAX7219_H

#define MAX7219_REG_NOOP 0x00
#define MAX7219_REG_DIGIT0 0x01
#define MAX7219_REG_DIGIT1 0x02
#define MAX7219_REG_DIGIT2 0x03
#define MAX7219_REG_DIGIT3 0x04
#define MAX7219_REG_DIGIT4 0x05
#define MAX7219_REG_DIGIT5 0x06
#define MAX7219_REG_DIGIT6 0x07
#define MAX7219_REG_DIGIT7 0x08
#define MAX7219_REG_DECODEMODE 0x09
#define MAX7219_REG_INTENSITY 0x0A
#define MAX7219_REG_SCANLIMIT 0x0B
#define MAX7219_REG_SHUTDOWN 0x0C
#define MAX7219_REG_DISPLAYTEST 0x0F

typedef struct
{

 int digits[8];

} max7219;
#endif
spiLED.h

Code: Select all

// (C) Copyright 2016, Dougie Lawson. All rights reserved.
#ifndef SPILED_H
#define SPILED_H

#define CMD_WRITE 0x40

int spi_fd;
void initialiseDisplay(max7219 *header);
void writeBytes(max7219 *header, int cmd, int data);
void writeDigits(max7219 *header, char chars[12]);
void clearDisplay(max7219 *header);
void writeByte(uint8_t reg, uint8_t data);
uint8_t asciiToBCD (uint8_t chr);
void byte_to_binary(int x);
void digitDisplay(max7219 *header);
void setBrightness(max7219 *header, int bright);

#endif
It's been running OK for four years and more.
https://github.com/DougieLawson/Raspber ... er/max7219 has the whole shebang.

https://github.com/DougieLawson/Raspber ... /LEDtest.c is the simplest example as it just does a static display of 12:34:56 in an endless loop (not even a ticking clock). That one will run OK on any RPi as long as it can open /dev/spidev0.1 without having a MAX7219 connected, it doesn't check whether any SPI call works (and there's no feedback from a MAX7219).

I've got a Siglent 'scope that has a SPI analysis option and VNC (not tried that with my MAX7219) if you need any traces. It's got SCPI but I've not learned how to use that feature yet.
I may have a tinker with https://ktln2.org/2018/02/20/control-si ... illoscope/ when I get more bored than I am right now.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2869
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: Moving Linux Kernel to 5.4

Fri Apr 17, 2020 10:59 am

There's a patch in our GitHub Linux repo that should fix SPI for the majority of devices. Whether it works for more exotic beasts remains to be seen.

User avatar
DougieLawson
Posts: 38784
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Moving Linux Kernel to 5.4

Fri Apr 17, 2020 11:12 am

PhilE wrote:
Fri Apr 17, 2020 10:59 am
There's a patch in our GitHub Linux repo that should fix SPI for the majority of devices. Whether it works for more exotic beasts remains to be seen.
OK. I'll see if I can pull that and build a kernel for my ZeroW (by running the build on a 3B+).
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5501
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: Moving Linux Kernel to 5.4

Fri Apr 17, 2020 11:19 am

DougieLawson wrote:
Fri Apr 17, 2020 11:12 am
OK. I'll see if I can pull that and build a kernel for my ZeroW (by running the build on a 3B+).
There is an rpi-update build in progress if you prefer to wait for that.

User avatar
DougieLawson
Posts: 38784
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Moving Linux Kernel to 5.4

Fri Apr 17, 2020 11:42 am

dom wrote:
Fri Apr 17, 2020 11:19 am
DougieLawson wrote:
Fri Apr 17, 2020 11:12 am
OK. I'll see if I can pull that and build a kernel for my ZeroW (by running the build on a 3B+).
There is an rpi-update build in progress if you prefer to wait for that.
It'll probably be quicker waiting as it's a long time (and a Buster re-install) since I've built a kernel.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5501
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: Moving Linux Kernel to 5.4

Fri Apr 17, 2020 12:06 pm

New rpi-update kernel with bump to 5.4.32 and potential spi fix.

fik
Posts: 37
Joined: Thu Jan 17, 2013 1:34 pm

Re: Moving Linux Kernel to 5.4

Fri Apr 17, 2020 1:34 pm

Still no progress on RPi3 frequency scaling and on the raspberrypi-clk raspberrypi-clk: Missing firmware node kernel error?

The 5.4.32 seems to introduce a new error on RPi4 in sdhci_send_command. No problem on RPi3.

Code: Select all

[  901.141242] WARNING: CPU: 0 PID: 84 at drivers/mmc/host/sdhci.c:1098 sdhci_send_command+0x744/0xd68
[  901.141244] Modules linked in: rfcomm bnep hci_uart btbcm serdev bluetooth ecdh_generic ecc 8021q garp stp llc brcmfmac brcmutil sha256_generic libsha256 cfg80211 vc
4 bcm2835_codec(C) v3d drm_kms_helper videobuf2_dma_contig gpu_sched rfkill v4l2_mem2mem bcm2835_v4l2(C) bcm2835_mmal_vchiq(C) videobuf2_vmalloc videobuf2_memops drm vi
deobuf2_v4l2 videobuf2_common raspberrypi_hwmon snd_soc_core drm_panel_orientation_quirks hwmon videodev snd_bcm2835(C) snd_compress mc vc_sm_cma(C) snd_pcm_dmaengine r
pivid_mem snd_pcm snd_timer snd syscopyarea sysfillrect sysimgblt fb_sys_fops uio_pdrv_genirq uio i2c_dev ip_tables x_tables ipv6 nf_defrag_ipv6
[  901.141287] CPU: 0 PID: 84 Comm: kworker/0:1H Tainted: G        WC        5.4.32-v8+ #1306
[  901.141288] Hardware name: Raspberry Pi 4 Model B Rev 1.1 (DT)
[  901.141292] Workqueue: kblockd blk_mq_run_work_fn
[  901.141295] pstate: a0000085 (NzCv daIf -PAN -UAO)
[  901.141298] pc : sdhci_send_command+0x744/0xd68
[  901.141301] lr : sdhci_send_command+0x524/0xd68
[  901.141302] sp : ffffffc0114739d0
[  901.141304] x29: ffffffc0114739d0 x28: ffffff80f54d26c8 
[  901.141307] x27: 0000000000000000 x26: ffffff80f5b90000 
[  901.141310] x25: ffffff80f54d2790 x24: ffffffc010e28000 
[  901.141313] x23: 0000000000418958 x22: 0000000000000003 
[  901.141316] x21: ffffff80f54d2850 x20: ffffff80f54d28d0 
[  901.141319] x19: ffffff80f5b90500 x18: 0000000000000000 
[  901.141322] x17: 0000000000000000 x16: 0000000000000000 
[  901.141324] x15: 0000000000003000 x14: 0000000000000000 
[  901.141327] x13: 0000000000080000 x12: 000000000000000e 
[  901.141330] x11: ffffff80fb74d000 x10: 0000000000200000 
[  901.141333] x9 : 000000000000000e x8 : 00000000001fffff 
[  901.141336] x7 : 000000000000007f x6 : ffffffc010e28a1c 
[  901.141338] x5 : ffffff80fb74d000 x4 : 0000000000000020 
[  901.141341] x3 : 0000000000000002 x2 : 0000000000000000 
[  901.141344] x1 : ffffff80f54e6000 x0 : 00000000ffffffe4 
[  901.141348] Call trace:
[  901.141350]  sdhci_send_command+0x744/0xd68
[  901.141353]  sdhci_request+0x78/0xf8
[  901.141356]  __mmc_start_request+0x78/0x1e8
[  901.141359]  mmc_start_request+0x88/0xb0
[  901.141363]  mmc_blk_mq_issue_rq+0x67c/0x7a8
[  901.141365]  mmc_mq_queue_rq+0x184/0x258
[  901.141368]  blk_mq_dispatch_rq_list+0xb0/0x5a0
[  901.141371]  blk_mq_do_dispatch_sched+0x84/0x110
[  901.141374]  blk_mq_sched_dispatch_requests+0x108/0x1b0
[  901.141377]  __blk_mq_run_hw_queue+0xb8/0x138
[  901.141379]  blk_mq_run_work_fn+0x28/0x38
[  901.141382]  process_one_work+0x158/0x4b8
[  901.141385]  worker_thread+0x50/0x498
[  901.141388]  kthread+0xfc/0x128
[  901.141392]  ret_from_fork+0x10/0x1c
[  901.141394] ---[ end trace a49f8dd9d7532016 ]---
This error repeats very often, filling the logs.

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 8673
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Moving Linux Kernel to 5.4

Fri Apr 17, 2020 1:39 pm

fik wrote:
Fri Apr 17, 2020 1:34 pm
Still no progress on RPi3 frequency scaling and on the raspberrypi-clk raspberrypi-clk: Missing firmware node kernel error?
It's an anomalous error - see https://github.com/raspberrypi/linux/issues/3548
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2869
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: Moving Linux Kernel to 5.4

Fri Apr 17, 2020 1:42 pm

The "raspberrypi-clk raspberrypi-clk: Missing firmware node" error is just a glitch and can be ignored. The clock device is being instantiated twice, once without a Device Tree node (which fails noisily) and once with.(which succeeds silently). The error case will be removed before launch, but apart from the error message the clock driver in the current build is working as expected.

See https://github.com/raspberrypi/linux/issues/3548 for a discussion of the matter.

User avatar
bleep42
Posts: 172
Joined: Wed Mar 07, 2012 12:43 pm
Location: Sussex

Re: Moving Linux Kernel to 5.4

Fri Apr 17, 2020 2:01 pm

Hi, I've been using 5.4 since the beginning of the month, as a standard user, browsing, VLC music, videos, file editing, gcc, everything is basically working well :-)
The only problem I have is with a multi tasking Mandelbrot program I wrote, that directly accesses /dev/fb0 what is now the recommended way of, as fast as possible, writing pixels to the screen, from C?
Regards, Kevin.

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5501
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: Moving Linux Kernel to 5.4

Fri Apr 17, 2020 2:06 pm

fik wrote:
Fri Apr 17, 2020 1:34 pm
Still no progress on RPi3 frequency scaling and on the raspberrypi-clk raspberrypi-clk: Missing firmware node kernel error?
I'll have a look at frequency scaling on Pi3.
The 5.4.32 seems to introduce a new error on RPi4 in sdhci_send_command. No problem on RPi3.
No immediate thoughts on that one. I;m not seeing those errors on a quick test on 5.4.32
Does reverting back one or two versions make the problem go away?

Return to “Advanced users”