diff mbox series

[U-Boot,11/20] w1: enumerate sandbox driver if configured

Message ID 1531994288-19423-12-git-send-email-eugen.hristev@microchip.com
State Superseded
Delegated to: Tom Rini
Headers show
Series Add support for 1wire protocol and 1wire eeproms | expand

Commit Message

Eugen Hristev July 19, 2018, 9:57 a.m. UTC
Add a sandbox eeprom on the bus as a device, if sandbox driver is configured.

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
---
 drivers/w1/w1-uclass.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Lukasz Majewski July 20, 2018, 2:01 p.m. UTC | #1
Hi Eugen,

Thanks for (re-)bringing the One wire support to u-boot.

> Add a sandbox eeprom on the bus as a device, if sandbox driver is
> configured.
> 
> Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
> ---
>  drivers/w1/w1-uclass.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/w1/w1-uclass.c b/drivers/w1/w1-uclass.c
> index cfddda3..e58c1ca 100644
> --- a/drivers/w1/w1-uclass.c
> +++ b/drivers/w1/w1-uclass.c
> @@ -142,6 +142,11 @@ static int w1_enumerate(struct udevice *bus)
>  		}
>  	}
>  
> +#ifdef CONFIG_W1_EEPROM_SANDBOX
> +	/* before we are finished, add a sandbox device if we can */
> +	w1_new_device(bus, W1_FAMILY_EEP_SANDBOX);
> +#endif

IMHO we shouldn't mix the sandbox code with production (on boards) code.

Maybe Simon (+CCed) could provide some more input here?

> +
>  	return 0;
>  }
>  




Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de
Simon Glass July 23, 2018, 11:48 p.m. UTC | #2
Hi,

On 20 July 2018 at 08:01, Lukasz Majewski <lukma@denx.de> wrote:
> Hi Eugen,
>
> Thanks for (re-)bringing the One wire support to u-boot.
>
>> Add a sandbox eeprom on the bus as a device, if sandbox driver is
>> configured.
>>
>> Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
>> ---
>>  drivers/w1/w1-uclass.c | 5 +++++
>>  1 file changed, 5 insertions(+)
>>
>> diff --git a/drivers/w1/w1-uclass.c b/drivers/w1/w1-uclass.c
>> index cfddda3..e58c1ca 100644
>> --- a/drivers/w1/w1-uclass.c
>> +++ b/drivers/w1/w1-uclass.c
>> @@ -142,6 +142,11 @@ static int w1_enumerate(struct udevice *bus)
>>               }
>>       }
>>
>> +#ifdef CONFIG_W1_EEPROM_SANDBOX
>> +     /* before we are finished, add a sandbox device if we can */
>> +     w1_new_device(bus, W1_FAMILY_EEP_SANDBOX);
>> +#endif
>
> IMHO we shouldn't mix the sandbox code with production (on boards) code.
>
> Maybe Simon (+CCed) could provide some more input here?

I have not seen this series. But new devices should be created
automatically based on them being in the device tree. So you should
just be able to add them there.

I don't understand what w1_new_device() does. Also, it should return an error.

Regards,
Simon
Maxime Ripard July 24, 2018, 6:58 a.m. UTC | #3
On Mon, Jul 23, 2018 at 05:48:25PM -0600, Simon Glass wrote:
> Hi,
> 
> On 20 July 2018 at 08:01, Lukasz Majewski <lukma@denx.de> wrote:
> > Hi Eugen,
> >
> > Thanks for (re-)bringing the One wire support to u-boot.
> >
> >> Add a sandbox eeprom on the bus as a device, if sandbox driver is
> >> configured.
> >>
> >> Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
> >> ---
> >>  drivers/w1/w1-uclass.c | 5 +++++
> >>  1 file changed, 5 insertions(+)
> >>
> >> diff --git a/drivers/w1/w1-uclass.c b/drivers/w1/w1-uclass.c
> >> index cfddda3..e58c1ca 100644
> >> --- a/drivers/w1/w1-uclass.c
> >> +++ b/drivers/w1/w1-uclass.c
> >> @@ -142,6 +142,11 @@ static int w1_enumerate(struct udevice *bus)
> >>               }
> >>       }
> >>
> >> +#ifdef CONFIG_W1_EEPROM_SANDBOX
> >> +     /* before we are finished, add a sandbox device if we can */
> >> +     w1_new_device(bus, W1_FAMILY_EEP_SANDBOX);
> >> +#endif
> >
> > IMHO we shouldn't mix the sandbox code with production (on boards) code.
> >
> > Maybe Simon (+CCed) could provide some more input here?
> 
> I have not seen this series. But new devices should be created
> automatically based on them being in the device tree. So you should
> just be able to add them there.

1-Wire is discoverable, so there's no device nodes in the DT.

Maxime
Simon Glass July 24, 2018, 3:28 p.m. UTC | #4
Hi Maxime,

