I am trying to use the static memory controller to drive a device using a "lightweight" parallel interface (only a chip select and 9-bit data lines). I want to use nCS0, to map my device @ 0x10000000 and D0 to D8 data lines. So far, I use a SAMA5D2 Xplained demo board with Linux4SAM v5.8.
For now, I have a test program from userspace which allows me to read/write to peripheral registers, using mmap(), so I can configure HSMC and write value @ 0x10000000. This works, I can see chip select and data lines on a scope.
Now, I would like to use my device tree file to configure EBI and HSMC drivers and add my "memory" so I will not have to configure the peripheral registers manually. But I am a bit lost. I found this document: https://github.com/linux4sam/linux-at91 ... %2Cebi.txt
So I added EBI, HSMC definitions in sama5d2.dtsi (based on linux mainline sama5d2.dtsi from https://github.com/torvalds/linux ), pinctrl to configure PA22 to PA26 (I use only 5 data lines for now, I will modify the board to use the other bits later) , and PC5 to alternate function and I tried to add the example from the Atmel EBI DT documentation. So, it looks like :
My user DTSI
Code: Select all
ebi: ebi@10000000 {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_dev_smc_default>;
dev: flash@0,0 {
compatible = "cfi-flash";
#address-cells = <1>;
#size-cells = <1>;
reg = <0x0 0x0 0x1>; /* Use nCS0, size is 1 byte */
atmel,smc-read-mode = "ncs";
atmel,smc-write-mode = "ncs";
atmel,smc-bus-width = <8>;
atmel,smc-ncs-rd-setup-ns = <0>;
atmel,smc-ncs-wr-setup-ns = <0>;
atmel,smc-nwe-setup-ns = <8>;
atmel,smc-nrd-setup-ns = <16>;
atmel,smc-ncs-rd-pulse-ns = <84>;
atmel,smc-ncs-wr-pulse-ns = <84>;
atmel,smc-nrd-pulse-ns = <76>;
atmel,smc-nwe-pulse-ns = <76>;
atmel,smc-nrd-cycle-ns = <107>;
atmel,smc-nwe-cycle-ns = <84>;
atmel,smc-tdf-ns = <16>;
};
};
...
pinctrl_dev_smc_default: io_dev{
pinmux = <PIN_PA22__D0>,
<PIN_PA23__D1>,
<PIN_PA24__D2>,
<PIN_PA25__D3>,
<PIN_PA26__D4>,
<PIN_PC5__NCS0>;
bias-disable;
};
Code: Select all
ebi: ebi@10000000 {
compatible = "atmel,sama5d3-ebi";
#address-cells = <2>;
#size-cells = <1>;
atmel,smc = <&hsmc>;
reg = <0x10000000 0x10000000
0x60000000 0x30000000>;
ranges = <0x0 0x0 0x10000000 0x10000000
0x1 0x0 0x60000000 0x10000000
0x2 0x0 0x70000000 0x10000000
0x3 0x0 0x80000000 0x10000000>;
clocks = <&mck>;
status = "disabled";
nand_controller: nand-controller {
compatible = "atmel,sama5d3-nand-controller";
atmel,nfc-sram = <&nfc_sram>;
atmel,nfc-io = <&nfc_io>;
ecc-engine = <&pmecc>;
#address-cells = <2>;
#size-cells = <1>;
ranges;
status = "disabled";
};
};
...
hsmc: hsmc@f8014000 {
compatible = "atmel,sama5d2-smc", "syscon", "simple-mfd";
reg = <0xf8014000 0x1000>;
interrupts = <17 IRQ_TYPE_LEVEL_HIGH 6>;
clocks = <&hsmc_clk>;
#address-cells = <1>;
#size-cells = <1>;
ranges;
pmecc: ecc-engine@f8014070 {
compatible = "atmel,sama5d2-pmecc";
reg = <0xf8014070 0x490>,
<0xf8014500 0x100>;
};
};
At least, HSMC clock is not enabled (PID17 in PCM_PCSR0 is reset) and HSMC settings are not modified (bus is 16-bit wide, wrong timings, etc.). The only thing in the DTSI that works is the pinctrl part.
So, where am I wrong ? Anybody already had such kind of application working ?
Thanks,
Kevin