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