Kernel Newbies archive on lore.kernel.org
 help / Atom feed
* Why eeprom driver is read-only ?
@ 2018-11-19 12:08 ranshalit
  2018-11-19 12:08 ` Ranran
                   ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: ranshalit @ 2018-11-19 12:08 UTC (permalink / raw)
  To: kernelnewbies

Hello,

What is the reason that kernel driver of eeprom is configured only as
read-only ?

Is it because the BIOS is stored there ?

Is there a way to make it writable ?

Thank you,
Ran

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Why eeprom driver is read-only ?
  2018-11-19 12:08 Why eeprom driver is read-only ? ranshalit
@ 2018-11-19 12:08 ` Ranran
  2018-11-19 13:12 ` ruben
  2018-11-19 14:07 ` valdis.kletnieks
  2 siblings, 0 replies; 14+ messages in thread
From: Ranran @ 2018-11-19 12:08 UTC (permalink / raw)
  To: kernelnewbies

Hello,

What is the reason that kernel driver of eeprom is configured only as
read-only ?

Is it because the BIOS is stored there ?

Is there a way to make it writable ?

Thank you,
Ran

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Why eeprom driver is read-only ?
  2018-11-19 12:08 Why eeprom driver is read-only ? ranshalit
  2018-11-19 12:08 ` Ranran
@ 2018-11-19 13:12 ` ruben
  2018-11-19 13:12   ` Ruben Safir
                     ` (2 more replies)
  2018-11-19 14:07 ` valdis.kletnieks
  2 siblings, 3 replies; 14+ messages in thread
From: ruben @ 2018-11-19 13:12 UTC (permalink / raw)
  To: kernelnewbies

On 11/19/18 7:08 AM, Ranran wrote:
> Hello,
> 
> What is the reason that kernel driver of eeprom is configured only as
> read-only ?
> 
> Is it because the BIOS is stored there ?
> 
> Is there a way to make it writable ?
> 
> Thank you,
> Ran
> 
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
> 


because the ROM is read only?


-- 
So many immigrant groups have swept through our town
that Brooklyn, like Atlantis, reaches mythological
proportions in the mind of the world - RI Safir 1998
http://www.mrbrklyn.com
DRM is THEFT - We are the STAKEHOLDERS - RI Safir 2002

http://www.nylxs.com - Leadership Development in Free Software
http://www.brooklyn-living.com

Being so tracked is for FARM ANIMALS and and extermination camps,
but incompatible with living as a free human being. -RI Safir 2013

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Why eeprom driver is read-only ?
  2018-11-19 13:12 ` ruben
@ 2018-11-19 13:12   ` Ruben Safir
  2018-11-19 13:48   ` cmcvista
  2018-11-19 22:04   ` ranshalit
  2 siblings, 0 replies; 14+ messages in thread
From: Ruben Safir @ 2018-11-19 13:12 UTC (permalink / raw)
  To: kernelnewbies

On 11/19/18 7:08 AM, Ranran wrote:
> Hello,
> 
> What is the reason that kernel driver of eeprom is configured only as
> read-only ?
> 
> Is it because the BIOS is stored there ?
> 
> Is there a way to make it writable ?
> 
> Thank you,
> Ran
> 
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies@kernelnewbies.org
> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
> 


because the ROM is read only?


-- 
So many immigrant groups have swept through our town
that Brooklyn, like Atlantis, reaches mythological
proportions in the mind of the world - RI Safir 1998
http://www.mrbrklyn.com
DRM is THEFT - We are the STAKEHOLDERS - RI Safir 2002

http://www.nylxs.com - Leadership Development in Free Software
http://www.brooklyn-living.com

Being so tracked is for FARM ANIMALS and and extermination camps,
but incompatible with living as a free human being. -RI Safir 2013

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Why eeprom driver is read-only ?
  2018-11-19 13:12 ` ruben
  2018-11-19 13:12   ` Ruben Safir
@ 2018-11-19 13:48   ` cmcvista
  2018-11-19 13:48     ` Chriz Chow
  2018-11-19 22:04   ` ranshalit
  2 siblings, 1 reply; 14+ messages in thread
