christianeisendle / nxprdlib-kernel-bal Goto Github PK
View Code? Open in Web Editor NEWNXP NFCRdLib Kernel BAL Module
License: GNU General Public License v2.0
NXP NFCRdLib Kernel BAL Module
License: GNU General Public License v2.0
Currently only PN5180 is supported. There should be a way to change the used IC, for instance using ioctl
I am trying to use this module with kernel 4.19. baldev_init successfully is called but /dev/bal not exposed. I found that bal_spi_probe is never called, despite there are not any errors. How I can get the /dev/bal? One thing which also looks strange, that I need to load the bal kernel module manually. I build the bal module out of tree. I use the following FDT:
`/dts-v1/;
/plugin/;
#include "sama5d2-pinfunc.h"
#include "dt-bindings/pinctrl/at91.h"
#include <dt-bindings/gpio/gpio.h>
&spi3 {
#address-cells = <1>;
#size-cells = <0>;
cs-gpios = <&pioA PIN_PD0 GPIO_ACTIVE_LOW>;
status = "okay";
bal: nxprdlib-bal@1 {
compatible = "nxp,bal";
reg = <1>;
spi-max-frequency = <24000000>;
busy-pin-gpio = <&pioA PIN_PB3 GPIO_ACTIVE_LOW>;
status = "okay";
};
};
&pioA {
pinctrl_pn5180_busy: pn5180_busy {
pinmux = <PIN_PB3>;
bias-disable;
};
};
&pinctrl_mikrobus2_spi_cs {
bias-pull-up;
};
&pinctrl_mikrobus_spi {
bias-pull-up;
};
&{/} {
model = "Atmel SAMA5D27 SOM1 EK PN5180";
};`
In order to allow firmware updates, PN5180 needs to be put in download mode.
Once in this mode a different host interface mode is required.
In normal mode, the host interface behavior is as such:
The behavior is sketched by the following wavedrom script (paste in http://wavedrom.com/editor.html):
{signal: [
{name: 'nss', wave: '1...0.........1.0......'},
{name: "mosi", wave: "0....==....0.........", data: ["ins", "payload"] },
{name: 'busy', wave: '0.....1........0....'},
]}
Download mode host interface behavior is like this:
The behavior is sketched by the following wavedrom script (paste in http://wavedrom.com/editor.html):
{signal: [
{name: 'nss', wave: '1...0..................1.0..........1...'},
{name: "mosi", wave: "0....==.==........=.0......=xx.....0....", data: ["0x7f", "len", "ins", "data", "crc", "0xff","dummy"] },
{name: 'miso', wave: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxx=......0....', data: ["response"]},
{name: 'irq', wave: '0.......................1............0..'},
]}
The BAL module should be extended to support this download mode by using an IOCTL option to switch between normal mode and download mode.
Currently only device tree is supported, i.e. module not working if device tree is disabled/not used.
Current implementation uses static context. This prevents multiple instantiations of the driver and, moreover, doesn't follow Linux Kernel design pattern to separate code from data
cmd parameter of baldev_ioctl doesn't follow the conventions as defined in ioctl.h
Second, arg parameter is used as value, but is intented to be used as a pointer
/dev/bal is always available once the module is loaded, also in case it has not been assigned to an SPI device.
Christian,
Following the instruction in the README to generates the bal module I noticed the following error:
Building the module using make M=/usr/src/nxprdlib-kernel-bal command fails because of the missing Makefile in the directory.
I fixed using the command make M=/usr/src/nxprdlib-kernel-bal/bal instead.
Jeremy.
When setting up transfers (read or write) with > 90 bytes payload, the data transferred is corrupted. This can easily reproduced by writing eg. 100 bytes into the file handle and compare it with the data transferred via SPI.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.