Hello Pavel,

it seems we have two different MDIO services:

cpsw/src/include/mdio.h:extern unsigned int MDIOPhyRegRead(unsigned int baseAddr, unsigned int phyAddr,

uLan/ports/driver/tms570_emac/ti_drv_mdio.h:MDIOPhyRegRead(volatile tms570_mdio_t *baseAddr, uint32_t phyAddr,

I get these warnings currently:

../../uLan/ports/driver/tms570_emac/phy_dp83848h.c: In function 'PHY_reset':
../../uLan/ports/driver/tms570_emac/phy_dp83848h.c:61:19: warning: passing argument 1 of 'MDIOPhyRegWrite' makes integer from pointer without a cast [-Wint-conversion]
   61 |   MDIOPhyRegWrite(mdioBaseAddr, phyAddr, PHY_BMCR, PHY_RESET_m);
      |                   ^~~~~~~~~~~~
      |                   |
      |                   volatile tms570_mdio_t *
In file included from ../../uLan/ports/driver/tms570_emac/phy_dp83848h.c:38:
../../cpsw/src/include/mdio.h:68:42: note: expected 'unsigned int' but argument is of type 'volatile tms570_mdio_t *' 68 | extern void MDIOPhyRegWrite(unsigned int baseAddr, unsigned int phyAddr,
      |                             ~~~~~~~~~~~~~^~~~~~~~
../../uLan/ports/driver/tms570_emac/phy_dp83848h.c:62:25: warning: passing argument 1 of 'MDIOPhyRegRead' makes integer from pointer without a cast [-Wint-conversion] 62 | while (MDIOPhyRegRead(mdioBaseAddr, phyAddr, PHY_BMCR, &regContent) & PHY_RESET_m);
      |                         ^~~~~~~~~~~~
      |                         |
      |                         volatile tms570_mdio_t *
In file included from ../../uLan/ports/driver/tms570_emac/phy_dp83848h.c:38:
../../cpsw/src/include/mdio.h:66:49: note: expected 'unsigned int' but argument is of type 'volatile tms570_mdio_t *' 66 | extern unsigned int MDIOPhyRegRead(unsigned int baseAddr, unsigned int phyAddr,
      |                                    ~~~~~~~~~~~~~^~~~~~~~
../../uLan/ports/driver/tms570_emac/phy_dp83848h.c: In function 'PHY_partner_ability_get': ../../uLan/ports/driver/tms570_emac/phy_dp83848h.c:68:26: warning: passing argument 1 of 'MDIOPhyRegRead' makes integer from pointer without a cast [-Wint-conversion] 68 | return (MDIOPhyRegRead(mdioBaseAddr, phyAddr, PHY_ANLPAR, regContent));
      |                          ^~~~~~~~~~~~
      |                          |
      |                          volatile tms570_mdio_t *
In file included from ../../uLan/ports/driver/tms570_emac/phy_dp83848h.c:38:
../../cpsw/src/include/mdio.h:66:49: note: expected 'unsigned int' but argument is of type 'volatile tms570_mdio_t *' 66 | extern unsigned int MDIOPhyRegRead(unsigned int baseAddr, unsigned int phyAddr,
      |                                    ~~~~~~~~~~~~~^~~~~~~~
../../uLan/ports/driver/tms570_emac/phy_dp83848h.c: In function 'PHY_start_auto_negotiate': ../../uLan/ports/driver/tms570_emac/phy_dp83848h.c:77:22: warning: passing argument 1 of 'MDIOPhyRegRead' makes integer from pointer without a cast [-Wint-conversion] 77 | if (MDIOPhyRegRead(mdioBaseAddr, phyAddr, PHY_BMCR, &regContent) != TRUE) {
      |                      ^~~~~~~~~~~~
      |                      |
      |                      volatile tms570_mdio_t *
In file included from ../../uLan/ports/driver/tms570_emac/phy_dp83848h.c:38:
../../cpsw/src/include/mdio.h:66:49: note: expected 'unsigned int' but argument is of type 'volatile tms570_mdio_t *' 66 | extern unsigned int MDIOPhyRegRead(unsigned int baseAddr, unsigned int phyAddr,
      |                                    ~~~~~~~~~~~~~^~~~~~~~
../../uLan/ports/driver/tms570_emac/phy_dp83848h.c:81:19: warning: passing argument 1 of 'MDIOPhyRegWrite' makes integer from pointer without a cast [-Wint-conversion] 81 | MDIOPhyRegWrite(mdioBaseAddr, phyAddr, PHY_BMCR, regContent); /* originally ...HY_BMCR, PHY_RESET_m | PHY_AUTONEG_EN_m); */
      |                   ^~~~~~~~~~~~
      |                   |
      |                   volatile tms570_mdio_t *
In file included from ../../uLan/ports/driver/tms570_emac/phy_dp83848h.c:38:
../../cpsw/src/include/mdio.h:68:42: note: expected 'unsigned int' but argument is of type 'volatile tms570_mdio_t *' 68 | extern void MDIOPhyRegWrite(unsigned int baseAddr, unsigned int phyAddr,
      |                             ~~~~~~~~~~~~~^~~~~~~~
../../uLan/ports/driver/tms570_emac/phy_dp83848h.c:84:22: warning: passing argument 1 of 'MDIOPhyRegRead' makes integer from pointer without a cast [-Wint-conversion] 84 | if (MDIOPhyRegRead(mdioBaseAddr, phyAddr, PHY_ANAR, &regContent) != TRUE) {
      |                      ^~~~~~~~~~~~
      |                      |
      |                      volatile tms570_mdio_t *
In file included from ../../uLan/ports/driver/tms570_emac/phy_dp83848h.c:38:
../../cpsw/src/include/mdio.h:66:49: note: expected 'unsigned int' but argument is of type 'volatile tms570_mdio_t *' 66 | extern unsigned int MDIOPhyRegRead(unsigned int baseAddr, unsigned int phyAddr,
      |                                    ~~~~~~~~~~~~~^~~~~~~~
../../uLan/ports/driver/tms570_emac/phy_dp83848h.c:88:19: warning: passing argument 1 of 'MDIOPhyRegWrite' makes integer from pointer without a cast [-Wint-conversion]
   88 |   MDIOPhyRegWrite(mdioBaseAddr, phyAddr, PHY_ANAR, regContent);
      |                   ^~~~~~~~~~~~
      |                   |
      |                   volatile tms570_mdio_t *
In file included from ../../uLan/ports/driver/tms570_emac/phy_dp83848h.c:38:
../../cpsw/src/include/mdio.h:68:42: note: expected 'unsigned int' but argument is of type 'volatile tms570_mdio_t *' 68 | extern void MDIOPhyRegWrite(unsigned int baseAddr, unsigned int phyAddr,
      |                             ~~~~~~~~~~~~~^~~~~~~~
../../uLan/ports/driver/tms570_emac/phy_dp83848h.c:91:18: warning: passing argument 1 of 'MDIOPhyRegRead' makes integer from pointer without a cast [-Wint-conversion]
   91 |   MDIOPhyRegRead(mdioBaseAddr, phyAddr, PHY_BMCR, &regContent);
      |                  ^~~~~~~~~~~~
      |                  |
      |                  volatile tms570_mdio_t *
In file included from ../../uLan/ports/driver/tms570_emac/phy_dp83848h.c:38:
../../cpsw/src/include/mdio.h:66:49: note: expected 'unsigned int' but argument is of type 'volatile tms570_mdio_t *' 66 | extern unsigned int MDIOPhyRegRead(unsigned int baseAddr, unsigned int phyAddr,
      |                                    ~~~~~~~~~~~~~^~~~~~~~
../../uLan/ports/driver/tms570_emac/phy_dp83848h.c:93:19: warning: passing argument 1 of 'MDIOPhyRegWrite' makes integer from pointer without a cast [-Wint-conversion]
   93 |   MDIOPhyRegWrite(mdioBaseAddr, phyAddr, PHY_BMCR, regContent);
      |                   ^~~~~~~~~~~~
      |                   |
      |                   volatile tms570_mdio_t *
In file included from ../../uLan/ports/driver/tms570_emac/phy_dp83848h.c:38:
../../cpsw/src/include/mdio.h:68:42: note: expected 'unsigned int' but argument is of type 'volatile tms570_mdio_t *' 68 | extern void MDIOPhyRegWrite(unsigned int baseAddr, unsigned int phyAddr,
      |                             ~~~~~~~~~~~~~^~~~~~~~
../../uLan/ports/driver/tms570_emac/phy_dp83848h.c: In function 'PHY_is_done_auto_negotiate': ../../uLan/ports/driver/tms570_emac/phy_dp83848h.c:103:22: warning: passing argument 1 of 'MDIOPhyRegRead' makes integer from pointer without a cast [-Wint-conversion] 103 | if (MDIOPhyRegRead(mdioBaseAddr, phyAddr, PHY_BMSR, &regContent) != TRUE) {
      |                      ^~~~~~~~~~~~
      |                      |
      |                      volatile tms570_mdio_t *
In file included from ../../uLan/ports/driver/tms570_emac/phy_dp83848h.c:38:
../../cpsw/src/include/mdio.h:66:49: note: expected 'unsigned int' but argument is of type 'volatile tms570_mdio_t *' 66 | extern unsigned int MDIOPhyRegRead(unsigned int baseAddr, unsigned int phyAddr,
      |                                    ~~~~~~~~~~~~~^~~~~~~~
../../uLan/ports/driver/tms570_emac/phy_dp83848h.c: In function 'PHY_link_status_get': ../../uLan/ports/driver/tms570_emac/phy_dp83848h.c:130:20: warning: passing argument 1 of 'MDIOPhyRegRead' makes integer from pointer without a cast [-Wint-conversion]
  130 |     MDIOPhyRegRead(mdioBaseAddr, phyAddr, PHY_BMSR, &linkStatus);
      |                    ^~~~~~~~~~~~
      |                    |
      |                    volatile tms570_mdio_t *
In file included from ../../uLan/ports/driver/tms570_emac/phy_dp83848h.c:38:
../../cpsw/src/include/mdio.h:66:49: note: expected 'unsigned int' but argument is of type 'volatile tms570_mdio_t *' 66 | extern unsigned int MDIOPhyRegRead(unsigned int baseAddr, unsigned int phyAddr,
      |                                    ~~~~~~~~~~~~~^~~~~~~~
../../uLan/ports/driver/tms570_emac/phy_dp83848h.c: In function 'PHY_RMII_mode_get': ../../uLan/ports/driver/tms570_emac/phy_dp83848h.c:149:18: warning: passing argument 1 of 'MDIOPhyRegRead' makes integer from pointer without a cast [-Wint-conversion]
  149 |   MDIOPhyRegRead(mdioBaseAddr, phyAddr, PHY_RBR, &regContent);
      |                  ^~~~~~~~~~~~
      |                  |
      |                  volatile tms570_mdio_t *
In file included from ../../uLan/ports/driver/tms570_emac/phy_dp83848h.c:38:
../../cpsw/src/include/mdio.h:66:49: note: expected 'unsigned int' but argument is of type 'volatile tms570_mdio_t *' 66 | extern unsigned int MDIOPhyRegRead(unsigned int baseAddr, unsigned int phyAddr,
      |                                    ~~~~~~~~~~~~~^~~~~~~~
../../uLan/ports/driver/tms570_emac/phy_dp83848h.c: In function 'PHY_MII_mode_set': ../../uLan/ports/driver/tms570_emac/phy_dp83848h.c:159:18: warning: passing argument 1 of 'MDIOPhyRegRead' makes integer from pointer without a cast [-Wint-conversion]
  159 |   MDIOPhyRegRead(mdioBaseAddr, phyAddr, PHY_RBR, &regContent);
      |                  ^~~~~~~~~~~~
      |                  |
      |                  volatile tms570_mdio_t *
In file included from ../../uLan/ports/driver/tms570_emac/phy_dp83848h.c:38:
../../cpsw/src/include/mdio.h:66:49: note: expected 'unsigned int' but argument is of type 'volatile tms570_mdio_t *' 66 | extern unsigned int MDIOPhyRegRead(unsigned int baseAddr, unsigned int phyAddr,
      |                                    ~~~~~~~~~~~~~^~~~~~~~
../../uLan/ports/driver/tms570_emac/phy_dp83848h.c:163:19: warning: passing argument 1 of 'MDIOPhyRegWrite' makes integer from pointer without a cast [-Wint-conversion]
  163 |   MDIOPhyRegWrite(mdioBaseAddr, phyAddr, PHY_RBR, regContent);
      |                   ^~~~~~~~~~~~
      |                   |
      |                   volatile tms570_mdio_t *
In file included from ../../uLan/ports/driver/tms570_emac/phy_dp83848h.c:38:
../../cpsw/src/include/mdio.h:68:42: note: expected 'unsigned int' but argument is of type 'volatile tms570_mdio_t *' 68 | extern void MDIOPhyRegWrite(unsigned int baseAddr, unsigned int phyAddr,
      |                             ~~~~~~~~~~~~~^~~~~~~~
../../uLan/ports/driver/tms570_emac/phy_dp83848h.c: In function 'PHY_Power_Down': ../../uLan/ports/driver/tms570_emac/phy_dp83848h.c:171:18: warning: passing argument 1 of 'MDIOPhyRegRead' makes integer from pointer without a cast [-Wint-conversion]
  171 |   MDIOPhyRegRead(mdioBaseAddr, phyAddr, PHY_BMCR, &regContent);
      |                  ^~~~~~~~~~~~
      |                  |
      |                  volatile tms570_mdio_t *
In file included from ../../uLan/ports/driver/tms570_emac/phy_dp83848h.c:38:
../../cpsw/src/include/mdio.h:66:49: note: expected 'unsigned int' but argument is of type 'volatile tms570_mdio_t *' 66 | extern unsigned int MDIOPhyRegRead(unsigned int baseAddr, unsigned int phyAddr,
      |                                    ~~~~~~~~~~~~~^~~~~~~~
../../uLan/ports/driver/tms570_emac/phy_dp83848h.c:172:19: warning: passing argument 1 of 'MDIOPhyRegWrite' makes integer from pointer without a cast [-Wint-conversion] 172 | MDIOPhyRegWrite(mdioBaseAddr, phyAddr, PHY_BMCR, regContent | PHY_POWERDOWN_m);
      |                   ^~~~~~~~~~~~
      |                   |
      |                   volatile tms570_mdio_t *
In file included from ../../uLan/ports/driver/tms570_emac/phy_dp83848h.c:38:
../../cpsw/src/include/mdio.h:68:42: note: expected 'unsigned int' but argument is of type 'volatile tms570_mdio_t *' 68 | extern void MDIOPhyRegWrite(unsigned int baseAddr, unsigned int phyAddr,
      |                             ~~~~~~~~~~~~~^~~~~~~~
../../uLan/ports/driver/tms570_emac/phy_dp83848h.c: In function 'PHY_Power_Up': ../../uLan/ports/driver/tms570_emac/phy_dp83848h.c:180:18: warning: passing argument 1 of 'MDIOPhyRegRead' makes integer from pointer without a cast [-Wint-conversion]
  180 |   MDIOPhyRegRead(mdioBaseAddr, phyAddr, PHY_BMCR, &regContent);
      |                  ^~~~~~~~~~~~
      |                  |
      |                  volatile tms570_mdio_t *
In file included from ../../uLan/ports/driver/tms570_emac/phy_dp83848h.c:38:
../../cpsw/src/include/mdio.h:66:49: note: expected 'unsigned int' but argument is of type 'volatile tms570_mdio_t *' 66 | extern unsigned int MDIOPhyRegRead(unsigned int baseAddr, unsigned int phyAddr,
      |                                    ~~~~~~~~~~~~~^~~~~~~~
../../uLan/ports/driver/tms570_emac/phy_dp83848h.c:181:19: warning: passing argument 1 of 'MDIOPhyRegWrite' makes integer from pointer without a cast [-Wint-conversion] 181 | MDIOPhyRegWrite(mdioBaseAddr, phyAddr, PHY_BMCR, regContent & ~PHY_POWERDOWN_m);
      |                   ^~~~~~~~~~~~
      |                   |
      |                   volatile tms570_mdio_t *
In file included from ../../uLan/ports/driver/tms570_emac/phy_dp83848h.c:38:
../../cpsw/src/include/mdio.h:68:42: note: expected 'unsigned int' but argument is of type 'volatile tms570_mdio_t *' 68 | extern void MDIOPhyRegWrite(unsigned int baseAddr, unsigned int phyAddr,
      |                             ~~~~~~~~~~~~~^~~~~~~~

../../uLan/ports/driver/tms570_emac/tms570_netif.c: In function 'tms570_eth_init_find_PHY': ../../uLan/ports/driver/tms570_emac/tms570_netif.c:304:3: warning: implicit declaration of function 'MDIOPhyRegRead' [-Wimplicit-function-declaration] 304 | MDIOPhyRegRead(nf_state->mdio_base, nf_state->phy_addr, PHY_BMSR, &regContent);
      |   ^~~~~~~~~~~~~~
../../uLan/ports/driver/tms570_emac/tms570_netif.c:305:15: warning: implicit declaration of function 'MDIOPhyAliveStatusGet' [-Wimplicit-function-declaration]
  305 |   physAlive = MDIOPhyAliveStatusGet(nf_state->mdio_base);
      |               ^~~~~~~~~~~~~~~~~~~~~
../../uLan/ports/driver/tms570_emac/tms570_netif.c: In function 'tms570_eth_init_hw': ../../uLan/ports/driver/tms570_emac/tms570_netif.c:379:3: warning: implicit declaration of function 'MDIOInit' [-Wimplicit-function-declaration]
  379 |   MDIOInit(nf_state->mdio_base, 0x0, 0x0);
      |   ^~~~~~~~
../../uLan/ports/driver/tms570_emac/tms570_netif.c: In function 'tms570_eth_memp_avaible': ../../uLan/ports/driver/tms570_emac/tms570_netif.c:1133:3: warning: implicit declaration of function 'netifapi_netif_common' [-Wimplicit-function-declaration] 1133 | netifapi_netif_common(eth_lwip_get_netif(0), tms570_eth_rx_pbuf_refill_single, NULL);
      |   ^~~~~~~~~~~~~~~~~~~~~


On 18.03.23 01:04, Pavel Pisa wrote:
Hello Kinsey and Sebastian,

On Thursday 09 of March 2023 14:46:28 Kinsey Moore wrote:
Normally with rtems-lwip I would complain that this doesn't follow the
convention of using #ifdef __rtems__ to modify files from upstream sources
(each root directory except rtemslwip has an upstream source), but the uLan
authors have given permission to fully integrate this code into the
rtemslwip directory where possible (the TI code will go into its own
directory). This patch looks good.

driver has no upstream, it has been designed for RTEMS and then
used even on FreeRTOS and it except for headers from Ti mainly
used for MDIO, it has been designed from scratch at CTU.
We have originally started and tried to fix Ti HalCoGen
code to work with Ti provided FreeRTOS and it newer worked
reliably. Then we have thrown away all that stuff and started
from scratch with some inspiration from similar BSD drivers.

I have call with Premek and we both agree on relicense to RTEMS
BSD variant. I can prepare commit when I have some while (I am
loaded by lectures, students support now). Next step is to move
code to

   rtemslwip/tms570

As for

+static inline void
+tms570_data_sync_barier(void)
+{
+#ifdef __arm__
+  _ARM_Data_synchronization_barrier();
+#endif
+}

it is OK but may it be not ideal, because more drivers could require
write buffers and instructions memory access order synchronization.
We have added that definition to ports/os/rtems/arch/sys_arch.h

#ifndef __rtems__
static inline sys_prot_t
sys_arch_protect(void)
{
   sys_prot_t pval;

   rtems_interrupt_disable(pval);
   return pval;
}

static inline void
sys_arch_unprotect(sys_prot_t pval)
{
   rtems_interrupt_enable(pval);
}

static inline void
sys_arch_data_sync_barier(void){
   _ARM_Data_synchronization_barrier();
}
#else

as the generic solution when to allow same drivers to be used
with different architectures. There can be more drivers requiring
such protection.

In the fact tms570_emac is similar or equivalent to some other
ETHERNET NICs, I do not remember which one at the moment, I would
need to search. But I think that I have seen same/similar registers
organization on other targets.

If I prepare changes of license, should I sent patches
only to the mailing list or should I try to create branch
and try to push it to rtems-lwip or fork some GitHub
matching repo?

...

It seems that my SSH key for pp...@dispatch.rtems.org has
expired?

Best wishes,

Pavel

--
embedded brains GmbH
Herr Sebastian HUBER
Dornierstr. 4
82178 Puchheim
Germany
email: sebastian.hu...@embedded-brains.de
phone: +49-89-18 94 741 - 16
fax:   +49-89-18 94 741 - 08

Registergericht: Amtsgericht München
Registernummer: HRB 157899
Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
Unsere Datenschutzerklärung finden Sie hier:
https://embedded-brains.de/datenschutzerklaerung/
_______________________________________________
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Reply via email to