On 24 July 2018 at 00:58, Maxime Ripard <maxime.ripard@bootlin.com> wrote:
> On Mon, Jul 23, 2018 at 05:48:25PM -0600, Simon Glass wrote:
>> Hi,
>>
>> On 20 July 2018 at 08:01, Lukasz Majewski <lukma@denx.de> wrote:
>> > Hi Eugen,
>> >
>> > Thanks for (re-)bringing the One wire support to u-boot.
>> >
>> >> Add a sandbox eeprom on the bus as a device, if sandbox driver is
>> >> configured.
>> >>
>> >> Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
>> >> ---
>> >>  drivers/w1/w1-uclass.c | 5 +++++
>> >>  1 file changed, 5 insertions(+)
>> >>
>> >> diff --git a/drivers/w1/w1-uclass.c b/drivers/w1/w1-uclass.c
>> >> index cfddda3..e58c1ca 100644
>> >> --- a/drivers/w1/w1-uclass.c
>> >> +++ b/drivers/w1/w1-uclass.c
>> >> @@ -142,6 +142,11 @@ static int w1_enumerate(struct udevice *bus)
>> >>               }
>> >>       }
>> >>
>> >> +#ifdef CONFIG_W1_EEPROM_SANDBOX
>> >> +     /* before we are finished, add a sandbox device if we can */
>> >> +     w1_new_device(bus, W1_FAMILY_EEP_SANDBOX);
>> >> +#endif
>> >
>> > IMHO we shouldn't mix the sandbox code with production (on boards) code.
>> >
>> > Maybe Simon (+CCed) could provide some more input here?
>>
>> I have not seen this series. But new devices should be created
>> automatically based on them being in the device tree. So you should
>> just be able to add them there.
>
> 1-Wire is discoverable, so there's no device nodes in the DT.

Well there should be. See for example PCI, USB, I2C and SPI :-)

Regards,
Simon
Maxime Ripard July 25, 2018, 9:15 a.m. UTC | #5
On Tue, Jul 24, 2018 at 09:28:30AM -0600, Simon Glass wrote:
> Hi Maxime,
> 
> On 24 July 2018 at 00:58, Maxime Ripard <maxime.ripard@bootlin.com> wrote:
> > On Mon, Jul 23, 2018 at 05:48:25PM -0600, Simon Glass wrote:
> >> Hi,
> >>
> >> On 20 July 2018 at 08:01, Lukasz Majewski <lukma@denx.de> wrote:
> >> > Hi Eugen,
> >> >
> >> > Thanks for (re-)bringing the One wire support to u-boot.
> >> >
> >> >> Add a sandbox eeprom on the bus as a device, if sandbox driver is
> >> >> configured.
> >> >>
> >> >> Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
> >> >> ---
> >> >>  drivers/w1/w1-uclass.c | 5 +++++
> >> >>  1 file changed, 5 insertions(+)
> >> >>
> >> >> diff --git a/drivers/w1/w1-uclass.c b/drivers/w1/w1-uclass.c
> >> >> index cfddda3..e58c1ca 100644
> >> >> --- a/drivers/w1/w1-uclass.c
> >> >> +++ b/drivers/w1/w1-uclass.c
> >> >> @@ -142,6 +142,11 @@ static int w1_enumerate(struct udevice *bus)
> >> >>               }
> >> >>       }
> >> >>
> >> >> +#ifdef CONFIG_W1_EEPROM_SANDBOX
> >> >> +     /* before we are finished, add a sandbox device if we can */
> >> >> +     w1_new_device(bus, W1_FAMILY_EEP_SANDBOX);
> >> >> +#endif
> >> >
> >> > IMHO we shouldn't mix the sandbox code with production (on boards) code.
> >> >
> >> > Maybe Simon (+CCed) could provide some more input here?
> >>
> >> I have not seen this series. But new devices should be created
> >> automatically based on them being in the device tree. So you should
> >> just be able to add them there.
> >
> > 1-Wire is discoverable, so there's no device nodes in the DT.
> 
> Well there should be. See for example PCI, USB, I2C and SPI :-)

I didn't know u-boot's sandbox had binding for USB and PCI devices. My
bad :)

Maxime
diff mbox series

Patch

diff --git a/drivers/w1/w1-uclass.c b/drivers/w1/w1-uclass.c
index cfddda3..e58c1ca 100644
--- a/drivers/w1/w1-uclass.c
+++ b/drivers/w1/w1-uclass.c
@@ -142,6 +142,11 @@  static int w1_enumerate(struct udevice *bus)
 		}
 	}
 
+#ifdef CONFIG_W1_EEPROM_SANDBOX
+	/* before we are finished, add a sandbox device if we can */
+	w1_new_device(bus, W1_FAMILY_EEP_SANDBOX);
+#endif
+
 	return 0;
 }