Re: [RFC PATCH 00/16] Introduce ICSSG Ethernet driver

2024-01-09 Thread Roger Quadros



On 09/01/2024 11:49, MD Danish Anwar wrote:
> 
> 
> On 09/01/24 2:56 pm, Roger Quadros wrote:
>>
>>
>> On 08/01/2024 12:25, MD Danish Anwar wrote:
>>> On 08/01/24 3:00 pm, Roger Quadros wrote:


 On 05/01/2024 12:15, Anwar, Md Danish wrote:
>
>
> On 1/5/2024 1:49 PM, Roger Quadros wrote:
>>
>>
>> On 03/01/2024 12:27, MD Danish Anwar wrote:
>>>
>>>
>>> On 02/01/24 7:26 pm, Andrew Davis wrote:
 On 12/27/23 12:56 AM, MD Danish Anwar wrote:
>
>
> On 22/12/23 6:13 pm, Roger Quadros wrote:
>>
>> On 22/12/2023 12:26, MD Danish Anwar wrote:
>>> Hi Roger,
>>>
>>> On 20/12/23 3:29 pm, Roger Quadros wrote:
 Hi,

 On 19/12/2023 12:11, MD Danish Anwar wrote:
> Introduce ICSSG PRUETH support in uboot. The ICSSG driver is used
> in TI
> AM654 SR2.0.
>
> The ICSSG PRU Sub-system runs on EMAC firmware. This series
> Introduces
> support for ICSSG driver in uboot. This series also adds the 
> driver's
> dependencies.
>
> The ICSSG2 node is added in device tree overlay so that it 
> remains in
> sync with linux kernel.
>
> The series introduces device tree and config changes and AM65x
> to enable ICSSG driver. The series also enables
> SPL_LOAD_FIT_APPLY_OVERLAY
> for AM65x in order to load overlay over spl.
>
> This series has been tested on AM65x SR2.0, and the ICSSG
> interface is
> able to ping / dhcp and boot kernel using tftp in uboot.
>
> To use ICSSG2 ethernet, the ICSSG firmware needs to be loaded to
> PRU RPROC
> cores and RPROC cores need to be booted with the firmware. This
> step is
> done inside driver in kernel as kernel supports APIs like
> rproc_set_firmware() and rproc_fw_boot(). But as u-boot doesn't
> have these
> APIs, the same needs to be done via u-boot cmds.
>
> To make sure icssg-eth works we need to do below steps.
>
> 1. Initialize rproc cores i.e. rproc_init()
> 2. Load $firmware_file from partition '1:2' (root) on device (mmc
> in this
>     example)
> 3. Load the firmware file to rproc cores passing. i.e. 
> rproc_load()
>     taking rproc_id, loadaddr and file size as arguments.
> 4. Start rproc cores. i.e. rproc_start() taking rproc_id as 
> arguments
>
> The above steps are done by running the below commands at u-boot
> prompt.
>
> => setenv start_icssg2 'rproc start 14; rproc start 15; rproc
> start 16; rproc start 17; rproc start 18; rproc start 19'
> => setenv stop_icssg2 'rproc stop 14; rproc stop 15; rproc stop
> 16; rproc stop 17; rproc stop 18; rproc stop 19'
> => setenv firmware_dir '/lib/firmware/ti-pruss'
> => setenv get_firmware_mmc 'load mmc ${bootpart} ${loadaddr}
> ${firmware_dir}/${firmware_file}'
>
> => setenv init_icssg2 'setenv ethact icssg2-eth; setenv autoload
> no; rproc init; setenv loadaddr 0x8000; \
>  setenv firmware_file am65x-sr2-pru0-prueth-fw.elf; run
> get_firmware_mmc;  rproc load 14 0x8000 ${filesize}; \
>  setenv loadaddr 0x8900; setenv firmware_file
> am65x-sr2-rtu0-prueth-fw.elf; run get_firmware_mmc; rproc load 15
> 0x8900 ${filesize}; \
>  setenv loadaddr 0x9000; setenv firmware_file
> am65x-sr2-txpru0-prueth-fw.elf; run get_firmware_mmc; rproc load
> 16 0x9000 ${filesize}; \
>  setenv loadaddr 0x8000; setenv firmware_file
> am65x-sr2-pru1-prueth-fw.elf; run get_firmware_mmc; rproc load 17
> 0x8000 ${filesize}; \
>  setenv loadaddr 0x8900; setenv firmware_file
> am65x-sr2-rtu1-prueth-fw.elf; run get_firmware_mmc; rproc load 18
> 0x8900 ${filesize}; \
>  setenv loadaddr 0x9000; setenv firmware_file
> am65x-sr2-txpru1-prueth-fw.elf; run get_firmware_mmc; rproc load
> 19 0x9000 ${filesize}; \
>  run start_icssg2;'

 A whole bunch of commands are required to get ethernet functional.
 This is not at all user friendly and will be a maintenance 
 nightmare.
 What worries me is tracking the 6 different rproc cores and the 6
 different firmware files to start 1 ethernet device.
>>>

Re: [RFC PATCH 00/16] Introduce ICSSG Ethernet driver

2024-01-09 Thread MD Danish Anwar



On 09/01/24 2:56 pm, Roger Quadros wrote:
> 
> 
> On 08/01/2024 12:25, MD Danish Anwar wrote:
>> On 08/01/24 3:00 pm, Roger Quadros wrote:
>>>
>>>
>>> On 05/01/2024 12:15, Anwar, Md Danish wrote:


 On 1/5/2024 1:49 PM, Roger Quadros wrote:
>
>
> On 03/01/2024 12:27, MD Danish Anwar wrote:
>>
>>
>> On 02/01/24 7:26 pm, Andrew Davis wrote:
>>> On 12/27/23 12:56 AM, MD Danish Anwar wrote:


 On 22/12/23 6:13 pm, Roger Quadros wrote:
>
> On 22/12/2023 12:26, MD Danish Anwar wrote:
>> Hi Roger,
>>
>> On 20/12/23 3:29 pm, Roger Quadros wrote:
>>> Hi,
>>>
>>> On 19/12/2023 12:11, MD Danish Anwar wrote:
 Introduce ICSSG PRUETH support in uboot. The ICSSG driver is used
 in TI
 AM654 SR2.0.

 The ICSSG PRU Sub-system runs on EMAC firmware. This series
 Introduces
 support for ICSSG driver in uboot. This series also adds the 
 driver's
 dependencies.

 The ICSSG2 node is added in device tree overlay so that it remains 
 in
 sync with linux kernel.

 The series introduces device tree and config changes and AM65x
 to enable ICSSG driver. The series also enables
 SPL_LOAD_FIT_APPLY_OVERLAY
 for AM65x in order to load overlay over spl.

 This series has been tested on AM65x SR2.0, and the ICSSG
 interface is
 able to ping / dhcp and boot kernel using tftp in uboot.

 To use ICSSG2 ethernet, the ICSSG firmware needs to be loaded to
 PRU RPROC
 cores and RPROC cores need to be booted with the firmware. This
 step is
 done inside driver in kernel as kernel supports APIs like
 rproc_set_firmware() and rproc_fw_boot(). But as u-boot doesn't
 have these
 APIs, the same needs to be done via u-boot cmds.

 To make sure icssg-eth works we need to do below steps.

 1. Initialize rproc cores i.e. rproc_init()
 2. Load $firmware_file from partition '1:2' (root) on device (mmc
 in this
     example)
 3. Load the firmware file to rproc cores passing. i.e. rproc_load()
     taking rproc_id, loadaddr and file size as arguments.
 4. Start rproc cores. i.e. rproc_start() taking rproc_id as 
 arguments

 The above steps are done by running the below commands at u-boot
 prompt.

 => setenv start_icssg2 'rproc start 14; rproc start 15; rproc
 start 16; rproc start 17; rproc start 18; rproc start 19'
 => setenv stop_icssg2 'rproc stop 14; rproc stop 15; rproc stop
 16; rproc stop 17; rproc stop 18; rproc stop 19'
 => setenv firmware_dir '/lib/firmware/ti-pruss'
 => setenv get_firmware_mmc 'load mmc ${bootpart} ${loadaddr}
 ${firmware_dir}/${firmware_file}'

 => setenv init_icssg2 'setenv ethact icssg2-eth; setenv autoload
 no; rproc init; setenv loadaddr 0x8000; \
  setenv firmware_file am65x-sr2-pru0-prueth-fw.elf; run
 get_firmware_mmc;  rproc load 14 0x8000 ${filesize}; \
  setenv loadaddr 0x8900; setenv firmware_file
 am65x-sr2-rtu0-prueth-fw.elf; run get_firmware_mmc; rproc load 15
 0x8900 ${filesize}; \
  setenv loadaddr 0x9000; setenv firmware_file
 am65x-sr2-txpru0-prueth-fw.elf; run get_firmware_mmc; rproc load
 16 0x9000 ${filesize}; \
  setenv loadaddr 0x8000; setenv firmware_file
 am65x-sr2-pru1-prueth-fw.elf; run get_firmware_mmc; rproc load 17
 0x8000 ${filesize}; \
  setenv loadaddr 0x8900; setenv firmware_file
 am65x-sr2-rtu1-prueth-fw.elf; run get_firmware_mmc; rproc load 18
 0x8900 ${filesize}; \
  setenv loadaddr 0x9000; setenv firmware_file
 am65x-sr2-txpru1-prueth-fw.elf; run get_firmware_mmc; rproc load
 19 0x9000 ${filesize}; \
  run start_icssg2;'
>>>
>>> A whole bunch of commands are required to get ethernet functional.
>>> This is not at all user friendly and will be a maintenance 
>>> nightmare.
>>> What worries me is tracking the 6 different rproc cores and the 6
>>> different firmware files to start 1 ethernet device.
>>> This will get even more interesting when we have to deal with
>>> different ICSSG instances on different boards.
>>>
>>> What is preventing 

Re: [RFC PATCH 00/16] Introduce ICSSG Ethernet driver

2024-01-09 Thread Roger Quadros



On 08/01/2024 12:25, MD Danish Anwar wrote:
> On 08/01/24 3:00 pm, Roger Quadros wrote:
>>
>>
>> On 05/01/2024 12:15, Anwar, Md Danish wrote:
>>>
>>>
>>> On 1/5/2024 1:49 PM, Roger Quadros wrote:


 On 03/01/2024 12:27, MD Danish Anwar wrote:
>
>
> On 02/01/24 7:26 pm, Andrew Davis wrote:
>> On 12/27/23 12:56 AM, MD Danish Anwar wrote:
>>>
>>>
>>> On 22/12/23 6:13 pm, Roger Quadros wrote:

 On 22/12/2023 12:26, MD Danish Anwar wrote:
> Hi Roger,
>
> On 20/12/23 3:29 pm, Roger Quadros wrote:
>> Hi,
>>
>> On 19/12/2023 12:11, MD Danish Anwar wrote:
>>> Introduce ICSSG PRUETH support in uboot. The ICSSG driver is used
>>> in TI
>>> AM654 SR2.0.
>>>
>>> The ICSSG PRU Sub-system runs on EMAC firmware. This series
>>> Introduces
>>> support for ICSSG driver in uboot. This series also adds the 
>>> driver's
>>> dependencies.
>>>
>>> The ICSSG2 node is added in device tree overlay so that it remains 
>>> in
>>> sync with linux kernel.
>>>
>>> The series introduces device tree and config changes and AM65x
>>> to enable ICSSG driver. The series also enables
>>> SPL_LOAD_FIT_APPLY_OVERLAY
>>> for AM65x in order to load overlay over spl.
>>>
>>> This series has been tested on AM65x SR2.0, and the ICSSG
>>> interface is
>>> able to ping / dhcp and boot kernel using tftp in uboot.
>>>
>>> To use ICSSG2 ethernet, the ICSSG firmware needs to be loaded to
>>> PRU RPROC
>>> cores and RPROC cores need to be booted with the firmware. This
>>> step is
>>> done inside driver in kernel as kernel supports APIs like
>>> rproc_set_firmware() and rproc_fw_boot(). But as u-boot doesn't
>>> have these
>>> APIs, the same needs to be done via u-boot cmds.
>>>
>>> To make sure icssg-eth works we need to do below steps.
>>>
>>> 1. Initialize rproc cores i.e. rproc_init()
>>> 2. Load $firmware_file from partition '1:2' (root) on device (mmc
>>> in this
>>>     example)
>>> 3. Load the firmware file to rproc cores passing. i.e. rproc_load()
>>>     taking rproc_id, loadaddr and file size as arguments.
>>> 4. Start rproc cores. i.e. rproc_start() taking rproc_id as 
>>> arguments
>>>
>>> The above steps are done by running the below commands at u-boot
>>> prompt.
>>>
>>> => setenv start_icssg2 'rproc start 14; rproc start 15; rproc
>>> start 16; rproc start 17; rproc start 18; rproc start 19'
>>> => setenv stop_icssg2 'rproc stop 14; rproc stop 15; rproc stop
>>> 16; rproc stop 17; rproc stop 18; rproc stop 19'
>>> => setenv firmware_dir '/lib/firmware/ti-pruss'
>>> => setenv get_firmware_mmc 'load mmc ${bootpart} ${loadaddr}
>>> ${firmware_dir}/${firmware_file}'
>>>
>>> => setenv init_icssg2 'setenv ethact icssg2-eth; setenv autoload
>>> no; rproc init; setenv loadaddr 0x8000; \
>>>  setenv firmware_file am65x-sr2-pru0-prueth-fw.elf; run
>>> get_firmware_mmc;  rproc load 14 0x8000 ${filesize}; \
>>>  setenv loadaddr 0x8900; setenv firmware_file
>>> am65x-sr2-rtu0-prueth-fw.elf; run get_firmware_mmc; rproc load 15
>>> 0x8900 ${filesize}; \
>>>  setenv loadaddr 0x9000; setenv firmware_file
>>> am65x-sr2-txpru0-prueth-fw.elf; run get_firmware_mmc; rproc load
>>> 16 0x9000 ${filesize}; \
>>>  setenv loadaddr 0x8000; setenv firmware_file
>>> am65x-sr2-pru1-prueth-fw.elf; run get_firmware_mmc; rproc load 17
>>> 0x8000 ${filesize}; \
>>>  setenv loadaddr 0x8900; setenv firmware_file
>>> am65x-sr2-rtu1-prueth-fw.elf; run get_firmware_mmc; rproc load 18
>>> 0x8900 ${filesize}; \
>>>  setenv loadaddr 0x9000; setenv firmware_file
>>> am65x-sr2-txpru1-prueth-fw.elf; run get_firmware_mmc; rproc load
>>> 19 0x9000 ${filesize}; \
>>>  run start_icssg2;'
>>
>> A whole bunch of commands are required to get ethernet functional.
>> This is not at all user friendly and will be a maintenance nightmare.
>> What worries me is tracking the 6 different rproc cores and the 6
>> different firmware files to start 1 ethernet device.
>> This will get even more interesting when we have to deal with
>> different ICSSG instances on different boards.
>>
>> What is preventing the driver from starting the rproc cores it
>> needs so user doesn't need to care about it?
>> All the necessary information is in the Device tree. At leas

Re: [RFC PATCH 00/16] Introduce ICSSG Ethernet driver

2024-01-08 Thread MD Danish Anwar
On 08/01/24 3:00 pm, Roger Quadros wrote:
> 
> 
> On 05/01/2024 12:15, Anwar, Md Danish wrote:
>>
>>
>> On 1/5/2024 1:49 PM, Roger Quadros wrote:
>>>
>>>
>>> On 03/01/2024 12:27, MD Danish Anwar wrote:


 On 02/01/24 7:26 pm, Andrew Davis wrote:
> On 12/27/23 12:56 AM, MD Danish Anwar wrote:
>>
>>
>> On 22/12/23 6:13 pm, Roger Quadros wrote:
>>>
>>> On 22/12/2023 12:26, MD Danish Anwar wrote:
 Hi Roger,

 On 20/12/23 3:29 pm, Roger Quadros wrote:
> Hi,
>
> On 19/12/2023 12:11, MD Danish Anwar wrote:
>> Introduce ICSSG PRUETH support in uboot. The ICSSG driver is used
>> in TI
>> AM654 SR2.0.
>>
>> The ICSSG PRU Sub-system runs on EMAC firmware. This series
>> Introduces
>> support for ICSSG driver in uboot. This series also adds the driver's
>> dependencies.
>>
>> The ICSSG2 node is added in device tree overlay so that it remains in
>> sync with linux kernel.
>>
>> The series introduces device tree and config changes and AM65x
>> to enable ICSSG driver. The series also enables
>> SPL_LOAD_FIT_APPLY_OVERLAY
>> for AM65x in order to load overlay over spl.
>>
>> This series has been tested on AM65x SR2.0, and the ICSSG
>> interface is
>> able to ping / dhcp and boot kernel using tftp in uboot.
>>
>> To use ICSSG2 ethernet, the ICSSG firmware needs to be loaded to
>> PRU RPROC
>> cores and RPROC cores need to be booted with the firmware. This
>> step is
>> done inside driver in kernel as kernel supports APIs like
>> rproc_set_firmware() and rproc_fw_boot(). But as u-boot doesn't
>> have these
>> APIs, the same needs to be done via u-boot cmds.
>>
>> To make sure icssg-eth works we need to do below steps.
>>
>> 1. Initialize rproc cores i.e. rproc_init()
>> 2. Load $firmware_file from partition '1:2' (root) on device (mmc
>> in this
>>     example)
>> 3. Load the firmware file to rproc cores passing. i.e. rproc_load()
>>     taking rproc_id, loadaddr and file size as arguments.
>> 4. Start rproc cores. i.e. rproc_start() taking rproc_id as arguments
>>
>> The above steps are done by running the below commands at u-boot
>> prompt.
>>
>> => setenv start_icssg2 'rproc start 14; rproc start 15; rproc
>> start 16; rproc start 17; rproc start 18; rproc start 19'
>> => setenv stop_icssg2 'rproc stop 14; rproc stop 15; rproc stop
>> 16; rproc stop 17; rproc stop 18; rproc stop 19'
>> => setenv firmware_dir '/lib/firmware/ti-pruss'
>> => setenv get_firmware_mmc 'load mmc ${bootpart} ${loadaddr}
>> ${firmware_dir}/${firmware_file}'
>>
>> => setenv init_icssg2 'setenv ethact icssg2-eth; setenv autoload
>> no; rproc init; setenv loadaddr 0x8000; \
>>  setenv firmware_file am65x-sr2-pru0-prueth-fw.elf; run
>> get_firmware_mmc;  rproc load 14 0x8000 ${filesize}; \
>>  setenv loadaddr 0x8900; setenv firmware_file
>> am65x-sr2-rtu0-prueth-fw.elf; run get_firmware_mmc; rproc load 15
>> 0x8900 ${filesize}; \
>>  setenv loadaddr 0x9000; setenv firmware_file
>> am65x-sr2-txpru0-prueth-fw.elf; run get_firmware_mmc; rproc load
>> 16 0x9000 ${filesize}; \
>>  setenv loadaddr 0x8000; setenv firmware_file
>> am65x-sr2-pru1-prueth-fw.elf; run get_firmware_mmc; rproc load 17
>> 0x8000 ${filesize}; \
>>  setenv loadaddr 0x8900; setenv firmware_file
>> am65x-sr2-rtu1-prueth-fw.elf; run get_firmware_mmc; rproc load 18
>> 0x8900 ${filesize}; \
>>  setenv loadaddr 0x9000; setenv firmware_file
>> am65x-sr2-txpru1-prueth-fw.elf; run get_firmware_mmc; rproc load
>> 19 0x9000 ${filesize}; \
>>  run start_icssg2;'
>
> A whole bunch of commands are required to get ethernet functional.
> This is not at all user friendly and will be a maintenance nightmare.
> What worries me is tracking the 6 different rproc cores and the 6
> different firmware files to start 1 ethernet device.
> This will get even more interesting when we have to deal with
> different ICSSG instances on different boards.
>
> What is preventing the driver from starting the rproc cores it
> needs so user doesn't need to care about it?
> All the necessary information is in the Device tree. At least this
> is how it is done on Linux.
>

 I tried removing the need for these commands and implementing them
 inside the driver only. I am able to load t

Re: [RFC PATCH 00/16] Introduce ICSSG Ethernet driver

2024-01-08 Thread Roger Quadros



On 05/01/2024 12:15, Anwar, Md Danish wrote:
> 
> 
> On 1/5/2024 1:49 PM, Roger Quadros wrote:
>>
>>
>> On 03/01/2024 12:27, MD Danish Anwar wrote:
>>>
>>>
>>> On 02/01/24 7:26 pm, Andrew Davis wrote:
 On 12/27/23 12:56 AM, MD Danish Anwar wrote:
>
>
> On 22/12/23 6:13 pm, Roger Quadros wrote:
>>
>> On 22/12/2023 12:26, MD Danish Anwar wrote:
>>> Hi Roger,
>>>
>>> On 20/12/23 3:29 pm, Roger Quadros wrote:
 Hi,

 On 19/12/2023 12:11, MD Danish Anwar wrote:
> Introduce ICSSG PRUETH support in uboot. The ICSSG driver is used
> in TI
> AM654 SR2.0.
>
> The ICSSG PRU Sub-system runs on EMAC firmware. This series
> Introduces
> support for ICSSG driver in uboot. This series also adds the driver's
> dependencies.
>
> The ICSSG2 node is added in device tree overlay so that it remains in
> sync with linux kernel.
>
> The series introduces device tree and config changes and AM65x
> to enable ICSSG driver. The series also enables
> SPL_LOAD_FIT_APPLY_OVERLAY
> for AM65x in order to load overlay over spl.
>
> This series has been tested on AM65x SR2.0, and the ICSSG
> interface is
> able to ping / dhcp and boot kernel using tftp in uboot.
>
> To use ICSSG2 ethernet, the ICSSG firmware needs to be loaded to
> PRU RPROC
> cores and RPROC cores need to be booted with the firmware. This
> step is
> done inside driver in kernel as kernel supports APIs like
> rproc_set_firmware() and rproc_fw_boot(). But as u-boot doesn't
> have these
> APIs, the same needs to be done via u-boot cmds.
>
> To make sure icssg-eth works we need to do below steps.
>
> 1. Initialize rproc cores i.e. rproc_init()
> 2. Load $firmware_file from partition '1:2' (root) on device (mmc
> in this
>     example)
> 3. Load the firmware file to rproc cores passing. i.e. rproc_load()
>     taking rproc_id, loadaddr and file size as arguments.
> 4. Start rproc cores. i.e. rproc_start() taking rproc_id as arguments
>
> The above steps are done by running the below commands at u-boot
> prompt.
>
> => setenv start_icssg2 'rproc start 14; rproc start 15; rproc
> start 16; rproc start 17; rproc start 18; rproc start 19'
> => setenv stop_icssg2 'rproc stop 14; rproc stop 15; rproc stop
> 16; rproc stop 17; rproc stop 18; rproc stop 19'
> => setenv firmware_dir '/lib/firmware/ti-pruss'
> => setenv get_firmware_mmc 'load mmc ${bootpart} ${loadaddr}
> ${firmware_dir}/${firmware_file}'
>
> => setenv init_icssg2 'setenv ethact icssg2-eth; setenv autoload
> no; rproc init; setenv loadaddr 0x8000; \
>  setenv firmware_file am65x-sr2-pru0-prueth-fw.elf; run
> get_firmware_mmc;  rproc load 14 0x8000 ${filesize}; \
>  setenv loadaddr 0x8900; setenv firmware_file
> am65x-sr2-rtu0-prueth-fw.elf; run get_firmware_mmc; rproc load 15
> 0x8900 ${filesize}; \
>  setenv loadaddr 0x9000; setenv firmware_file
> am65x-sr2-txpru0-prueth-fw.elf; run get_firmware_mmc; rproc load
> 16 0x9000 ${filesize}; \
>  setenv loadaddr 0x8000; setenv firmware_file
> am65x-sr2-pru1-prueth-fw.elf; run get_firmware_mmc; rproc load 17
> 0x8000 ${filesize}; \
>  setenv loadaddr 0x8900; setenv firmware_file
> am65x-sr2-rtu1-prueth-fw.elf; run get_firmware_mmc; rproc load 18
> 0x8900 ${filesize}; \
>  setenv loadaddr 0x9000; setenv firmware_file
> am65x-sr2-txpru1-prueth-fw.elf; run get_firmware_mmc; rproc load
> 19 0x9000 ${filesize}; \
>  run start_icssg2;'

 A whole bunch of commands are required to get ethernet functional.
 This is not at all user friendly and will be a maintenance nightmare.
 What worries me is tracking the 6 different rproc cores and the 6
 different firmware files to start 1 ethernet device.
 This will get even more interesting when we have to deal with
 different ICSSG instances on different boards.

 What is preventing the driver from starting the rproc cores it
 needs so user doesn't need to care about it?
 All the necessary information is in the Device tree. At least this
 is how it is done on Linux.

>>>
>>> I tried removing the need for these commands and implementing them
>>> inside the driver only. I am able to load the firmware from driver
>>> using
>>> the fs_loader API request_firmware_into_buf(). It requires changes to
>>> dt. A DT node called fs-loade

Re: [RFC PATCH 00/16] Introduce ICSSG Ethernet driver

2024-01-05 Thread Anwar, Md Danish



On 1/5/2024 1:49 PM, Roger Quadros wrote:
> 
> 
> On 03/01/2024 12:27, MD Danish Anwar wrote:
>>
>>
>> On 02/01/24 7:26 pm, Andrew Davis wrote:
>>> On 12/27/23 12:56 AM, MD Danish Anwar wrote:


 On 22/12/23 6:13 pm, Roger Quadros wrote:
>
> On 22/12/2023 12:26, MD Danish Anwar wrote:
>> Hi Roger,
>>
>> On 20/12/23 3:29 pm, Roger Quadros wrote:
>>> Hi,
>>>
>>> On 19/12/2023 12:11, MD Danish Anwar wrote:
 Introduce ICSSG PRUETH support in uboot. The ICSSG driver is used
 in TI
 AM654 SR2.0.

 The ICSSG PRU Sub-system runs on EMAC firmware. This series
 Introduces
 support for ICSSG driver in uboot. This series also adds the driver's
 dependencies.

 The ICSSG2 node is added in device tree overlay so that it remains in
 sync with linux kernel.

 The series introduces device tree and config changes and AM65x
 to enable ICSSG driver. The series also enables
 SPL_LOAD_FIT_APPLY_OVERLAY
 for AM65x in order to load overlay over spl.

 This series has been tested on AM65x SR2.0, and the ICSSG
 interface is
 able to ping / dhcp and boot kernel using tftp in uboot.

 To use ICSSG2 ethernet, the ICSSG firmware needs to be loaded to
 PRU RPROC
 cores and RPROC cores need to be booted with the firmware. This
 step is
 done inside driver in kernel as kernel supports APIs like
 rproc_set_firmware() and rproc_fw_boot(). But as u-boot doesn't
 have these
 APIs, the same needs to be done via u-boot cmds.

 To make sure icssg-eth works we need to do below steps.

 1. Initialize rproc cores i.e. rproc_init()
 2. Load $firmware_file from partition '1:2' (root) on device (mmc
 in this
     example)
 3. Load the firmware file to rproc cores passing. i.e. rproc_load()
     taking rproc_id, loadaddr and file size as arguments.
 4. Start rproc cores. i.e. rproc_start() taking rproc_id as arguments

 The above steps are done by running the below commands at u-boot
 prompt.

 => setenv start_icssg2 'rproc start 14; rproc start 15; rproc
 start 16; rproc start 17; rproc start 18; rproc start 19'
 => setenv stop_icssg2 'rproc stop 14; rproc stop 15; rproc stop
 16; rproc stop 17; rproc stop 18; rproc stop 19'
 => setenv firmware_dir '/lib/firmware/ti-pruss'
 => setenv get_firmware_mmc 'load mmc ${bootpart} ${loadaddr}
 ${firmware_dir}/${firmware_file}'

 => setenv init_icssg2 'setenv ethact icssg2-eth; setenv autoload
 no; rproc init; setenv loadaddr 0x8000; \
  setenv firmware_file am65x-sr2-pru0-prueth-fw.elf; run
 get_firmware_mmc;  rproc load 14 0x8000 ${filesize}; \
  setenv loadaddr 0x8900; setenv firmware_file
 am65x-sr2-rtu0-prueth-fw.elf; run get_firmware_mmc; rproc load 15
 0x8900 ${filesize}; \
  setenv loadaddr 0x9000; setenv firmware_file
 am65x-sr2-txpru0-prueth-fw.elf; run get_firmware_mmc; rproc load
 16 0x9000 ${filesize}; \
  setenv loadaddr 0x8000; setenv firmware_file
 am65x-sr2-pru1-prueth-fw.elf; run get_firmware_mmc; rproc load 17
 0x8000 ${filesize}; \
  setenv loadaddr 0x8900; setenv firmware_file
 am65x-sr2-rtu1-prueth-fw.elf; run get_firmware_mmc; rproc load 18
 0x8900 ${filesize}; \
  setenv loadaddr 0x9000; setenv firmware_file
 am65x-sr2-txpru1-prueth-fw.elf; run get_firmware_mmc; rproc load
 19 0x9000 ${filesize}; \
  run start_icssg2;'
>>>
>>> A whole bunch of commands are required to get ethernet functional.
>>> This is not at all user friendly and will be a maintenance nightmare.
>>> What worries me is tracking the 6 different rproc cores and the 6
>>> different firmware files to start 1 ethernet device.
>>> This will get even more interesting when we have to deal with
>>> different ICSSG instances on different boards.
>>>
>>> What is preventing the driver from starting the rproc cores it
>>> needs so user doesn't need to care about it?
>>> All the necessary information is in the Device tree. At least this
>>> is how it is done on Linux.
>>>
>>
>> I tried removing the need for these commands and implementing them
>> inside the driver only. I am able to load the firmware from driver
>> using
>> the fs_loader API request_firmware_into_buf(). It requires changes to
>> dt. A DT node called fs-loader needs to be added also CONFIG_FS_LOADER
>> needs to enabled. In the DT node we need to specify the storage media
>> that we are using i.e. mmc, ospi,

Re: [RFC PATCH 00/16] Introduce ICSSG Ethernet driver

2024-01-05 Thread Roger Quadros



On 03/01/2024 12:27, MD Danish Anwar wrote:
> 
> 
> On 02/01/24 7:26 pm, Andrew Davis wrote:
>> On 12/27/23 12:56 AM, MD Danish Anwar wrote:
>>>
>>>
>>> On 22/12/23 6:13 pm, Roger Quadros wrote:

 On 22/12/2023 12:26, MD Danish Anwar wrote:
> Hi Roger,
>
> On 20/12/23 3:29 pm, Roger Quadros wrote:
>> Hi,
>>
>> On 19/12/2023 12:11, MD Danish Anwar wrote:
>>> Introduce ICSSG PRUETH support in uboot. The ICSSG driver is used
>>> in TI
>>> AM654 SR2.0.
>>>
>>> The ICSSG PRU Sub-system runs on EMAC firmware. This series
>>> Introduces
>>> support for ICSSG driver in uboot. This series also adds the driver's
>>> dependencies.
>>>
>>> The ICSSG2 node is added in device tree overlay so that it remains in
>>> sync with linux kernel.
>>>
>>> The series introduces device tree and config changes and AM65x
>>> to enable ICSSG driver. The series also enables
>>> SPL_LOAD_FIT_APPLY_OVERLAY
>>> for AM65x in order to load overlay over spl.
>>>
>>> This series has been tested on AM65x SR2.0, and the ICSSG
>>> interface is
>>> able to ping / dhcp and boot kernel using tftp in uboot.
>>>
>>> To use ICSSG2 ethernet, the ICSSG firmware needs to be loaded to
>>> PRU RPROC
>>> cores and RPROC cores need to be booted with the firmware. This
>>> step is
>>> done inside driver in kernel as kernel supports APIs like
>>> rproc_set_firmware() and rproc_fw_boot(). But as u-boot doesn't
>>> have these
>>> APIs, the same needs to be done via u-boot cmds.
>>>
>>> To make sure icssg-eth works we need to do below steps.
>>>
>>> 1. Initialize rproc cores i.e. rproc_init()
>>> 2. Load $firmware_file from partition '1:2' (root) on device (mmc
>>> in this
>>>     example)
>>> 3. Load the firmware file to rproc cores passing. i.e. rproc_load()
>>>     taking rproc_id, loadaddr and file size as arguments.
>>> 4. Start rproc cores. i.e. rproc_start() taking rproc_id as arguments
>>>
>>> The above steps are done by running the below commands at u-boot
>>> prompt.
>>>
>>> => setenv start_icssg2 'rproc start 14; rproc start 15; rproc
>>> start 16; rproc start 17; rproc start 18; rproc start 19'
>>> => setenv stop_icssg2 'rproc stop 14; rproc stop 15; rproc stop
>>> 16; rproc stop 17; rproc stop 18; rproc stop 19'
>>> => setenv firmware_dir '/lib/firmware/ti-pruss'
>>> => setenv get_firmware_mmc 'load mmc ${bootpart} ${loadaddr}
>>> ${firmware_dir}/${firmware_file}'
>>>
>>> => setenv init_icssg2 'setenv ethact icssg2-eth; setenv autoload
>>> no; rproc init; setenv loadaddr 0x8000; \
>>>  setenv firmware_file am65x-sr2-pru0-prueth-fw.elf; run
>>> get_firmware_mmc;  rproc load 14 0x8000 ${filesize}; \
>>>  setenv loadaddr 0x8900; setenv firmware_file
>>> am65x-sr2-rtu0-prueth-fw.elf; run get_firmware_mmc; rproc load 15
>>> 0x8900 ${filesize}; \
>>>  setenv loadaddr 0x9000; setenv firmware_file
>>> am65x-sr2-txpru0-prueth-fw.elf; run get_firmware_mmc; rproc load
>>> 16 0x9000 ${filesize}; \
>>>  setenv loadaddr 0x8000; setenv firmware_file
>>> am65x-sr2-pru1-prueth-fw.elf; run get_firmware_mmc; rproc load 17
>>> 0x8000 ${filesize}; \
>>>  setenv loadaddr 0x8900; setenv firmware_file
>>> am65x-sr2-rtu1-prueth-fw.elf; run get_firmware_mmc; rproc load 18
>>> 0x8900 ${filesize}; \
>>>  setenv loadaddr 0x9000; setenv firmware_file
>>> am65x-sr2-txpru1-prueth-fw.elf; run get_firmware_mmc; rproc load
>>> 19 0x9000 ${filesize}; \
>>>  run start_icssg2;'
>>
>> A whole bunch of commands are required to get ethernet functional.
>> This is not at all user friendly and will be a maintenance nightmare.
>> What worries me is tracking the 6 different rproc cores and the 6
>> different firmware files to start 1 ethernet device.
>> This will get even more interesting when we have to deal with
>> different ICSSG instances on different boards.
>>
>> What is preventing the driver from starting the rproc cores it
>> needs so user doesn't need to care about it?
>> All the necessary information is in the Device tree. At least this
>> is how it is done on Linux.
>>
>
> I tried removing the need for these commands and implementing them
> inside the driver only. I am able to load the firmware from driver
> using
> the fs_loader API request_firmware_into_buf(). It requires changes to
> dt. A DT node called fs-loader needs to be added also CONFIG_FS_LOADER
> needs to enabled. In the DT node we need to specify the storage media
> that we are using i.e. mmc, ospi, usb. It's upto user to modify the
> storage media, the driver will take the media from DT and try to laod
> firmware from their.
>
> For l

Re: [RFC PATCH 00/16] Introduce ICSSG Ethernet driver

2024-01-03 Thread MD Danish Anwar



On 02/01/24 7:26 pm, Andrew Davis wrote:
> On 12/27/23 12:56 AM, MD Danish Anwar wrote:
>>
>>
>> On 22/12/23 6:13 pm, Roger Quadros wrote:
>>>
>>> On 22/12/2023 12:26, MD Danish Anwar wrote:
 Hi Roger,

 On 20/12/23 3:29 pm, Roger Quadros wrote:
> Hi,
>
> On 19/12/2023 12:11, MD Danish Anwar wrote:
>> Introduce ICSSG PRUETH support in uboot. The ICSSG driver is used
>> in TI
>> AM654 SR2.0.
>>
>> The ICSSG PRU Sub-system runs on EMAC firmware. This series
>> Introduces
>> support for ICSSG driver in uboot. This series also adds the driver's
>> dependencies.
>>
>> The ICSSG2 node is added in device tree overlay so that it remains in
>> sync with linux kernel.
>>
>> The series introduces device tree and config changes and AM65x
>> to enable ICSSG driver. The series also enables
>> SPL_LOAD_FIT_APPLY_OVERLAY
>> for AM65x in order to load overlay over spl.
>>
>> This series has been tested on AM65x SR2.0, and the ICSSG
>> interface is
>> able to ping / dhcp and boot kernel using tftp in uboot.
>>
>> To use ICSSG2 ethernet, the ICSSG firmware needs to be loaded to
>> PRU RPROC
>> cores and RPROC cores need to be booted with the firmware. This
>> step is
>> done inside driver in kernel as kernel supports APIs like
>> rproc_set_firmware() and rproc_fw_boot(). But as u-boot doesn't
>> have these
>> APIs, the same needs to be done via u-boot cmds.
>>
>> To make sure icssg-eth works we need to do below steps.
>>
>> 1. Initialize rproc cores i.e. rproc_init()
>> 2. Load $firmware_file from partition '1:2' (root) on device (mmc
>> in this
>>     example)
>> 3. Load the firmware file to rproc cores passing. i.e. rproc_load()
>>     taking rproc_id, loadaddr and file size as arguments.
>> 4. Start rproc cores. i.e. rproc_start() taking rproc_id as arguments
>>
>> The above steps are done by running the below commands at u-boot
>> prompt.
>>
>> => setenv start_icssg2 'rproc start 14; rproc start 15; rproc
>> start 16; rproc start 17; rproc start 18; rproc start 19'
>> => setenv stop_icssg2 'rproc stop 14; rproc stop 15; rproc stop
>> 16; rproc stop 17; rproc stop 18; rproc stop 19'
>> => setenv firmware_dir '/lib/firmware/ti-pruss'
>> => setenv get_firmware_mmc 'load mmc ${bootpart} ${loadaddr}
>> ${firmware_dir}/${firmware_file}'
>>
>> => setenv init_icssg2 'setenv ethact icssg2-eth; setenv autoload
>> no; rproc init; setenv loadaddr 0x8000; \
>>  setenv firmware_file am65x-sr2-pru0-prueth-fw.elf; run
>> get_firmware_mmc;  rproc load 14 0x8000 ${filesize}; \
>>  setenv loadaddr 0x8900; setenv firmware_file
>> am65x-sr2-rtu0-prueth-fw.elf; run get_firmware_mmc; rproc load 15
>> 0x8900 ${filesize}; \
>>  setenv loadaddr 0x9000; setenv firmware_file
>> am65x-sr2-txpru0-prueth-fw.elf; run get_firmware_mmc; rproc load
>> 16 0x9000 ${filesize}; \
>>  setenv loadaddr 0x8000; setenv firmware_file
>> am65x-sr2-pru1-prueth-fw.elf; run get_firmware_mmc; rproc load 17
>> 0x8000 ${filesize}; \
>>  setenv loadaddr 0x8900; setenv firmware_file
>> am65x-sr2-rtu1-prueth-fw.elf; run get_firmware_mmc; rproc load 18
>> 0x8900 ${filesize}; \
>>  setenv loadaddr 0x9000; setenv firmware_file
>> am65x-sr2-txpru1-prueth-fw.elf; run get_firmware_mmc; rproc load
>> 19 0x9000 ${filesize}; \
>>  run start_icssg2;'
>
> A whole bunch of commands are required to get ethernet functional.
> This is not at all user friendly and will be a maintenance nightmare.
> What worries me is tracking the 6 different rproc cores and the 6
> different firmware files to start 1 ethernet device.
> This will get even more interesting when we have to deal with
> different ICSSG instances on different boards.
>
> What is preventing the driver from starting the rproc cores it
> needs so user doesn't need to care about it?
> All the necessary information is in the Device tree. At least this
> is how it is done on Linux.
>

 I tried removing the need for these commands and implementing them
 inside the driver only. I am able to load the firmware from driver
 using
 the fs_loader API request_firmware_into_buf(). It requires changes to
 dt. A DT node called fs-loader needs to be added also CONFIG_FS_LOADER
 needs to enabled. In the DT node we need to specify the storage media
 that we are using i.e. mmc, ospi, usb. It's upto user to modify the
 storage media, the driver will take the media from DT and try to laod
 firmware from their.

 For loading firmwares to rproc cores, rproc_load() API is needed. Now
 this API takes rproc_id, loadaddr and firmware_size as arguments.
 loadaddr is fixed f

Re: [RFC PATCH 00/16] Introduce ICSSG Ethernet driver

2024-01-02 Thread Andrew Davis

On 12/27/23 12:56 AM, MD Danish Anwar wrote:



On 22/12/23 6:13 pm, Roger Quadros wrote:


On 22/12/2023 12:26, MD Danish Anwar wrote:

Hi Roger,

On 20/12/23 3:29 pm, Roger Quadros wrote:

Hi,

On 19/12/2023 12:11, MD Danish Anwar wrote:

Introduce ICSSG PRUETH support in uboot. The ICSSG driver is used in TI
AM654 SR2.0.

The ICSSG PRU Sub-system runs on EMAC firmware. This series Introduces
support for ICSSG driver in uboot. This series also adds the driver's
dependencies.

The ICSSG2 node is added in device tree overlay so that it remains in
sync with linux kernel.

The series introduces device tree and config changes and AM65x
to enable ICSSG driver. The series also enables SPL_LOAD_FIT_APPLY_OVERLAY
for AM65x in order to load overlay over spl.

This series has been tested on AM65x SR2.0, and the ICSSG interface is
able to ping / dhcp and boot kernel using tftp in uboot.

To use ICSSG2 ethernet, the ICSSG firmware needs to be loaded to PRU RPROC
cores and RPROC cores need to be booted with the firmware. This step is
done inside driver in kernel as kernel supports APIs like
rproc_set_firmware() and rproc_fw_boot(). But as u-boot doesn't have these
APIs, the same needs to be done via u-boot cmds.

To make sure icssg-eth works we need to do below steps.

1. Initialize rproc cores i.e. rproc_init()
2. Load $firmware_file from partition '1:2' (root) on device (mmc in this
example)
3. Load the firmware file to rproc cores passing. i.e. rproc_load()
taking rproc_id, loadaddr and file size as arguments.
4. Start rproc cores. i.e. rproc_start() taking rproc_id as arguments

The above steps are done by running the below commands at u-boot prompt.

=> setenv start_icssg2 'rproc start 14; rproc start 15; rproc start 16; rproc 
start 17; rproc start 18; rproc start 19'
=> setenv stop_icssg2 'rproc stop 14; rproc stop 15; rproc stop 16; rproc stop 
17; rproc stop 18; rproc stop 19'
=> setenv firmware_dir '/lib/firmware/ti-pruss'
=> setenv get_firmware_mmc 'load mmc ${bootpart} ${loadaddr} 
${firmware_dir}/${firmware_file}'

=> setenv init_icssg2 'setenv ethact icssg2-eth; setenv autoload no; rproc 
init; setenv loadaddr 0x8000; \
 setenv firmware_file am65x-sr2-pru0-prueth-fw.elf; run get_firmware_mmc;  
