powerpc/85xx: Add a property bus-num for espi controller
Subsystems (3)
PATCH 1/2 powerpc/85xx: Add a property bus-num for espi controller
To use "mtdparts=..." in cmdline, the spi_master bus_num must be static. This property is use to asign a static bus number for spi_master other than allocate dynamically.
--- arch/powerpc/boot/dts/fsl/pq3-espi-0.dtsi | 1 + arch/powerpc/boot/dts/fsl/qoriq-espi-0.dtsi | 1 + 2 files changed, 2 insertions(+)
arch/powerpc/boot/dts/fsl/pq3-espi-0.dtsi +1 -0
@@ -38,4 +38,5 @@ spi@7000 { compatible = "fsl,mpc8536-espi"; reg = <0x7000 0x1000>; interrupts = <59 0x2 0 0>; + bus-num = <0>; };
arch/powerpc/boot/dts/fsl/qoriq-espi-0.dtsi +1 -0
@@ -38,4 +38,5 @@ spi@110000 { compatible = "fsl,mpc8536-espi"; reg = <0x110000 0x1000>; interrupts = <53 0x2 0 0>; + bus-num = <0>; };
Signature · 7 lines
1.8.5 -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 1394789757-40732-1-git-send-email-B48286-KZfg59tc24xl57MIdRCFDg@public.gmane.org
PATCH 2/2 spi/fsl-lib: Get the SPI controller bus number from DTS
Get the spi_master's bus_num from DTS to make the spi_master's name static. So "mtdparts=spi.bus_num.chip_select:..." in cmdline can be used to asign mtd partions of spi flash.
--- drivers/spi/spi-fsl-lib.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/spi/spi-fsl-lib.c +7 -3
@@ -198,7 +198,7 @@ int of_mpc8xxx_spi_probe(struct platform_device *ofdev)struct mpc8xxx_spi_probe_info *pinfo;struct fsl_spi_platform_data *pdata;const void *prop; -int ret = -ENOMEM ; +int ret = -ENOMEM , bus_num; pinfo =kzalloc (sizeof (*pinfo),GFP_KERNEL );if (!pinfo)
@@ -207,8 +207,12 @@ int of_mpc8xxx_spi_probe(struct platform_device *ofdev) pdata = &pinfo->pdata; dev->platform_data = pdata; -/* Allocate bus num dynamically. */ - pdata->bus_num =-1 ; + ret =of_property_read_u32 (np,"bus-num" , &bus_num); +if (ret <0 ) { +/* Allocate bus num dynamically. */ + bus_num =-1 ; + } + pdata->bus_num = bus_num;#ifdef CONFIG_FSL_SOC /* SPI controller is either clocked from QE or SoC clock. */
Signature · 7 lines
1.8.5 -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 1394789757-40732-2-git-send-email-B48286-KZfg59tc24xl57MIdRCFDg@public.gmane.org
Re: [PATCH 2/2] spi/fsl-lib: Get the SPI controller bus number from DTS
Quoted 3 lines · Hou Zhiqiang
Get the spi_master's
bus_numfrom DTS to make the spi_master's name static. So "mtdparts=spi.bus_num.chip_select:..." in cmdline can be used to asign mtd partions of spi flash.
If we are going to do this it shouldn't be device specific (it should be done in the framework since nothing is specific to the controller there) but I'm not convinced that we should be doing it - this is all very Linux specific.
The DT already has support for specifying flash layouts, can't those be used (for example via chosen if they're not fixed for the board)? Or if it's just picking the correct filesystem then UUIDs and labels are the standard way to do things.
A message that is not in the archive (sent off-list or not yet received): [email protected]
RE: [PATCH 2/2] spi/fsl-lib: Get the SPI controller bus number from DTS
Quoted 14 lines
-----Original Message-----
From: Mark Brown [mailto:[email protected]]
Sent: Saturday, March 15, 2014 3:19 AM
To: Hou Zhiqiang-B48286
Cc: [email protected]; [email protected]; rob.herring-bsGFqQB8/[email protected]; [email protected]; [email protected]; [email protected]; [email protected]; grant.likely-s3s/[email protected]; Wood Scott-B07421; Hu Mingkai-B21284
Subject: Re: [PATCH 2/2] spi/fsl-lib: Get the SPI controller bus number
from DTSOn Fri, Mar 14, 2014 at 05:35:57PM +0800, Hou Zhiqiang wrote:
Quoted 8 lines
Quoted 3 lines
Get the spi_master's
bus_numfrom DTS to make the spi_master's name static. So "mtdparts=spi.bus_num.chip_select:..." in cmdline can be used to asign mtd partions of spi flash.If we are going to do this it shouldn't be device specific (it should be done in the framework since nothing is specific to the controller there) but I'm not convinced that we should be doing it - this is all very Linux specific.
This patch just assign a bus number to the controller. It is driver's responsibility to distribute a bus number to spi_master and the definition of bus_num is used to distinguish controllers. So, it is specific for the controller and doesn't affect the framework.
Quoted 5 lines
The DT already has support for specifying flash layouts, can't those be used (for example via chosen if they're not fixed for the board)? Or if it's just picking the correct filesystem then UUIDs and labels are the standard way to do things.
The DT specifying flash layouts is ok. There is another way to make the flash layouts using command line, but it is not safe because of the dynamic bus_num. It is not the reason that the way of DT is supported flash layouts, to live the other way unsafe, right?
Thanks,
Zhiqiang
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): c4b28b01b2f544ca9d264eaee2542257-ufbTtyGzTTTk7ZsBhlipOOO6mTEJWrR4XA4E9RH9d+qIuWR1G4zioA@public.gmane.org
Re: [PATCH 2/2] spi/fsl-lib: Get the SPI controller bus number from DTS
Quoted 10 lines · On Mon, Mar 17, 2014 at 05:11:11AM +0000…
Quoted 9 lines · Hou Zhiqiang
Quoted 3 lines
Get the spi_master's
bus_numfrom DTS to make the spi_master's name static. So "mtdparts=spi.bus_num.chip_select:..." in cmdline can be used to asign mtd partions of spi flash.If we are going to do this it shouldn't be device specific (it should be done in the framework since nothing is specific to the controller there) but I'm not convinced that we should be doing it - this is all very Linux specific.
Quoted 4 lines
This patch just assign a bus number to the controller. It is driver's responsibility to distribute a bus number to
spi_masterand the definition ofbus_numis used to distinguish controllers. So, it is specific for the controller and doesn't affect the framework.
You are adding a property to specify a bus number. There is no reason why such a property should be specific to a single controller, every controller in every system has a bus number assigned to it so if we have a way to specify one controller via the device tree we should have a way to specify it for all.
Quoted 9 lines
Quoted 4 lines
The DT already has support for specifying flash layouts, can't those be used (for example via chosen if they're not fixed for the board)? Or if it's just picking the correct filesystem then UUIDs and labels are the standard way to do things.
The DT specifying flash layouts is ok. There is another way to make the flash layouts using command line, but it is not safe because of the dynamic
bus_num. It is not the reason that the way of DT is supported flash layouts, to live the other way unsafe, right?
This sounds to me like we need a better way of talking about flash device names on the Linux command line rather than a way to fix the bus number - for example, being able to refer to them using a fixed property like the physical address. Being able to refer to devices via an alias assigned in the DT would also be useful (and more readable), I think there may already be a mechanism for doing that which would need to be plumbed in but I'm not 100% sure.
A message that is not in the archive (sent off-list or not yet received): [email protected]
RE: [PATCH 2/2] spi/fsl-lib: Get the SPI controller bus number from DTS
Quoted 29 lines
-----Original Message-----
From: Mark Brown [mailto:[email protected]]
Sent: Monday, March 17, 2014 9:01 PM
To: Hou Zhiqiang-B48286
Cc: [email protected]; [email protected]; rob.herring-bsGFqQB8/[email protected]; [email protected]; [email protected]; [email protected]; [email protected]; grant.likely-s3s/[email protected]; Wood Scott-B07421; Hu Mingkai-B21284
Subject: Re: [PATCH 2/2] spi/fsl-lib: Get the SPI controller bus number
from DTSQuoted 10 lines · On Mon, Mar 17, 2014 at 05:11:11AM +0000…
Quoted 9 lines · Hou Zhiqiang
Quoted 3 lines
Get the spi_master's
bus_numfrom DTS to make the spi_master's name static. So "mtdparts=spi.bus_num.chip_select:..." in cmdline can be used to asign mtd partions of spi flash.If we are going to do this it shouldn't be device specific (it should be done in the framework since nothing is specific to the controller there) but I'm not convinced that we should be doing it - this is all very Linux specific.
Quoted 4 lines
This patch just assign a bus number to the controller. It is driver's responsibility to distribute a bus number to
spi_masterand the definition ofbus_numis used to distinguish controllers. So, it is specific for the controller and doesn't affect the framework.
Quoted 6 lines
You are adding a property to specify a bus number. There is no reason why such a property should be specific to a single controller, every controller in every system has a bus number assigned to it so if we have a way to specify one controller via the device tree we should have a way to specify it for all.
The reason to specify a bus number to a single controller is to avoid allocating one dynamically, so we know the bus number before booting up the kernel. If there are several controllers, you should add this property to all of them. But it is unnecessary to add this property, if you do not care about the bus number, and it will be allocated dynamically.
Quoted 10 lines
Quoted 9 lines
Quoted 4 lines
The DT already has support for specifying flash layouts, can't those be used (for example via chosen if they're not fixed for the board)? Or if it's just picking the correct filesystem then UUIDs and labels are the standard way to do things.
The DT specifying flash layouts is ok. There is another way to make the flash layouts using command line, but it is not safe because of the dynamic
bus_num. It is not the reason that the way of DT is supported flash layouts, to live the other way unsafe, right?
Quoted 7 lines
This sounds to me like we need a better way of talking about flash device names on the Linux command line rather than a way to fix the bus number - for example, being able to refer to them using a fixed property like the physical address. Being able to refer to devices via an alias assigned in the DT would also be useful (and more readable), I think there may already be a mechanism for doing that which would need to be plumbed in but I'm not 100% sure.
The bus number is the variable designed to distinguish one spi controller from others. Why spi controller's physical address must be use instead of bus number?
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 9186860716f446f9a5773e7e47d39114-ufbTtyGzTTTk7ZsBhlipOOO6mTEJWrR4XA4E9RH9d+qIuWR1G4zioA@public.gmane.org
Re: [PATCH 2/2] spi/fsl-lib: Get the SPI controller bus number from DTS
Quoted 18 lines · On Tue, Mar 18, 2014 at 8:40 AM, [email protected]…
Quoted 10 lines
Quoted 9 lines
Quoted 4 lines
The DT already has support for specifying flash layouts, can't those be used (for example via chosen if they're not fixed for the board)? Or if it's just picking the correct filesystem then UUIDs and labels are the standard way to do things.
The DT specifying flash layouts is ok. There is another way to make the flash layouts using command line, but it is not safe because of the dynamic
bus_num. It is not the reason that the way of DT is supported flash layouts, to live the other way unsafe, right?Quoted 7 lines
This sounds to me like we need a better way of talking about flash device names on the Linux command line rather than a way to fix the bus number - for example, being able to refer to them using a fixed property like the physical address. Being able to refer to devices via an alias assigned in the DT would also be useful (and more readable), I think there may already be a mechanism for doing that which would need to be plumbed in but I'm not 100% sure.
Quoted 3 lines
The bus number is the variable designed to distinguish one spi controller from others. Why spi controller's physical address must be use instead of bus number?
Because the bus number is dynamic, while the physical address doesn't change, so it can be used to uniqely identify the device before booting the kernel.
Cfr. "spi1" vs. "e6e20000.spi".
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): CAMuHMdWHSVPDZ9q9rw0FZqNrR+E0q9pQcYLRiseopoM-K-5svg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
RE: [PATCH 2/2] spi/fsl-lib: Get the SPI controller bus number from DTS
DQoNCj4gLS0tLS1PcmlnaW5hbCBNZXNzYWdlLS0tLS0NCj4gRnJvbTogZ2VlcnQudXl0dGVyaG9l dmVuQGdtYWlsLmNvbSBbbWFpbHRvOmdlZXJ0LnV5dHRlcmhvZXZlbkBnbWFpbC5jb21dDQo+IE9u IEJlaGFsZiBPZiBHZWVydCBVeXR0ZXJob2V2ZW4NCj4gU2VudDogVHVlc2RheSwgTWFyY2ggMTgs IDIwMTQgNDo1NiBQTQ0KPiBUbzogSG91IFpoaXFpYW5nLUI0ODI4Ng0KPiBDYzogTWFyayBCcm93 bjsgbGludXgtc3BpQHZnZXIua2VybmVsLm9yZzsgZGV2aWNldHJlZUB2Z2VyLmtlcm5lbC5vcmc7 DQo+IHJvYi5oZXJyaW5nQGNhbHhlZGEuY29tOyBwYXdlbC5tb2xsQGFybS5jb207IG1hcmsucnV0 bGFuZEBhcm0uY29tOw0KPiBpamMrZGV2aWNldHJlZUBoZWxsaW9uLm9yZy51azsgZ2FsYWtAY29k ZWF1cm9yYS5vcmc7DQo+IGdyYW50Lmxpa2VseUBzZWNyZXRsYWIuY2E7IFdvb2QgU2NvdHQtQjA3 NDIxOyBIdSBNaW5na2FpLUIyMTI4NA0KPiBTdWJqZWN0OiBSZTogW1BBVENIIDIvMl0gc3BpL2Zz bC1saWI6IEdldCB0aGU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Nw aTEiIHZzLiAiZTZlMjAwMDAuc3BpIi4NCj4gDQoNClRoZSBwcmVjb25kaXRpb24gb2YgZHluYW1p YyBidXMgbnVtYmVyIGlzIGluaXRpYWwgaXQgd2l0aCAtMSBpbiB0aGUgY29udHJvbGxlcg0KZHJp dmVyLiBCdXQgbm93IEkgbmVlZCBhIHJlYXNvbmFibGUgYnVzIG51bWJlciwgSSBkb24ndCB3YW50 IGEgZHluYW1pYyBvbmUuDQpXaHkgZG9lcyB1c2UgdGhlIGNvbnRyb2xsZXIncyBwaHlzaWNhbCBh ZGRyZXNzIHRvIHRha2UgdGhlIHJvbGUgb2YgYnVzIG51bWJlcg0KdG8gZGlzdGluZ3Vpc2ggY29u dHJvbGxlcnMuIA0KDQo+IEdye29ldGplLGVldGluZ31zLA0KPiANCj4gICAgICAgICAgICAgICAg ICAgICAgICAgR2VlcnQNCj4gDQo+IC0tDQo+IEdlZXJ0IFV5dHRlcmhvZXZlbiAtLSBUaGVyZSdz IGxvdHMgb2YgTGludXggYmV5b25kIGlhMzIgLS0gZ2VlcnRAbGludXgtDQo+IG02OGsub3JnDQo+ IA0KPiBJbiBwZXJzb25hbCBjb252ZXJzYXRpb25zIHdpdGggdGVjaG5pY2FsIHBlb3BsZSwgSSBj YWxsIG15c2VsZiBhIGhhY2tlci4NCj4gQnV0IHdoZW4gSSdtIHRhbGtpbmcgdG8gam91cm5hbGlz dHMgSSBqdXN0IHNheSAicHJvZ3JhbW1lciIgb3Igc29tZXRoaW5nDQo+IGxpa2UgdGhhdC4NCj4g ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAtLSBMaW51cyBUb3J2YWxkcw0KPiANCg0K --
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 01e4d20dc3d94e2f8f7252225932c774-ufbTtyGzTTTk7ZsBhlipOOO6mTEJWrR4XA4E9RH9d+qIuWR1G4zioA@public.gmane.org
Re: [PATCH 2/2] spi/fsl-lib: Get the SPI controller bus number from DTS
Quoted 44 lines · On Tue, 2014-03-18 at 04:34 -0500, Hou Zhiqiang-B48286 wrote:
Quoted 34 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Geert Uytterhoeven
Sent: Tuesday, March 18, 2014 4:56 PM
To: Hou Zhiqiang-B48286
Cc: Mark Brown; [email protected]; [email protected]; rob.herring-bsGFqQB8/[email protected]; [email protected]; [email protected]; [email protected]; [email protected]; grant.likely-s3s/[email protected]; Wood Scott-B07421; Hu Mingkai-B21284
Subject: Re: [PATCH 2/2] spi/fsl-lib: Get the SPI controller bus number
from DTSQuoted 2 lines · On Tue, Mar 18, 2014 at 8:40 AM, [email protected]…
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
The DT already has support for specifying flash layouts, can't those be used (for example via chosen if they're not fixed for the
board)?
Quoted 16 lines
Quoted 15 lines
Quoted 7 lines
Quoted 2 lines
Or if it's just picking the correct filesystem then UUIDs and labels are the standard way to do things.
The DT specifying flash layouts is ok. There is another way to make the flash layouts using command line, but it is not safe because of the dynamic
bus_num. It is not the reason that the way of DT is supported flash layouts, to live the other way unsafe, right?This sounds to me like we need a better way of talking about flash device names on the Linux command line rather than a way to fix the bus number - for example, being able to refer to them using a fixed property like the physical address. Being able to refer to devices via an alias assigned in the DT would also be useful (and more readable), I think there may already be a mechanism for doing that which would need to be plumbed in but I'm not 100% sure.
Quoted 9 lines
Quoted 3 lines
The bus number is the variable designed to distinguish one spi controller from others. Why spi controller's physical address must be use instead of bus number?
Because the bus number is dynamic, while the physical address doesn't change, so it can be used to uniqely identify the device before booting the kernel.
Cfr. "spi1" vs. "e6e20000.spi".
Quoted 4 lines
The precondition of dynamic bus number is initial it with -1 in the controller driver. But now I need a reasonable bus number, I don't want a dynamic one. Why does use the controller's physical address to take the role of bus number to distinguish controllers.
Where are you going to get this "reasonable" non-dynamic number from? How are you going to ensure there are no conflicts with other SPI controllers (e.g. on a dynamic add-on card)?
Physical addresses work well because they are tied to something real, rather than an arbitrary enumeration. Our NAND controllers use the physical address for the MTD name. Device tree NOR flash allows the device tree to set the mtd name[1], and otherwise falls back on the platform device name, which contains the physical address.
-Scott
[1] This violates the "device tree describes hardware rather than configures Linux" rule...
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 1395180522.12479.214.camel-88ow+0ZRuxG2UiBs7uKeOtHuzzzSOjJt@public.gmane.org
RE: [PATCH 2/2] spi/fsl-lib: Get the SPI controller bus number from DTS
DQoNCj4gLS0tLS1PcmlnaW5hbCBNZXNzYWdlLS0tLS0NCj4gRnJvbTogV29vZCBTY290dC1CMDc0 MjENCj4gU2VudDogV2VkbmVzZGF5LCBNYXJjaCAxOSwgMjAxNCA2OjA5IEFNDQo+IFRvOiBIb3Ug WmhpcWlhbmctQjQ4Mjg2DQo+IENjOiAnR2VlcnQgVXl0dGVyaG9ldmVuJzsgTWFyayBCcm93bjsg bGludXgtc3BpQHZnZXIua2VybmVsLm9yZzsNCj4gZGV2aWNldHJlZUB2Z2VyLmtlcm5lbC5vcmc7 IHJvYi5oZXJyaW5nQGNhbHhlZGEuY29tOyBwYXdlbC5tb2xsQGFybS5jb207DQo+IG1hcmsucnV0 bGFuZEBhcm0uY29tOyBpamMrZGV2aWNldHJlZUBoZWxsaW9uLm9yZy51azsgZ2FsYWtAY29kZWF1 cm9yYS5vcmc7DQo+IGdyYW50Lmxpa2VseUBzZWNyZXRsYWIuY2E7IEh1IE1pbmdrYWktQjIxMjg0 DQo+IFN1YmplY3Q6IFJlOiBbUEFUQ0ggMi8yXSBzcGkvZnNsLWxpYjogR2V0IHRoZSBTUEkgY29u dHJvbGxlciBidXMgbnVtYmVyDQo+IGZyb20gRFRTDQo+IA0KPiBPbiBUdWUsIDIwMTQtMDMtMTgg YXQgMDQ6MzQgLTA1MDAsIEhvdSBaaGlxaWF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+IA0KDQo=
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 83b4fe0227144d3f89543dfa92399dcd-ufbTtyGzTTTk7ZsBhlipOOO6mTEJWrR4XA4E9RH9d+qIuWR1G4zioA@public.gmane.org
Re: [PATCH 2/2] spi/fsl-lib: Get the SPI controller bus number from DTS
Quoted 72 lines · On Tue, 2014-03-18 at 21:49 -0500, Hou Zhiqiang-B48286 wrote:
Quoted 64 lines
-----Original Message-----
From: Wood Scott-B07421
Sent: Wednesday, March 19, 2014 6:09 AM
To: Hou Zhiqiang-B48286
Cc: 'Geert Uytterhoeven'; Mark Brown; [email protected]; [email protected]; rob.herring-bsGFqQB8/[email protected]; [email protected]; [email protected]; [email protected]; [email protected]; grant.likely-s3s/[email protected]; Hu Mingkai-B21284
Subject: Re: [PATCH 2/2] spi/fsl-lib: Get the SPI controller bus number
from DTSQuoted 20 lines · On Tue, 2014-03-18 at 04:34 -0500, Hou Zhiqiang-B48286 wrote:
Quoted 20 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]]
On Behalf Of Geert Uytterhoeven
Sent: Tuesday, March 18, 2014 4:56 PM
To: Hou Zhiqiang-B48286
Cc: Mark Brown; [email protected]; [email protected]; rob.herring-bsGFqQB8/[email protected]; [email protected]; [email protected]; [email protected]; [email protected]; grant.likely-s3s/[email protected]; Wood Scott-B07421; Hu Mingkai-B21284
Subject: Re: [PATCH 2/2] spi/fsl-lib: Get the SPI controller bus
number from DTSQuoted 3 lines · On Tue, Mar 18, 2014 at 8:40 AM, [email protected]…
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
The DT already has support for specifying flash layouts, can't those be used (for example via chosen if they're not fixed for the
Quoted 8 lines
Quoted 8 lines
board)?
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 2 lines
Or if it's just picking the correct filesystem then UUIDs and labels are the standard way to do things.
The DT specifying flash layouts is ok. There is another way to make the flash layouts using command line, but it is not safe because of the dynamic
bus_num. It is not the reason that the way of DT is supported flash layouts, to live the other wayunsafe, right?
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
This sounds to me like we need a better way of talking about flash device names on the Linux command line rather than a way to fix the bus number - for example, being able to refer to them using a fixed property like the physical address. Being able to refer to devices via an alias assigned in the DT would also be useful (and more readable), I think there may already be a mechanism for doing that which would need to be plumbed in but I'm
not 100% sure.
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
The bus number is the variable designed to distinguish one spi controller from others. Why spi controller's physical address must be use instead of bus number?
Quoted 8 lines
Quoted 5 lines
Because the bus number is dynamic, while the physical address doesn't change, so it can be used to uniqely identify the device before booting the kernel.
Cfr. "spi1" vs. "e6e20000.spi".The precondition of dynamic bus number is initial it with -1 in the controller driver. But now I need a reasonable bus number, I don't want
Quoted 8 lines
a dynamic one.
Quoted 2 lines
Why does use the controller's physical address to take the role of bus number to distinguish controllers.
Where are you going to get this "reasonable" non-dynamic number from? How are you going to ensure there are no conflicts with other SPI controllers (e.g. on a dynamic add-on card)?
Quoted 9 lines
"other than negative (== assign one dynamically),
bus_numis fully board-specific. usually that simplifies to being SOC-specific.
example: one SOC has three SPI controllers, numbered 0..2, and one board's schematics might show it using SPI-2. software would normally use bus_num=2 for that controller."
The above paragraph is description ofbus_numinspi.h. The "reasonable" is from it.
Other controllers should also include this property, otherwise it will be dynamic. So there is not conflict.
So instead of using something concrete like a physical address, you want to use a number from a manual. Again, what happens in a system where SPI controllers can be added dynamically (forget about whether this is possible on the systems you care about), or even statically from a different source (e.g. board logic)? How does the driver know what number the manual assigns to a given controller? Why would you even want to deal with this when using the physical address is so easy?
Quoted 8 lines
Quoted 6 lines
Physical addresses work well because they are tied to something real, rather than an arbitrary enumeration. Our NAND controllers use the physical address for the MTD name. Device tree NOR flash allows the device tree to set the mtd name[1], and otherwise falls back on the platform device name, which contains the physical address.
I know the physical work well, but there is a mechanism of bus number. As the description say above, isn't it reasonable?
No.
-Scott
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/2] spi/fsl-lib: Get the SPI controller bus number from DTS
In reply to a message not in the archiveQuoted 11 lines · On Tue, Mar 18, 2014 at 07:40:28AM +0000…
Quoted 5 lines
You are adding a property to specify a bus number. There is no reason why such a property should be specific to a single controller, every controller in every system has a bus number assigned to it so if we have a way to specify one controller via the device tree we should have a way to specify it for all.
The reason to specify a bus number to a single controller is to avoid allocating one dynamically, so we know the bus number before booting up the kernel. If there are several controllers, you should add this property to all of them. But it is unnecessary to add this property, if you do not care about the bus number, and it will be allocated dynamically.
Please re-read what I wrote above, you're completely missing the point. The problem above is that you are adding this in driver specific code, even if this is a good idea there's nothing specific to this device about it so we shouldn't be doing it in a driver.