Re: [PR] drivers/net/mdio: add mdio bus [nuttx]
xiaoxiang781216 merged PR #16999: URL: https://github.com/apache/nuttx/pull/16999 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
Re: [PR] drivers/net/mdio: add mdio bus [nuttx]
tinnedkarma commented on PR #16999: URL: https://github.com/apache/nuttx/pull/16999#issuecomment-3332731362 @xiaoxiang781216 Is there anything else to do in this PR? I would like to add next changes after this PR is merged -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
Re: [PR] drivers/net/mdio: add mdio bus [nuttx]
xiaoxiang781216 commented on code in PR #16999:
URL: https://github.com/apache/nuttx/pull/16999#discussion_r2348100573
##
include/nuttx/net/mdio.h:
##
@@ -0,0 +1,208 @@
+/
+ * include/nuttx/net/mdio.h
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ /
+
+#ifndef __INCLUDE_NUTTX_NET_MDIO_H
+#define __INCLUDE_NUTTX_NET_MDIO_H
+
+/
+ * Included Files
+ /
+
+#include
+#include
+#include
+
+/
+ * Pre-processor Definitions
+ /
+
+/
+ * Public Types
+ /
+
+/* Forward references */
+
+struct mdio_bus_s;
+struct mdio_lowerhalf_s;
+
+/* This structure defines the interface for the MDIO lower-half driver.
+ * These methods are called by the upper-half MDIO driver.
+ */
+
+struct mdio_ops_s
+{
+ /* Clause 22 MDIO Read. The first argument is a reference to the
+ * lower-half driver's private state.
+ */
+
+ int (*read)(FAR struct mdio_lowerhalf_s *lower, uint8_t phyaddr,
+ uint8_t regaddr, FAR uint16_t *value);
+
+ /* Clause 22 MDIO Write */
+
+ int (*write)(FAR struct mdio_lowerhalf_s *lower, uint8_t phyaddr,
+ uint8_t regaddr, uint16_t value);
+
+ /* PHY Reset. Optional. */
+
+ int (*reset)(FAR struct mdio_lowerhalf_s *lower, uint8_t phyaddr);
+};
+
+/* This structure defines the state of the MDIO lower-half driver.
+ * The chip-specific MDIO driver must allocate and initialize one instance
+ * of this structure.
+ */
+
+struct mdio_lowerhalf_s
+{
+ /* The vtable of MDIO lower-half operations.
+ * This must be the first field.
+ */
+
+ FAR const struct mdio_ops_s ops;
+
+ /* Opaque pointer to the lower-half driver's private state */
+
+ FAR void *priv;
+};
+
+/* This is the opaque handle used by application code to access the
+ * MDIO bus.
+ */
+
+struct mdio_bus_s
Review Comment:
yes, but the caller just need forward declaration. The detailed info just
need in source file
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
Re: [PR] drivers/net/mdio: add mdio bus [nuttx]
ppisa commented on PR #16999: URL: https://github.com/apache/nuttx/pull/16999#issuecomment-3289333147 Please, check compatibility with PHY access according to Clause 45 / MMD Ethernet standard implemented by @matiamic and mainlined in #16926 include/net/if.h: Add mechanism for MMD access with SIOCxMIIREG ioctls The final IOCTLs has been defined Linux kernel compatible way. The MMD has been used only for SPI OA MAC-PHY drivers till now #16936 but many already included MAC drivers can be extended to support MMD if underlaying hardware supports it. There is high probability that Elektroline adds that support for integrated SAMv7 MAC is some time (@michallenc and @Cynerd are closer to such planning). If the given STM32 family provides MMD functionality in PHY/MDIO interface then it would worth to think about testing it implementing it with MMD support from the start. The MMD PHY API functions should be considered from start in each case. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
Re: [PR] drivers/net/mdio: add mdio bus [nuttx]
acassis commented on PR #16999: URL: https://github.com/apache/nuttx/pull/16999#issuecomment-3275539679 @tinnedkarma this is great addition, this way we will have a standard way to communicate with PHY. Could you please create a basic Documentation about this driver? Unfortunately your drivers documentation are really "shy", the best references you can use will be: https://nuttx.apache.org/docs/latest/components/drivers/special/mtd.html https://nuttx.apache.org/docs/latest/components/drivers/special/lcd.html Thank again for your this great contribution -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
Re: [PR] drivers/net/mdio: add mdio bus [nuttx]
tinnedkarma commented on code in PR #16999:
URL: https://github.com/apache/nuttx/pull/16999#discussion_r2348054851
##
include/nuttx/net/mdio.h:
##
@@ -0,0 +1,208 @@
+/
+ * include/nuttx/net/mdio.h
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ /
+
+#ifndef __INCLUDE_NUTTX_NET_MDIO_H
+#define __INCLUDE_NUTTX_NET_MDIO_H
+
+/
+ * Included Files
+ /
+
+#include
+#include
+#include
+
+/
+ * Pre-processor Definitions
+ /
+
+/
+ * Public Types
+ /
+
+/* Forward references */
+
+struct mdio_bus_s;
+struct mdio_lowerhalf_s;
+
+/* This structure defines the interface for the MDIO lower-half driver.
+ * These methods are called by the upper-half MDIO driver.
+ */
+
+struct mdio_ops_s
+{
+ /* Clause 22 MDIO Read. The first argument is a reference to the
+ * lower-half driver's private state.
+ */
+
+ int (*read)(FAR struct mdio_lowerhalf_s *lower, uint8_t phyaddr,
+ uint8_t regaddr, FAR uint16_t *value);
+
+ /* Clause 22 MDIO Write */
+
+ int (*write)(FAR struct mdio_lowerhalf_s *lower, uint8_t phyaddr,
+ uint8_t regaddr, uint16_t value);
+
+ /* PHY Reset. Optional. */
+
+ int (*reset)(FAR struct mdio_lowerhalf_s *lower, uint8_t phyaddr);
+};
+
+/* This structure defines the state of the MDIO lower-half driver.
+ * The chip-specific MDIO driver must allocate and initialize one instance
+ * of this structure.
+ */
+
+struct mdio_lowerhalf_s
+{
+ /* The vtable of MDIO lower-half operations.
+ * This must be the first field.
+ */
+
+ FAR const struct mdio_ops_s ops;
+
+ /* Opaque pointer to the lower-half driver's private state */
+
+ FAR void *priv;
+};
+
+/* This is the opaque handle used by application code to access the
+ * MDIO bus.
+ */
+
+struct mdio_bus_s
Review Comment:
I am not sure I can. I need to refactor the whole driver.
Externally, devices should use this mdio_bus_s (see stm32_ethernet.c, from
stm32h7, changes are in this PR) not the lowerhalf struct.
Lowerhalf should also be exported, as a contract between upperhalf and
hardware dependent code.
If I do not understand how the upperhalf/lowerhalf approach works, please
help.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
Re: [PR] drivers/net/mdio: add mdio bus [nuttx]
xiaoxiang781216 commented on code in PR #16999:
URL: https://github.com/apache/nuttx/pull/16999#discussion_r2355879591
##
include/nuttx/net/mdio.h:
##
@@ -0,0 +1,200 @@
+/
+ * include/nuttx/net/mdio.h
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ /
+
+#ifndef __INCLUDE_NUTTX_NET_MDIO_H
+#define __INCLUDE_NUTTX_NET_MDIO_H
+
+/
+ * Included Files
+ /
+
+#include
+#include
+#include
+
+/
+ * Pre-processor Definitions
+ /
+
+/
+ * Public Types
+ /
+
+/* Forward references */
+
+struct mdio_bus_s;
+struct mdio_lowerhalf_s;
+
+/* This structure defines the interface for the MDIO lower-half driver.
+ * These methods are called by the upper-half MDIO driver.
+ */
+
+struct mdio_ops_s
+{
+ #ifdef CONFIG_MDIO_CLAUSE_22
Review Comment:
should we remove CONFIG_MDIO_CLAUSE_22 option? which should be always exist,
I think.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
Re: [PR] drivers/net/mdio: add mdio bus [nuttx]
tinnedkarma commented on PR #16999: URL: https://github.com/apache/nuttx/pull/16999#issuecomment-3301480139 @xiaoxiang781216 I'll add the kconfig options and guard both read/write functions for c22 today. I'll open a new pr with the c45 function signatures, as this thread is getting long and hard to follow. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
Re: [PR] drivers/net/mdio: add mdio bus [nuttx]
acassis commented on PR #16999: URL: https://github.com/apache/nuttx/pull/16999#issuecomment-3298447782 > So the last thing to clarify then is how we handle both c22 and c45 clauses. @matiamic I understand that you can agree on the kconfig approach? @xiaoxiang781216 @acassis Maybe you can have an last word? I think adding an option in Kconfig is fine (although I prefer when we remove items from Kconfig than when we add items there, since NuttX has too many entries) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
Re: [PR] drivers/net/mdio: add mdio bus [nuttx]
xiaoxiang781216 commented on PR #16999: URL: https://github.com/apache/nuttx/pull/16999#issuecomment-3300816078 should we support c45 clauses in this patch or put into new pr? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
Re: [PR] drivers/net/mdio: add mdio bus [nuttx]
tinnedkarma commented on PR #16999: URL: https://github.com/apache/nuttx/pull/16999#issuecomment-3299041080 > > So the last thing to clarify then is how we handle both c22 and c45 clauses. @matiamic I understand that you can agree on the kconfig approach? @xiaoxiang781216 @acassis Maybe you can have an last word? > > I think adding an option in Kconfig is fine (although I prefer when we remove items from Kconfig than when we add items there, since NuttX has too many entries) I agree, there a some Kconfig files that a thousands of lines long. But I see it as the better option here. I'll update the docs, and the source files with the function signatures. The votes will reset though. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
Re: [PR] drivers/net/mdio: add mdio bus [nuttx]
tinnedkarma commented on code in PR #16999: URL: https://github.com/apache/nuttx/pull/16999#discussion_r2348081422 ## drivers/net/mdio.c: ## @@ -0,0 +1,234 @@ +/ + * drivers/net/mdio.c + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + / + +/ + * Included Files + / + +#include +#include +#include +#include +#include + +/ + * Public Defines + / + +#define MDIO_READ(d,a,r,v) d->d_lower->ops.read(d->d_lower, a, r, v); + +#define MDIO_WRITE(d,a,r,v) d->d_lower->ops.write(d->d_lower, a, r, v); + +#define MDIO_RESET(d,a) d->d_lower->ops.reset(d->d_lower, a); Review Comment: I am not sure I understand what I should do here. These defined are "private" for mdio.c, cannot be used outside the upperhalf mdio (mdio.c). I've added them to keep the code cleaner. Writing the whole `priv->lower->ops->write(priv->lower, phyaddr, phyreg, value)` will end up with lines that are longer than what is allowed, so I'll need to split the function call into two lines. Can you please help me here? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
Re: [PR] drivers/net/mdio: add mdio bus [nuttx]
tinnedkarma commented on code in PR #16999:
URL: https://github.com/apache/nuttx/pull/16999#discussion_r2348768524
##
include/nuttx/net/mdio.h:
##
@@ -0,0 +1,208 @@
+/
+ * include/nuttx/net/mdio.h
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ /
+
+#ifndef __INCLUDE_NUTTX_NET_MDIO_H
+#define __INCLUDE_NUTTX_NET_MDIO_H
+
+/
+ * Included Files
+ /
+
+#include
+#include
+#include
+
+/
+ * Pre-processor Definitions
+ /
+
+/
+ * Public Types
+ /
+
+/* Forward references */
+
+struct mdio_bus_s;
+struct mdio_lowerhalf_s;
+
+/* This structure defines the interface for the MDIO lower-half driver.
+ * These methods are called by the upper-half MDIO driver.
+ */
+
+struct mdio_ops_s
+{
+ /* Clause 22 MDIO Read. The first argument is a reference to the
+ * lower-half driver's private state.
+ */
+
+ int (*read)(FAR struct mdio_lowerhalf_s *lower, uint8_t phyaddr,
+ uint8_t regaddr, FAR uint16_t *value);
+
+ /* Clause 22 MDIO Write */
+
+ int (*write)(FAR struct mdio_lowerhalf_s *lower, uint8_t phyaddr,
+ uint8_t regaddr, uint16_t value);
+
+ /* PHY Reset. Optional. */
+
+ int (*reset)(FAR struct mdio_lowerhalf_s *lower, uint8_t phyaddr);
+};
+
+/* This structure defines the state of the MDIO lower-half driver.
+ * The chip-specific MDIO driver must allocate and initialize one instance
+ * of this structure.
+ */
+
+struct mdio_lowerhalf_s
+{
+ /* The vtable of MDIO lower-half operations.
+ * This must be the first field.
+ */
+
+ FAR const struct mdio_ops_s ops;
+
+ /* Opaque pointer to the lower-half driver's private state */
+
+ FAR void *priv;
+};
+
+/* This is the opaque handle used by application code to access the
+ * MDIO bus.
+ */
+
+struct mdio_bus_s
Review Comment:
Done
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
Re: [PR] drivers/net/mdio: add mdio bus [nuttx]
tinnedkarma commented on code in PR #16999:
URL: https://github.com/apache/nuttx/pull/16999#discussion_r2348107205
##
include/nuttx/net/mdio.h:
##
@@ -0,0 +1,208 @@
+/
+ * include/nuttx/net/mdio.h
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ /
+
+#ifndef __INCLUDE_NUTTX_NET_MDIO_H
+#define __INCLUDE_NUTTX_NET_MDIO_H
+
+/
+ * Included Files
+ /
+
+#include
+#include
+#include
+
+/
+ * Pre-processor Definitions
+ /
+
+/
+ * Public Types
+ /
+
+/* Forward references */
+
+struct mdio_bus_s;
+struct mdio_lowerhalf_s;
+
+/* This structure defines the interface for the MDIO lower-half driver.
+ * These methods are called by the upper-half MDIO driver.
+ */
+
+struct mdio_ops_s
+{
+ /* Clause 22 MDIO Read. The first argument is a reference to the
+ * lower-half driver's private state.
+ */
+
+ int (*read)(FAR struct mdio_lowerhalf_s *lower, uint8_t phyaddr,
+ uint8_t regaddr, FAR uint16_t *value);
+
+ /* Clause 22 MDIO Write */
+
+ int (*write)(FAR struct mdio_lowerhalf_s *lower, uint8_t phyaddr,
+ uint8_t regaddr, uint16_t value);
+
+ /* PHY Reset. Optional. */
+
+ int (*reset)(FAR struct mdio_lowerhalf_s *lower, uint8_t phyaddr);
+};
+
+/* This structure defines the state of the MDIO lower-half driver.
+ * The chip-specific MDIO driver must allocate and initialize one instance
+ * of this structure.
+ */
+
+struct mdio_lowerhalf_s
+{
+ /* The vtable of MDIO lower-half operations.
+ * This must be the first field.
+ */
+
+ FAR const struct mdio_ops_s ops;
+
+ /* Opaque pointer to the lower-half driver's private state */
+
+ FAR void *priv;
+};
+
+/* This is the opaque handle used by application code to access the
+ * MDIO bus.
+ */
+
+struct mdio_bus_s
Review Comment:
Got it, I'll move it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
Re: [PR] drivers/net/mdio: add mdio bus [nuttx]
tinnedkarma commented on code in PR #16999:
URL: https://github.com/apache/nuttx/pull/16999#discussion_r2348047187
##
include/nuttx/net/mdio.h:
##
@@ -0,0 +1,208 @@
+/
+ * include/nuttx/net/mdio.h
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ /
+
+#ifndef __INCLUDE_NUTTX_NET_MDIO_H
+#define __INCLUDE_NUTTX_NET_MDIO_H
+
+/
+ * Included Files
+ /
+
+#include
+#include
+#include
+
+/
+ * Pre-processor Definitions
+ /
+
+/
+ * Public Types
+ /
+
+/* Forward references */
+
+struct mdio_bus_s;
+struct mdio_lowerhalf_s;
+
+/* This structure defines the interface for the MDIO lower-half driver.
+ * These methods are called by the upper-half MDIO driver.
+ */
+
+struct mdio_ops_s
+{
+ /* Clause 22 MDIO Read. The first argument is a reference to the
+ * lower-half driver's private state.
+ */
+
+ int (*read)(FAR struct mdio_lowerhalf_s *lower, uint8_t phyaddr,
+ uint8_t regaddr, FAR uint16_t *value);
+
+ /* Clause 22 MDIO Write */
+
+ int (*write)(FAR struct mdio_lowerhalf_s *lower, uint8_t phyaddr,
+ uint8_t regaddr, uint16_t value);
+
+ /* PHY Reset. Optional. */
+
+ int (*reset)(FAR struct mdio_lowerhalf_s *lower, uint8_t phyaddr);
+};
+
+/* This structure defines the state of the MDIO lower-half driver.
+ * The chip-specific MDIO driver must allocate and initialize one instance
+ * of this structure.
+ */
+
+struct mdio_lowerhalf_s
+{
+ /* The vtable of MDIO lower-half operations.
+ * This must be the first field.
+ */
+
+ FAR const struct mdio_ops_s ops;
Review Comment:
Done.
This was one of my questions, why do we keep ops, as static globals.
Or rather, what is wrong with the other approach? Aside from being different
from nuttx standard.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
Re: [PR] drivers/net/mdio: add mdio bus [nuttx]
matiamic commented on PR #16999: URL: https://github.com/apache/nuttx/pull/16999#issuecomment-3290025883 > Great, then I see here two approaches: > > - I'll update the Kconfig file with an clause choice, so the phy driver (or user) can y select c22, c45, or both. I'll update mdio bus so it provides independent mdio_read/write_c22 and mdio_read/write_c45, each guarded by the choice above. > > - I'll add a new an new parameter (enum or int) to mdio_bus_s to specify what clauses it supports. I'll add the prtad parameter to the function signature, and pass it as NULL if c22 is used. For the second approach it might be worth considering the encoding introduced in https://github.com/apache/nuttx/pull/16926: Add mechanism for MMD access with SIOCxMIIREG ioctls. Usage in driver [here](https://github.com/apache/nuttx/blob/71f558765c7d53d0dad001cd1617d7f6ecf23c8c/drivers/net/oa_tc6/oa_tc6.c#L1828). But special functions for c22 and c45 seem clearer. As seen in [`mii_bus` struct in Linux](https://elixir.bootlin.com/linux/v6.16.7/source/include/linux/phy.h#L334). I think the inclusion of the c45 functionality from the start would be nice. As @ppisa noted it is needed for configuration of the PLCA in 10BASE-T1S PHYs. > At the first glance. > I see the ioctl function mapping, and it currently returning OA_TC6_IOCTL_CMD_NOT_IMPLEMENTED. You are probably looking into chip-specific drivers. The MDIO access in question is implemented in the generic driver [here](https://github.com/apache/nuttx/blob/71f558765c7d53d0dad001cd1617d7f6ecf23c8c/drivers/net/oa_tc6/oa_tc6.c#L1820). > Also, talking about mac-phy, mac is onboard the external chip, so your lowerhalf mdio bus implementation will be managing spi translations, some part of the Control transactions, if i understand correctly. I'm not even sure that having a explicit mdio bus would help you, maybe is easier just to treat everything as spi data regardless if it is Ethernet MAC Frame data transactions or Control transactions. I'll need more time to read the datasheets. I think you are right, having explicit mdio bus would not help here. If I understand correctly, your concern is to provide standard way of exchanging configuration between MAC drivers and external PHYs. The concern of the OA-TC6 driver in this regard is to expose MMD registers to user apps (such as [`plcatool`](https://github.com/apache/nuttx-apps/pull/3181)) - at this moment the direct implementation of the SIOCxMIIREG ioctls seems like the best option. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
Re: [PR] drivers/net/mdio: add mdio bus [nuttx]
xiaoxiang781216 commented on code in PR #16999:
URL: https://github.com/apache/nuttx/pull/16999#discussion_r2347459811
##
include/nuttx/net/mdio.h:
##
@@ -0,0 +1,208 @@
+/
+ * include/nuttx/net/mdio.h
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ /
+
+#ifndef __INCLUDE_NUTTX_NET_MDIO_H
+#define __INCLUDE_NUTTX_NET_MDIO_H
+
+/
+ * Included Files
+ /
+
+#include
+#include
+#include
+
+/
+ * Pre-processor Definitions
+ /
+
+/
+ * Public Types
+ /
+
+/* Forward references */
+
+struct mdio_bus_s;
+struct mdio_lowerhalf_s;
+
+/* This structure defines the interface for the MDIO lower-half driver.
+ * These methods are called by the upper-half MDIO driver.
+ */
+
+struct mdio_ops_s
+{
+ /* Clause 22 MDIO Read. The first argument is a reference to the
+ * lower-half driver's private state.
+ */
+
+ int (*read)(FAR struct mdio_lowerhalf_s *lower, uint8_t phyaddr,
+ uint8_t regaddr, FAR uint16_t *value);
+
+ /* Clause 22 MDIO Write */
+
+ int (*write)(FAR struct mdio_lowerhalf_s *lower, uint8_t phyaddr,
+ uint8_t regaddr, uint16_t value);
+
+ /* PHY Reset. Optional. */
+
+ int (*reset)(FAR struct mdio_lowerhalf_s *lower, uint8_t phyaddr);
+};
+
+/* This structure defines the state of the MDIO lower-half driver.
+ * The chip-specific MDIO driver must allocate and initialize one instance
+ * of this structure.
+ */
+
+struct mdio_lowerhalf_s
+{
+ /* The vtable of MDIO lower-half operations.
+ * This must be the first field.
+ */
+
+ FAR const struct mdio_ops_s ops;
+
+ /* Opaque pointer to the lower-half driver's private state */
+
+ FAR void *priv;
Review Comment:
remove, lowerhalf should embed mdio_lowerhalf_s directly in private struct
and restore by container_of or direct cast.
##
drivers/net/mdio.c:
##
@@ -0,0 +1,234 @@
+/
+ * drivers/net/mdio.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ /
+
+/
+ * Included Files
+ /
+
+#include
+#include
+#include
+#include
+#include
+
+/
+ * Public Defines
+ /
+
+#define MDIO_READ(d,a,r,v) d->d_lower->ops.read(d->d_lower, a, r, v);
+
+#define MDIO_WRITE(d,a,r,v) d->d_lower->ops.write(d->d_lower, a, r, v);
+
+#define MDIO_RESET(d,a) d->d_lower->ops.reset(d->d_lower, a);
Review Comment:
remove all macro, but call the callback in mdio_xxx directly
##
include/nuttx/net/mdio.h:
##
@@ -0,0 +1,208 @@
+/*
Re: [PR] drivers/net/mdio: add mdio bus [nuttx]
ppisa commented on code in PR #16999:
URL: https://github.com/apache/nuttx/pull/16999#discussion_r2347191905
##
include/nuttx/net/mdio.h:
##
@@ -0,0 +1,208 @@
+/
+ * include/nuttx/net/mdio.h
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ /
+
+#ifndef __INCLUDE_NUTTX_NET_MDIO_H
+#define __INCLUDE_NUTTX_NET_MDIO_H
+
+/
+ * Included Files
+ /
+
+#include
+#include
+#include
+
+/
+ * Pre-processor Definitions
+ /
+
+/
+ * Public Types
+ /
+
+/* Forward references */
+
+struct mdio_bus_s;
+struct mdio_lowerhalf_s;
+
+/* This structure defines the interface for the MDIO lower-half driver.
+ * These methods are called by the upper-half MDIO driver.
+ */
+
+struct mdio_ops_s
+{
+ /* Clause 22 MDIO Read. The first argument is a reference to the
+ * lower-half driver's private state.
+ */
+
+ int (*read)(FAR struct mdio_lowerhalf_s *lower, uint8_t phyaddr,
+ uint8_t regaddr, FAR uint16_t *value);
+
+ /* Clause 22 MDIO Write */
+
+ int (*write)(FAR struct mdio_lowerhalf_s *lower, uint8_t phyaddr,
+ uint8_t regaddr, uint16_t value);
Review Comment:
Please, consider there where the MMD PRTAD could be passed. I would vote
for additional `int prtad` argument. See related Linux code
https://elixir.bootlin.com/linux/v6.16.3/source/include/linux/mdio.h#L139
https://elixir.bootlin.com/linux/v6.16.3/source/drivers/net/mdio.c#L26
Please, think about some locations/flags where PHY and MAC stores
information if they supports C22, C45 or both.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
Re: [PR] drivers/net/mdio: add mdio bus [nuttx]
tinnedkarma commented on code in PR #16999:
URL: https://github.com/apache/nuttx/pull/16999#discussion_r2347285840
##
include/nuttx/net/mdio.h:
##
@@ -0,0 +1,208 @@
+/
+ * include/nuttx/net/mdio.h
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ /
+
+#ifndef __INCLUDE_NUTTX_NET_MDIO_H
+#define __INCLUDE_NUTTX_NET_MDIO_H
+
+/
+ * Included Files
+ /
+
+#include
+#include
+#include
+
+/
+ * Pre-processor Definitions
+ /
+
+/
+ * Public Types
+ /
+
+/* Forward references */
+
+struct mdio_bus_s;
+struct mdio_lowerhalf_s;
+
+/* This structure defines the interface for the MDIO lower-half driver.
+ * These methods are called by the upper-half MDIO driver.
+ */
+
+struct mdio_ops_s
+{
+ /* Clause 22 MDIO Read. The first argument is a reference to the
+ * lower-half driver's private state.
+ */
+
+ int (*read)(FAR struct mdio_lowerhalf_s *lower, uint8_t phyaddr,
+ uint8_t regaddr, FAR uint16_t *value);
+
+ /* Clause 22 MDIO Write */
+
+ int (*write)(FAR struct mdio_lowerhalf_s *lower, uint8_t phyaddr,
+ uint8_t regaddr, uint16_t value);
Review Comment:
Hello, thanks for the feedback.
The Clause 45 was indeed left out, my application uses only Clause 22 and
cannot test anything C45 related.
My thought was to add later on Kconfig defines, for C45, or both C22 C45.
Other (RT)OSes I took inspiration offers separate functions for c45 clause
(mdio_read/write_c45).
I've nothing against adding another parameter to the write function, it we
vote this way, but how about I add defines for both c22 and c45 read write
functions, I'll update the mdio Kconfig so we can select what clauses are
defined.
Then the c22 stays as it is and c45 function follows linux-like signature?
Anyway, there are others that have work in progress regarding this topic I
see.
Now is the best time to agree on a solution.
@matiamic @michallenc @Cynerd
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
Re: [PR] drivers/net/mdio: add mdio bus [nuttx]
acassis commented on PR #16999: URL: https://github.com/apache/nuttx/pull/16999#issuecomment-3289529413 > I am not up to date regarding the mentioned work. Last I checked, there was a thesis published at CTU which I read, something about OpenAlliance MAC-PHY , but there was no mdio involved, phy used spi, but correct me if I am wrong. @tinnedkarma I read a little bit about that Clause 45 and maybe these documents could help: https://www.ieee802.org/3/efm/public/nov02/oam/pannell_oam_1_1102.pdf TN1305 Technical note from ST https://pebblebay.com/rtos-clause-45-phy-support/ features supported by QNX and VxWorks. I think we can add this initial driver to support the common/old Clause 22 and later improve it to support Clause 45. What do you think @ppisa ? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
Re: [PR] drivers/net/mdio: add mdio bus [nuttx]
tinnedkarma commented on PR #16999: URL: https://github.com/apache/nuttx/pull/16999#issuecomment-3289622714 > > I am not up to date regarding the mentioned work. Last I checked, there was a thesis published at CTU which I read, something about OpenAlliance MAC-PHY , but there was no mdio involved, phy used spi, but correct me if I am wrong. > > The MMD/MDIO extension compatible with Linux kernel one has been mainlined #16926 and then OA SPI MAC-PHY driver #16646 > > The OA SPI MAC-PHY driver provides PHY IOCTLs with MMD support and tool to set OA SPI MAC-PHY for PLCA (Physical Layer Collision Avoidance) is near to the pull request ([development branch](https://github.com/matiamic/nuttx-apps/commits/plcatool/) intended to be squashed for PR). The mapping of the drivers for BSPs is prepared for [boards/arm/samv7/samv71-xult](https://github.com/matiamic/nuttx/commits/oa-pr-sam/) and [boards/risc-v/esp32c6](https://github.com/matiamic/nuttx/commits/oa-pr-esp). > > The PLCA tool is planned to work even with discrete T1S PHYs connected to MCUs, priority for Elektroline.cz is SAMv7. > > The related thesis text [there](https://dspace.cvut.cz/bitstream/handle/10467/123231/F3-BP-2025-Matias-Michal-bp.pdf). But even that the final version prototype of the thesis worked the work in the GSoC frame moved project to the another level which allowed start mainlining where core is already accepted. PLCA functionality has been reached during last weeks and tested as well. > > So I think that it worth to think how the IOCTLs level would be mapped to read and write. It is possible to keep that MMD/MDIO multiplexing in the single phyadr and register, but I think that it would be cleaner to separate it same way as it is done in the Linux kernel. Thanks for the update, I'll check the drivers in more details tomorrow. At the first glance. I see the ioctl function mapping, and it currently returning `OA_TC6_IOCTL_CMD_NOT_IMPLEMENTED`. Also, talking about mac-phy, mac is onboard the external chip, so your lowerhalf mdio bus implementation will be managing spi translations, some part of the Control transactions, if i understand correctly. I'm not even sure that having a explicit mdio bus would help you, maybe is easier just to treat everything as spi data regardless if it is Ethernet MAC Frame data transactions or Control transactions. I'll need more time to read the datasheets. Your architectural concept, even just a sketch, can help me a lot. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
Re: [PR] drivers/net/mdio: add mdio bus [nuttx]
tinnedkarma commented on PR #16999: URL: https://github.com/apache/nuttx/pull/16999#issuecomment-3289516507 I am not up to date regarding the mentioned work. Last I checked, there was a thesis published at CTU which I read, something about OpenAlliance MAC-PHY , but there was no mdio involved, phy used spi, but correct me if I am wrong. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
Re: [PR] drivers/net/mdio: add mdio bus [nuttx]
tinnedkarma commented on PR #16999: URL: https://github.com/apache/nuttx/pull/16999#issuecomment-3289594571 > > > I am not up to date regarding the mentioned work. Last I checked, there was a thesis published at CTU which I read, something about OpenAlliance MAC-PHY , but there was no mdio involved, phy used spi, but correct me if I am wrong. > > > > > > @tinnedkarma I read a little bit about that Clause 45 and maybe these documents could help: https://www.ieee802.org/3/efm/public/nov02/oam/pannell_oam_1_1102.pdf TN1305 Technical note from ST https://pebblebay.com/rtos-clause-45-phy-support/ features supported by QNX and VxWorks. > > I think we can add this initial driver to support the common/old Clause 22 and later improve it to support Clause 45. What do you think @ppisa ? > > I think that we should think at least about parameters to read and write functions and define them such way, that they can be used for both C22 and C45 accesses without changes. Actual C45 functionality for drivers, even STM32, can wait. It is not a problem from my side. Great, then I see here two approaches: * I'll update the Kconfig file with an clause choice, so the phy driver (or user) can y select c22, c45, or both. I'll update mdio bus so it provides independent mdio_read/write_c22 and mdio_read/write_c45, each guarded by the choice above. * I'll add a new an new parameter (enum or int) to mdio_bus_s to specify what clauses it supports. I'll add the prtad parameter to the function signature, and pass it as NULL if c22 is used. I'd opt for the first one, it's a bit more static by design, but is up for debate either choice. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
Re: [PR] drivers/net/mdio: add mdio bus [nuttx]
ppisa commented on PR #16999: URL: https://github.com/apache/nuttx/pull/16999#issuecomment-3289561322 > I am not up to date regarding the mentioned work. Last I checked, there was a thesis published at CTU which I read, something about OpenAlliance MAC-PHY , but there was no mdio involved, phy used spi, but correct me if I am wrong. The MMD/MDIO extension compatible with Linux kernel one has been mainlined #16926 and then OA SPI MAC-PHY driver #16646 The OA SPI MAC-PHY driver provides PHY IOCTLs with MMD support and tool to set OA SPI MAC-PHY for PLCA (Physical Layer Collision Avoidance) is near to the pull request ([development branch](https://github.com/matiamic/nuttx-apps/commits/plcatool/) intended to be squashed for PR). The mapping of the drivers for BSPs is prepared for [boards/arm/samv7/samv71-xult](https://github.com/matiamic/nuttx/commits/oa-pr-sam/) and [boards/risc-v/esp32c6](https://github.com/matiamic/nuttx/commits/oa-pr-esp). The PLCA tool is planned to work even with discrete T1S PHYs connected to MCUs, priority for Elektroline.cz is SAMv7. The related thesis text [there](https://dspace.cvut.cz/bitstream/handle/10467/123231/F3-BP-2025-Matias-Michal-bp.pdf). But even that the final version prototype of the thesis worked the work in the GSoC frame moved project to the another level which allowed start mainlining where core is already accepted. PLCA functionality has been reached during last weeks and tested as well. So I think that it worth to think how the IOCTLs level would be mapped to read and write. It is possible to keep that MMD/MDIO multiplexing in the single phyadr and register, but I think that it would be cleaner to separate it sam as it is done in the Linux kernel. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
Re: [PR] drivers/net/mdio: add mdio bus [nuttx]
ppisa commented on PR #16999: URL: https://github.com/apache/nuttx/pull/16999#issuecomment-3289563864 > > I am not up to date regarding the mentioned work. Last I checked, there was a thesis published at CTU which I read, something about OpenAlliance MAC-PHY , but there was no mdio involved, phy used spi, but correct me if I am wrong. > > @tinnedkarma I read a little bit about that Clause 45 and maybe these documents could help: https://www.ieee802.org/3/efm/public/nov02/oam/pannell_oam_1_1102.pdf TN1305 Technical note from ST https://pebblebay.com/rtos-clause-45-phy-support/ features supported by QNX and VxWorks. > > I think we can add this initial driver to support the common/old Clause 22 and later improve it to support Clause 45. What do you think @ppisa ? I think that we should think at least about parameters to read and write functions and define them such way, that they can be used for both C22 and C45 accesses without changes. Actual C45 functionality for drivers, even STM32, can wait. It is not a problem from my side. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
Re: [PR] drivers/net/mdio: add mdio bus [nuttx]
tinnedkarma commented on PR #16999: URL: https://github.com/apache/nuttx/pull/16999#issuecomment-3289546030 > > I am not up to date regarding the mentioned work. Last I checked, there was a thesis published at CTU which I read, something about OpenAlliance MAC-PHY , but there was no mdio involved, phy used spi, but correct me if I am wrong. > > @tinnedkarma I read a little bit about that Clause 45 and maybe these documents could help: https://www.ieee802.org/3/efm/public/nov02/oam/pannell_oam_1_1102.pdf TN1305 Technical note from ST https://pebblebay.com/rtos-clause-45-phy-support/ features supported by QNX and VxWorks. @acassis, thank you for the links, I'll have a look over them shortly. Though, I was referring to the fact that I am not aware of what others are working on NuttX, or what plans are there for NuttX. > I think we can add this initial driver to support the common/old Clause 22 and later improve it to support Clause 45. What do you think @ppisa ? I would wait a bit. Let other add their ideas, we'll get to common ground, I'll update the documentation with the outcome and the code where it needs to, then we'll see if it makes sense to merge it as is, only c22, or to continue work with c45 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
Re: [PR] drivers/net/mdio: add mdio bus [nuttx]
tinnedkarma commented on PR #16999: URL: https://github.com/apache/nuttx/pull/16999#issuecomment-3289509238 > Please, check compatibility with PHY access according to Clause 45 / MMD Ethernet standard implemented by @matiamic and mainlined in > > #16926 include/net/if.h: Add mechanism for MMD access with SIOCxMIIREG ioctls > > The final IOCTLs has been defined Linux kernel compatible way. The MMD has been used only for SPI OA MAC-PHY drivers till now #16936 but many already included MAC drivers can be extended to support MMD if underlaying hardware supports it. There is high probability that Elektroline adds that support for integrated SAMv7 MAC is some time (@michallenc and @Cynerd are closer to such planning). > > If the given STM32 family provides MMD functionality in PHY/MDIO interface then it would worth to think about testing it implementing it with MMD support from the start. > > The MMD PHY API functions should be considered from start in each case. > > MMD is important today to allow seamlessly connect and configure PLCA T1S PHYs directly to existing MCUs where probably many of them include MMD support in MDIO interface. _Let me start by presenting the concept/design of my work. Then we'll have a common starting point to make is suit everyone's work._ Lately, my work was mainly on the stm32 mcus. There, the netdevs _(usually living in stm32_ethernet.c or stm32_eth.c)_ handles everything. From register access to memory mamagement to packets that gets in and out of the net subsystem. It is plain hard to understand the logic there, and it also led to code duplication across st mcu families. I try to improve what is going on there as follows: * MDIO handling, a separate upperhalf/lowerhalf device that handles the mdio data transation. Nothing more, nothing less. Upperhalf as generic as possible, handling as much as posible. Lowerhalf concerned with the registers. * PHY handling, a separate upperhalf/lowerhalf device that holds a handle to mdio bus/device. It should handle negotiations, both forced and auto, device detection (phy id) and interrupt signalling. You mention IOCTLs. I did not plan anything of this sort. The current upperhalf/lowerhalf netdev approach want to handle the IOCTLs, so no IOCTLs for MDIO or PHY. My take on the netdevs architecture is as follows: netdev->phy->mdio * lowerhalf netdev take a phy handle to any phy. Things like link management, power management through if_up, if_down * lowerhalf phy holds a handle to mdio bus. It controls higher level interaction over mdio bus, negotiations and status. So to try giving an answer. I think ioctls should be handled two layers up, by the netdev, not the mdio bus, this is why there is nothing ioctl related in my bus. Anything else is up for debate. I would really need some feedback for the phy api, or we can work in parallel after agreeing on a common approach. The current changes for the stm32_ethernet.c file is part of my testing, work validation, I'll continue updating this file when I start work on the phy. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
Re: [PR] drivers/net/mdio: add mdio bus [nuttx]
xiaoxiang781216 commented on PR #16999: URL: https://github.com/apache/nuttx/pull/16999#issuecomment-3285065905 i will review the weekend -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
Re: [PR] drivers/net/mdio: add mdio bus [nuttx]
acassis commented on PR #16999: URL: https://github.com/apache/nuttx/pull/16999#issuecomment-3284970521 ping @xiaoxiang781216 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
Re: [PR] drivers/net/mdio: add mdio bus [nuttx]
acassis commented on PR #16999: URL: https://github.com/apache/nuttx/pull/16999#issuecomment-3281020777 @tinnedkarma very good Documentation! Kudos! -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
Re: [PR] drivers/net/mdio: add mdio bus [nuttx]
tinnedkarma commented on PR #16999: URL: https://github.com/apache/nuttx/pull/16999#issuecomment-3275727879 > @tinnedkarma this is great addition, this way we will have a standard way to communicate with PHY. > > Could you please create a basic Documentation about this driver? Unfortunately your drivers documentation are really "shy", the best references you can use will be: > > https://nuttx.apache.org/docs/latest/components/drivers/special/mtd.html https://nuttx.apache.org/docs/latest/components/drivers/special/lcd.html > > Thank again for your this great contribution Hi @acassis, you are right, I'm also overdue with the documentation for some other contributions. There are things all over the place (my intention are not to be rude, sorry), still figuring out what should get where. I've opened this pull request as draft to have feedback early on for things such as file locations, design approaches and other such big/obvious things. I am working on the documentation in the mean time, but I would need some review over the code to kwon if at least I'm going the right way. If the code needs changes, the documentation will need them as well. There are some things that differs from standard nuttx "approach". Please have a look over them. * The "main" struct is called mdio_bus_s, although from what I can see, nuttx have only devices but no buses, as a difference to other unix-like oses. * Usually, the struct that holds the *ops* is usually statically allocated (g___ops), along with the struct that handles the hardware info/data. I see a lot of uses for the later struct, as a introspection into hardware, but the ops struct feels like littering the global variables space (much more things to search while in gdb), so my stm32 mdio driver does not offer that global ops struct. I'll get this PR out of draft after the documentation is added, but in the mean time, can you have a look over the point above? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