rproc load 14 0x8000 ${filesize}; \
 setenv loadaddr 0x8900; setenv firmware_file 
am65x-sr2-rtu0-prueth-fw.elf; run get_firmware_mmc; rproc load 15 0x8900 
${filesize}; \
 setenv loadaddr 0x9000; setenv firmware_file 
am65x-sr2-txpru0-prueth-fw.elf; run get_firmware_mmc; rproc load 16 0x9000 
${filesize}; \
 setenv loadaddr 0x8000; setenv firmware_file 
am65x-sr2-pru1-prueth-fw.elf; run get_firmware_mmc; rproc load 17 0x8000 
${filesize}; \
 setenv loadaddr 0x8900; setenv firmware_file 
am65x-sr2-rtu1-prueth-fw.elf; run get_firmware_mmc; rproc load 18 0x8900 
${filesize}; \
 setenv loadaddr 0x9000; setenv firmware_file 
am65x-sr2-txpru1-prueth-fw.elf; run get_firmware_mmc; rproc load 19 0x9000 
${filesize}; \
 run start_icssg2;'


A whole bunch of commands are required to get ethernet functional.
This is not at all user friendly and will be a maintenance nightmare.
What worries me is tracking the 6 different rproc cores and the 6 different 
firmware files to start 1 ethernet device.
This will get even more interesting when we have to deal with different ICSSG 
instances on different boards.

What is preventing the driver from starting the rproc cores it needs so user 
doesn't need to care about it?
All the necessary information is in the Device tree. At least this is how it is 
done on Linux.



I tried removing the need for these commands and implementing them
inside the driver only. I am able to load the firmware from driver using
the fs_loader API request_firmware_into_buf(). It requires changes to
dt. A DT node called fs-loader needs to be added also CONFIG_FS_LOADER
needs to enabled. In the DT node we need to specify the storage media
that we are using i.e. mmc, ospi, usb. It's upto user to modify the
storage media, the driver will take the media from DT and try to laod
firmware from their.

For loading firmwares to rproc cores, rproc_load() API is needed. Now
this API takes rproc_id, loadaddr and firmware_size as arguments.
loadaddr is fixed for all three pru cores. firmware_size is obtained
from request_firmware_into_buf() but I couldn't find a way to get the
rproc_id. For now based on the ICSSG instance and slice number I am
figuring out the rproc_id and passing it to rproc_load() and
rproc_start() APIs. Please let me know if you have any other / better
way of finding rproc_id.

Below is the entire diff to remove these commands and move their
functionality to driver. Please have a look and let me know if this is ok.



Good to see you got something working so quickly.
It has some rough edges but nothing that is blocking.



Save New Duplicate & Edit Just Text Twitter
diff --git a/arch/arm/dts/k3-am654-base-board.dts
b/arc

Re: [RFC PATCH 00/16] Introduce ICSSG Ethernet driver

2023-12-26 Thread MD Danish Anwar



On 22/12/23 6:13 pm, Roger Quadros wrote:
> 
> On 22/12/2023 12:26, MD Danish Anwar wrote:
>> Hi Roger,
>>
>> On 20/12/23 3:29 pm, Roger Quadros wrote:
>>> Hi,
>>>
>>> On 19/12/2023 12:11, MD Danish Anwar wrote:
 Introduce ICSSG PRUETH support in uboot. The ICSSG driver is used in TI
 AM654 SR2.0.

 The ICSSG PRU Sub-system runs on EMAC firmware. This series Introduces
 support for ICSSG driver in uboot. This series also adds the driver's
 dependencies.

 The ICSSG2 node is added in device tree overlay so that it remains in
 sync with linux kernel.

 The series introduces device tree and config changes and AM65x
 to enable ICSSG driver. The series also enables SPL_LOAD_FIT_APPLY_OVERLAY
 for AM65x in order to load overlay over spl.

 This series has been tested on AM65x SR2.0, and the ICSSG interface is
 able to ping / dhcp and boot kernel using tftp in uboot.

 To use ICSSG2 ethernet, the ICSSG firmware needs to be loaded to PRU RPROC
 cores and RPROC cores need to be booted with the firmware. This step is
 done inside driver in kernel as kernel supports APIs like
 rproc_set_firmware() and rproc_fw_boot(). But as u-boot doesn't have these
 APIs, the same needs to be done via u-boot cmds.

 To make sure icssg-eth works we need to do below steps.

 1. Initialize rproc cores i.e. rproc_init()
 2. Load $firmware_file from partition '1:2' (root) on device (mmc in this
example)
 3. Load the firmware file to rproc cores passing. i.e. rproc_load()
taking rproc_id, loadaddr and file size as arguments.
 4. Start rproc cores. i.e. rproc_start() taking rproc_id as arguments

 The above steps are done by running the below commands at u-boot prompt.

 => setenv start_icssg2 'rproc start 14; rproc start 15; rproc start 16; 
 rproc start 17; rproc start 18; rproc start 19'
 => setenv stop_icssg2 'rproc stop 14; rproc stop 15; rproc stop 16; rproc 
 stop 17; rproc stop 18; rproc stop 19'
 => setenv firmware_dir '/lib/firmware/ti-pruss'
 => setenv get_firmware_mmc 'load mmc ${bootpart} ${loadaddr} 
 ${firmware_dir}/${firmware_file}'

 => setenv init_icssg2 'setenv ethact icssg2-eth; setenv autoload no; rproc 
 init; setenv loadaddr 0x8000; \
 setenv firmware_file am65x-sr2-pru0-prueth-fw.elf; run 
 get_firmware_mmc;  rproc load 14 0x8000 ${filesize}; \
 setenv loadaddr 0x8900; setenv firmware_file 
 am65x-sr2-rtu0-prueth-fw.elf; run get_firmware_mmc; rproc load 15 
 0x8900 ${filesize}; \
 setenv loadaddr 0x9000; setenv firmware_file 
 am65x-sr2-txpru0-prueth-fw.elf; run get_firmware_mmc; rproc load 16 
 0x9000 ${filesize}; \
 setenv loadaddr 0x8000; setenv firmware_file 
 am65x-sr2-pru1-prueth-fw.elf; run get_firmware_mmc; rproc load 17 
 0x8000 ${filesize}; \
 setenv loadaddr 0x8900; setenv firmware_file 
 am65x-sr2-rtu1-prueth-fw.elf; run get_firmware_mmc; rproc load 18 
 0x8900 ${filesize}; \
 setenv loadaddr 0x9000; setenv firmware_file 
 am65x-sr2-txpru1-prueth-fw.elf; run get_firmware_mmc; rproc load 19 
 0x9000 ${filesize}; \
 run start_icssg2;'
>>>
>>> A whole bunch of commands are required to get ethernet functional.
>>> This is not at all user friendly and will be a maintenance nightmare.
>>> What worries me is tracking the 6 different rproc cores and the 6 different 
>>> firmware files to start 1 ethernet device.
>>> This will get even more interesting when we have to deal with different 
>>> ICSSG instances on different boards.
>>>
>>> What is preventing the driver from starting the rproc cores it needs so 
>>> user doesn't need to care about it?
>>> All the necessary information is in the Device tree. At least this is how 
>>> it is done on Linux.
>>>
>>
>> I tried removing the need for these commands and implementing them
>> inside the driver only. I am able to load the firmware from driver using
>> the fs_loader API request_firmware_into_buf(). It requires changes to
>> dt. A DT node called fs-loader needs to be added also CONFIG_FS_LOADER
>> needs to enabled. In the DT node we need to specify the storage media
>> that we are using i.e. mmc, ospi, usb. It's upto user to modify the
>> storage media, the driver will take the media from DT and try to laod
>> firmware from their.
>>
>> For loading firmwares to rproc cores, rproc_load() API is needed. Now
>> this API takes rproc_id, loadaddr and firmware_size as arguments.
>> loadaddr is fixed for all three pru cores. firmware_size is obtained
>> from request_firmware_into_buf() but I couldn't find a way to get the
>> rproc_id. For now based on the ICSSG instance and slice number I am
>> figuring out the rproc_id and passing it to rproc_load() and
>> rproc_start() APIs. Please let me know if you have any other / better
>> way of findi

Re: [RFC PATCH 00/16] Introduce ICSSG Ethernet driver

2023-12-22 Thread Roger Quadros


