1/*
2 * Copyright (c) 2021 Thomas Stranger
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7#include <freq.h>
8#include <mem.h>
9
10/ {
11	aliases {
12		eeprom-0 = &eeprom0_x_nucleo_eeprma2;
13		eeprom-1 = &eeprom4_x_nucleo_eeprma2;
14	};
15};
16
17&arduino_i2c {
18	status = "okay";
19	clock-frequency = <I2C_BITRATE_FAST>;
20
21	eeprom0_x_nucleo_eeprma2: eeprom@54 {
22		/* M24C02-FMC6TG aka U1 (2 kbit eeprom in DFN8 package) */
23		compatible = "st,m24c02", "st,m24xxx", "atmel,at24";
24		reg = <0x54>;
25		size = <256>;
26		pagesize = <16>;
27		address-width = <8>;
28		timeout = <5>;
29
30		/* if solder-bridge closed: arduino A1 pin on CN8 can wp */
31		/* wp-gpios = <&arduino_header 1 GPIO_ACTIVE_LOW>; */
32	};
33
34	eeprom1_x_nucleo_eeprma2: eeprom@55 {
35		/* M24256-DFDW6TP aka U2 (256 kbit eeprom in TSSOP package) */
36		compatible = "st,m24256", "st,m24xxx", "atmel,at24";
37		reg = <0x55>;
38		size = <DT_SIZE_K(32)>;
39		pagesize = <64>;
40		address-width = <16>;
41		timeout = <5>;
42
43		/* if solder-bridge closed: arduino A1 pin on CN8 can wp */
44		/* wp-gpios = <&arduino_header 1 GPIO_ACTIVE_LOW>; */
45	};
46
47	eeprom2_x_nucleo_eeprma2: eeprom@56 {
48		/* M24M01-DFMN6TP aka U3 (1 Mbit eeprom in SO8N package) */
49		compatible = "st,m24m01", "st,m24xxx", "atmel,at24";
50		reg = <0x56>;
51		size = <DT_SIZE_K(128)>;
52		pagesize = <256>;
53		address-width = <16>;
54		timeout = <5>;
55
56		/* if solder-bridge closed: arduino A1 pin on CN8 can wp */
57		/* wp-gpios = <&arduino_header 1 GPIO_ACTIVE_LOW>; */
58	};
59
60	/* U4: unpopulated SO8N footprint for any I2C M24 EEPROM */
61};
62
63&arduino_spi {
64	status = "okay";
65	cs-gpios = <&arduino_header  8 GPIO_ACTIVE_LOW>, /* U5: eeprom4 */
66		   <&arduino_header 15 GPIO_ACTIVE_LOW>, /* U6: eeprom5 */
67		   <&arduino_header 16 GPIO_ACTIVE_LOW>; /* U7: eeprom6 */
68
69	/*
70	 * All chip select pins have an on board 10k pull-up resistor to VCC,
71	 * and are connected to their respective arduino pins via a normally
72	 * closed solder bridge.
73	 *
74	 * All hold pins are connected to VCC with a 10k pull-up, and
75	 * have a connection to arduino pin A3 on CN8 via an open solder bridge.
76	 *
77	 * All write-protect pins are connected to J11 with a 10k pull-up
78	 * resistor. Where they can either be torn to VCC or GND.
79	 * Additionally they are connected to arduino pin A0 on CN8
80	 * via an open solder bridge.
81	 */
82
83	eeprom4_x_nucleo_eeprma2: eeprom_m95040@0 {
84		/* M95040-RMC6TG aka U5 (4 kbit eeprom in DFN8 package) */
85		compatible = "st,m95040", "st,m95xxx", "atmel,at25";
86		reg = <0x00>;
87		size = <512>;
88		pagesize = <16>;
89		address-width = <8>;
90		spi-max-frequency = <DT_FREQ_M(20)>;
91		timeout = <5>;
92
93		/* if solder-bridge closed: arduino A0 pin on CN8 can wp */
94		/* wp-gpios = <&arduino_header 0 GPIO_ACTIVE_LOW>; */
95	};
96
97	eeprom5_x_nucleo_eeprma2: eeprom_m95256@1 {
98		/* M95256-DFDW6TP aka U6 (256 kbit eeprom in TSSOP package) */
99		compatible = "st,m95256", "st,m95xxx", "atmel,at25";
100		reg = <0x01>;
101		size = <DT_SIZE_K(32)>;
102		pagesize = <64>;
103		address-width = <16>;
104		spi-max-frequency = <DT_FREQ_M(20)>;
105		timeout = <5>;
106
107		/* if solder-bridge closed: arduino A0 pin on CN8 can wp */
108		/* wp-gpios = <&arduino_header 0 GPIO_ACTIVE_LOW>; */
109	};
110
111	eeprom6_x_nucleo_eeprma2: eeprom_m95m04@2 {
112		/* M95M04-DRMN6TP aka U7 (4 Mbit eeprom in SON8 package) */
113		compatible = "st,m95m04", "st,m95xxx", "atmel,at25";
114		reg = <0x02>;
115		size = <DT_SIZE_K(512)>;
116		pagesize = <512>;
117		address-width = <24>;
118		/* max-frequency 10MHz for vcc>=2.5V and 5MHz for vcc>=1.8V */
119		spi-max-frequency = <DT_FREQ_M(10)>;
120		timeout = <5>;
121
122		/* if solder-bridge closed: arduino A0 pin on CN8 can wp */
123		/* wp-gpios = <&arduino_header 0 GPIO_ACTIVE_LOW>; */
124	};
125
126	/* U8: unpopulated SO8N footprint for any M95 SPI EEPROM */
127};
128