aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott Wood <scottwood@freescale.com>2007-09-14 14:24:02 -0400
committerKumar Gala <galak@kernel.crashing.org>2007-10-04 12:02:34 -0400
commit96fca1dea8f32e96668d55727d66416fdd67360b (patch)
tree2e7c810fd76475d9c9cbb17af4ef6d99c82513e1
parent2d2294ae12827a97c9daa253f1ce99e7ae3195d7 (diff)
[POWERPC] Document local bus nodes in the device tree, and update cuboot-pq2.
The localbus node is used to describe devices that are connected via a chip select or similar mechanism. The advantages over placing the devices under the root node are that it can be probed without probing other random things under the root, and that the description of which chip select a given device uses can be used to set up mappings if the firmware failed to do so in a useful manner. cuboot-pq2 is updated to match the binding; previously, it called itself chipselect rather than localbus, and used phandle linkage between the actual bus node and the control node (the current agreement is to simply use the fully-qualified address of the control registers, and ignore the overlap with the IMMR node). Signed-off-by: Scott Wood <scottwood@freescale.com> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
-rw-r--r--Documentation/powerpc/booting-without-of.txt38
-rw-r--r--arch/powerpc/boot/cuboot-pq2.c29
2 files changed, 46 insertions, 21 deletions
diff --git a/Documentation/powerpc/booting-without-of.txt b/Documentation/powerpc/booting-without-of.txt
index a599f1a8a145..c36dcd2fbdc4 100644
--- a/Documentation/powerpc/booting-without-of.txt
+++ b/Documentation/powerpc/booting-without-of.txt
@@ -2017,6 +2017,44 @@ platforms are moved over to use the flattened-device-tree model.
2017 fsl,cpm-command = <2e600000>; 2017 fsl,cpm-command = <2e600000>;
2018 }; 2018 };
2019 2019
2020 m) Chipselect/Local Bus
2021
2022 Properties:
2023 - name : Should be localbus
2024 - #address-cells : Should be either two or three. The first cell is the
2025 chipselect number, and the remaining cells are the
2026 offset into the chipselect.
2027 - #size-cells : Either one or two, depending on how large each chipselect
2028 can be.
2029 - ranges : Each range corresponds to a single chipselect, and cover
2030 the entire access window as configured.
2031
2032 Example:
2033 localbus@f0010100 {
2034 compatible = "fsl,mpc8272ads-localbus",
2035 "fsl,mpc8272-localbus",
2036 "fsl,pq2-localbus";
2037 #address-cells = <2>;
2038 #size-cells = <1>;
2039 reg = <f0010100 40>;
2040
2041 ranges = <0 0 fe000000 02000000
2042 1 0 f4500000 00008000>;
2043
2044 flash@0,0 {
2045 compatible = "jedec-flash";
2046 reg = <0 0 2000000>;
2047 bank-width = <4>;
2048 device-width = <1>;
2049 };
2050
2051 board-control@1,0 {
2052 reg = <1 0 20>;
2053 compatible = "fsl,mpc8272ads-bcsr";
2054 };
2055 };
2056
2057
2020 More devices will be defined as this spec matures. 2058 More devices will be defined as this spec matures.
2021 2059
2022VII - Specifying interrupt information for devices 2060VII - Specifying interrupt information for devices
diff --git a/arch/powerpc/boot/cuboot-pq2.c b/arch/powerpc/boot/cuboot-pq2.c
index 470ffacb8373..61574f3272dd 100644
--- a/arch/powerpc/boot/cuboot-pq2.c
+++ b/arch/powerpc/boot/cuboot-pq2.c
@@ -44,22 +44,21 @@ struct pci_range pci_ranges_buf[MAX_PROP_LEN / sizeof(struct pci_range)];
44 * some don't set up the PCI PIC at all, so we assume the device tree is 44 * some don't set up the PCI PIC at all, so we assume the device tree is
45 * sane and update the BRx registers appropriately. 45 * sane and update the BRx registers appropriately.
46 * 46 *
47 * For any node defined as compatible with fsl,pq2-chipselect, 47 * For any node defined as compatible with fsl,pq2-localbus,
48 * #address/#size must be 2/1 for chipselect bus, 1/1 for parent bus, 48 * #address/#size must be 2/1 for the localbus, and 1/1 for the parent bus.
49 * and ranges must be for whole chip selects. 49 * Ranges must be for whole chip selects.
50 */ 50 */
51static void update_cs_ranges(void) 51static void update_cs_ranges(void)
52{ 52{
53 u32 ctrl_ph; 53 void *bus_node, *parent_node;
54 void *ctrl_node, *bus_node, *parent_node;
55 u32 *ctrl_addr; 54 u32 *ctrl_addr;
56 unsigned long ctrl_size; 55 unsigned long ctrl_size;
57 u32 naddr, nsize; 56 u32 naddr, nsize;
58 int len; 57 int len;
59 int i; 58 int i;
60 59
61 bus_node = finddevice("/chipselect"); 60 bus_node = finddevice("/localbus");
62 if (!bus_node || !dt_is_compatible(bus_node, "fsl,pq2-chipselect")) 61 if (!bus_node || !dt_is_compatible(bus_node, "fsl,pq2-localbus"))
63 return; 62 return;
64 63
65 dt_get_reg_format(bus_node, &naddr, &nsize); 64 dt_get_reg_format(bus_node, &naddr, &nsize);
@@ -74,19 +73,7 @@ static void update_cs_ranges(void)
74 if (naddr != 1 || nsize != 1) 73 if (naddr != 1 || nsize != 1)
75 goto err; 74 goto err;
76 75
77 len = getprop(bus_node, "fsl,ctrl", &ctrl_ph, 4); 76 if (!dt_xlate_reg(bus_node, 0, (unsigned long *)&ctrl_addr,
78 if (len != 4)
79 goto err;
80
81 ctrl_node = find_node_by_prop_value(NULL, "linux,phandle",
82 (char *)&ctrl_ph, 4);
83 if (!ctrl_node)
84 goto err;
85
86 if (!dt_is_compatible(ctrl_node, "fsl,pq2-chipselect-ctrl"))
87 goto err;
88
89 if (!dt_xlate_reg(ctrl_node, 0, (unsigned long *)&ctrl_addr,
90 &ctrl_size)) 77 &ctrl_size))
91 goto err; 78 goto err;
92 79
@@ -123,7 +110,7 @@ static void update_cs_ranges(void)
123 return; 110 return;
124 111
125err: 112err:
126 printf("Bad /chipselect or fsl,pq2-chipselect-ctrl node\r\n"); 113 printf("Bad /localbus node\r\n");
127} 114}
128 115
129/* Older u-boots don't set PCI up properly. Update the hardware to match 116/* Older u-boots don't set PCI up properly. Update the hardware to match