From: cmcvista @ 2018-11-19 13:48 UTC (permalink / raw)
  To: kernelnewbies

Hello,

It seems that some drivers in drivers/misc/eeprom does support write access. For example at24.c seems to have a function at24_write().

https://github.com/torvalds/linux/blob/master/drivers/misc/eeprom/at24.c

However some drivers doesn?t have write support, I believe it is because of simplicity - some eeprom are used for read only, such as ddr4 spd eeprom.

Point me out if I am wrong. 

Chriz

Enviado desde mi iPhone

> El 19 nov 2018, a las 9:12 p. m., Ruben Safir <ruben@mrbrklyn.com> escribi?:
> 
>> On 11/19/18 7:08 AM, Ranran wrote:
>> Hello,
>> 
>> What is the reason that kernel driver of eeprom is configured only as
>> read-only ?
>> 
>> Is it because the BIOS is stored there ?
>> 
>> Is there a way to make it writable ?
>> 
>> Thank you,
>> Ran
>> 
>> _______________________________________________
>> Kernelnewbies mailing list
>> Kernelnewbies at kernelnewbies.org
>> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>> 
> 
> 
> because the ROM is read only?
> 
> 
> -- 
> So many immigrant groups have swept through our town
> that Brooklyn, like Atlantis, reaches mythological
> proportions in the mind of the world - RI Safir 1998
> http://www.mrbrklyn.com
> DRM is THEFT - We are the STAKEHOLDERS - RI Safir 2002
> 
> http://www.nylxs.com - Leadership Development in Free Software
> http://www.brooklyn-living.com
> 
> Being so tracked is for FARM ANIMALS and and extermination camps,
> but incompatible with living as a free human being. -RI Safir 2013
> 
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20181119/26006023/attachment.html>

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Why eeprom driver is read-only ?
  2018-11-19 13:48   ` cmcvista
@ 2018-11-19 13:48     ` Chriz Chow
  0 siblings, 0 replies; 14+ messages in thread
From: Chriz Chow @ 2018-11-19 13:48 UTC (permalink / raw)
  To: Ruben Safir; +Cc: kernelnewbies