On 22/12/2023 12:26, MD Danish Anwar wrote:
> Hi Roger,
> 
> On 20/12/23 3:29 pm, Roger Quadros wrote:
>> Hi,
>>
>> On 19/12/2023 12:11, MD Danish Anwar wrote:
>>> Introduce ICSSG PRUETH support in uboot. The ICSSG driver is used in TI
>>> AM654 SR2.0.
>>>
>>> The ICSSG PRU Sub-system runs on EMAC firmware. This series Introduces
>>> support for ICSSG driver in uboot. This series also adds the driver's
>>> dependencies.
>>>
>>> The ICSSG2 node is added in device tree overlay so that it remains in
>>> sync with linux kernel.
>>>
>>> The series introduces device tree and config changes and AM65x
>>> to enable ICSSG driver. The series also enables SPL_LOAD_FIT_APPLY_OVERLAY
>>> for AM65x in order to load overlay over spl.
>>>
>>> This series has been tested on AM65x SR2.0, and the ICSSG interface is
>>> able to ping / dhcp and boot kernel using tftp in uboot.
>>>
>>> To use ICSSG2 ethernet, the ICSSG firmware needs to be loaded to PRU RPROC
>>> cores and RPROC cores need to be booted with the firmware. This step is
>>> done inside driver in kernel as kernel supports APIs like
>>> rproc_set_firmware() and rproc_fw_boot(). But as u-boot doesn't have these
>>> APIs, the same needs to be done via u-boot cmds.
>>>
>>> To make sure icssg-eth works we need to do below steps.
>>>
>>> 1. Initialize rproc cores i.e. rproc_init()
>>> 2. Load $firmware_file from partition '1:2' (root) on device (mmc in this
>>>example)
>>> 3. Load the firmware file to rproc cores passing. i.e. rproc_load()
>>>taking rproc_id, loadaddr and file size as arguments.
>>> 4. Start rproc cores. i.e. rproc_start() taking rproc_id as arguments
>>>
>>> The above steps are done by running the below commands at u-boot prompt.
>>>
>>> => setenv start_icssg2 'rproc start 14; rproc start 15; rproc start 16; 
>>> rproc start 17; rproc start 18; rproc start 19'
>>> => setenv stop_icssg2 'rproc stop 14; rproc stop 15; rproc stop 16; rproc 
>>> stop 17; rproc stop 18; rproc stop 19'
>>> => setenv firmware_dir '/lib/firmware/ti-pruss'
>>> => setenv get_firmware_mmc 'load mmc ${bootpart} ${loadaddr} 
>>> ${firmware_dir}/${firmware_file}'
>>>
>>> => setenv init_icssg2 'setenv ethact icssg2-eth; setenv autoload no; rproc 
>>> init; setenv loadaddr 0x8000; \
>>> setenv firmware_file am65x-sr2-pru0-prueth-fw.elf; run 
>>> get_firmware_mmc;  rproc load 14 0x8000 ${filesize}; \
>>> setenv loadaddr 0x8900; setenv firmware_file 
>>> am65x-sr2-rtu0-prueth-fw.elf; run get_firmware_mmc; rproc load 15 
>>> 0x8900 ${filesize}; \
>>> setenv loadaddr 0x9000; setenv firmware_file 
>>> am65x-sr2-txpru0-prueth-fw.elf; run get_firmware_mmc; rproc load 16 
>>> 0x9000 ${filesize}; \
>>> setenv loadaddr 0x8000; setenv firmware_file 
>>> am65x-sr2-pru1-prueth-fw.elf; run get_firmware_mmc; rproc load 17 
>>> 0x8000 ${filesize}; \
>>> setenv loadaddr 0x8900; setenv firmware_file 
>>> am65x-sr2-rtu1-prueth-fw.elf; run get_firmware_mmc; rproc load 18 
>>> 0x8900 ${filesize}; \
>>> setenv loadaddr 0x9000; setenv firmware_file 
>>> am65x-sr2-txpru1-prueth-fw.elf; run get_firmware_mmc; rproc load 19 
>>> 0x9000 ${filesize}; \
>>> run start_icssg2;'
>>
>> A whole bunch of commands are required to get ethernet functional.
>> This is not at all user friendly and will be a maintenance nightmare.
>> What worries me is tracking the 6 different rproc cores and the 6 different 
>> firmware files to start 1 ethernet device.
>> This will get even more interesting when we have to deal with different 
>> ICSSG instances on different boards.
>>
>> What is preventing the driver from starting the rproc cores it needs so user 
>> doesn't need to care about it?
>> All the necessary information is in the Device tree. At least this is how it 
>> is done on Linux.
>>
> 
> I tried removing the need for these commands and implementing them
> inside the driver only. I am able to load the firmware from driver using
> the fs_loader API request_firmware_into_buf(). It requires changes to
> dt. A DT node called fs-loader needs to be added also CONFIG_FS_LOADER
> needs to enabled. In the DT node we need to specify the storage media
> that we are using i.e. mmc, ospi, usb. It's upto user to modify the
> storage media, the driver will take the media from DT and try to laod
> firmware from their.
> 
> For loading firmwares to rproc cores, rproc_load() API is needed. Now
> this API takes rproc_id, loadaddr and firmware_size as arguments.
> loadaddr is fixed for all three pru cores. firmware_size is obtained
> from request_firmware_into_buf() but I couldn't find a way to get the
> rproc_id. For now based on the ICSSG instance and slice number I am
> figuring out the rproc_id and passing it to rproc_load() and
> rproc_start() APIs. Please let me know if you have any other / better
> way of finding rproc_id.
> 
> Below is the entire diff to remove these commands and move their
> functionality to driver. Please have a look and let me know

Re: [RFC PATCH 00/16] Introduce ICSSG Ethernet driver

2023-12-22 Thread MD Danish Anwar
Hi Roger,

On 20/12/23 3:29 pm, Roger Quadros wrote:
> Hi,
> 
> On 19/12/2023 12:11, MD Danish Anwar wrote:
>> Introduce ICSSG PRUETH support in uboot. The ICSSG driver is used in TI
>> AM654 SR2.0.
>>
>> The ICSSG PRU Sub-system runs on EMAC firmware. This series Introduces
>> support for ICSSG driver in uboot. This series also adds the driver's
>> dependencies.
>>
>> The ICSSG2 node is added in device tree overlay so that it remains in
>> sync with linux kernel.
>>
>> The series introduces device tree and config changes and AM65x
>> to enable ICSSG driver. The series also enables SPL_LOAD_FIT_APPLY_OVERLAY
>> for AM65x in order to load overlay over spl.
>>
>> This series has been tested on AM65x SR2.0, and the ICSSG interface is
>> able to ping / dhcp and boot kernel using tftp in uboot.
>>
>> To use ICSSG2 ethernet, the ICSSG firmware needs to be loaded to PRU RPROC
>> cores and RPROC cores need to be booted with the firmware. This step is
>> done inside driver in kernel as kernel supports APIs like
>> rproc_set_firmware() and rproc_fw_boot(). But as u-boot doesn't have these
>> APIs, the same needs to be done via u-boot cmds.
>>
>> To make sure icssg-eth works we need to do below steps.
>>
>> 1. Initialize rproc cores i.e. rproc_init()
>> 2. Load $firmware_file from partition '1:2' (root) on device (mmc in this
>>example)
>> 3. Load the firmware file to rproc cores passing. i.e. rproc_load()
>>taking rproc_id, loadaddr and file size as arguments.
>> 4. Start rproc cores. i.e. rproc_start() taking rproc_id as arguments
>>
>> The above steps are done by running the below commands at u-boot prompt.
>>
>> => setenv start_icssg2 'rproc start 14; rproc start 15; rproc start 16; 
>> rproc start 17; rproc start 18; rproc start 19'
>> => setenv stop_icssg2 'rproc stop 14; rproc stop 15; rproc stop 16; rproc 
>> stop 17; rproc stop 18; rproc stop 19'
>> => setenv firmware_dir '/lib/firmware/ti-pruss'
>> => setenv get_firmware_mmc 'load mmc ${bootpart} ${loadaddr} 
>> ${firmware_dir}/${firmware_file}'
>>
>> => setenv init_icssg2 'setenv ethact icssg2-eth; setenv autoload no; rproc 
>> init; setenv loadaddr 0x8000; \
>> setenv firmware_file am65x-sr2-pru0-prueth-fw.elf; run get_firmware_mmc; 
>>  rproc load 14 0x8000 ${filesize}; \
>> setenv loadaddr 0x8900; setenv firmware_file 
>> am65x-sr2-rtu0-prueth-fw.elf; run get_firmware_mmc; rproc load 15 0x8900 
>> ${filesize}; \
>> setenv loadaddr 0x9000; setenv firmware_file 
>> am65x-sr2-txpru0-prueth-fw.elf; run get_firmware_mmc; rproc load 16 
>> 0x9000 ${filesize}; \
>> setenv loadaddr 0x8000; setenv firmware_file 
>> am65x-sr2-pru1-prueth-fw.elf; run get_firmware_mmc; rproc load 17 0x8000 
>> ${filesize}; \
>> setenv loadaddr 0x8900; setenv firmware_file 
>> am65x-sr2-rtu1-prueth-fw.elf; run get_firmware_mmc; rproc load 18 0x8900 
>> ${filesize}; \
>> setenv loadaddr 0x9000; setenv firmware_file 
>> am65x-sr2-txpru1-prueth-fw.elf; run get_firmware_mmc; rproc load 19 
>> 0x9000 ${filesize}; \
>> run start_icssg2;'
> 
> A whole bunch of commands are required to get ethernet functional.
> This is not at all user friendly and will be a maintenance nightmare.
> What worries me is tracking the 6 different rproc cores and the 6 different 
> firmware files to start 1 ethernet device.
> This will get even more interesting when we have to deal with different ICSSG 
> instances on different boards.
> 
> What is preventing the driver from starting the rproc cores it needs so user 
> doesn't need to care about it?
> All the necessary information is in the Device tree. At least this is how it 
> is done on Linux.
> 

I tried removing the need for these commands and implementing them
inside the driver only. I am able to load the firmware from driver using
the fs_loader API request_firmware_into_buf(). It requires changes to
dt. A DT node called fs-loader needs to be added also CONFIG_FS_LOADER
needs to enabled. In the DT node we need to specify the storage media
that we are using i.e. mmc, ospi, usb. It's upto user to modify the
storage media, the driver will take the media from DT and try to laod
firmware from their.

For loading firmwares to rproc cores, rproc_load() API is needed. Now
this API takes rproc_id, loadaddr and firmware_size as arguments.
loadaddr is fixed for all three pru cores. firmware_size is obtained
from request_firmware_into_buf() but I couldn't find a way to get the
rproc_id. For now based on the ICSSG instance and slice number I am
figuring out the rproc_id and passing it to rproc_load() and
rproc_start() APIs. Please let me know if you have any other / better
way of finding rproc_id.

Below is the entire diff to remove these commands and move their
functionality to driver. Please have a look and let me know if this is ok.


Save New Duplicate & Edit Just Text Twitter
diff --git a/arch/arm/dts/k3-am654-base-board.dts
b/arch/arm/dts/k3-am654-base-board.dts
index cfbcebfa37.

Re: [RFC PATCH 00/16] Introduce ICSSG Ethernet driver

2023-12-20 Thread Roger Quadros
Hi,

On 19/12/2023 12:11, MD Danish Anwar wrote:
> Introduce ICSSG PRUETH support in uboot. The ICSSG driver is used in TI
> AM654 SR2.0.
> 
> The ICSSG PRU Sub-system runs on EMAC firmware. This series Introduces
> support for ICSSG driver in uboot. This series also adds the driver's
> dependencies.
> 
> The ICSSG2 node is added in device tree overlay so that it remains in
> sync with linux kernel.
> 
> The series introduces device tree and config changes and AM65x
> to enable ICSSG driver. The series also enables SPL_LOAD_FIT_APPLY_OVERLAY
> for AM65x in order to load overlay over spl.
> 
> This series has been tested on AM65x SR2.0, and the ICSSG interface is
> able to ping / dhcp and boot kernel using tftp in uboot.
> 
> To use ICSSG2 ethernet, the ICSSG firmware needs to be loaded to PRU RPROC
> cores and RPROC cores need to be booted with the firmware. This step is
> done inside driver in kernel as kernel supports APIs like
> rproc_set_firmware() and rproc_fw_boot(). But as u-boot doesn't have these
> APIs, the same needs to be done via u-boot cmds.
> 
> To make sure icssg-eth works we need to do below steps.
> 
> 1. Initialize rproc cores i.e. rproc_init()
> 2. Load $firmware_file from partition '1:2' (root) on device (mmc in this
>example)
> 3. Load the firmware file to rproc cores passing. i.e. rproc_load()
>taking rproc_id, loadaddr and file size as arguments.
> 4. Start rproc cores. i.e. rproc_start() taking rproc_id as arguments
> 
> The above steps are done by running the below commands at u-boot prompt.
> 
> => setenv start_icssg2 'rproc start 14; rproc start 15; rproc start 16; rproc 
> start 17; rproc start 18; rproc start 19'
> => setenv stop_icssg2 'rproc stop 14; rproc stop 15; rproc stop 16; rproc 
> stop 17; rproc stop 18; rproc stop 19'
> => setenv firmware_dir '/lib/firmware/ti-pruss'
> => setenv get_firmware_mmc 'load mmc ${bootpart} ${loadaddr} 
> ${firmware_dir}/${firmware_file}'
> 
> => setenv init_icssg2 'setenv ethact icssg2-eth; setenv autoload no; rproc 
> init; setenv loadaddr 0x8000; \
> setenv firmware_file am65x-sr2-pru0-prueth-fw.elf; run get_firmware_mmc;  
> rproc load 14 0x8000 ${filesize}; \
> setenv loadaddr 0x8900; setenv firmware_file 
> am65x-sr2-rtu0-prueth-fw.elf; run get_firmware_mmc; rproc load 15 0x8900 
> ${filesize}; \
> setenv loadaddr 0x9000; setenv firmware_file 
> am65x-sr2-txpru0-prueth-fw.elf; run get_firmware_mmc; rproc load 16 
> 0x9000 ${filesize}; \
> setenv loadaddr 0x8000; setenv firmware_file 
> am65x-sr2-pru1-prueth-fw.elf; run get_firmware_mmc; rproc load 17 0x8000 
> ${filesize}; \
> setenv loadaddr 0x8900; setenv firmware_file 
> am65x-sr2-rtu1-prueth-fw.elf; run get_firmware_mmc; rproc load 18 0x8900 
> ${filesize}; \
> setenv loadaddr 0x9000; setenv firmware_file 
> am65x-sr2-txpru1-prueth-fw.elf; run get_firmware_mmc; rproc load 19 
> 0x9000 ${filesize}; \
> run start_icssg2;'

