add DFL bus support to MODULE_DEVICE_TABLE()
Subsystems (3)
Xu Yilun
maintainerv2 cover add DFL bus support to MODULE_DEVICE_TABLE()
Patch #1 and #2 add dfl bus support to MODULE_DEVICE_TABLE(), so that dfl driver modules could be auto-loaded when dfl devices are added.
Patch #3 is a fix of the description of fields in struct dfl_device.
Patch #4 moves the dfl bus APIs to a new header file in the public folder so that scattered dfl device drivers could include the common dfl bus APIs.
Main changes from v1:
- A new patch (Patch #3) to fix the description.
- Rename the dfl-bus.h to dfl.h
- Updated the MAINTAINERS under FPGA DFL DRIVERS.
- Improve comments and minor fixes.
Xu Yilun (4):
fpga: dfl: move dfl_device_id to mod_devicetable.h
dfl: add dfl bus support to MODULE_DEVICE_TABLE()
fpga: dfl: fix the comments of type & feature_id fields
fpga: dfl: move dfl bus related APIs to include/linux/fpga/dfl.h
MAINTAINERS | 1 + drivers/fpga/dfl-n3000-nios.c | 3 +- drivers/fpga/dfl.c | 1 + drivers/fpga/dfl.h | 85 +------------------------------------- include/linux/fpga/dfl.h | 86 +++++++++++++++++++++++++++++++++++++++ include/linux/mod_devicetable.h | 12 ++++++ scripts/mod/devicetable-offsets.c | 4 ++ scripts/mod/file2alias.c | 17 ++++++++ 8 files changed, 123 insertions(+), 86 deletions(-) create mode 100644 include/linux/fpga/dfl.h
Signature · 1 line
2.7.4
Xu Yilun
maintainerPATCH v2 1/4 fpga: dfl: move dfl_device_id to mod_devicetable.h
In order to support MODULE_DEVICE_TABLE() for dfl device driver, this patch moves struct dfl_device_id to mod_devicetable.h
---
v2: fix the order for the header file
--- drivers/fpga/dfl.h | 13 +------------ include/linux/mod_devicetable.h | 12 ++++++++++++ 2 files changed, 13 insertions(+), 12 deletions(-)
drivers/fpga/dfl.h +1 -12
@@ -22,6 +22,7 @@#include <linux/interrupt.h> #include <linux/iopoll.h> #include <linux/io-64-nonatomic-lo-hi.h> +#include <linux/mod_devicetable.h> #include <linux/platform_device.h> #include <linux/slab.h> #include <linux/uuid.h>
@@ -526,18 +527,6 @@ enum dfl_id_type { };/** -* struct dfl_device_id - dfl device identifier -* @type: contains 4 bits DFL FIU type of the device. See enum dfl_id_type. -* @feature_id: contains 12 bits feature identifier local to its DFL FIU type. -* @driver_data: driver specific data. -*/ -struct dfl_device_id { -u8 type; -u16 feature_id; -unsigned long driver_data; -}; - -/** * struct dfl_device - represent an dfl device on dfl bus * * @dev: generic device interface.
include/linux/mod_devicetable.h +12 -0
@@ -838,4 +838,16 @@ struct mhi_device_id { kernel_ulong_t driver_data; }; +/** +* struct dfl_device_id - dfl device identifier +* @type: contains 4 bits DFL FIU type of the device. See enum dfl_id_type. +* @feature_id: contains 12 bits feature identifier local to its DFL FIU type. +* @driver_data: driver specific data. +*/ +struct dfl_device_id { +__u8 type; +__u16 feature_id; +kernel_ulong_t driver_data; +}; +#endif /* LINUX_MOD_DEVICETABLE_H */
Signature · 1 line
2.7.4
Re: [PATCH v2 1/4] fpga: dfl: move dfl_device_id to mod_devicetable.h
Quoted 71 lines · Xu Yilun
In order to support
MODULE_DEVICE_TABLE()for dfl device driver, this patch moves structdfl_device_idtomod_devicetable.hSigned-off-by Xu Yilun <[email protected]>Signed-off-by Wu Hao <[email protected]>Signed-off-by Matthew Gerlach <[email protected]>Signed-off-by Russ Weight <[email protected]>Reviewed-by Tom Rix <[email protected]>Acked-by Wu Hao <[email protected]>---
v2: fix the order for the header file--- drivers/fpga/dfl.h | 13 +------------ include/linux/mod_devicetable.h | 12 ++++++++++++ 2 files changed, 13 insertions(+), 12 deletions(-)drivers/fpga/dfl.h +1
-12@@ -22,6 +22,7 @@#include <linux/interrupt.h> #include <linux/iopoll.h> #include <linux/io-64-nonatomic-lo-hi.h> +#include <linux/mod_devicetable.h> #include <linux/platform_device.h> #include <linux/slab.h> #include <linux/uuid.h> @@ -526,18 +527,6 @@ enum dfl_id_type { };/** -* struct dfl_device_id - dfl device identifier -* @type: contains 4 bits DFL FIU type of the device. See enum dfl_id_type. -* @feature_id: contains 12 bits feature identifier local to its DFL FIU type. -* @driver_data: driver specific data. -*/ -struct dfl_device_id { -u8 type; -u16 feature_id; -unsigned long driver_data; -}; - -/** * struct dfl_device - represent an dfl device on dfl bus * * @dev: generic device interface. include/linux/mod_devicetable.h +12
-0@@ -838,4 +838,16 @@ struct mhi_device_id { kernel_ulong_t driver_data; }; +/** +* struct dfl_device_id - dfl device identifier +* @type: contains 4 bits DFL FIU type of the device. See enum dfl_id_type. +* @feature_id: contains 12 bits feature identifier local to its DFL FIU type. +* @driver_data: driver specific data. +*/ +struct dfl_device_id { +__u8 type; +__u16 feature_id; +kernel_ulong_t driver_data; +}; +#endif /* LINUX_MOD_DEVICETABLE_H */ Signature · 1 line
2.7.4
Applied to for-next,
Thanks
Xu Yilun
maintainerPATCH v2 2/4 dfl: add dfl bus support to MODULE_DEVICE_TABLE()
In reply to Xu YilunDevice Feature List (DFL) is a linked list of feature headers within the device MMIO space. It is used by FPGA to enumerate multiple sub features within it. Each feature can be uniquely identified by DFL type and feature id, which can be read out from feature headers.
A dfl bus helps DFL framework modularize DFL device drivers for different sub features. The dfl bus matches its devices and drivers by DFL type and feature id.
This patch add dfl bus support to MODULE_DEVICE_TABLE() by adding info about struct dfl_device_id in devicetable-offsets.c and add a dfl entry point in file2alias.c.
---
v2: add comments for the format of modalias
--- scripts/mod/devicetable-offsets.c | 4 ++++ scripts/mod/file2alias.c | 17 +++++++++++++++++ 2 files changed, 21 insertions(+)
scripts/mod/devicetable-offsets.c +4 -0
@@ -243,5 +243,9 @@ int main(void)DEVID (mhi_device_id);DEVID_FIELD (mhi_device_id, chan); +DEVID (dfl_device_id); +DEVID_FIELD (dfl_device_id, type); +DEVID_FIELD (dfl_device_id, feature_id); +return 0 ; }
scripts/mod/file2alias.c +17 -0
@@ -1368,6 +1368,22 @@ static int do_mhi_entry(const char *filename, void *symval, char *alias)return 1 ; } +/* Looks like: dfl:tNfN */ +static int do_dfl_entry (const char *filename,void *symval,char *alias) +{ +DEF_FIELD (symval, dfl_device_id, type); +DEF_FIELD (symval, dfl_device_id, feature_id); + +/* +* type contains 4 valid bits and feature_id contains 12 valid bits +* according to DFL specification. +*/ +sprintf (alias,"dfl:t%01Xf%03X" , type, feature_id); + +add_wildcard (alias); +return 1 ; +} +/* Does namelen bytes of name exactly match the symbol? */ static bool sym_is (const char *name,unsigned namelen,const char *symbol) {
@@ -1442,6 +1458,7 @@ static const struct devtable devtable[] = { {"tee", SIZE_tee_client_device_id, do_tee_entry}, {"wmi", SIZE_wmi_device_id, do_wmi_entry}, {"mhi", SIZE_mhi_device_id, do_mhi_entry}, + {"dfl", SIZE_dfl_device_id, do_dfl_entry}, };/* Create MODULE_ALIAS() statements.
Signature · 1 line
2.7.4
Re: [PATCH v2 2/4] dfl: add dfl bus support to MODULE_DEVICE_TABLE()
Quoted 77 lines · Xu Yilun
Device Feature List (DFL) is a linked list of feature headers within the device MMIO space. It is used by FPGA to enumerate multiple sub features within it. Each feature can be uniquely identified by DFL type and feature id, which can be read out from feature headers.
A dfl bus helps DFL framework modularize DFL device drivers for different sub features. The dfl bus matches its devices and drivers by DFL type and feature id.
This patch add dfl bus support to
MODULE_DEVICE_TABLE()by adding info about structdfl_device_idindevicetable-offsets.cand add a dfl entry point infile2alias.c.Signed-off-by Xu Yilun <[email protected]>Signed-off-by Wu Hao <[email protected]>Signed-off-by Matthew Gerlach <[email protected]>Signed-off-by Russ Weight <[email protected]>Acked-by Wu Hao <[email protected]>---
v2: add comments for the format of modalias--- scripts/mod/devicetable-offsets.c | 4 ++++ scripts/mod/file2alias.c | 17 +++++++++++++++++ 2 files changed, 21 insertions(+)scripts/mod/devicetable-offsets.c +4
-0@@ -243,5 +243,9 @@ int main(void)DEVID (mhi_device_id);DEVID_FIELD (mhi_device_id, chan); +DEVID (dfl_device_id); +DEVID_FIELD (dfl_device_id, type); +DEVID_FIELD (dfl_device_id, feature_id); +return 0 ; }scripts/mod/file2alias.c +17
-0@@ -1368,6 +1368,22 @@ static int do_mhi_entry(const char *filename, void *symval, char *alias)return 1 ; } +/* Looks like: dfl:tNfN */ +static int do_dfl_entry (const char *filename,void *symval,char *alias) +{ +DEF_FIELD (symval, dfl_device_id, type); +DEF_FIELD (symval, dfl_device_id, feature_id); + +/* +* type contains 4 valid bits and feature_id contains 12 valid bits +* according to DFL specification. +*/ +sprintf (alias,"dfl:t%01Xf%03X" , type, feature_id); + +add_wildcard (alias); +return 1 ; +} +/* Does namelen bytes of name exactly match the symbol? */ static bool sym_is (const char *name,unsigned namelen,const char *symbol) {@@ -1442,6 +1458,7 @@ static const struct devtable devtable[] = { {"tee", SIZE_tee_client_device_id, do_tee_entry}, {"wmi", SIZE_wmi_device_id, do_wmi_entry}, {"mhi", SIZE_mhi_device_id, do_mhi_entry}, + {"dfl", SIZE_dfl_device_id, do_dfl_entry}, };/* Create MODULE_ALIAS() statements. Signature · 1 line
2.7.4
Applied to for-next,
Thanks
A message that is not in the archive (sent off-list or not yet received): DM6PR11MB381970CD3C77534AA3E4C76385200@DM6PR11MB3819.namprd11.prod.outlook.com
Xu Yilun
maintainerRe: [PATCH v2 2/4] dfl: add dfl bus support to MODULE_DEVICE_TABLE()
Quoted 20 lines · Hao
Quoted 14 lines · Xu Yilun
Quoted 13 lines
Device Feature List (DFL) is a linked list of feature headers within the device MMIO space. It is used by FPGA to enumerate multiple sub features within it. Each feature can be uniquely identified by DFL type and feature id, which can be read out from feature headers.
A dfl bus helps DFL framework modularize DFL device drivers for different sub features. The dfl bus matches its devices and drivers by DFL type and feature id.
This patch add dfl bus support to
MODULE_DEVICE_TABLE()by adding info about structdfl_device_idindevicetable-offsets.cand add a dfl entry point infile2alias.c.Quoted 5 lines
Quoted 5 lines
Signed-off-by Xu Yilun <[email protected]>Signed-off-by Wu Hao <[email protected]>Signed-off-by Matthew Gerlach <[email protected]>Signed-off-by Russ Weight <[email protected]>Acked-by Wu Hao <[email protected]>
Quoted 3 lines
Yilun,
I haven't acked-by this patch as it doesn't modify any dfl files, ideally you
Sorry, I misunderstood your comments "Acked-by: xxx for DFL related changes after this fix".
Quoted 1 line
need acked-by from real maintainer of
scripts/modcode, right?
Ideally yes. From the MAINTAINERS it is Masahiro Yamada, I added him on the "to" list. But I see some other patches (also for devtable entries) in kernel don't have his acked-by.
Hi Moritz:
Do you have any ideas on that?
Thanks,
Yilun.
Quoted 69 lines
Thanks
HaoQuoted 65 lines
scripts/mod/devicetable-
Quoted 8 lines
---
v2: add comments for the format of modalias--- scripts/mod/devicetable-offsets.c | 4 ++++ scripts/mod/file2alias.c | 17 +++++++++++++++++ 2 files changed, 21 insertions(+)scripts/mod/devicetable- renamed from scripts/mod/devicetable-offsets.c +0
-0
offsets.cscripts/mod/file2alias.c static int do_mhi_entry(const char *filename,
Quoted 18 lines
index 27007c1..d8350ee 100644
scripts/mod/devicetable-offsets.c +4
-0@@ -243,5 +243,9 @@ int main(void)DEVID (mhi_device_id);DEVID_FIELD (mhi_device_id, chan); +DEVID (dfl_device_id); +DEVID_FIELD (dfl_device_id, type); +DEVID_FIELD (dfl_device_id, feature_id); +return 0 ; }scripts/mod/file2alias.c +0
-0@@ -1368,6 +1368,22 @@ static int do_mhi_entry(const char *filename,void *symval, char *alias)
Quoted 11 lines
scripts/mod/file2alias.c +8
-0return 1 ; } +/* Looks like: dfl:tNfN */ +static int do_dfl_entry (const char *filename,void *symval,char *alias) +{ +DEF_FIELD (symval, dfl_device_id, type); +DEF_FIELD (symval, dfl_device_id, feature_id); + +/* +* type contains 4 valid bits and feature_id contains 12 valid bits scripts/mod/file2alias.c static int do_mhi_entry(const char *filename, void *symval, char *alias)
Quoted 10 lines
scripts/mod/file2alias.c +8
-0+* according to DFL specification. +*/ +sprintf (alias,"dfl:t%01Xf%03X" , type, feature_id); + +add_wildcard (alias); +return 1 ; +} +/* Does namelen bytes of name exactly match the symbol? */ static bool sym_is(const char *name, unsigned namelen, const char*symbol)
Quoted 10 lines
scripts/mod/file2alias.c +1
-1{@@ -1442,6 +1458,7 @@ static const struct devtable devtable[] = { {"tee", SIZE_tee_client_device_id, do_tee_entry}, {"wmi", SIZE_wmi_device_id, do_wmi_entry}, {"mhi", SIZE_mhi_device_id, do_mhi_entry}, +{"dfl", SIZE_dfl_device_id, do_dfl_entry}, };/* Create MODULE_ALIAS() statements. -- Quoted 2 lines
2.7.4
Applied to for-next,
Thanks
A message that is not in the archive (sent off-list or not yet received): DM6PR11MB3819106F9D50E39F7CC7837D85200@DM6PR11MB3819.namprd11.prod.outlook.com
Moritz Fischer
maintainerRe: [PATCH v2 2/4] dfl: add dfl bus support to MODULE_DEVICE_TABLE()
Hi Hao, Xu,
Quoted 25 lines · Hao
Quoted 25 lines · Hao
Quoted 3 lines
Quoted 3 lines · Xu Yilun
Quoted 2 lines
Device Feature List (DFL) is a linked list of feature headers within the device MMIO space. It is used by FPGA to enumerate multiple sub
features
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
within it. Each feature can be uniquely identified by DFL type and feature id, which can be read out from feature headers.
A dfl bus helps DFL framework modularize DFL device drivers for
different
Quoted 1 line
Quoted 1 line
Quoted 1 line
sub features. The dfl bus matches its devices and drivers by DFL type
and
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
feature id.
This patch add dfl bus support to
MODULE_DEVICE_TABLE()by addinginfo
Quoted 9 lines
Quoted 8 lines
Quoted 8 lines
about struct
dfl_device_idindevicetable-offsets.cand add a dfl entry point infile2alias.c.Signed-off-by Xu Yilun <[email protected]>Signed-off-by Wu Hao <[email protected]>Signed-off-by Matthew Gerlach <[email protected]>Signed-off-by Russ Weight <[email protected]>Acked-by Wu Hao <[email protected]>
Quoted 6 lines
Quoted 6 lines
Quoted 3 lines
Yilun,
I haven't acked-by this patch as it doesn't modify any dfl files, ideally you
Sorry, I misunderstood your comments "Acked-by: xxx for DFL related changes after this fix".
Yeah it wasn't entirely clear to me either :)
Quoted 12 lines
Because the first patch contains changes to non-dfl files as well. : )
Hao
Quoted 7 lines
Quoted 2 lines
need acked-by from real maintainer of
scripts/modcode, right?Ideally yes. From the
MAINTAINERSit is Masahiro Yamada, I added him on the "to"
list. But I see some other patches (also for devtable entries) in kernel don't have his acked-by.
Yeah, I've looked at that and most patches for those files seem to be from subsystem maintainers. So I *think* it should be fine?
Quoted 72 lines
Quoted 72 lines
Hi Moritz:
Do you have any ideas on that?
Thanks,
Yilun.Quoted 4 lines
Thanks
HaoQuoted 8 lines
Quoted 8 lines
Review
Quoted 8 lines
---
v2: add comments for the format of modalias--- scripts/mod/devicetable-offsets.c | 4 ++++ scripts/mod/file2alias.c | 17 +++++++++++++++++ 2 files changed, 21 insertions(+)(quoted diff) +0
-0b/scripts/mod/devicetable-
Quoted 8 lines
Quoted 8 lines
offsets.cQuoted 7 lines
index 27007c1..d8350ee 100644
scripts/mod/devicetable-offsets.c +0
-0@@ -243,5 +243,9 @@ int main(void)DEVID (mhi_device_id);DEVID_FIELD (mhi_device_id, chan);Quoted 11 lines
Quoted 11 lines
scripts/mod/file2alias.c static int do_mhi_entry(const char
Quoted 11 lines
scripts/mod/devicetable-offsets.c +4
-0+DEVID (dfl_device_id); +DEVID_FIELD (dfl_device_id, type); +DEVID_FIELD (dfl_device_id, feature_id); +return 0 ; }scripts/mod/file2alias.c +0
-0@@ -1368,6 +1368,22 @@ static int do_mhi_entry(const char*filename,
Quoted 31 lines
Quoted 31 lines
void *symval, char *alias)
Quoted 11 lines
scripts/mod/file2alias.c +8
-0return 1 ; } +/* Looks like: dfl:tNfN */ +static int do_dfl_entry (const char *filename,void *symval,char *alias) +{ +DEF_FIELD (symval, dfl_device_id, type); +DEF_FIELD (symval, dfl_device_id, feature_id); + +/* +* type contains 4 valid bits and feature_id contains 12 valid bits scripts/mod/file2alias.c static int do_mhi_entry(const char *filename, void *symval, char *alias)
Quoted 10 lines
scripts/mod/file2alias.c +8
-0+* according to DFL specification. +*/ +sprintf (alias,"dfl:t%01Xf%03X" , type, feature_id); + +add_wildcard (alias); +return 1 ; +} +/* Does namelen bytes of name exactly match the symbol? */ static bool sym_is(const char *name, unsigned namelen, const char*symbol)
Quoted 8 lines
scripts/mod/file2alias.c +1
-0{@@ -1442,6 +1458,7 @@ static const struct devtable devtable[] = { {"tee", SIZE_tee_client_device_id, do_tee_entry}, {"wmi", SIZE_wmi_device_id, do_wmi_entry}, {"mhi", SIZE_mhi_device_id, do_mhi_entry}, +{"dfl", SIZE_dfl_device_id, do_dfl_entry}, };
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 4 lines
scripts/mod/file2alias.c +0
-1/* Create MODULE_ALIAS() statements. -- 2.7.4
Applied to for-next,
Thanks
Cheers,
Moritz
Xu Yilun
maintainerRe: [PATCH v2 2/4] dfl: add dfl bus support to MODULE_DEVICE_TABLE()
Quoted 44 lines · Moritz Fischer
Hi Hao, Xu,
Quoted 25 lines · Hao
Quoted 25 lines · Hao
Quoted 3 lines
Quoted 3 lines · Xu Yilun
Quoted 2 lines
Device Feature List (DFL) is a linked list of feature headers within the device MMIO space. It is used by FPGA to enumerate multiple sub
features
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
within it. Each feature can be uniquely identified by DFL type and feature id, which can be read out from feature headers.
A dfl bus helps DFL framework modularize DFL device drivers for
different
Quoted 1 line
Quoted 1 line
Quoted 1 line
sub features. The dfl bus matches its devices and drivers by DFL type
and
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
feature id.
This patch add dfl bus support to
MODULE_DEVICE_TABLE()by addinginfo
Quoted 9 lines
Quoted 8 lines
Quoted 8 lines
about struct
dfl_device_idindevicetable-offsets.cand add a dfl entry point infile2alias.c.Signed-off-by Xu Yilun <[email protected]>Signed-off-by Wu Hao <[email protected]>Signed-off-by Matthew Gerlach <[email protected]>Signed-off-by Russ Weight <[email protected]>Acked-by Wu Hao <[email protected]>Quoted 6 lines
Quoted 6 lines
Quoted 3 lines
Yilun,
I haven't acked-by this patch as it doesn't modify any dfl files, ideally you
Sorry, I misunderstood your comments "Acked-by: xxx for DFL related changes after this fix".
Yeah it wasn't entirely clear to me either :)
Quoted 8 lines
Because the first patch contains changes to non-dfl files as well. : )
Hao
Quoted 3 lines
Quoted 2 lines
need acked-by from real maintainer of
scripts/modcode, right?
Quoted 7 lines
Quoted 4 lines
Quoted 4 lines
Ideally yes. From the
MAINTAINERSit is Masahiro Yamada, I added him on the "to"
list. But I see some other patches (also for devtable entries) in kernel don't have his acked-by.Yeah, I've looked at that and most patches for those files seem to be from subsystem maintainers. So I *think* it should be fine?
I see you have applied the patch. I'm very fine. :)
Quoted 83 lines
Quoted 73 lines
Quoted 73 lines
Hi Moritz:
Do you have any ideas on that?
Thanks,
Yilun.Quoted 4 lines
Thanks
HaoQuoted 8 lines
Quoted 8 lines
Review
Quoted 8 lines
---
v2: add comments for the format of modalias--- scripts/mod/devicetable-offsets.c | 4 ++++ scripts/mod/file2alias.c | 17 +++++++++++++++++ 2 files changed, 21 insertions(+)(quoted diff) +0
-0b/scripts/mod/devicetable-
Quoted 8 lines
Quoted 8 lines
offsets.cQuoted 7 lines
index 27007c1..d8350ee 100644
scripts/mod/devicetable-offsets.c +0
-0@@ -243,5 +243,9 @@ int main(void)DEVID (mhi_device_id);DEVID_FIELD (mhi_device_id, chan);Quoted 11 lines
Quoted 11 lines
scripts/mod/file2alias.c static int do_mhi_entry(const char
Quoted 11 lines
scripts/mod/devicetable-offsets.c +4
-0+DEVID (dfl_device_id); +DEVID_FIELD (dfl_device_id, type); +DEVID_FIELD (dfl_device_id, feature_id); +return 0 ; }scripts/mod/file2alias.c +0
-0@@ -1368,6 +1368,22 @@ static int do_mhi_entry(const char*filename,
Quoted 31 lines
Quoted 31 lines
void *symval, char *alias)
Quoted 11 lines
scripts/mod/file2alias.c +8
-0return 1 ; } +/* Looks like: dfl:tNfN */ +static int do_dfl_entry (const char *filename,void *symval,char *alias) +{ +DEF_FIELD (symval, dfl_device_id, type); +DEF_FIELD (symval, dfl_device_id, feature_id); + +/* +* type contains 4 valid bits and feature_id contains 12 valid bits scripts/mod/file2alias.c static int do_mhi_entry(const char *filename, void *symval, char *alias)
Quoted 10 lines
scripts/mod/file2alias.c +8
-0+* according to DFL specification. +*/ +sprintf (alias,"dfl:t%01Xf%03X" , type, feature_id); + +add_wildcard (alias); +return 1 ; +} +/* Does namelen bytes of name exactly match the symbol? */ static bool sym_is(const char *name, unsigned namelen, const char*symbol)
Quoted 8 lines
scripts/mod/file2alias.c +1
-0{@@ -1442,6 +1458,7 @@ static const struct devtable devtable[] = { {"tee", SIZE_tee_client_device_id, do_tee_entry}, {"wmi", SIZE_wmi_device_id, do_wmi_entry}, {"mhi", SIZE_mhi_device_id, do_mhi_entry}, +{"dfl", SIZE_dfl_device_id, do_dfl_entry}, };Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 4 lines
scripts/mod/file2alias.c +0
-1/* Create MODULE_ALIAS() statements. -- 2.7.4
Applied to for-next,
Thanks
Cheers,
Moritz
Xu Yilun
maintainerPATCH v2 3/4 fpga: dfl: fix the comments of type & feature_id fields
In reply to Xu YilunThe description of feature_id in struct dfl_device is not accurate. In DFL specification the feature_id is the 12 bits field. The description in struct dfl_device_id is more clear so we make them aligned. We also made the similar fix for the type field.
--- drivers/fpga/dfl.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/fpga/dfl.h +2 -2
@@ -531,8 +531,8 @@ enum dfl_id_type {* * @dev: generic device interface. * @id: id of the dfl device. -* @type: type of DFL FIU of the device. See enum dfl_id_type. -* @feature_id: 16 bits feature identifier local to its DFL FIU type. +* @type: contains 4 bits DFL FIU type of the device. See enum dfl_id_type. +* @feature_id: contains 12 bits feature identifier local to its DFL FIU type. * @mmio_res: mmio resource of this dfl device. * @irqs: list of Linux IRQ numbers of this dfl device. * @num_irqs: number of IRQs supported by this dfl device.
Signature · 1 line
2.7.4
Re: [PATCH v2 3/4] fpga: dfl: fix the comments of type & feature_id fields
Quoted 28 lines · Xu Yilun
The description of
feature_idin structdfl_deviceis not accurate. In DFL specification thefeature_idis the 12 bits field. The description in structdfl_device_idis more clear so we make them aligned. We also made the similar fix for the type field.Signed-off-by Xu Yilun <[email protected]>--- drivers/fpga/dfl.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/fpga/dfl.h +2
-2@@ -531,8 +531,8 @@ enum dfl_id_type {* * @dev: generic device interface. * @id: id of the dfl device. -* @type: type of DFL FIU of the device. See enum dfl_id_type. -* @feature_id: 16 bits feature identifier local to its DFL FIU type. +* @type: contains 4 bits DFL FIU type of the device. See enum dfl_id_type. +* @feature_id: contains 12 bits feature identifier local to its DFL FIU type. * @mmio_res: mmio resource of this dfl device. * @irqs: list of Linux IRQ numbers of this dfl device. * @num_irqs: number of IRQs supported by this dfl device. Signature · 1 line
2.7.4
Applied to for-next,
Thanks
Wu, Hao
Acked-byRE: [PATCH v2 3/4] fpga: dfl: fix the comments of type & feature_id fields
Quoted 7 lines · Xu Yilun
Quoted 6 lines
The description of
feature_idin structdfl_deviceis not accurate. In DFL specification thefeature_idis the 12 bits field. The description in structdfl_device_idis more clear so we make them aligned. We also made the similar fix for the type field.Signed-off-by Xu Yilun <[email protected]>
Thanks
Hao
Quoted 26 lines
Quoted 20 lines
--- drivers/fpga/dfl.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/fpga/dfl.h +2
-3@@ -531,8 +531,8 @@ enum dfl_id_type {* * @dev: generic device interface. * @id: id of the dfl device. -* @type: type of DFL FIU of the device. See enum dfl_id_type. -* @feature_id: 16 bits feature identifier local to its DFL FIU type. +* @type: contains 4 bits DFL FIU type of the device. See enum dfl_id_type. +* @feature_id: contains 12 bits feature identifier local to its DFL FIU type. * @mmio_res: mmio resource of this dfl device. * @irqs: list of Linux IRQ numbers of this dfl device. * @num_irqs: number of IRQs supported by this dfl device. -- Quoted 2 lines
2.7.4
Applied to for-next,
Thanks
Xu Yilun
maintainerPATCH v2 4/4 fpga: dfl: move dfl bus related APIs to include/linux/fpga/dfl.h
In reply to Xu YilunThe patch moves dfl-bus related APIs to include/linux/fpga/dfl.h
Now the DFL device drivers could be made as independent modules and put in different folders according to their functionality. In order for scattered DFL device drivers to include dfl bus APIs, move the dfl bus APIs to a new header file in the public folder.
---
v2: updated the MAINTAINERS under FPGA DFL DRIVERS
improve the comments
rename the dfl-bus.h to dfl.h
--- MAINTAINERS | 1 + drivers/fpga/dfl-n3000-nios.c | 3 +- drivers/fpga/dfl.c | 1 + drivers/fpga/dfl.h | 72 ------------------------------------ include/linux/fpga/dfl.h | 86 +++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 89 insertions(+), 74 deletions(-) create mode 100644 include/linux/fpga/dfl.h
MAINTAINERS +1 -0
@@ -6883,6 +6883,7 @@ S: Maintained F: Documentation/ABI/testing/sysfs-bus-dfl F: Documentation/fpga/dfl.rst F: drivers/fpga/dfl* +F: include/linux/fpga/dfl.h F: include/uapi/linux/fpga-dfl.h FPGA MANAGER FRAMEWORK
drivers/fpga/dfl-n3000-nios.c +1 -2
@@ -11,6 +11,7 @@*/ #include <linux/bitfield.h> #include <linux/errno.h> +#include <linux/fpga/dfl.h> #include <linux/io.h> #include <linux/io-64-nonatomic-lo-hi.h> #include <linux/kernel.h>
@@ -22,8 +23,6 @@#include <linux/spi/spi.h> #include <linux/types.h> -#include "dfl.h" -static char *fec_mode ="rs" ;module_param (fec_mode, charp,0444 );MODULE_PARM_DESC (fec_mode,"FEC mode of the ethernet retimer on Intel PAC N3000" );
drivers/fpga/dfl.c +1 -0
@@ -11,6 +11,7 @@* Xiao Guangrong <[email protected]> */ #include <linux/fpga-dfl.h> +#include <linux/fpga/dfl.h> #include <linux/module.h> #include <linux/uaccess.h>
drivers/fpga/dfl.h +0 -72
76 lines not on this page · raw message
include/linux/fpga/dfl.h new file +86 -0
86 lines not on this page · raw message
Signature · 1 line
2.7.4
Re: [PATCH v2 4/4] fpga: dfl: move dfl bus related APIs to include/linux/fpga/dfl.h
Quoted 244 lines · Xu Yilun
The patch moves dfl-bus related APIs to
include/linux/fpga/dfl.hNow the DFL device drivers could be made as independent modules and put in different folders according to their functionality. In order for scattered DFL device drivers to include dfl bus APIs, move the dfl bus APIs to a new header file in the public folder.
Signed-off-by Xu Yilun <[email protected]>Reviewed-by Tom Rix <[email protected]>Acked-by Wu Hao <[email protected]>---
v2: updated theMAINTAINERSunder FPGA DFL DRIVERS
improve the comments
rename thedfl-bus.htodfl.h--- MAINTAINERS | 1 + drivers/fpga/dfl-n3000-nios.c | 3 +- drivers/fpga/dfl.c | 1 + drivers/fpga/dfl.h | 72 ------------------------------------ include/linux/fpga/dfl.h | 86 +++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 89 insertions(+), 74 deletions(-) create mode 100644 include/linux/fpga/dfl.hMAINTAINERS +1
-0@@ -6883,6 +6883,7 @@ S: Maintained F: Documentation/ABI/testing/sysfs-bus-dfl F: Documentation/fpga/dfl.rst F: drivers/fpga/dfl* +F: include/linux/fpga/dfl.h F: include/uapi/linux/fpga-dfl.h FPGA MANAGER FRAMEWORKdrivers/fpga/dfl-n3000-nios.c +1
-2@@ -11,6 +11,7 @@*/ #include <linux/bitfield.h> #include <linux/errno.h> +#include <linux/fpga/dfl.h> #include <linux/io.h> #include <linux/io-64-nonatomic-lo-hi.h> #include <linux/kernel.h> @@ -22,8 +23,6 @@#include <linux/spi/spi.h> #include <linux/types.h> -#include "dfl.h" -static char *fec_mode ="rs" ;module_param (fec_mode, charp,0444 );MODULE_PARM_DESC (fec_mode,"FEC mode of the ethernet retimer on Intel PAC N3000" );drivers/fpga/dfl.c +1
-0@@ -11,6 +11,7 @@* Xiao Guangrong <[email protected]> */ #include <linux/fpga-dfl.h> +#include <linux/fpga/dfl.h> #include <linux/module.h> #include <linux/uaccess.h> drivers/fpga/dfl.h +0
-72@@ -517,76 +517,4 @@ long dfl_feature_ioctl_set_irq(struct platform_device *pdev,struct dfl_feature *feature, unsigned long arg); -/** -* enum dfl_id_type - define the DFL FIU types -*/ -enum dfl_id_type { -FME_ID , -PORT_ID , -DFL_ID_MAX , -}; - -/** -* struct dfl_device - represent an dfl device on dfl bus -* -* @dev: generic device interface. -* @id: id of the dfl device. -* @type: contains 4 bits DFL FIU type of the device. See enum dfl_id_type. -* @feature_id: contains 12 bits feature identifier local to its DFL FIU type. -* @mmio_res: mmio resource of this dfl device. -* @irqs: list of Linux IRQ numbers of this dfl device. -* @num_irqs: number of IRQs supported by this dfl device. -* @cdev: pointer to DFL FPGA container device this dfl device belongs to. -* @id_entry: matched id entry in dfl driver's id table. -*/ -struct dfl_device { -struct device dev; -int id; -u8 type; -u16 feature_id; -struct resource mmio_res; -int *irqs; -unsigned int num_irqs; -struct dfl_fpga_cdev *cdev; -const struct dfl_device_id *id_entry; -}; - -/** -* struct dfl_driver - represent an dfl device driver -* -* @drv: driver model structure. -* @id_table: pointer to table of device IDs the driver is interested in. -* { } member terminated. -* @probe: mandatory callback for device binding. -* @remove: callback for device unbinding. -*/ -struct dfl_driver { -struct device_driver drv; -const struct dfl_device_id *id_table; - -int (*probe)(struct dfl_device *dfl_dev); -void (*remove)(struct dfl_device *dfl_dev); -}; - -#define to_dfl_dev (d) container_of(d, struct dfl_device, dev) -#define to_dfl_drv (d) container_of(d, struct dfl_driver, drv) - -/* -* use a macro to avoid include chaining to get THIS_MODULE. -*/ -#define dfl_driver_register (drv) \ - __dfl_driver_register(drv, THIS_MODULE) -int __dfl_driver_register (struct dfl_driver *dfl_drv,struct module *owner); -void dfl_driver_unregister (struct dfl_driver *dfl_drv); - -/* -* module_dfl_driver() - Helper macro for drivers that don't do -* anything special in module init/exit. This eliminates a lot of -* boilerplate. Each module may only use this macro once, and -* calling it replaces module_init() and module_exit(). -*/ -#define module_dfl_driver (__dfl_driver) \ - module_driver(__dfl_driver, dfl_driver_register, \ - dfl_driver_unregister) -#endif /* __FPGA_DFL_H */ include/linux/fpga/dfl.h new file +86
-0@@ -0,0 +1,86 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Header file for DFL driver and device API +* +* Copyright (C) 2020 Intel Corporation, Inc. +*/ + +#ifndef __LINUX_FPGA_DFL_H +#define __LINUX_FPGA_DFL_H + +#include <linux/device.h> +#include <linux/mod_devicetable.h> + +/** +* enum dfl_id_type - define the DFL FIU types +*/ +enum dfl_id_type { +FME_ID , +PORT_ID , +DFL_ID_MAX , +}; + +/** +* struct dfl_device - represent an dfl device on dfl bus +* +* @dev: generic device interface. +* @id: id of the dfl device. +* @type: contains 4 bits DFL FIU type of the device. See enum dfl_id_type. +* @feature_id: contains 12 bits feature identifier local to its DFL FIU type. +* @mmio_res: mmio resource of this dfl device. +* @irqs: list of Linux IRQ numbers of this dfl device. +* @num_irqs: number of IRQs supported by this dfl device. +* @cdev: pointer to DFL FPGA container device this dfl device belongs to. +* @id_entry: matched id entry in dfl driver's id table. +*/ +struct dfl_device { +struct device dev; +int id; +u8 type; +u16 feature_id; +struct resource mmio_res; +int *irqs; +unsigned int num_irqs; +struct dfl_fpga_cdev *cdev; +const struct dfl_device_id *id_entry; +}; + +/** +* struct dfl_driver - represent an dfl device driver +* +* @drv: driver model structure. +* @id_table: pointer to table of device IDs the driver is interested in. +* { } member terminated. +* @probe: mandatory callback for device binding. +* @remove: callback for device unbinding. +*/ +struct dfl_driver { +struct device_driver drv; +const struct dfl_device_id *id_table; + +int (*probe)(struct dfl_device *dfl_dev); +void (*remove)(struct dfl_device *dfl_dev); +}; + +#define to_dfl_dev (d) container_of(d, struct dfl_device, dev) +#define to_dfl_drv (d) container_of(d, struct dfl_driver, drv) + +/* +* use a macro to avoid include chaining to get THIS_MODULE. +*/ +#define dfl_driver_register (drv) \ + __dfl_driver_register(drv, THIS_MODULE) +int __dfl_driver_register (struct dfl_driver *dfl_drv,struct module *owner); +void dfl_driver_unregister (struct dfl_driver *dfl_drv); + +/* +* module_dfl_driver() - Helper macro for drivers that don't do +* anything special in module init/exit. This eliminates a lot of +* boilerplate. Each module may only use this macro once, and +* calling it replaces module_init() and module_exit(). +*/ +#define module_dfl_driver (__dfl_driver) \ + module_driver(__dfl_driver, dfl_driver_register, \ + dfl_driver_unregister) + +#endif /* __LINUX_FPGA_DFL_H */ Signature · 1 line
2.7.4
Applied to for-next,
Thanks