How do I define an i2c device that has multiple addresses.

I have a 2 Mbit EEPROM, normally I would configure the overlay as follows:

	m24m02: m24m02@50 {
		compatible = "atmel,at24";
		reg = <0x50>;
		size = <262144>;
		pagesize = <256>;
		address-width = <16>;  // Max address length = 16 we need 18!
		timeout = <5>;
		//label = "M24M02E";    // Label depricated.
		//wp-gpios = <&gpio0 22 (GPIO_PULL_DOWN | GPIO_ACTIVE_LOW)>;
		//supply-gpios = <&gpio0 7 GPIO_PULL_DOWN>;
		status = "okay";
	};

But the M24M02 eeprom uses 4 addresses to access 4 blocks of memory within the device, 50, 51, 52, 53.

So my question is how do I configure the overlay so that the driver can access 4 addresses depenedent of the memory address to be accessed?

Do I have to define 4 different devices?

Many thanks

Chris

Parents Reply
  • Hi Kazi,

    No unfortunately in that example they are actually defining 3 different size EEPROMs I guess their development kit has 3 different size devices on their PCB.

    My issue is that the M24M02 is a 2 Mbit (256K) eeprom. Given eeproms have only 2 x 8 bit address bytes (16 bits) but to access 2 Mbit (256K) you need 18 bits of address.  ST use a 2 bit field in the eeprom address register for the extra 2 bits required.

    Which means you have to address the eeprom at 4 different addresses (50, 51, 52, 53) each address can access 64K of the eeprom array, making a total of 256k.

    Regards

    Chris

Children
Related