A whole bunch of commands are required to get ethernet functional.
This is not at all user friendly and will be a maintenance nightmare.
What worries me is tracking the 6 different rproc cores and the 6 different 
firmware files to start 1 ethernet device.
This will get even more interesting when we have to deal with different ICSSG 
instances on different boards.

What is preventing the driver from starting the rproc cores it needs so user 
doesn't need to care about it?
All the necessary information is in the Device tree. At least this is how it is 
done on Linux.

> 
> => run init_icssg2
> => dhcp
> k3-navss-ringacc ringacc@3c00: Ring Accelerator probed rings:818, 
> gp-rings[304,100] sci-dev-id:187
> k3-navss-ringacc ringacc@3c00: dma-ring-reset-quirk: disabled
> prueth icssg2-eth: K3 ICSSG: rflow_id_base: 8, chn_name = rx0
> link up on port 0, speed 1000, full duplex
> BOOTP broadcast 1
> BOOTP broadcast 2
> BOOTP broadcast 3
> DHCP client bound to address 192.168.4.58 (1020 ms)
> 

What about shutting down the interface?
I believe this has to be done manually too?

> Thanks and Regards,
> MD Danish Anwar
> 
> MD Danish Anwar (16):
>   net: ti: icssg: Add Firmware Interface for ICSSG Ethernet driver.
>   net: ti: icssg: Add Firmware config and classification APIs.
>   net: ti: icssg: Add icssg queues APIs and macros
>   net: ti: icssg: Add ICSSG ethernet driver
>   net: ti: icssg: Add support sending FDB command to update rx_flow_id
>   net: ti: icssg: Enforce pinctrl state on the MDIO child node
>   arm: dts: k3-am65: Add additional regs for DMA components
>   arm: dts: k3-am65: Add cfg reg region to ringacc node
>   arm: dts: k3-am65-main: Add ICSSG IEP nodes
>   arm: dts: k3-am654-base-board: Add ICSSG2 Ethernet support
>   arm: dts: k3-am65x-binman: Add ICSSG2 overlay and configuration
>   configs: am65x_evm_a53: Enable ICSSG Driver
>   configs: am65x_evm_a53_defconfig: add SPL_LOAD_FIT_APPLY_OVERLAY
>   tools/fdtgrep: Include __symbols__ table
>   board: ti: am65

[RFC PATCH 00/16] Introduce ICSSG Ethernet driver

2023-12-19 Thread MD Danish Anwar
Introduce ICSSG PRUETH support in uboot. The ICSSG driver is used in TI
AM654 SR2.0.

The ICSSG PRU Sub-system runs on EMAC firmware. This series Introduces
support for ICSSG driver in uboot. This series also adds the driver's
dependencies.

The ICSSG2 node is added in device tree overlay so that it remains in
sync with linux kernel.

The series introduces device tree and config changes and AM65x
to enable ICSSG driver. The series also enables SPL_LOAD_FIT_APPLY_OVERLAY
for AM65x in order to load overlay over spl.

This series has been tested on AM65x SR2.0, and the ICSSG interface is
able to ping / dhcp and boot kernel using tftp in uboot.

To use ICSSG2 ethernet, the ICSSG firmware needs to be loaded to PRU RPROC
cores and RPROC cores need to be booted with the firmware. This step is
done inside driver in kernel as kernel supports APIs like
rproc_set_firmware() and rproc_fw_boot(). But as u-boot doesn't have these
APIs, the same needs to be done via u-boot cmds.

To make sure icssg-eth works we need to
do below steps.

1. Initialize rproc cores i.e. rproc_init()
2. Load $firmware_file from partition '1:2' (root) on device (mmc in this
   example)
3. Load the firmware file to rproc cores passing. i.e. rproc_load()
   taking rproc_id, loadaddr and file size as arguments.
4. Start rproc cores. i.e. rproc_start() taking rproc_id as arguments

The above steps are done by running the below commands at u-boot prompt.

=> setenv start_icssg2 'rproc start 14; rproc start 15; rproc start 16; rproc 
start 17; rproc start 18; rproc start 19'
=> setenv stop_icssg2 'rproc stop 14; rproc stop 15; rproc stop 16; rproc stop 
17; rproc stop 18; rproc stop 19'
=> setenv firmware_dir '/lib/firmware/ti-pruss'
=> setenv get_firmware_mmc 'load mmc ${bootpart} ${loadaddr} 
${firmware_dir}/${firmware_file}'

=> setenv init_icssg2 'setenv ethact icssg2-eth; setenv autoload no; rproc 
init; setenv loadaddr 0x8000; \
setenv firmware_file am65x-sr2-pru0-prueth-fw.elf; run get_firmware_mmc;  
rproc load 14 0x8000 ${filesize}; \
setenv loadaddr 0x8900; setenv firmware_file 
am65x-sr2-rtu0-prueth-fw.elf; run get_firmware_mmc; rproc load 15 0x8900 
${filesize}; \
setenv loadaddr 0x9000; setenv firmware_file 
am65x-sr2-txpru0-prueth-fw.elf; run get_firmware_mmc; rproc load 16 0x9000 
${filesize}; \
setenv loadaddr 0x8000; setenv firmware_file 
am65x-sr2-pru1-prueth-fw.elf; run get_firmware_mmc; rproc load 17 0x8000 
${filesize}; \
setenv loadaddr 0x8900; setenv firmware_file 
am65x-sr2-rtu1-prueth-fw.elf; run get_firmware_mmc; rproc load 18 0x8900 
${filesize}; \
setenv loadaddr 0x9000; setenv firmware_file 
am65x-sr2-txpru1-prueth-fw.elf; run get_firmware_mmc; rproc load 19 0x9000 
${filesize}; \
run start_icssg2;'

=> run init_icssg2
=> dhcp
k3-navss-ringacc ringacc@3c00: Ring Accelerator probed rings:818, 
gp-rings[304,100] sci-dev-id:187
k3-navss-ringacc ringacc@3c00: dma-ring-reset-quirk: disabled
prueth icssg2-eth: K3 ICSSG: rflow_id_base: 8, chn_name = rx0
link up on port 0, speed 1000, full duplex
BOOTP broadcast 1
BOOTP broadcast 2
BOOTP broadcast 3
DHCP client bound to address 192.168.4.58 (1020 ms)

Thanks and Regards,
MD Danish Anwar

MD Danish Anwar (16):
  dma: ti: k3-udma: Use ring_idx to pair k3 nav rings
  net: ti: icssg: Add Firmware Interface for ICSSG Ethernet driver.
  net: ti: icssg: Add Firmware config and classification APIs.
  net: ti: icssg: Add icssg queues APIs and macros
  net: ti: icssg: Add ICSSG ethernet driver
  net: ti: icssg: Add support sending FDB command to update rx_flow_id
  net: ti: icssg: Enforce pinctrl state on the MDIO child node
  arm: dts: k3-am65: Add additional regs for DMA components
  arm: dts: k3-am65: Add cfg reg region to ringacc node
  arm: dts: k3-am65-main: Add ICSSG IEP nodes
  arm: dts: k3-am654-base-board: Add ICSSG2 Ethernet support
  arm: dts: k3-am65x-binman: Add ICSSG2 overlay and configuration
  configs: am65x_evm_a53: Enable ICSSG Driver
  configs: am65x_evm_a53_defconfig: add SPL_LOAD_FIT_APPLY_OVERLAY
  tools/fdtgrep: Include __symbols__ table
  board: ti: am65x: Add check for k3-am654-icssg2 in
board_fit_config_match()

 arch/arm/dts/Makefile |   3 +-
 arch/arm/dts/k3-am65-main.dtsi|  49 ++-
 arch/arm/dts/k3-am65-mcu.dtsi |  13 +-
 arch/arm/dts/k3-am654-icssg2.dtso | 145 +++
 arch/arm/dts/k3-am65x-binman.dtsi |  85 
 board/ti/am65x/evm.c  |  11 +-
 configs/am65x_evm_a53_defconfig   |   4 +
 drivers/dma/ti/k3-udma.c  |  11 +-
 drivers/net/ti/Kconfig|   9 +
 drivers/net/ti/Makefile   |   1 +
 drivers/net/ti/icss_mii_rt.h  | 192 +
 drivers/net/ti/icssg_classifier.c | 376 +
 drivers/net/ti/icssg_config.c | 469 +
 drivers/net/ti/icssg_config.h | 195 +
 drivers/net/ti/icssg_prueth.c | 654 ++
 drivers/net/ti/icssg_prueth.h | 

Re: [RFC PATCH 00/16] Introduce ICSSG Ethernet driver

2023-12-19 Thread MD Danish Anwar
Hi All,

Please ignore this thread. Some mails seems to have been duplicated.
I will post another thread soon. Pls ignore this.
Sorry for the inconvenience.

