What is name of gpio hardware on a rock64?
#1
The driver code checks for it, and will return a valid answer if its a bcm2709, bcm2835, bcm2836, or a bcm2837. Code is:
Code:
#define CPUINFO_BUFSIZE (16*1024) // Should be large enough for now
static platform_t check_platform(void)
{
FILE *fp;
char *buf;
size_t fsize;
platform_t rv = RPI_UNSUPPORTED;

if(!(buf = rtapi_kmalloc(CPUINFO_BUFSIZE, RTAPI_GFP_KERNEL))) {
rtapi_print_msg(RPSPI_ERR, "hm2_rpspi: No dynamic memory\n");
return RPI_UNSUPPORTED;
}
if(!(fp = fopen("/proc/cpuinfo", "r"))) {
rtapi_print_msg(RPSPI_ERR, "hm2_rpspi: Failed to open /proc/cpuinfo\n");
goto check_exit;
}
fsize = fread(buf, 1, CPUINFO_BUFSIZE - 1, fp);
fclose(fp);

// we have truncated cpuinfo return unsupported
if(!fsize || fsize == CPUINFO_BUFSIZE - 1) {
rtapi_print_msg(RPSPI_ERR, "hm2_rpspi: Platform detection memory buffer too small\n");
goto check_exit;
}

/* NUL terminate the buffer */
buf[fsize] = '\0';

if(strstr(buf, "BCM2708")) {
rv = RPI_1;
} else if(strstr(buf, "BCM2709")) {
rv = RPI_2; //for RPI 3 too
} else if(strstr(buf, "BCM2835")) { // starting with 4.8 kernels revision tag has board details
char *rev_val = strstr(buf, "Revision");
if(rev_val) {
char *rev_start = strstr(rev_val, ": ");
unsigned long rev = strtol(rev_start + 2, NULL, 16);

if(rev <= 0xffff)
rv = RPI_1; // pre pi2 revision scheme
else {
switch((rev & 0xf000) >> 12) {
case 0: //bcm2835
rv = RPI_1;
break;
case 1: //bcm2836
case 2: //bcm2837
rv = RPI_2; // peripheral base is same on pi2/3
break;
default:
break;
}
}
}
}

check_exit:
rtapi_kfree(buf);
return rv;
}

And all the c style indenting has been stripped, so how do I post code?  This sucks.



Thanks everybody.

Cheers, Gene83
  Reply
#2
gpio is a function of the soc [rockchip 3328]
  Reply
#3
Thank you very much.

Cheers, gene83
  Reply
#4
If you wish to verify that /proc/cpuinfo contains the board model, you better verify that first, because in some kernels, the name won't appear.
Some other way to do that is to verify /proc/device-tree/model ...
  Reply
#5
The only place I can find that is in /proc/device-tree/spi@ff190000 and that isn't explicit.

There are rockchip, and rk3328's scattered here and there but I've no clue how volatile they may be. But they I think hold the most promise, but it a whole new kilobyte of prelude code to get there, and I haven't hacked on c code in 25 years. Complicated by my wet ram turning 83 yo today.

Cheers & thanks, martinayotte

Gene83
  Reply
#6
On my board, doing "cat /proc/device-tree/model" returns "PINE64 ROCK64".
  Reply
#7
Whereas I get:Rockchip RK3328 Rock64

Without an eof or eol. And which would appear to be a valid ID.

Thanks. Not working on the code yet, morning here and I'm still a quart low on coffee. :-)

Cheers martinayotte, gene83
  Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Centos 8 Stream on Rock64 ayoungdukie 1 133 06-07-2021, 11:50 AM
Last Post: zer0sig
  Talos on ROCK64 cjyar 2 141 06-04-2021, 11:50 AM
Last Post: cjyar
  CentOS 7 for Rock64 pineadmin 3 2,692 05-30-2021, 08:20 AM
Last Post: ayoungdukie
  The state of mainline hardware decoding CounterPillow 6 250 05-29-2021, 01:10 PM
Last Post: CounterPillow
  Rock64 CRUX-ARM (aarch64) mara 0 110 05-27-2021, 02:22 PM
Last Post: mara
  DietPi OS for ROCK64 MichaIng 15 3,923 05-24-2021, 07:46 AM
Last Post: MichaIng
  openwrt for the rock64 wilsonYan 14 5,988 05-23-2021, 07:53 AM
Last Post: stamasd
  RETRO-GAMING: UPDATED RELEASE OF RECALBOX FOR THE ROCK64 Mrfixit2001 32 24,396 05-22-2021, 07:01 AM
Last Post: fartadeadrian
  Armbian for Rock64 pineadmin 31 20,676 05-08-2021, 09:35 AM
Last Post: Wizzard
  slarm64 (unofficial slackware) Rock64 RK3328 (aarch64) mara 113 60,694 05-02-2021, 04:48 AM
Last Post: mara

Forum Jump:


Users browsing this thread: 1 Guest(s)