[-- Attachment #1.1: Type: text/plain, Size: 1737 bytes --]

Hello,

It seems that some drivers in drivers/misc/eeprom does support write access. For example at24.c seems to have a function at24_write().

https://github.com/torvalds/linux/blob/master/drivers/misc/eeprom/at24.c

However some drivers doesn’t have write support, I believe it is because of simplicity - some eeprom are used for read only, such as ddr4 spd eeprom.

Point me out if I am wrong. 

Chriz

Enviado desde mi iPhone

> El 19 nov 2018, a las 9:12 p. m., Ruben Safir <ruben@mrbrklyn.com> escribió:
> 
>> On 11/19/18 7:08 AM, Ranran wrote:
>> Hello,
>> 
>> What is the reason that kernel driver of eeprom is configured only as
>> read-only ?
>> 
>> Is it because the BIOS is stored there ?
>> 
>> Is there a way to make it writable ?
>> 
>> Thank you,
>> Ran
>> 
>> _______________________________________________
>> Kernelnewbies mailing list
>> Kernelnewbies@kernelnewbies.org
>> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>> 
> 
> 
> because the ROM is read only?
> 
> 
> -- 
> So many immigrant groups have swept through our town
> that Brooklyn, like Atlantis, reaches mythological
> proportions in the mind of the world - RI Safir 1998
> http://www.mrbrklyn.com
> DRM is THEFT - We are the STAKEHOLDERS - RI Safir 2002
> 
> http://www.nylxs.com - Leadership Development in Free Software
> http://www.brooklyn-living.com
> 
> Being so tracked is for FARM ANIMALS and and extermination camps,
> but incompatible with living as a free human being. -RI Safir 2013
> 
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies@kernelnewbies.org
> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

[-- Attachment #1.2: Type: text/html, Size: 3751 bytes --]

<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto">Hello,<div><br></div><div>It seems that some drivers in drivers/misc/eeprom does support write access. For example at24.c seems to have a function at24_write().</div><div><br></div><div><a href="https://github.com/torvalds/linux/blob/master/drivers/misc/eeprom/at24.c">https://github.com/torvalds/linux/blob/master/drivers/misc/eeprom/at24.c</a></div><div><br></div><div>However some drivers doesn’t have write support, I believe it is because of simplicity - some eeprom are used for read only, such as&nbsp;ddr4 spd eeprom.</div><div><br></div><div>Point me out if I am wrong.&nbsp;</div><div><br></div><div>Chriz</div><div><br><div id="AppleMailSignature" dir="ltr">Enviado desde mi iPhone</div><div dir="ltr"><br>El 19 nov 2018, a las 9:12 p. m., Ruben Safir &lt;<a href="mailto:ruben@mrbrklyn.com">ruben@mrbrklyn.com</a>&gt; escribió:<br><br></div><blockquote type="cite"><div dir="ltr"><span>On 11/19/18 7:08 AM, Ranran wrote:</span><br><blockquote type="cite"><span>Hello,</span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span>What is the reason that kernel driver of eeprom is configured only as</span><br></blockquote><blockquote type="cite"><span>read-only ?</span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span>Is it because the BIOS is stored there ?</span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span>Is there a way to make it writable ?</span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span>Thank you,</span><br></blockquote><blockquote type="cite"><span>Ran</span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span>_______________________________________________</span><br></blockquote><blockquote type="cite"><span>Kernelnewbies mailing list</span><br></blockquote><blockquote type="cite"><span><a href="mailto:Kernelnewbies@kernelnewbies.org">Kernelnewbies@kernelnewbies.org</a></span><br></blockquote><blockquote type="cite"><span><a href="https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies">https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a></span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><span></span><br><span></span><br><span>because the ROM is read only?</span><br><span></span><br><span></span><br><span>-- </span><br><span>So many immigrant groups have swept through our town</span><br><span>that Brooklyn, like Atlantis, reaches mythological</span><br><span>proportions in the mind of the world - RI Safir 1998</span><br><span><a href="http://www.mrbrklyn.com">http://www.mrbrklyn.com</a></span><br><span>DRM is THEFT - We are the STAKEHOLDERS - RI Safir 2002</span><br><span></span><br><span><a href="http://www.nylxs.com">http://www.nylxs.com</a> - Leadership Development in Free Software</span><br><span><a href="http://www.brooklyn-living.com">http://www.brooklyn-living.com</a></span><br><span></span><br><span>Being so tracked is for FARM ANIMALS and and extermination camps,</span><br><span>but incompatible with living as a free human being. -RI Safir 2013</span><br><span></span><br><span>_______________________________________________</span><br><span>Kernelnewbies mailing list</span><br><span><a href="mailto:Kernelnewbies@kernelnewbies.org">Kernelnewbies@kernelnewbies.org</a></span><br><span><a href="https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies">https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a></span><br></div></blockquote></div></body></html>

[-- Attachment #2: Type: text/plain, Size: 170 bytes --]

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Why eeprom driver is read-only ?
  2018-11-19 12:08 Why eeprom driver is read-only ? ranshalit
  2018-11-19 12:08 ` Ranran
  2018-11-19 13:12 ` ruben
@ 2018-11-19 14:07 ` valdis.kletnieks
  2018-11-19 14:07   ` valdis.kletnieks
  2 siblings, 1 reply; 14+ messages in thread
From: valdis.kletnieks @ 2018-11-19 14:07 UTC (permalink / raw)
  To: kernelnewbies

On Mon, 19 Nov 2018 14:08:26 +0200, Ranran said:

> What is the reason that kernel driver of eeprom is configured only as
> read-only ?

Probably depends on the hardware.  I'm pretty sure that *some* eeproms
are writable.

> Is it because the BIOS is stored there ?

Remember that the BIOS is stored in one of what may be several eeproms in the
system - graphics cards and other controllers probably have their own eeproms.

You might want to think about why most systems do a restart after updating the BIOS,
and then ask yourself if you really want to write to it while the system is up....

> Is there a way to make it writable ?

Depends on which eeprom you're talking about.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 486 bytes
Desc: not available
URL: <http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20181119/63c92451/attachment.sig>

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Why eeprom driver is read-only ?
  2018-11-19 14:07 ` valdis.kletnieks
@ 2018-11-19 14:07   ` valdis.kletnieks
  0 siblings, 0 replies; 14+ messages in thread
From: valdis.kletnieks @ 2018-11-19 14:07 UTC (permalink / raw)
  To: Ranran; +Cc: kernelnewbies

[-- Attachment #1.1: Type: text/plain, Size: 680 bytes --]

On Mon, 19 Nov 2018 14:08:26 +0200, Ranran said:

> What is the reason that kernel driver of eeprom is configured only as
> read-only ?

Probably depends on the hardware.  I'm pretty sure that *some* eeproms
are writable.

> Is it because the BIOS is stored there ?

Remember that the BIOS is stored in one of what may be several eeproms in the
system - graphics cards and other controllers probably have their own eeproms.

You might want to think about why most systems do a restart after updating the BIOS,
and then ask yourself if you really want to write to it while the system is up....

> Is there a way to make it writable ?

Depends on which eeprom you're talking about.

[-- Attachment #1.2: Type: application/pgp-signature, Size: 486 bytes --]

[-- Attachment #2: Type: text/plain, Size: 170 bytes --]

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Why eeprom driver is read-only ?
  2018-11-19 13:12 ` ruben
  2018-11-19 13:12   ` Ruben Safir
  2018-11-19 13:48   ` cmcvista
@ 2018-11-19 22:04   ` ranshalit
  2018-11-19 22:04     ` Ranran
  2018-11-19 22:32     ` valdis.kletnieks
  2 siblings, 2 replies; 14+ messages in thread
From: ranshalit @ 2018-11-19 22:04 UTC (permalink / raw)
  To: kernelnewbies

On Mon, Nov 19, 2018 at 3:13 PM Ruben Safir <ruben@mrbrklyn.com> wrote:
>
> On 11/19/18 7:08 AM, Ranran wrote:
> > Hello,
> >
> > What is the reason that kernel driver of eeprom is configured only as
> > read-only ?
> >
> > Is it because the BIOS is stored there ?
> >
> > Is there a way to make it writable ?
> >
> > Thank you,
> > Ran
> >
> > _______________________________________________
> > Kernelnewbies mailing list
> > Kernelnewbies at kernelnewbies.org
> > https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
> >
>
>
> because the ROM is read only?
>

That's interesting...
I think the name is confusing, because this chips are also writable.

Not only this, but in arm the eeprom (at24) is writable!
But in the x86 I am using, it is readonly in kernel code:
https://android.googlesource.com/kernel/omap/+/glass-omap-xrr02/drivers/misc/eeprom/eeprom.c
static struct bin_attribute eeprom_attr = {
.attr = {
.name = "eeprom",
.mode = S_IRUGO,
},
.size = EEPROM_SIZE,
.read = eeprom_read,
};

Regards,
ran



>
> --
> So many immigrant groups have swept through our town
> that Brooklyn, like Atlantis, reaches mythological
> proportions in the mind of the world - RI Safir 1998
> http://www.mrbrklyn.com
> DRM is THEFT - We are the STAKEHOLDERS - RI Safir 2002
>
> http://www.nylxs.com - Leadership Development in Free Software
> http://www.brooklyn-living.com
>
> Being so tracked is for FARM ANIMALS and and extermination camps,
> but incompatible with living as a free human being. -RI Safir 2013
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Why eeprom driver is read-only ?
  2018-11-19 22:04   ` ranshalit
@ 2018-11-19 22:04     ` Ranran
  2018-11-19 22:32     ` valdis.kletnieks
  1 sibling, 0 replies; 14+ messages in thread
From: Ranran @ 2018-11-19 22:04 UTC (permalink / raw)
  To: ruben; +Cc: kernelnewbies

On Mon, Nov 19, 2018 at 3:13 PM Ruben Safir <ruben@mrbrklyn.com> wrote:
>
> On 11/19/18 7:08 AM, Ranran wrote:
> > Hello,
> >
> > What is the reason that kernel driver of eeprom is configured only as
> > read-only ?
> >
> > Is it because the BIOS is stored there ?
> >
> > Is there a way to make it writable ?
> >
> > Thank you,
> > Ran
> >
> > _______________________________________________
> > Kernelnewbies mailing list
> > Kernelnewbies@kernelnewbies.org
> > https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
> >
>
>
> because the ROM is read only?
>

That's interesting...
I think the name is confusing, because this chips are also writable.

Not only this, but in arm the eeprom (at24) is writable!
But in the x86 I am using, it is readonly in kernel code:
https://android.googlesource.com/kernel/omap/+/glass-omap-xrr02/drivers/misc/eeprom/eeprom.c
static struct bin_attribute eeprom_attr = {
.attr = {
.name = "eeprom",
.mode = S_IRUGO,
},
.size = EEPROM_SIZE,
.read = eeprom_read,
};

Regards,
ran



>
> --
> So many immigrant groups have swept through our town
> that Brooklyn, like Atlantis, reaches mythological
> proportions in the mind of the world - RI Safir 1998
> http://www.mrbrklyn.com
> DRM is THEFT - We are the STAKEHOLDERS - RI Safir 2002
>
> http://www.nylxs.com - Leadership Development in Free Software
> http://www.brooklyn-living.com
>
> Being so tracked is for FARM ANIMALS and and extermination camps,
> but incompatible with living as a free human being. -RI Safir 2013
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies@kernelnewbies.org
> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Why eeprom driver is read-only ?
  2018-11-19 22:04   ` ranshalit
  2018-11-19 22:04     ` Ranran
@ 2018-11-19 22:32     ` valdis.kletnieks
  2018-11-19 22:32       ` valdis.kletnieks
  2018-11-20  6:44       ` ranshalit
  1 sibling, 2 replies; 14+ messages in thread
From: valdis.kletnieks @ 2018-11-19 22:32 UTC (permalink / raw)
  To: kernelnewbies

On Tue, 20 Nov 2018 00:04:03 +0200, Ranran said:

> That's interesting...
> I think the name is confusing, because this chips are also writable.
>
> Not only this, but in arm the eeprom (at24) is writable!
> But in the x86 I am using, it is readonly in kernel code:
> https://android.googlesource.com/kernel/omap/+/glass-omap-xrr02/drivers/misc/eeprom/eeprom.c
> static struct bin_attribute eeprom_attr = {
> .attr = {
> .name = "eeprom",
> .mode = S_IRUGO,
> },
> .size = EEPROM_SIZE,
> .read = eeprom_read,
> };

Well, at least in the mainline kernel, we have this at the top of the eeprom.c file:

/* Addresses to scan */
static const unsigned short normal_i2c[] = { 0x50, 0x51, 0x52, 0x53, 0x54,
                                        0x55, 0x56, 0x57, I2C_CLIENT_END };


/* Size of EEPROM in bytes */
#define EEPROM_SIZE             256

which is pretty obviously intended for "very small eeprom hanging off an I2C adapter",
and thus probably *NOT* the boot ROM that the BIOS lives in.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 486 bytes
Desc: not available
URL: <http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20181119/20996617/attachment.sig>

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Why eeprom driver is read-only ?
  2018-11-19 22:32     ` valdis.kletnieks
@ 2018-11-19 22:32       ` valdis.kletnieks
  2018-11-20  6:44       ` ranshalit
  1 sibling, 0 replies; 14+ messages in thread
From: valdis.kletnieks @ 2018-11-19 22:32 UTC (permalink / raw)
  To: Ranran; +Cc: ruben, kernelnewbies

[-- Attachment #1.1: Type: text/plain, Size: 993 bytes --]

On Tue, 20 Nov 2018 00:04:03 +0200, Ranran said:

> That's interesting...
> I think the name is confusing, because this chips are also writable.
>
> Not only this, but in arm the eeprom (at24) is writable!
> But in the x86 I am using, it is readonly in kernel code:
> https://android.googlesource.com/kernel/omap/+/glass-omap-xrr02/drivers/misc/eeprom/eeprom.c
> static struct bin_attribute eeprom_attr = {
> .attr = {
> .name = "eeprom",
> .mode = S_IRUGO,
> },
> .size = EEPROM_SIZE,
> .read = eeprom_read,
> };

Well, at least in the mainline kernel, we have this at the top of the eeprom.c file:

/* Addresses to scan */
static const unsigned short normal_i2c[] = { 0x50, 0x51, 0x52, 0x53, 0x54,
                                        0x55, 0x56, 0x57, I2C_CLIENT_END };


/* Size of EEPROM in bytes */
#define EEPROM_SIZE             256

which is pretty obviously intended for "very small eeprom hanging off an I2C adapter",
and thus probably *NOT* the boot ROM that the BIOS lives in.

[-- Attachment #1.2: Type: application/pgp-signature, Size: 486 bytes --]

[-- Attachment #2: Type: text/plain, Size: 170 bytes --]

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Why eeprom driver is read-only ?
  2018-11-19 22:32     ` valdis.kletnieks
  2018-11-19 22:32       ` valdis.kletnieks
@ 2018-11-20  6:44       ` ranshalit
  2018-11-20  6:44         ` Ranran
  1 sibling, 1 reply; 14+ messages in thread
From: ranshalit @ 2018-11-20  6:44 UTC (permalink / raw)
  To: kernelnewbies

On Tue, Nov 20, 2018 at 12:32 AM <valdis.kletnieks@vt.edu> wrote:
>
> On Tue, 20 Nov 2018 00:04:03 +0200, Ranran said:
>
> > That's interesting...
> > I think the name is confusing, because this chips are also writable.
> >
> > Not only this, but in arm the eeprom (at24) is writable!
> > But in the x86 I am using, it is readonly in kernel code:
> > https://android.googlesource.com/kernel/omap/+/glass-omap-xrr02/drivers/misc/eeprom/eeprom.c
> > static struct bin_attribute eeprom_attr = {
> > .attr = {
> > .name = "eeprom",
> > .mode = S_IRUGO,
> > },
> > .size = EEPROM_SIZE,
> > .read = eeprom_read,
> > };
>
> Well, at least in the mainline kernel, we have this at the top of the eeprom.c file:
>
> /* Addresses to scan */
> static const unsigned short normal_i2c[] = { 0x50, 0x51, 0x52, 0x53, 0x54,
>                                         0x55, 0x56, 0x57, I2C_CLIENT_END };
>
>
> /* Size of EEPROM in bytes */
> #define EEPROM_SIZE             256
>
> which is pretty obviously intended for "very small eeprom hanging off an I2C adapter",
> and thus probably *NOT* the boot ROM that the BIOS lives in.

although I think that in my system it is a flash rom which stores the
BIOS, so I really don't know what's the use of the eeprom....

I need a very small amout of data (several bytes) to save some non
volatile information in x86 system.
I can't use disk for this, but can use any other peripheral or even
x86 chip on board.
Now it also seems that I can't use the eeprom becuase of the kernel
limitation (can I open it for writing if the BIOS is not stored
there??)

I don't have any idea where I can find such storage.
Does x86 include some programmable registers ?
Do you have any idea where I can store the data ?

Thanks

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Why eeprom driver is read-only ?
  2018-11-20  6:44       ` ranshalit
@ 2018-11-20  6:44         ` Ranran
  0 siblings, 0 replies; 14+ messages in thread
From: Ranran @ 2018-11-20  6:44 UTC (permalink / raw)
  To: Valdis Kletnieks; +Cc: ruben, kernelnewbies

On Tue, Nov 20, 2018 at 12:32 AM <valdis.kletnieks@vt.edu> wrote:
>
> On Tue, 20 Nov 2018 00:04:03 +0200, Ranran said:
>
> > That's interesting...
> > I think the name is confusing, because this chips are also writable.
> >
> > Not only this, but in arm the eeprom (at24) is writable!
> > But in the x86 I am using, it is readonly in kernel code:
> > https://android.googlesource.com/kernel/omap/+/glass-omap-xrr02/drivers/misc/eeprom/eeprom.c
> > static struct bin_attribute eeprom_attr = {
> > .attr = {
> > .name = "eeprom",
> > .mode = S_IRUGO,
> > },
> > .size = EEPROM_SIZE,
> > .read = eeprom_read,
> > };
>
> Well, at least in the mainline kernel, we have this at the top of the eeprom.c file:
>
> /* Addresses to scan */
> static const unsigned short normal_i2c[] = { 0x50, 0x51, 0x52, 0x53, 0x54,
>                                         0x55, 0x56, 0x57, I2C_CLIENT_END };
>
>
> /* Size of EEPROM in bytes */
> #define EEPROM_SIZE             256
>
> which is pretty obviously intended for "very small eeprom hanging off an I2C adapter",
> and thus probably *NOT* the boot ROM that the BIOS lives in.

although I think that in my system it is a flash rom which stores the
BIOS, so I really don't know what's the use of the eeprom....

I need a very small amout of data (several bytes) to save some non
volatile information in x86 system.
I can't use disk for this, but can use any other peripheral or even
x86 chip on board.
Now it also seems that I can't use the eeprom becuase of the kernel
limitation (can I open it for writing if the BIOS is not stored
there??)

I don't have any idea where I can find such storage.
Does x86 include some programmable registers ?
Do you have any idea where I can store the data ?

Thanks

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, back to index

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-19 12:08 Why eeprom driver is read-only ? ranshalit
2018-11-19 12:08 ` Ranran
2018-11-19 13:12 ` ruben
2018-11-19 13:12   ` Ruben Safir
2018-11-19 13:48   ` cmcvista
2018-11-19 13:48     ` Chriz Chow
2018-11-19 22:04   ` ranshalit
2018-11-19 22:04     ` Ranran
2018-11-19 22:32     ` valdis.kletnieks
2018-11-19 22:32       ` valdis.kletnieks
2018-11-20  6:44       ` ranshalit
2018-11-20  6:44         ` Ranran
2018-11-19 14:07 ` valdis.kletnieks
2018-11-19 14:07   ` valdis.kletnieks

Kernel Newbies archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/kernelnewbies/0 kernelnewbies/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 kernelnewbies kernelnewbies/ https://lore.kernel.org/kernelnewbies \
		kernelnewbies@kernelnewbies.org kernelnewbies@archiver.kernel.org
	public-inbox-index kernelnewbies


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernelnewbies.kernelnewbies


AGPL code for this site: git clone https://public-inbox.org/ public-inbox