On 19/12/23 3:41 pm, MD Danish Anwar wrote:
> Introduce ICSSG PRUETH support in uboot. The ICSSG driver is used in TI
> AM654 SR2.0.
> 
> The ICSSG PRU Sub-system runs on EMAC firmware. This series Introduces
> support for ICSSG driver in uboot. This series also adds the driver's
> dependencies.
> 
> The ICSSG2 node is added in device tree overlay so that it remains in
> sync with linux kernel.
> 
> The series introduces device tree and config changes and AM65x
> to enable ICSSG driver. The series also enables SPL_LOAD_FIT_APPLY_OVERLAY
> for AM65x in order to load overlay over spl.
> 
> This series has been tested on AM65x SR2.0, and the ICSSG interface is
> able to ping / dhcp and boot kernel using tftp in uboot.
> 
> To use ICSSG2 ethernet, the ICSSG firmware needs to be loaded to PRU RPROC
> cores and RPROC cores need to be booted with the firmware. This step is
> done inside driver in kernel as kernel supports APIs like
> rproc_set_firmware() and rproc_fw_boot(). But as u-boot doesn't have these
> APIs, the same needs to be done via u-boot cmds.
> 
> To make sure icssg-eth works we need to do below steps.
> 
> 1. Initialize rproc cores i.e. rproc_init()
> 2. Load $firmware_file from partition '1:2' (root) on device (mmc in this
>example)
> 3. Load the firmware file to rproc cores passing. i.e. rproc_load()
>taking rproc_id, loadaddr and file size as arguments.
> 4. Start rproc cores. i.e. rproc_start() taking rproc_id as arguments
> 
> The above steps are done by running the below commands at u-boot prompt.
> 
> => setenv start_icssg2 'rproc start 14; rproc start 15; rproc start 16; rproc 
> start 17; rproc start 18; rproc start 19'
> => setenv stop_icssg2 'rproc stop 14; rproc stop 15; rproc stop 16; rproc 
> stop 17; rproc stop 18; rproc stop 19'
> => setenv firmware_dir '/lib/firmware/ti-pruss'
> => setenv get_firmware_mmc 'load mmc ${bootpart} ${loadaddr} 
> ${firmware_dir}/${firmware_file}'
> 
> => setenv init_icssg2 'setenv ethact icssg2-eth; setenv autoload no; rproc 
> init; setenv loadaddr 0x8000; \
> setenv firmware_file am65x-sr2-pru0-prueth-fw.elf; run get_firmware_mmc;  
> rproc load 14 0x8000 ${filesize}; \
> setenv loadaddr 0x8900; setenv firmware_file 
> am65x-sr2-rtu0-prueth-fw.elf; run get_firmware_mmc; rproc load 15 0x8900 
> ${filesize}; \
> setenv loadaddr 0x9000; setenv firmware_file 
> am65x-sr2-txpru0-prueth-fw.elf; run get_firmware_mmc; rproc load 16 
> 0x9000 ${filesize}; \
> setenv loadaddr 0x8000; setenv firmware_file 
> am65x-sr2-pru1-prueth-fw.elf; run get_firmware_mmc; rproc load 17 0x8000 
> ${filesize}; \
> setenv loadaddr 0x8900; setenv firmware_file 
> am65x-sr2-rtu1-prueth-fw.elf; run get_firmware_mmc; rproc load 18 0x8900 
> ${filesize}; \
> setenv loadaddr 0x9000; setenv firmware_file 
> am65x-sr2-txpru1-prueth-fw.elf; run get_firmware_mmc; rproc load 19 
> 0x9000 ${filesize}; \
> run start_icssg2;'
> 
> => run init_icssg2
> => dhcp
> k3-navss-ringacc ringacc@3c00: Ring Accelerator probed rings:818, 
> gp-rings[304,100] sci-dev-id:187
> k3-navss-ringacc ringacc@3c00: dma-ring-reset-quirk: disabled
> prueth icssg2-eth: K3 ICSSG: rflow_id_base: 8, chn_name = rx0
> link up on port 0, speed 1000, full duplex
> BOOTP broadcast 1
> BOOTP broadcast 2
> BOOTP broadcast 3
> DHCP client bound to address 192.168.4.58 (1020 ms)
> 
> Thanks and Regards,
> MD Danish Anwar
> 
> MD Danish Anwar (16):
>   net: ti: icssg: Add Firmware Interface for ICSSG Ethernet driver.
>   net: ti: icssg: Add Firmware config and classification APIs.
>   net: ti: icssg: Add icssg queues APIs and macros
>   net: ti: icssg: Add ICSSG ethernet driver
>   net: ti: icssg: Add support sending FDB command to update rx_flow_id
>   net: ti: icssg: Enforce pinctrl state on the MDIO child node
>   arm: dts: k3-am65: Add additional regs for DMA components
>   arm: dts: k3-am65: Add cfg reg region to ringacc node
>   arm: dts: k3-am65-main: Add ICSSG IEP nodes
>   arm: dts: k3-am654-base-board: Add ICSSG2 Ethernet support
>   arm: dts: k3-am65x-binman: Add ICSSG2 overlay and configuration
>   configs: am65x_evm_a53: Enable ICSSG Driver
>   configs: am65x_evm_a53_defconfig: add SPL_LOAD_FIT_APPLY_OVERLAY
>   tools/fdtgrep: Include __symbols__ table
>   board: ti: am65x: Add check for k3-am654-icssg2 in
> board_fit_config_match()
>   Revert "dm: core: Report bootph-pre-ram/sram node as pre-reloc after
> relocation"
> 
>  arch/arm/dts/Makefile |   3 +-
>  arch/arm/dts/k3-am65-main.dtsi|  49 ++-
>  arch/arm/dts/k3-am65-mcu.dtsi |  13 +-
>  arch/arm/dts/k3-am654-icssg2.dtso | 145 +++
>  arch/arm/dts/k3-am65x-binman.dtsi |  85 
>  board/ti/am65x/evm.c  |  11 +-
>  configs/am65x_evm_a53_defconfig   |   4 +
>  drivers/core/of

[RFC PATCH 00/16] Introduce ICSSG Ethernet driver

2023-12-19 Thread MD Danish Anwar
Introduce ICSSG PRUETH support in uboot. The ICSSG driver is used in TI
AM654 SR2.0.

The ICSSG PRU Sub-system runs on EMAC firmware. This series Introduces
support for ICSSG driver in uboot. This series also adds the driver's
dependencies.

The ICSSG2 node is added in device tree overlay so that it remains in
sync with linux kernel.

The series introduces device tree and config changes and AM65x
to enable ICSSG driver. The series also enables SPL_LOAD_FIT_APPLY_OVERLAY
for AM65x in order to load overlay over spl.

This series has been tested on AM65x SR2.0, and the ICSSG interface is
able to ping / dhcp and boot kernel using tftp in uboot.

To use ICSSG2 ethernet, the ICSSG firmware needs to be loaded to PRU RPROC
cores and RPROC cores need to be booted with the firmware. This step is
done inside driver in kernel as kernel supports APIs like
rproc_set_firmware() and rproc_fw_boot(). But as u-boot doesn't have these
APIs, the same needs to be done via u-boot cmds.

To make sure icssg-eth works we need to do below steps.

1. Initialize rproc cores i.e. rproc_init()
2. Load $firmware_file from partition '1:2' (root) on device (mmc in this
   example)
3. Load the firmware file to rproc cores passing. i.e. rproc_load()
   taking rproc_id, loadaddr and file size as arguments.
4. Start rproc cores. i.e. rproc_start() taking rproc_id as arguments

The above steps are done by running the below commands at u-boot prompt.

=> setenv start_icssg2 'rproc start 14; rproc start 15; rproc start 16; rproc 
start 17; rproc start 18; rproc start 19'
=> setenv stop_icssg2 'rproc stop 14; rproc stop 15; rproc stop 16; rproc stop 
17; rproc stop 18; rproc stop 19'
=> setenv firmware_dir '/lib/firmware/ti-pruss'
=> setenv get_firmware_mmc 'load mmc ${bootpart} ${loadaddr} 
${firmware_dir}/${firmware_file}'

=> setenv init_icssg2 'setenv ethact icssg2-eth; setenv autoload no; rproc 
init; setenv loadaddr 0x8000; \
setenv firmware_file am65x-sr2-pru0-prueth-fw.elf; run get_firmware_mmc;  
rproc load 14 0x8000 ${filesize}; \
setenv loadaddr 0x8900; setenv firmware_file 
am65x-sr2-rtu0-prueth-fw.elf; run get_firmware_mmc; rproc load 15 0x8900 
${filesize}; \
setenv loadaddr 0x9000; setenv firmware_file 
am65x-sr2-txpru0-prueth-fw.elf; run get_firmware_mmc; rproc load 16 0x9000 
${filesize}; \
setenv loadaddr 0x8000; setenv firmware_file 
am65x-sr2-pru1-prueth-fw.elf; run get_firmware_mmc; rproc load 17 0x8000 
${filesize}; \
setenv loadaddr 0x8900; setenv firmware_file 
am65x-sr2-rtu1-prueth-fw.elf; run get_firmware_mmc; rproc load 18 0x8900 
${filesize}; \
setenv loadaddr 0x9000; setenv firmware_file 
am65x-sr2-txpru1-prueth-fw.elf; run get_firmware_mmc; rproc load 19 0x9000 
${filesize}; \
run start_icssg2;'

=> run init_icssg2
=> dhcp
k3-navss-ringacc ringacc@3c00: Ring Accelerator probed rings:818, 
gp-rings[304,100] sci-dev-id:187
k3-navss-ringacc ringacc@3c00: dma-ring-reset-quirk: disabled
prueth icssg2-eth: K3 ICSSG: rflow_id_base: 8, chn_name = rx0
link up on port 0, speed 1000, full duplex
BOOTP broadcast 1
BOOTP broadcast 2
BOOTP broadcast 3
DHCP client bound to address 192.168.4.58 (1020 ms)

Thanks and Regards,
MD Danish Anwar

MD Danish Anwar (16):
  net: ti: icssg: Add Firmware Interface for ICSSG Ethernet driver.
  net: ti: icssg: Add Firmware config and classification APIs.
  net: ti: icssg: Add icssg queues APIs and macros
  net: ti: icssg: Add ICSSG ethernet driver
  net: ti: icssg: Add support sending FDB command to update rx_flow_id
  net: ti: icssg: Enforce pinctrl state on the MDIO child node
  arm: dts: k3-am65: Add additional regs for DMA components
  arm: dts: k3-am65: Add cfg reg region to ringacc node
  arm: dts: k3-am65-main: Add ICSSG IEP nodes
  arm: dts: k3-am654-base-board: Add ICSSG2 Ethernet support
  arm: dts: k3-am65x-binman: Add ICSSG2 overlay and configuration
  configs: am65x_evm_a53: Enable ICSSG Driver
  configs: am65x_evm_a53_defconfig: add SPL_LOAD_FIT_APPLY_OVERLAY
  tools/fdtgrep: Include __symbols__ table
  board: ti: am65x: Add check for k3-am654-icssg2 in
board_fit_config_match()
  Revert "dm: core: Report bootph-pre-ram/sram node as pre-reloc after
relocation"

 arch/arm/dts/Makefile |   3 +-
 arch/arm/dts/k3-am65-main.dtsi|  49 ++-
 arch/arm/dts/k3-am65-mcu.dtsi |  13 +-
 arch/arm/dts/k3-am654-icssg2.dtso | 145 +++
 arch/arm/dts/k3-am65x-binman.dtsi |  85 
 board/ti/am65x/evm.c  |  11 +-
 configs/am65x_evm_a53_defconfig   |   4 +
 drivers/core/ofnode.c |   2 +-
 drivers/net/ti/Kconfig|   9 +
 drivers/net/ti/Makefile   |   1 +
 drivers/net/ti/icss_mii_rt.h  | 192 +
 drivers/net/ti/icssg_classifier.c | 376 +
 drivers/net/ti/icssg_config.c | 469 +
 drivers/net/ti/icssg_config.h | 195 +
 drivers/net/ti/icssg_prueth.c | 654 ++
 dri